hellbound/Assets/Scripts/Game/UI/Windows/TestPlayWindow.cs

57 lines
1.5 KiB
C#

using game;
using UnityEngine;
using UnityEngine.UI;
public class TestPlayWindow : ParameterlessWindow
{
[SerializeField] private Button loseButton;
[SerializeField] private Button winButton;
[SerializeField] private Button chestWindow;
[SerializeField] private Button offline;
[SerializeField] private Button daily;
protected override void OnInit()
{
loseButton.onClick.AddListener(ShowLose);
winButton.onClick.AddListener(ShowWin);
chestWindow.onClick.AddListener(ShowChest);
offline.onClick.AddListener(ShowOffline);
daily.onClick.AddListener(ShowDaily);
}
private void ShowLose()
{
Close();
UI.ShowWindow<LoseWindow>();
}
private void ShowWin()
{
Close();
UI.ShowWindow<WinWindow>();
}
private void ShowChest()
{
Close();
Save.Inventory.RemoveConsumableItem(EnumConsumable.KEY,
Save.Inventory.GetConsumableItemAmount(EnumConsumable.KEY));
Save.Inventory.AddConsumableItem(EnumConsumable.KEY, 3);
UI.ShowWindow<ChestsWindow, ChestsGenerator>(new ChestsGenerator());
}
private void ShowOffline()
{
Close();
UI.ShowWindow<OfflineWindow, int>(Random.Range(0, 300));
}
private void ShowDaily()
{
Close();
UI.ShowWindow<DailyWindow, DailyReward>(new DailyReward(G.Instance.Configs.Get<ConfDailyReward>("@time_rewards/daily_reward")));
}
}