summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/UI/GuildArenaRankDlg.cs
blob: d867c98fe34ed917ec78d1db3814c5fd9b756bdb (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
using System;
using System.Collections.Generic;
using KKSG;
using UILib;
using UnityEngine;
using XMainClient.UI.UICommon;

namespace XMainClient.UI
{
	internal class GuildArenaRankDlg : DlgBase<GuildArenaRankDlg, GuildArenaRankBehaviour>
	{
		public override string fileName
		{
			get
			{
				return "Guild/GuildArena/GuildArenaRankDlg";
			}
		}

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

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

		private List<GuildArenaHistory> m_historys;

		protected override void Init()
		{
			base.Init();
			base.uiBehaviour.m_WrapContent.RegisterItemUpdateEventHandler(new WrapItemUpdateEventHandler(this.OnWrapContentUpdate));
		}

		protected override void OnShow()
		{
			base.OnShow();
			this.Refresh();
			XGuildArenaDocument specificDocument = XDocuments.GetSpecificDocument<XGuildArenaDocument>(XGuildArenaDocument.uuID);
			specificDocument.SendReqGuildArenaHistory();
		}

		private void OnWrapContentUpdate(Transform t, int index)
		{
			IXUILabelSymbol ixuilabelSymbol = t.Find("First").GetComponent("XUILabelSymbol") as IXUILabelSymbol;
			IXUILabelSymbol ixuilabelSymbol2 = t.Find("Second").GetComponent("XUILabelSymbol") as IXUILabelSymbol;
			IXUILabel ixuilabel = t.Find("Number").GetComponent("XUILabel") as IXUILabel;
			IXUIButton ixuibutton = t.Find("Btn_View").GetComponent("XUIButton") as IXUIButton;
			ixuibutton.SetVisible(false);
			ixuibutton.RegisterClickEventHandler(new ButtonClickEventHandler(this.ClickShow));
			ixuilabel.SetText(XStringDefineProxy.GetString("GUILD_ARENA_INDEX", new object[]
			{
				index + 1
			}));
			bool flag = this.m_historys == null || index >= this.m_historys.Count;
			if (flag)
			{
				ixuilabelSymbol.InputText = "?";
				ixuilabelSymbol2.InputText = "?";
			}
			else
			{
				GuildArenaHistory guildArenaHistory = this.m_historys[index];
				ixuilabelSymbol.InputText = guildArenaHistory.first;
				ixuilabelSymbol2.InputText = guildArenaHistory.second;
			}
		}

		public void SetHistoryList(List<GuildArenaHistory> historys)
		{
			this.m_historys = historys;
			this.Refresh();
		}

		public void Refresh()
		{
			int num = 0;
			bool flag = this.m_historys != null;
			if (flag)
			{
				num = this.m_historys.Count;
			}
			base.uiBehaviour.m_WrapContent.SetContentCount(num, false);
			base.uiBehaviour.m_ScrollView.ResetPosition();
			base.uiBehaviour.m_NA.gameObject.SetActive(num == 0);
		}

		private bool ClickShow(IXUIButton btn)
		{
			return false;
		}

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

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