73 lines
1.9 KiB
C#
73 lines
1.9 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
/// <summary>
|
|
/// 玩家信息
|
|
/// </summary>
|
|
public class PlayerUser_Mon : MonoBehaviour
|
|
{
|
|
/// <summary>
|
|
/// 玩家头像
|
|
/// </summary>
|
|
private Image usericon;
|
|
/// <summary>
|
|
/// 用户名称
|
|
/// </summary>
|
|
private TextMeshProUGUI username;
|
|
/// <summary>
|
|
/// 玩家等级
|
|
/// </summary>
|
|
private TextMeshProUGUI grade;
|
|
/// <summary>
|
|
/// 体力
|
|
/// </summary>
|
|
private TextMeshProUGUI strength;
|
|
/// <summary>
|
|
/// 金币
|
|
/// </summary>
|
|
private TextMeshProUGUI money;
|
|
/// <summary>
|
|
/// 游戏组件初始化
|
|
/// </summary>
|
|
private void LoadGame()
|
|
{
|
|
this.usericon=this.transform.Find("用户头像").GetComponent<Image>();
|
|
this.username = this.transform.Find("用户名称").GetComponent<TextMeshProUGUI>();
|
|
this.grade=this.transform.Find("等级value").GetComponent<TextMeshProUGUI>();
|
|
this.strength=this.transform.Find("体力BG").Find("体力").GetComponent <TextMeshProUGUI>();
|
|
this.money = this.transform.Find("金币BG").Find("金币").GetComponent<TextMeshProUGUI>();
|
|
}
|
|
/// <summary>
|
|
/// UI界面数据加载
|
|
/// </summary>
|
|
/// <param name="usericon_">用户图标</param>
|
|
/// <param name="username_">用户姓名</param>
|
|
/// <param name="grade_">用户等级</param>
|
|
/// <param name="strength_">用户体力</param>
|
|
/// <param name="money_">用户金币</param>
|
|
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()
|
|
{
|
|
|
|
}
|
|
}
|