summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/UI/GuildInheritDlg.cs
blob: 5eec78fdc5209ba7453ef518735ee20b9930947b (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 UILib;
using UnityEngine;
using XMainClient.UI.UICommon;

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

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

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

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

		private XGuildInheritDocument _Doc;

		protected override void Init()
		{
			base.Init();
			this._Doc = XDocuments.GetSpecificDocument<XGuildInheritDocument>(XGuildInheritDocument.uuID);
			base.uiBehaviour.WrapContent.RegisterItemUpdateEventHandler(new WrapItemUpdateEventHandler(this.OnItemUpdateHandler));
		}

		public override void RegisterEvent()
		{
			base.RegisterEvent();
			base.uiBehaviour.OverLook.RegisterClickEventHandler(new ButtonClickEventHandler(this.CloseClick));
			base.uiBehaviour.Close.RegisterClickEventHandler(new ButtonClickEventHandler(this.CloseClick));
			base.uiBehaviour.NotAccept.RegisterClickEventHandler(new ButtonClickEventHandler(this.OverLookClick));
		}

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

		public void RefreshData()
		{
			base.uiBehaviour.WrapContent.SetContentCount(this._Doc.InheritList.Count, false);
			base.uiBehaviour.ScrollView.ResetPosition();
		}

		private bool OverLookClick(IXUIButton btn)
		{
			this._Doc.SendDelInherit();
			this.SetVisibleWithAnimation(false, null);
			return false;
		}

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

		private void OnItemUpdateHandler(Transform t, int index)
		{
			bool flag = index >= this._Doc.InheritList.Count;
			if (!flag)
			{
				IXUILabelSymbol ixuilabelSymbol = t.Find("Name").GetComponent("XUILabelSymbol") as IXUILabelSymbol;
				IXUILabel ixuilabel = t.Find("Level").GetComponent("XUILabel") as IXUILabel;
				IXUILabel ixuilabel2 = t.Find("Position").GetComponent("XUILabel") as IXUILabel;
				IXUILabel ixuilabel3 = t.Find("LastLoginTime").GetComponent("XUILabel") as IXUILabel;
				IXUIButton ixuibutton = t.Find("BtnReceive").GetComponent("XUIButton") as IXUIButton;
				GuildInheritInfo guildInheritInfo = this._Doc.InheritList[index];
				ixuibutton.ID = (ulong)((long)index);
				ixuibutton.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClickReceive));
				ixuilabel.SetText(guildInheritInfo.GetLevelString());
				ixuilabel2.SetText(guildInheritInfo.GetSceneName());
				ixuilabel3.SetText(guildInheritInfo.GetTimeString());
				ixuilabelSymbol.InputText = guildInheritInfo.name;
			}
		}

		private bool OnClickReceive(IXUIButton btn)
		{
			bool flag = btn.ID >= 0UL;
			if (flag)
			{
				this._Doc.SendAccpetInherit((int)btn.ID);
			}
			return true;
		}
	}
}