using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class AssetsPanel : MonoBehaviour { [Header("按钮,记得对应关系")] public Button but1; public Button but2; public Button but3; public Button but4; [Header("按下按钮显示的panel,目前是同一个")] public GameObject mygameObject; public bool is_one = false; public Text Stone; public Text Coin; public Text Ore; public Text Forging; public Text UserName; public Text UserID; public Image UserHead; public Text PersonaText; public Text PersonID; // Start is called before the first frame update void Start() { if (but1 != null) { but1.onClick.AddListener(() => { mygameObject.GetComponent().ShowPanel(2); }); } if (but2 != null) { but2.onClick.AddListener(() => { mygameObject.GetComponent().ShowPanel(1); }); } if (but3 != null) { but3.onClick.AddListener(() => { mygameObject.GetComponent().ShowPanel(3); }); } if (but4 != null) { but4.onClick.AddListener(() => { mygameObject.GetComponent().ShowPanel(4); }); } UpdateTaxt(); } async void UpdateTaxt() { PlayerInfoData _PlayerInfoData = await Scene_main_jiekou.instance.PlayerInfos(); Stone.text = _PlayerInfoData.gem.ToString(); Coin.text = _PlayerInfoData.gold.ToString(); Ore.text = _PlayerInfoData.water.ToString(); Forging.text = _PlayerInfoData.forge.ToString(); } }