2025-09-03 19:59:22 +08:00
|
|
|
using System;
|
2025-10-03 00:31:34 +08:00
|
|
|
using Entity;
|
2025-09-03 19:59:22 +08:00
|
|
|
using TMPro;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
namespace UI
|
|
|
|
|
{
|
|
|
|
|
public class CoinCountUI:MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
public TMP_Text text;
|
2025-10-03 00:31:34 +08:00
|
|
|
public int coinCount;
|
2025-09-03 19:59:22 +08:00
|
|
|
|
|
|
|
|
private void Start()
|
|
|
|
|
{
|
2025-10-03 00:31:34 +08:00
|
|
|
text.text = coinCount.ToString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Update()
|
|
|
|
|
{
|
|
|
|
|
var playerEntity = Program.Instance.FocusedEntity as Character;
|
|
|
|
|
if (!playerEntity || playerEntity.Coin == null)
|
|
|
|
|
return;
|
|
|
|
|
if (coinCount == playerEntity.Coin.Quantity) return;
|
|
|
|
|
coinCount = playerEntity.Coin.Quantity;
|
|
|
|
|
text.text = coinCount.ToString();
|
2025-09-03 19:59:22 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|