Scriptum/Assets/Scripts/REFACTORING/Application/AccountBalance/PanelCashController.cs
2022-12-24 15:27:45 +01:00

47 lines
1018 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
class PanelCashController : MonoBehaviour
{
[Header("Current Value")]
public int AccountBalanceValue;
[Header("Account Balance")]
[SerializeField] public TextMeshProUGUI displayedValue;
public void Start()
{
// Get current remembered value
var balanceManager = AccountBalanceManager.Instance;
if (balanceManager == null)
throw new NullReferenceException("AccountBalanceManager not found!!!");
RefreshPanel(balanceManager.Gold);
DisplayePlayerAccountBalance();
}
// synch status after selling, buying item
public void RefreshPanel(int gold)
{
AccountBalanceValue = gold;
DisplayePlayerAccountBalance();
}
public void DisplayePlayerAccountBalance()
{
displayedValue.text = $"{AccountBalanceValue}";
}
}