using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; using UnityEngine.UI; /// /// 玩家信息 /// public class PlayerUser_Mon : MonoBehaviour { /// /// 玩家头像 /// private Image usericon; /// /// 用户名称 /// private TextMeshProUGUI username; /// /// 玩家等级 /// private TextMeshProUGUI grade; /// /// 体力 /// private TextMeshProUGUI strength; /// /// 金币 /// private TextMeshProUGUI money; /// /// 游戏组件初始化 /// private void LoadGame() { this.usericon=this.transform.Find("用户头像").GetComponent(); this.username = this.transform.Find("用户名称").GetComponent(); this.grade=this.transform.Find("等级value").GetComponent(); this.strength=this.transform.Find("体力BG").Find("体力").GetComponent (); this.money = this.transform.Find("金币BG").Find("金币").GetComponent(); } /// /// UI界面数据加载 /// /// 用户图标 /// 用户姓名 /// 用户等级 /// 用户体力 /// 用户金币 public void LoadGameUI(Sprite usericon_,string username_,int grade_,int strength_,int money_) { this.usericon.sprite = usericon_; this.username.text= username_; this.grade.text=grade_.ToString(); this.strength.text= strength_.ToString(); this.money.text=money_.ToString(); } private void Awake() { this.LoadGame(); } void Start() { } // Update is called once per frame void Update() { } }