summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/LevelRewardSuperRiskFailHandler.cs
blob: 0c53a81f26bd3b3fa76d22bf48070edbd6bcc9cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
using System;
using KKSG;
using UILib;
using UnityEngine;
using XUtliPoolLib;

namespace XMainClient
{
	internal class LevelRewardSuperRiskFailHandler : DlgHandlerBase
	{
		protected override string FileName
		{
			get
			{
				return "Battle/LevelReward/LevelRewardSuperRiskFail";
			}
		}

		private XLevelRewardDocument _doc = null;

		private IXUIButton m_ReturnButton;

		private IXUIButton m_GuildMineReturnButton;

		private IXUIButton m_ChallengeAgainButton;

		private IXUILabelSymbol m_CostLabel;

		private Transform m_SuperRiskLabel;

		private Transform m_GuildMineLabel;

		private Transform m_SuperRiskButton;

		private Transform m_GuildMineButton;

		protected override void Init()
		{
			base.Init();
			this._doc = XDocuments.GetSpecificDocument<XLevelRewardDocument>(XLevelRewardDocument.uuID);
			this.InitUI();
		}

		private void InitUI()
		{
			this.m_SuperRiskLabel = base.transform.Find("Bg/SuperRisk");
			this.m_GuildMineLabel = base.transform.Find("Bg/GuildMine");
			this.m_SuperRiskButton = base.transform.Find("Bg/Button/SuperRisk");
			this.m_GuildMineButton = base.transform.Find("Bg/Button/GuildMine");
			this.m_ReturnButton = (base.transform.Find("Bg/Button/SuperRisk/Return").GetComponent("XUIButton") as IXUIButton);
			this.m_GuildMineReturnButton = (base.transform.Find("Bg/Button/GuildMine/Return").GetComponent("XUIButton") as IXUIButton);
			this.m_ChallengeAgainButton = (base.transform.Find("Bg/Button/SuperRisk/Continue").GetComponent("XUIButton") as IXUIButton);
			this.m_CostLabel = (base.transform.Find("Bg/Button/SuperRisk/Continue/MoneyCost").GetComponent("XUILabelSymbol") as IXUILabelSymbol);
			SeqList<int> sequenceList = XSingleton<XGlobalConfig>.singleton.GetSequenceList("RiskReBattle", true);
			this.m_CostLabel.InputText = string.Format("{0}{1}", XLabelSymbolHelper.FormatSmallIcon(sequenceList[0, 0]), sequenceList[0, 1]);
		}

		public override void RegisterEvent()
		{
			base.RegisterEvent();
			this.m_ReturnButton.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnReturnButtonClicked));
			this.m_GuildMineReturnButton.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnReturnButtonClicked));
			this.m_ChallengeAgainButton.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnChallengeAgainButtonClicked));
		}

		private bool OnReturnButtonClicked(IXUIButton button)
		{
			this._doc.SendLeaveScene();
			return true;
		}

		private bool OnChallengeAgainButtonClicked(IXUIButton button)
		{
			this._doc.SendReEnterRiskBattle();
			return true;
		}

		protected override void OnShow()
		{
			base.OnShow();
			bool flag = XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_RESWAR_PVP || XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_RESWAR_PVE;
			if (flag)
			{
				this.m_SuperRiskLabel.gameObject.SetActive(false);
				this.m_SuperRiskButton.gameObject.SetActive(false);
				this.m_GuildMineLabel.gameObject.SetActive(true);
				this.m_GuildMineButton.gameObject.SetActive(true);
				XSingleton<XUICacheMgr>.singleton.RemoveCachedUI(XSysDefine.XSys_Team);
				XGuildMineMainDocument specificDocument = XDocuments.GetSpecificDocument<XGuildMineMainDocument>(XGuildMineMainDocument.uuID);
				specificDocument.IsNeedShowMainUI = true;
			}
			else
			{
				this.m_SuperRiskLabel.gameObject.SetActive(true);
				this.m_SuperRiskButton.gameObject.SetActive(true);
				this.m_GuildMineLabel.gameObject.SetActive(false);
				this.m_GuildMineButton.gameObject.SetActive(false);
			}
		}
	}
}