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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
|
using System;
using UILib;
using UnityEngine;
using XMainClient.UI.UICommon;
using XUtliPoolLib;
namespace XMainClient.UI
{
internal class AnnouncementHandler : DlgHandlerBase
{
protected override string FileName
{
get
{
return "OperatingActivity/ActivityAnnouncement";
}
}
private XAnnouncementDocument _doc;
private IXUITable m_Table;
private XUIPool m_NoticePool = new XUIPool(XSingleton<XGameUI>.singleton.m_uiTool);
private XUIPool m_ActivityPool = new XUIPool(XSingleton<XGameUI>.singleton.m_uiTool);
private XUIPool m_TabPool = new XUIPool(XSingleton<XGameUI>.singleton.m_uiTool);
private GameObject _last_notice = null;
protected override void Init()
{
this._doc = XDocuments.GetSpecificDocument<XAnnouncementDocument>(XAnnouncementDocument.uuID);
base.Init();
this.m_Table = (base.PanelObject.transform.Find("ScrollView/Table").GetComponent("XUITable") as IXUITable);
Transform transform = base.PanelObject.transform.Find("ScrollView/Table/NoticeTpl");
this.m_NoticePool.SetupPool(transform.parent.gameObject, transform.gameObject, 5u, false);
transform = base.PanelObject.transform.Find("ScrollView/Table/ActivityTpl");
this.m_ActivityPool.SetupPool(transform.parent.gameObject, transform.gameObject, 5u, false);
transform = base.PanelObject.transform.Find("Tabs/TabTpl");
this.m_TabPool.SetupPool(transform.parent.gameObject, transform.gameObject, 2u, false);
}
protected override void OnShow()
{
base.OnShow();
this._doc.CurrentTab = 0;
this._doc.SendFetchNotice();
this.RefreshData();
}
protected override void OnHide()
{
base.OnHide();
XSingleton<UiUtility>.singleton.DestroyTextureInActivePool(this.m_NoticePool, "ChildList/LevelTwoTpl/Texture");
}
public override void RefreshData()
{
base.RefreshData();
this.RefreshTab();
int currentTab = this._doc.CurrentTab;
if (currentTab != 0)
{
if (currentTab == 1)
{
this.RefreshNoticeList();
}
}
else
{
this.RefreshActivityList();
}
this._last_notice = null;
}
public void RefreshTab()
{
this.m_TabPool.ReturnAll(false);
for (int i = 0; i < 2; i++)
{
GameObject gameObject = this.m_TabPool.FetchGameObject(false);
IXUILabel ixuilabel = gameObject.transform.Find("Bg/TextLabel").GetComponent("XUILabel") as IXUILabel;
IXUILabel ixuilabel2 = gameObject.transform.Find("Bg/SelectedTextLabel").GetComponent("XUILabel") as IXUILabel;
Transform transform = gameObject.transform.Find("Bg/RedPoint");
IXUICheckBox ixuicheckBox = gameObject.transform.Find("Bg").GetComponent("XUICheckBox") as IXUICheckBox;
ixuilabel.SetText(XStringDefineProxy.GetString(string.Format("AnnouncementTab{0}", i)));
ixuilabel2.SetText(XStringDefineProxy.GetString(string.Format("AnnouncementTab{0}", i)));
transform.gameObject.SetActive(this._doc.GetTabRedPoint(i));
ixuicheckBox.ForceSetFlag(i == this._doc.CurrentTab);
ixuicheckBox.ID = (ulong)((long)i);
ixuicheckBox.RegisterOnCheckEventHandler(new CheckBoxOnCheckEventHandler(this.OnTabClicked));
gameObject.transform.localPosition = this.m_TabPool.TplPos + new Vector3((float)(i * this.m_TabPool.TplWidth), 0f);
}
}
private bool OnTabClicked(IXUICheckBox checkbox)
{
bool bChecked = checkbox.bChecked;
if (bChecked)
{
this._doc.CurrentTab = (int)checkbox.ID;
this.RefreshData();
}
return true;
}
public void RefreshActivityList()
{
this.m_ActivityPool.ReturnAll(false);
this.m_NoticePool.ReturnAll(false);
for (int i = 0; i < this._doc.NoticeList.Count; i++)
{
bool flag = this._doc.NoticeList[i].type != 6u;
if (!flag)
{
GameObject gameObject = this.m_ActivityPool.FetchGameObject(false);
gameObject.name = "activity" + i.ToString("d4");
IXUITexture ixuitexture = gameObject.GetComponent("XUITexture") as IXUITexture;
IXUITexture ixuitexture2 = gameObject.transform.Find("ActivityTex").GetComponent("XUITexture") as IXUITexture;
IXUILabel ixuilabel = gameObject.transform.Find("ChildList/LevelTwoTpl/Label").GetComponent("XUILabel") as IXUILabel;
Transform transform = gameObject.transform.Find("new");
transform.gameObject.SetActive(this._doc.NoticeList[i].isnew);
ixuitexture2.SetVisible(true);
XSingleton<XUICacheImage>.singleton.Load(this._doc.NoticeList[i].title, ixuitexture2, DlgBase<XOperatingActivityView, XOperatingActivityBehaviour>.singleton.uiBehaviour);
ixuilabel.SetText(this._doc.NoticeList[i].content);
ixuitexture.ID = (ulong)((long)i);
ixuitexture.RegisterLabelClickEventHandler(new TextureClickEventHandler(this.OnActivityClicked));
Transform transform2 = gameObject.transform.Find("ChildList");
transform2.localScale = new Vector3(1f, 0f, 1f);
}
}
this.m_Table.RePositionNow();
}
public void RefreshNoticeList()
{
this.m_ActivityPool.ReturnAll(false);
this.m_NoticePool.ReturnAll(false);
for (int i = 0; i < this._doc.NoticeList.Count; i++)
{
bool flag = this._doc.NoticeList[i].type != 3u && this._doc.NoticeList[i].type != 4u;
if (!flag)
{
GameObject gameObject = this.m_NoticePool.FetchGameObject(false);
IXUISprite ixuisprite = gameObject.transform.GetComponent("XUISprite") as IXUISprite;
gameObject.name = "notice" + i.ToString("d4");
Transform transform = gameObject.transform.Find("new");
IXUILabel ixuilabel = gameObject.transform.Find("Title").GetComponent("XUILabel") as IXUILabel;
IXUILabel ixuilabel2 = gameObject.transform.Find("Time").GetComponent("XUILabel") as IXUILabel;
IXUILabel ixuilabel3 = gameObject.transform.Find("Selected/Title").GetComponent("XUILabel") as IXUILabel;
IXUILabel ixuilabel4 = gameObject.transform.Find("Selected/Time").GetComponent("XUILabel") as IXUILabel;
IXUILabel ixuilabel5 = gameObject.transform.Find("ChildList/LevelTwoTpl/Label").GetComponent("XUILabel") as IXUILabel;
IXUITexture ixuitexture = gameObject.transform.Find("ChildList/LevelTwoTpl/Texture").GetComponent("XUITexture") as IXUITexture;
transform.gameObject.SetActive(this._doc.NoticeList[i].isnew);
ixuilabel.SetText(this._doc.NoticeList[i].title);
ixuilabel3.SetText(this._doc.NoticeList[i].title);
DateTime dateTime = XSingleton<UiUtility>.singleton.TimeNow(this._doc.NoticeList[i].updatetime, true);
ixuilabel2.SetText(dateTime.ToString("yyyy-MM-dd"));
ixuilabel4.SetText(dateTime.ToString("yyyy-MM-dd"));
uint type = this._doc.NoticeList[i].type;
if (type != 3u)
{
if (type == 4u)
{
ixuilabel5.SetVisible(false);
ixuitexture.SetVisible(true);
XSingleton<XUICacheImage>.singleton.Load(this._doc.NoticeList[i].content, ixuitexture, DlgBase<XOperatingActivityView, XOperatingActivityBehaviour>.singleton.uiBehaviour);
}
}
else
{
ixuilabel5.SetVisible(true);
ixuitexture.SetVisible(false);
ixuilabel5.SetText(this._doc.NoticeList[i].content);
}
ixuisprite.ID = (ulong)((long)i);
ixuisprite.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnNoticeClicked));
Transform transform2 = gameObject.transform.Find("Selected");
Transform transform3 = gameObject.transform.Find("ChildList");
transform2.gameObject.SetActive(false);
transform3.localScale = new Vector3(1f, 0f, 1f);
}
}
this.m_Table.RePositionNow();
}
private void OnNoticeClicked(IXUISprite sp)
{
bool flag = sp.gameObject == this._last_notice;
if (flag)
{
IXUITweenTool ixuitweenTool = this._last_notice.GetComponent("XUIPlayTween") as IXUITweenTool;
Transform transform = this._last_notice.transform.Find("Selected");
transform.gameObject.SetActive(false);
ixuitweenTool.PlayTween(false, -1f);
this._last_notice = null;
}
else
{
IXUITweenTool ixuitweenTool2 = sp.transform.GetComponent("XUIPlayTween") as IXUITweenTool;
Transform transform2 = sp.transform.Find("Selected");
transform2.gameObject.SetActive(true);
ixuitweenTool2.PlayTween(true, -1f);
bool flag2 = this._last_notice != null;
if (flag2)
{
IXUITweenTool ixuitweenTool3 = this._last_notice.GetComponent("XUIPlayTween") as IXUITweenTool;
Transform transform3 = this._last_notice.transform.Find("Selected");
transform3.gameObject.SetActive(false);
ixuitweenTool3.PlayTween(false, -1f);
}
this._last_notice = sp.gameObject;
}
bool isnew = this._doc.NoticeList[(int)sp.ID].isnew;
if (isnew)
{
this._doc.SendClickNotice(this._doc.NoticeList[(int)sp.ID]);
Transform transform4 = sp.transform.Find("new");
transform4.gameObject.SetActive(false);
}
}
private void OnActivityClicked(IXUITexture tex)
{
bool flag = tex.gameObject == this._last_notice;
if (flag)
{
IXUITweenTool ixuitweenTool = this._last_notice.GetComponent("XUIPlayTween") as IXUITweenTool;
ixuitweenTool.PlayTween(false, -1f);
this._last_notice = null;
}
else
{
IXUITweenTool ixuitweenTool2 = tex.gameObject.GetComponent("XUIPlayTween") as IXUITweenTool;
ixuitweenTool2.PlayTween(true, -1f);
bool flag2 = this._last_notice != null;
if (flag2)
{
IXUITweenTool ixuitweenTool3 = this._last_notice.GetComponent("XUIPlayTween") as IXUITweenTool;
ixuitweenTool3.PlayTween(false, -1f);
}
this._last_notice = tex.gameObject;
}
bool isnew = this._doc.NoticeList[(int)tex.ID].isnew;
if (isnew)
{
this._doc.SendClickNotice(this._doc.NoticeList[(int)tex.ID]);
Transform transform = tex.gameObject.transform.Find("new");
transform.gameObject.SetActive(false);
}
}
}
}
|