mergemilitary/Assets/Scripts/UIs/PanelTopBar.cs

62 lines
1.3 KiB
C#

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class PanelTopBar : BasePanel
{
public Action DelCoinRefresh;
[SerializeField] ResShower mShower;
[SerializeField] GameObject mGobBP;
[SerializeField] Text mTxtPlayerBP;
[SerializeField] Text mTxtEnemyBP;
public override void OnOpen()
{
base.OnOpen();
mShower.DelCoinRefresh = NotifyCoinRefresh;
mShower.Init();
RefreshCoin();
ShowBP(GameConfig.Instance.IsDebug);
}
public void FlyCoin(Vector3 pPos, int pAdd)
{
mShower.FlyCoins(pPos, Mathf.Clamp(pAdd / 50, 3, 20), pAdd, PlayerData.Instance.Coin);
}
public void PopCoin(int pDelta)
{
mShower.PopCoinChange(pDelta);
RefreshCoin();
}
public void RefreshCoin()
{
mShower.RefreshCoin(PlayerData.Instance.Coin);
}
public void ShowBP(bool pShow)
{
mGobBP.SetActive(pShow);
}
public void SetPlayerBP(int pPlayerBP)
{
mTxtPlayerBP.text = "Player:" + pPlayerBP.ToString();
}
public void SetEnemyBP(int pEnemyBP)
{
mTxtEnemyBP.text = "Enemy:" + pEnemyBP.ToString();
}
private void NotifyCoinRefresh()
{
DelCoinRefresh?.Invoke();
}
}