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
255
256
257
258
|
using System;
using System.Collections.Generic;
using UILib;
using UnityEngine;
using XMainClient.UI.UICommon;
using XUtliPoolLib;
namespace XMainClient.UI
{
internal class XSystemMailView : DlgHandlerBase
{
private List<ulong> selects
{
get
{
List<ulong> list = new List<ulong>();
foreach (XSystemItemMailView xsystemItemMailView in this.items)
{
bool flag = xsystemItemMailView != null && xsystemItemMailView.Select;
if (flag)
{
list.Add(xsystemItemMailView.uid);
}
}
return list;
}
}
public bool hasRwd
{
get
{
bool result = false;
bool flag = this.items != null;
if (flag)
{
for (int i = 0; i < this.items.Length; i++)
{
XSystemItemMailView xsystemItemMailView = this.items[i];
bool flag2 = xsystemItemMailView != null;
if (flag2)
{
bool flag3 = xsystemItemMailView.Select && xsystemItemMailView.isRwd;
if (flag3)
{
result = true;
break;
}
}
}
}
return result;
}
}
private XMailDocument _doc = null;
public IXUISprite m_sprsel;
public IXUILabel m_lblpage;
public IXUIButton m_sprleft;
public IXUIButton m_sprright;
public IXUIButton m_btndel;
public IXUIButton m_btnsq;
public GameObject m_objDelHighlight;
public XSystemItemMailView[] items = new XSystemItemMailView[7];
public static XSystemMailView.DelSelect doSelSelect;
public static XSystemMailView.DelSelect doItemSelect;
private bool all_selected;
public delegate void DelSelect();
protected override void Init()
{
base.Init();
this.m_sprsel = (base.PanelObject.transform.Find("btm/AllSelItem/sign").GetComponent("XUISprite") as IXUISprite);
this.m_lblpage = (base.PanelObject.transform.Find("btm/pageItem/T").GetComponent("XUILabel") as IXUILabel);
this.m_sprleft = (base.PanelObject.transform.Find("btm/pageItem/left").GetComponent("XUIButton") as IXUIButton);
this.m_sprright = (base.PanelObject.transform.Find("btm/pageItem/right").GetComponent("XUIButton") as IXUIButton);
this.m_btndel = (base.PanelObject.transform.Find("btm/deletBtn").GetComponent("XUIButton") as IXUIButton);
this.m_btnsq = (base.PanelObject.transform.Find("btm/sqBtn").GetComponent("XUIButton") as IXUIButton);
this.m_objDelHighlight = this.m_btndel.gameObject.transform.Find("Highlight").gameObject;
this.ShowSel(false);
this.m_objDelHighlight.SetActive(false);
for (int i = 0; i < this.items.Length; i++)
{
string text = "Content/item" + i;
GameObject gameObject = base.PanelObject.transform.Find(text).gameObject;
bool flag = gameObject != null;
if (flag)
{
this.items[i] = gameObject.AddComponent<XSystemItemMailView>();
}
}
XSystemMailView.doSelSelect = new XSystemMailView.DelSelect(this.CheckDelbtnShow);
XSystemMailView.doItemSelect = (XSystemMailView.DelSelect)Delegate.Combine(XSystemMailView.doItemSelect, new XSystemMailView.DelSelect(this.Hidehighlight));
}
public override void RegisterEvent()
{
base.RegisterEvent();
this.m_sprsel.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnAllSelClick));
this.m_btndel.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnDelClick));
this.m_sprleft.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnPageLeftClick));
this.m_sprright.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnPageRightClick));
this.m_btnsq.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnSQClick));
}
protected override void OnShow()
{
base.OnShow();
this._doc = (XSingleton<XGame>.singleton.Doc.GetXComponent(XMailDocument.uuID) as XMailDocument);
this._doc.ReqMailInfo();
}
public void Refresh()
{
this._doc.RefreshContentNil();
this.ShowItemsSel(false);
this.ShowSel(false);
this.m_objDelHighlight.SetActive(false);
this.m_btndel.SetEnable(false, false);
this.Hidehighlight();
this.RefreshItems();
this.RefreshPage();
}
public void RefreshItems()
{
List<MailItem> mails = this._doc.mails;
for (int i = 0; i < mails.Count; i++)
{
this.items[i].gameObject.SetActive(true);
this.items[i].Refresh(mails[i].id);
}
for (int j = mails.Count; j < 7; j++)
{
this.items[j].gameObject.SetActive(false);
}
}
public void RefreshPage()
{
this.m_lblpage.SetText(this._doc.GetPageFormat());
}
public override void OnUnload()
{
XSystemMailView.doItemSelect = (XSystemMailView.DelSelect)Delegate.Remove(XSystemMailView.doItemSelect, new XSystemMailView.DelSelect(this.Hidehighlight));
base.OnUnload();
}
private bool OnDelClick(IXUIButton btn)
{
bool flag = !this.m_objDelHighlight.activeSelf || DlgBase<RewdAnimDlg, RewdAnimBehaviour>.singleton.IsVisible();
bool result;
if (flag)
{
result = true;
}
else
{
bool hasRwd = this.hasRwd;
if (hasRwd)
{
XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("Mail_RWD"), "fece00");
}
else
{
this._doc.ReqMailOP(MailOP.Delete, this.selects);
}
result = true;
}
return result;
}
private bool OnPageLeftClick(IXUIButton btn)
{
bool flag = this._doc.CtlPage(false);
if (flag)
{
this.Refresh();
}
return true;
}
private bool OnPageRightClick(IXUIButton btn)
{
bool flag = this._doc.CtlPage(true);
if (flag)
{
this.Refresh();
}
return true;
}
private bool OnSQClick(IXUIButton btn)
{
XSingleton<XDebug>.singleton.AddLog("sq click", null, null, null, null, null, XDebugColor.XDebug_None);
this._doc.ReqMailOP(MailOP.ClaimAll, new List<ulong>());
return true;
}
private void OnAllSelClick(IXUISprite spr)
{
this.ShowSel(!this.all_selected);
this.ShowItemsSel(this.all_selected);
this.CheckDelbtnShow();
}
private void ShowItemsSel(bool show)
{
foreach (XSystemItemMailView xsystemItemMailView in this.items)
{
xsystemItemMailView.ShowSel(show);
}
}
private void ShowSel(bool show)
{
this.all_selected = show;
this.m_sprsel.SetAlpha(show ? 1f : 0.01f);
}
private void CheckDelbtnShow()
{
bool flag = false;
foreach (XSystemItemMailView xsystemItemMailView in this.items)
{
bool select = xsystemItemMailView.Select;
if (select)
{
flag = true;
break;
}
}
this.m_objDelHighlight.SetActive(flag);
this.m_btndel.SetEnable(flag, false);
}
private void Hidehighlight()
{
foreach (XSystemItemMailView xsystemItemMailView in this.items)
{
xsystemItemMailView.ShowHighLight(false);
}
}
}
}
|