Cute_demon_attacks/meng_yao/Assets/script/Panel/Main_AsstePanel.cs

98 lines
2.2 KiB
C#
Raw Normal View History

2024-11-07 20:27:33 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Main_AsstePanel : MonoBehaviour
{
public bool is_one = false;
public Text Stone;
public Text Coin;
public Text Ore;
public Text Forging;
public Button StoneBtn;
public Button CoinBtn;
public Button OreBtn;
public Button ForgingBtn;
public GameObject AssetDetails;
void Start()
{
if (Promptmgr.Main_AsstePanel == null)
{
Promptmgr.Main_AsstePanel = this;
Stone.text = PlayerManager.Instance.Stones.ToString();
Forging.text = PlayerManager.Instance.Forging.ToString();
Coin.text = PlayerManager.Instance.Coins.ToString();
Ore.text = PlayerManager.Instance.Ore.ToString();
Promptmgr.Main_AsstePanel.is_one = true;
2024-11-11 12:04:41 +08:00
// Promptmgr.Main_AsstePanel.InvokeRepeating("Tloding", 1.0f, 1.0f);
2024-11-07 20:27:33 +08:00
}
AssetDetails.gameObject.SetActive(false);
StoneBtn.onClick.AddListener(AsClick);
CoinBtn.onClick.AddListener(AsClick);
OreBtn.onClick.AddListener(AsClick);
ForgingBtn.onClick.AddListener(AsClick);
}
2024-11-11 12:04:41 +08:00
public void AsClick()
2024-11-07 20:27:33 +08:00
{
Debug.Log("<22><><EFBFBD><EFBFBD><EFBFBD>ʲ<EFBFBD><CAB2><EFBFBD>ϸ<EFBFBD><CFB8>ť");
AssetDetails.gameObject.SetActive(true);
}
public void CloseClick()
{
AssetDetails.gameObject.SetActive(false);
}
2024-11-12 21:10:56 +08:00
2024-11-07 20:27:33 +08:00
public void SetStoneText(float num)
{
if (Stone != null)
{
Stone.text = num.ToString();
}
}
public void SetCoinText(float num)
{
if (Coin != null)
{
Coin.text = num.ToString();
}
}
public void SetOreText(float num)
{
if (Ore != null)
{
Ore.text = num.ToString();
}
}
public void SetForgingText(float num)
{
if (Forging != null)
{
Forging.text = num.ToString();
}
}
private void Update()
{
Stone.text = PlayerManager.Instance.Stones.ToString();
Coin.text = PlayerManager.Instance.Coins.ToString();
Ore.text = PlayerManager.Instance.Ore.ToString();
Forging.text = PlayerManager.Instance.Forging.ToString();
}
}