43 lines
945 B
C#
43 lines
945 B
C#
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();
|
|
}
|
|
}
|