summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/UI/DragonGuildShopRecordsHandler.cs
blob: 0f1d2f21fb9596fa4ab7881de43db7ef326c5a73 (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
140
141
142
143
144
145
146
147
148
149
150
using System;
using UILib;
using UnityEngine;
using XUtliPoolLib;

namespace XMainClient.UI
{
	internal class DragonGuildShopRecordsHandler : DlgHandlerBase
	{
		private XDragonGuildDocument m_doc
		{
			get
			{
				return XDragonGuildDocument.Doc;
			}
		}

		protected override string FileName
		{
			get
			{
				return "Partner/PartnerShopRecords";
			}
		}

		private IXUIButton m_closeBtn;

		private IXUIWrapContent m_wrapContent;

		private GameObject m_tipsGo;

		private IXUIScrollView m_ScrollView;

		protected override void Init()
		{
			base.Init();
			this.m_doc.ShopRecordsHandler = this;
			this.m_closeBtn = (base.PanelObject.transform.Find("Close").GetComponent("XUIButton") as IXUIButton);
			Transform transform = base.PanelObject.transform.Find("Panel");
			this.m_ScrollView = (transform.GetComponent("XUIScrollView") as IXUIScrollView);
			this.m_wrapContent = (transform.Find("Wrap").GetComponent("XUIWrapContent") as IXUIWrapContent);
			this.m_tipsGo = base.PanelObject.transform.Find("Tips").gameObject;
			this.m_ScrollView.ResetPosition();
			this.m_wrapContent.RegisterItemUpdateEventHandler(new WrapItemUpdateEventHandler(this.WrapContentItemUpdated));
		}

		public override void RegisterEvent()
		{
			base.RegisterEvent();
			this.m_closeBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClosedClicked));
		}

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

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

		public override void StackRefresh()
		{
			base.StackRefresh();
		}

		public override void OnUnload()
		{
			this.m_doc.ShopRecordsHandler = null;
			base.OnUnload();
		}

		private void FillDefault()
		{
			this.m_tipsGo.SetActive(true);
			this.m_wrapContent.gameObject.SetActive(false);
		}

		public void FillContent()
		{
			bool flag = this.m_doc.ShopRecordList == null;
			if (flag)
			{
				XSingleton<XDebug>.singleton.AddGreenLog("ShopRecordList is null", null, null, null, null, null);
			}
			else
			{
				bool flag2 = this.m_doc.ShopRecordList.Count == 0;
				if (flag2)
				{
					this.m_tipsGo.SetActive(true);
					this.m_wrapContent.gameObject.SetActive(false);
				}
				else
				{
					this.m_tipsGo.SetActive(false);
					this.m_wrapContent.gameObject.SetActive(true);
					int count = this.m_doc.ShopRecordList.Count;
					this.m_wrapContent.SetContentCount(count, false);
				}
			}
		}

		private void WrapContentItemUpdated(Transform t, int index)
		{
			bool flag = index >= this.m_doc.ShopRecordList.Count;
			if (flag)
			{
				XSingleton<XDebug>.singleton.AddErrorLog("index >= ShopRecordList.Count", null, null, null, null, null);
			}
			else
			{
				DragonGuildShopRecord dragonGuildShopRecord = this.m_doc.ShopRecordList[index];
				IXUILabel ixuilabel = t.Find("Time").GetComponent("XUILabel") as IXUILabel;
				ixuilabel.SetText(dragonGuildShopRecord.TimeStr.Replace("/n", "\n"));
				ixuilabel = (t.Find("ItemName").GetComponent("XUILabel") as IXUILabel);
				ixuilabel.SetText(dragonGuildShopRecord.ItemName);
				ixuilabel = (t.Find("ItemNum").GetComponent("XUILabel") as IXUILabel);
				ixuilabel.SetText(dragonGuildShopRecord.BuyCount.ToString());
				IXUILabelSymbol ixuilabelSymbol = t.Find("PlayerName").GetComponent("XUILabelSymbol") as IXUILabelSymbol;
				ixuilabelSymbol.InputText = dragonGuildShopRecord.PlayerName;
				ixuilabelSymbol.ID = (ulong)((long)index);
				ixuilabelSymbol.RegisterSymbolClickHandler(new LabelSymbolClickEventHandler(this.OnClickName));
			}
		}

		private void OnClickName(IXUILabelSymbol iSp)
		{
			bool flag = this.m_doc.ShopRecordList == null;
			if (!flag)
			{
				int index = (int)iSp.ID / 100;
				DragonGuildShopRecord dragonGuildShopRecord = this.m_doc.ShopRecordList[index];
				bool flag2 = dragonGuildShopRecord == null;
				if (!flag2)
				{
					XCharacterCommonMenuDocument.ReqCharacterMenuInfo(dragonGuildShopRecord.RoleId, false);
				}
			}
		}

		private bool OnClosedClicked(IXUIButton sp)
		{
			base.SetVisible(false);
			return true;
		}
	}
}