Cute_demon_attacks/meng_yao/Assets/script/scene_Main/AssetsPanel.cs

102 lines
2.3 KiB
C#
Raw Normal View History

2024-11-12 23:18:51 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class AssetsPanel : MonoBehaviour
{
[Header("<22><>ť<EFBFBD><C5A5><EFBFBD>ǵö<C7B5>Ӧ<EFBFBD><D3A6>ϵ")]
public Button but1;
public Button but2;
public Button but3;
public Button but4;
2024-11-14 17:18:51 +08:00
[Header("<22><><EFBFBD>°<EFBFBD>ť<EFBFBD><C5A5>ʾ<EFBFBD><CABE>panel<65><6C>Ŀǰ<C4BF><C7B0>ͬһ<CDAC><D2BB>")]
2024-11-12 23:18:51 +08:00
public GameObject mygameObject;
2024-11-14 09:57:30 +08:00
public bool is_one = false;
public Text Stone;
public Text Coin;
public Text Ore;
public Text Forging;
2024-12-17 17:18:09 +08:00
public Text UserName;
public Text UserID;
public Image UserHead;
2024-12-17 22:23:25 +08:00
public Text PersonaText;
public Text PersonID;
2024-12-19 00:57:23 +08:00
private bool isUpdating=false;
2024-11-12 23:18:51 +08:00
// Start is called before the first frame update
void Start()
{
if (but1 != null)
{
2024-12-18 15:32:45 +08:00
but1.onClick.AddListener(() =>
{
mygameObject.GetComponent<Asset_Details>().ShowPanel(2);
2024-11-12 23:18:51 +08:00
});
}
if (but2 != null)
{
2024-12-18 15:32:45 +08:00
but2.onClick.AddListener(() => {
mygameObject.GetComponent<Asset_Details>().ShowPanel(1);
2024-11-12 23:18:51 +08:00
});
}
if (but3 != null)
{
2024-12-18 15:32:45 +08:00
but3.onClick.AddListener(() => {
mygameObject.GetComponent<Asset_Details>().ShowPanel(3);
2024-11-12 23:18:51 +08:00
});
}
if (but4 != null)
{
2024-12-18 15:32:45 +08:00
but4.onClick.AddListener(() => {
mygameObject.GetComponent<Asset_Details>().ShowPanel(4);
2024-11-12 23:18:51 +08:00
});
}
2024-12-17 15:31:37 +08:00
2024-12-19 00:57:23 +08:00
InvokeRepeating("UpDateText", 1f,1f);
2024-11-12 23:18:51 +08:00
}
2024-11-14 09:57:30 +08:00
2024-12-19 00:57:23 +08:00
private void UpDateText()
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD><ECB2BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֱ<EFBFBD>ӷ<EFBFBD><D3B7>أ<EFBFBD><D8A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD>
if (isUpdating)
return;
UpdateTaxt();
}
2024-11-14 09:57:30 +08:00
2024-12-17 15:31:37 +08:00
async void UpdateTaxt()
2024-11-14 09:57:30 +08:00
{
2024-12-19 00:57:23 +08:00
isUpdating = true;
2024-12-18 20:52:56 +08:00
PlayerInfoData _PlayerInfoData = await Scene_main_jiekou.instance.PlayerInfos();
2024-12-18 20:32:37 +08:00
Stone.text = _PlayerInfoData.gem.ToString();
Coin.text = _PlayerInfoData.gold.ToString();
Ore.text = _PlayerInfoData.water.ToString();
Forging.text = _PlayerInfoData.forge.ToString();
2024-12-19 00:57:23 +08:00
_PlayerInfoData = null;
// <20><EFBFBD><ECB2BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD><C9A3><EFBFBD><EFBFBD><EFBFBD>Ϊδִ<CEB4><D6B4>
isUpdating = false;
}
2024-12-19 15:25:25 +08:00
private void OnEnable()
{
InvokeRepeating("UpDateText", 1f, 1f);
}
2024-12-19 00:57:23 +08:00
private void OnDisable()
{
CancelInvoke("UpDateText");
2024-11-14 09:57:30 +08:00
}
2024-11-12 23:18:51 +08:00
}