DESKTOP-DDTRVOR\asus a00ecd193d 添加新手引导
2024-12-24 17:05:51 +08:00

74 lines
2.0 KiB
C#

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.UI;
public class CombatPanel : MonoBehaviour
{
[SerializeField] private Slider _hp;
[SerializeField] private Slider _exp;
[SerializeField] private Text _lv;
[SerializeField] private RogenPanel _rogenPanel;
[SerializeField] private List<CombatItem> _combatItems = new List<CombatItem>();
[SerializeField] private GameObject item;
[SerializeField] private Transform itemParent;
public void StartPanel()
{
_rogenPanel.gameObject.SetActive(false);
if (_combatItems.Count>0)
{
for (int i = 0; i < _combatItems.Count; i++)
{
Destroy(_combatItems[i].gameObject);
}
}
_combatItems = new List<CombatItem>();
}
public void ResetItem()
{
foreach (var state in BattleManager.ins.SkillStates)
{
var bo = _combatItems.Any(c => c.State == state);
if (!bo)
{
var obj = Instantiate(item, itemParent);
obj.SetActive(true);
obj.GetComponent<CombatItem>().SetData(state);
_combatItems.Add(obj.GetComponent<CombatItem>());
}
}
}
public void OpenRogenPanel()
{
_rogenPanel.gameObject.SetActive(true);
_rogenPanel.SetResetIndex(1);
_rogenPanel.InitData();
if (DataManager.GetPrefab("firstGuideV3")!=1)
{
UIMgr.ins.OpenFirstGuidePanelv3();
}
}
public void CloseRogenPanel()
{
_rogenPanel.gameObject.SetActive(false);
}
public void ResetHp()
{
_hp.value = (BattleManager.ins.HP-(float)BattleManager.ins.Injured) / (float)BattleManager.ins.HP;
}
public void ResetExp()
{
_exp.value = (float)BattleManager.ins.Exp / BattleManager.ins.MaxExp;
_lv.text = BattleManager.ins.ExpLevel.ToString();
}
}