OneShotOneKill/Assets/Script/UGUI/Ingame/DefeatUI.cs

73 lines
2.1 KiB
C#

using CodeStage.AntiCheat.ObscuredTypes;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class DefeatUI : MonoBehaviourSingletonTemplate<DefeatUI>
{
public GameObject[] gos; // 0 정상 패배 화면, 1 몹툴 결과 화면
public Image[] images_btn; // 0 광고 부활, 1 부활권
public Image[] Images_item;
public TextMeshProUGUI[] texts_item; // 0 골드, 1 소울
public TextMeshProUGUI t_minus; // 골드 차감량
ObscuredInt m_Reincarnation;
ObscuredBool b_AD;
public void Init()
{
m_Reincarnation = 1; // 정인호 : 부활권? 갯수?
m_Reincarnation.RandomizeCryptoKey();
b_AD = true;
b_AD.RandomizeCryptoKey();
}
public void Set()
{
On();
DSUtil.InActivateGameObjects(gos, MyValue.m_MyStageData.m_EnterType == eStageEnterType.Tool_Mob ? 1 : 0);
images_btn[0].sprite = UIAtlasMgr.Ins.Get_Button_Sprite(b_AD ? 1 : 7);
images_btn[1].sprite = UIAtlasMgr.Ins.Get_Button_Sprite(m_Reincarnation > 0 ? 3 : 7);
}
public void OnClick_Button(GameObject go)
{
switch (go.name)
{
case "btn_ad": // 광고 보고 부활
if (b_AD)
{
ADInfo.Ins.Show_AD(() =>
{
b_AD = false;
b_AD.RandomizeCryptoKey();
Revive();
});
}
break;
case "btn_reincarnation": // 부활권 쓰고 부활
if (m_Reincarnation > 0)
{
--m_Reincarnation;
m_Reincarnation.RandomizeCryptoKey();
Revive();
}
break;
case "btn_giveup":
Off();
InGameInfo.Ins.Return_To_Lobby();
break;
case "btn_retry_toolmob":
Off();
InGameInfo.Ins.Start_Game_byTool();
break;
}
}
void Revive()
{
Off();
InGameInfo.Ins.Revive_PC();
}
}