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

43 lines
945 B
C#
Raw Normal View History

2021-11-26 11:16:25 +03:00
using UnityEngine;
public class LoseWindow : ParameterlessWindow
{
[SerializeField] private RewardButtonsSection _rewardButtonsSection;
protected override void OnInit()
{
_rewardButtonsSection.SetCallback(OnRewardSectionResult);
}
protected override void OnShowed()
{
Ads.ShowInterstitial("lose");
_rewardButtonsSection.Begin();
}
private void OnRewardSectionResult(EnumRewardResult result)
{
if (result == EnumRewardResult.SKIP)
OnPlayerSkipReward();
else if (result == EnumRewardResult.FAIL)
OnPlayerFailReward();
else
OnPlayerNeedReward();
}
private void OnPlayerSkipReward()
{
G.Instance.Session.Restart();
}
private void OnPlayerFailReward()
{
_rewardButtonsSection.Begin();
}
private void OnPlayerNeedReward()
{
G.Instance.Session.SkipLevel();
}
}