Cute_demon_attacks/meng_yao/Assets/script/scene_Main/AssetsPanel.cs
2024-12-17 17:18:09 +08:00

77 lines
1.9 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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;
// Start is called before the first frame update
void Start()
{
if (but1 != null)
{
but1.onClick.AddListener(() => {
mygameObject.SetActive(true);
});
}
if (but2 != null)
{
but2.onClick.AddListener(() => {
mygameObject.SetActive(true);
});
}
if (but3 != null)
{
but3.onClick.AddListener(() => {
mygameObject.SetActive(true);
});
}
if (but4 != null)
{
but4.onClick.AddListener(() => {
mygameObject.SetActive(true);
});
}
UpdateTaxt();
}
async void UpdateTaxt()
{
PlayerInfoData info=await Scene_main_jiekou.instance.PlayerInfos();
Stone.text = Scene_main_jiekou.instance.infoData.gem.ToString();
Coin.text = Scene_main_jiekou.instance.infoData.gold.ToString();
Ore.text = Scene_main_jiekou.instance.infoData.water.ToString();
Forging.text = Scene_main_jiekou.instance.infoData.forge.ToString();
UserName.text = Scene_main_jiekou.instance.infoData.nickname.ToString();
UserID.text = Scene_main_jiekou.instance.infoData.uid.ToString();
}
}