RandomGFGoStop/Assets/Scripts/UI/Popup/PreviewPopup.cs

49 lines
1.3 KiB
C#

using TMPro;
using UnityEngine;
public class PreviewPopup : PopupBase
{
public TextMeshProUGUI t_price;
public override void ShowPopup(int drawOrder)
{
if (GamePanel.Instance.IsPreview)
{
GameManager.UI.HideTopPopup();
GameManager.UI.ShowNStackPopup(EPopupType.PreViewUIPopup);
}
else
{
base.ShowPopup(drawOrder);
GameManager.Sound.PlaySFX(ESFXType.Open_Popup);
//t_price.text = $"{Get_Price()} / {GameManager.DB.Key}";
//t_price.color = Get_Price() > GameManager.DB.Key ? Color.red : Color.green;
}
}
int Get_Price() { return 100; }
public void ClickYes()
{
if (!GamePanel.Instance.IsPreview && GameManager.DB.Key >= Get_Price())
{
GameManager.DB.SubKey(Get_Price(), name);
GameManager.DB.SaveDatas();
GamePanel.Instance.IsPreview = true;
GameManager.UI.HideTopPopup();
GameManager.UI.ShowNStackPopup(EPopupType.PreViewUIPopup);
}
else
{
ClickCancel();
GameManager.UI.ShowNStackPopup(EPopupType.NoDiaPPopup);
}
}
public void ClickCancel()
{
GameManager.Sound.PlaySFX(ESFXType.Button_Hit);
GameManager.UI.HideTopPopup();
}
}