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

62 lines
1.6 KiB
C#

using game;
using UnityEngine;
using UnityEngine.UI;
namespace RND
{
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.Show<LoseWindow>();
}
private void ShowWin()
{
Close();
UI.Show<WinWindow>();
}
private void ShowChest()
{
Close();
Save.Inventory.RemoveConsumableItem(EnumConsumable.KEY,
Save.Inventory.GetConsumableItemAmount(EnumConsumable.KEY));
Save.Inventory.AddConsumableItem(EnumConsumable.KEY, 3);
UI.Show<ChestsWindow, ChestsGenerator>(new ChestsGenerator());
}
private void ShowOffline()
{
Close();
UI.Show<OfflineWindow, int>(Random.Range(0, 300));
}
private void ShowDaily()
{
Close();
UI.Show<DailyWindow, DailyReward>(
new DailyReward(G.Instance.Configs.Get<ConfDailyReward>("@time_rewards/daily_reward")));
}
}
}