2024-10-10 08:42:20 +00:00
|
|
|
using System;
|
2024-07-20 11:32:54 +00:00
|
|
|
using DG.Tweening;
|
|
|
|
using Sirenix.OdinInspector;
|
|
|
|
using TMPro;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
namespace BlueWater.Uis
|
|
|
|
{
|
|
|
|
public class PayMoneyUi : MonoBehaviour
|
|
|
|
{
|
|
|
|
[SerializeField, Required]
|
|
|
|
private DOTweenAnimation _moveAnimation;
|
2024-10-06 23:41:09 +00:00
|
|
|
|
|
|
|
[SerializeField, Required]
|
|
|
|
private GameObject _panel;
|
2024-07-20 11:32:54 +00:00
|
|
|
|
|
|
|
[SerializeField, Required]
|
|
|
|
private TMP_Text _goldText;
|
|
|
|
|
2024-10-10 08:42:20 +00:00
|
|
|
private void Start()
|
|
|
|
{
|
|
|
|
EventManager.OnChangeGold += PayMoney;
|
|
|
|
}
|
|
|
|
|
2024-07-20 11:32:54 +00:00
|
|
|
private void OnDestroy()
|
|
|
|
{
|
2024-10-10 08:42:20 +00:00
|
|
|
EventManager.OnChangeGold -= PayMoney;
|
|
|
|
|
2024-07-20 11:32:54 +00:00
|
|
|
_moveAnimation.DOKill();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void PayMoney(int gold)
|
|
|
|
{
|
|
|
|
_goldText.text = gold.ToString("N0");
|
2024-10-06 23:41:09 +00:00
|
|
|
ShowUi();
|
|
|
|
_moveAnimation.DORestart();
|
2024-07-20 11:32:54 +00:00
|
|
|
}
|
2024-10-06 23:41:09 +00:00
|
|
|
|
|
|
|
public void ShowUi() => _panel.SetActive(true);
|
|
|
|
public void HideUi() => _panel.SetActive(false);
|
2024-07-20 11:32:54 +00:00
|
|
|
}
|
|
|
|
}
|