blob: c9b9f75b8b79e8ec2c45ce1f3d3668051e951aa6 (
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
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
|
using System;
using System.Collections.Generic;
using KKSG;
using UILib;
using UnityEngine;
using XMainClient.UI.UICommon;
using XUtliPoolLib;
namespace XMainClient
{
internal class GiftboxDlg : DlgBase<GiftboxDlg, GiftboxBehaviour>
{
private XGameMallDocument doc
{
get
{
return XDocuments.GetSpecificDocument<XGameMallDocument>(XGameMallDocument.uuID);
}
}
public override int layer
{
get
{
return 1;
}
}
public override int group
{
get
{
return 1;
}
}
public override bool autoload
{
get
{
return true;
}
}
public override bool fullscreenui
{
get
{
return true;
}
}
public override bool hideMainMenu
{
get
{
return true;
}
}
public override string fileName
{
get
{
return "GameSystem/GiftBoxDlg";
}
}
private DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
private List<IBGiftHistItem> currItems;
public GiftboxDlg.State state = GiftboxDlg.State.Present;
public enum State
{
Present,
Recv
}
protected override void Init()
{
base.Init();
}
public override void RegisterEvent()
{
base.RegisterEvent();
base.uiBehaviour.m_btnClose.RegisterClickEventHandler(new ButtonClickEventHandler(this.Close));
base.uiBehaviour.m_checkbox1.RegisterOnCheckEventHandler(new CheckBoxOnCheckEventHandler(this.TogglePresent));
base.uiBehaviour.m_checkbox2.RegisterOnCheckEventHandler(new CheckBoxOnCheckEventHandler(this.ToggleRecv));
base.uiBehaviour.m_wrap.RegisterItemUpdateEventHandler(new WrapItemUpdateEventHandler(this.WrapContentItemUpdated));
}
protected override void OnShow()
{
base.OnShow();
base.uiBehaviour.m_checkbox1.bChecked = true;
this.TogglePresent(base.uiBehaviour.m_checkbox1);
}
protected override void OnHide()
{
this.doc.ClearGiftItems();
base.OnHide();
}
public void Refresh()
{
this.currItems = ((this.state == GiftboxDlg.State.Present) ? this.doc.presentList : this.doc.recvList);
bool flag = this.currItems != null;
if (flag)
{
bool flag2 = this.state == GiftboxDlg.State.Present;
if (flag2)
{
this.RefreshPresent();
}
else
{
bool flag3 = this.state == GiftboxDlg.State.Recv;
if (flag3)
{
this.RefreshRecv();
}
}
}
}
private bool Close(IXUIButton btn)
{
this.SetVisible(false, true);
return true;
}
private bool ToggleRecv(IXUICheckBox box)
{
bool bChecked = box.bChecked;
if (bChecked)
{
this.state = GiftboxDlg.State.Recv;
this.ToggleTip(this.state);
this.doc.SendQueryGiftItems(1u);
}
return true;
}
private void RefreshRecv()
{
bool flag = this.doc.recvList != null;
if (flag)
{
base.uiBehaviour.m_scroll.ResetPosition();
base.uiBehaviour.m_wrap.SetContentCount(this.doc.recvList.Count, false);
}
}
private bool TogglePresent(IXUICheckBox box)
{
bool bChecked = box.bChecked;
if (bChecked)
{
this.state = GiftboxDlg.State.Present;
this.ToggleTip(this.state);
this.doc.SendQueryGiftItems(0u);
}
return true;
}
private void ToggleTip(GiftboxDlg.State state)
{
base.uiBehaviour.m_tip0.SetActive(state == GiftboxDlg.State.Recv);
base.uiBehaviour.m_tip1.SetActive(state == GiftboxDlg.State.Present);
}
private void RefreshPresent()
{
bool flag = this.doc.presentList != null;
if (flag)
{
base.uiBehaviour.m_scroll.ResetPosition();
base.uiBehaviour.m_wrap.SetContentCount(this.doc.presentList.Count, false);
}
}
private void WrapContentItemUpdated(Transform t, int index)
{
bool flag = this.currItems == null || this.currItems.Count <= index;
if (!flag)
{
IBGiftHistItem ibgiftHistItem = this.currItems[index];
IXUILabel ixuilabel = t.Find("Label").GetComponent("XUILabel") as IXUILabel;
IXUILabel ixuilabel2 = t.Find("Recv").GetComponent("XUILabel") as IXUILabel;
ixuilabel.SetText(this.startTime.AddSeconds(ibgiftHistItem.time).ToString("yyyy-MM-dd"));
ixuilabel2.SetText(ibgiftHistItem.name);
XSingleton<XItemDrawerMgr>.singleton.normalItemDrawer.DrawItem(t.gameObject, (int)ibgiftHistItem.item.itemID, (int)ibgiftHistItem.item.itemCount, false);
}
}
}
}
|