summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/NextLevelSealView.cs
blob: 9ddc074b3c43a36d15e512471416d76a35ebbd55 (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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
using System;
using System.Collections.Generic;
using UILib;
using UnityEngine;
using XMainClient.UI.UICommon;
using XUtliPoolLib;

namespace XMainClient
{
	internal class NextLevelSealView : DlgBase<NextLevelSealView, NextLevelSealBehaviour>
	{
		public override string fileName
		{
			get
			{
				return "OperatingActivity/NextSeal";
			}
		}

		public override int layer
		{
			get
			{
				return 1;
			}
		}

		public override int group
		{
			get
			{
				return 1;
			}
		}

		public override bool autoload
		{
			get
			{
				return true;
			}
		}

		private XLevelSealDocument doc = null;

		protected override void Init()
		{
			this.doc = XDocuments.GetSpecificDocument<XLevelSealDocument>(XLevelSealDocument.uuID);
		}

		public override void RegisterEvent()
		{
			base.uiBehaviour.m_Close.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnCloseClicked));
		}

		public bool OnCloseClicked(IXUIButton btn)
		{
			this.SetVisibleWithAnimation(false, null);
			return true;
		}

		protected override void OnShow()
		{
			base.OnShow();
			this.RefreshPage();
		}

		protected override void OnHide()
		{
			base.uiBehaviour.m_NextSealTexL.SetTexturePath("");
			base.uiBehaviour.m_NextSealTexR.SetTexturePath("");
			base.uiBehaviour.m_NextSealTexM.SetTexturePath("");
			base.OnHide();
		}

		protected override void OnUnload()
		{
			base.OnUnload();
		}

		public void RefreshPage()
		{
			uint removeSealType = this.doc.GetRemoveSealType(XSingleton<XAttributeMgr>.singleton.XPlayerData.Level);
			Queue<LevelSealNewFunctionTable.RowData> levelSealNewFunction = this.doc.GetLevelSealNewFunction(removeSealType);
			base.uiBehaviour.m_NewFunctionPool.ReturnAll(false);
			int count = levelSealNewFunction.Count;
			for (int i = 0; i < count; i++)
			{
				GameObject gameObject = base.uiBehaviour.m_NewFunctionPool.FetchGameObject(false);
				LevelSealNewFunctionTable.RowData rowData = levelSealNewFunction.Dequeue();
				(gameObject.transform.Find("Function/Level").GetComponent("XUILabel") as IXUILabel).SetText(rowData.OpenLevel.ToString() + XStringDefineProxy.GetString("SEAL_OPEN_FUNCTION"));
				(gameObject.transform.Find("Function/Name").GetComponent("XUILabel") as IXUILabel).SetText(rowData.Tag);
				(gameObject.transform.Find("Function/P").GetComponent("XUISprite") as IXUISprite).SetSprite(rowData.IconName);
				gameObject.transform.localPosition = new Vector3((float)(base.uiBehaviour.m_NewFunctionPool.TplWidth * i), 0f, 0f);
			}
			bool flag = count == 0;
			if (flag)
			{
				base.uiBehaviour.m_NewFunction.gameObject.SetActive(false);
			}
			else
			{
				base.uiBehaviour.m_NewFunction.gameObject.SetActive(true);
				base.uiBehaviour.m_NewFunctionBg.spriteWidth = base.uiBehaviour.m_NewFunctionBgWidth + (count - 1) * base.uiBehaviour.m_NewFunctionPool.TplWidth;
			}
			LevelSealTypeTable.RowData levelSealType = XLevelSealDocument.GetLevelSealType(removeSealType);
			bool flag2 = !string.IsNullOrEmpty(levelSealType.NextSealImageL);
			if (flag2)
			{
				base.uiBehaviour.m_NextSealTexL.SetTexturePath(levelSealType.NextSealImageL);
			}
			bool flag3 = !string.IsNullOrEmpty(levelSealType.NextSealImageR);
			if (flag3)
			{
				base.uiBehaviour.m_NextSealTexR.SetTexturePath(levelSealType.NextSealImageR);
			}
			bool flag4 = levelSealType.NextSealImageBig != null && levelSealType.NextSealImageBig != "";
			if (flag4)
			{
				base.uiBehaviour.m_NextSealTexM.SetAlpha(1f);
				base.uiBehaviour.m_NextSealTexM.SetTexturePath(levelSealType.NextSealImageBig);
			}
			else
			{
				base.uiBehaviour.m_NextSealTexM.SetAlpha(0f);
			}
		}

		public void SetNextSealLabel(string str)
		{
			base.uiBehaviour.m_NextSealLabel.SetText(str);
		}

		public void SetPosition(Vector3 pos)
		{
			base.uiBehaviour.transform.position = pos;
		}
	}
}