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

106 lines
2.5 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-11-12 23:18:51 +08:00
// Start is called before the first frame update
void Start()
{
2024-11-14 09:57:30 +08:00
if (Promptmgr.assestPanel == null)
{
Promptmgr.assestPanel = 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.assestPanel.is_one = true;
}
2024-11-12 23:18:51 +08:00
if (but1 != null)
{
2024-11-14 17:18:51 +08:00
but1.onClick.AddListener(() => {
2024-11-12 23:18:51 +08:00
mygameObject.SetActive(true);
});
}
if (but2 != null)
{
2024-11-14 17:18:51 +08:00
but2.onClick.AddListener(() => {
2024-11-12 23:18:51 +08:00
mygameObject.SetActive(true);
});
}
if (but3 != null)
{
2024-11-14 17:18:51 +08:00
but3.onClick.AddListener(() => {
2024-11-12 23:18:51 +08:00
mygameObject.SetActive(true);
});
}
if (but4 != null)
{
2024-11-14 17:18:51 +08:00
but4.onClick.AddListener(() => {
2024-11-12 23:18:51 +08:00
mygameObject.SetActive(true);
});
}
}
2024-11-14 09:57:30 +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();
}
2024-11-12 23:18:51 +08:00
}