using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; using UnityEngine.UI; public class TopPanel : BasePanel { //人物名字 public TextMeshProUGUI txtUsername; //人物境界 public Text txtRealm; //灵气 public Text txtAura; //战斗力 public Text txtFighting; //灵石 public Text txtStone; //仙玉 public Text txtFairy; private PlayerData player; public override void Init() { player = GameDataMgr.Instance.player; UpdatePanel(); } public void UpdatePanel() { txtUsername.text = player.name; txtRealm.text = player.state; txtRealm.color = GameMgr.Instance.HexToColor(GameDataMgr.Instance.userUpGradeInfo[player.stateId].color); //灵气 if ((player.stateId + 1) > (GameDataMgr.Instance.userUpGradeInfo.Count - 1)) { txtAura.text = "灵气:" + GameMgr.Instance.SetNumber(player.gas) + "/" + "无"; } else { txtAura.text = "灵气:" + GameMgr.Instance.SetNumber(player.gas) + "/" + GameMgr.Instance.SetNumber(GameDataMgr.Instance.userUpGradeInfo[player.stateId + 1].gas); } txtFairy.text="仙玉:" + GameMgr.Instance.SetNumber(player.yu); txtStone.text="灵石:" + GameMgr.Instance.SetNumber(player.stone); txtFighting.text = "战斗力:" + GameMgr.Instance.SetNumber(player.figthing); } }