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
|
using System;
using System.Collections.Generic;
using UILib;
using UnityEngine;
using XMainClient.UI.UICommon;
using XUtliPoolLib;
namespace XMainClient.UI
{
internal class XGuildSignInView : DlgBase<XGuildSignInView, XGuildSignInBehaviour>
{
public XGuildLogView LogView
{
get
{
return this._LogView;
}
}
public override string fileName
{
get
{
return "Guild/GuildSignInDlg";
}
}
public override int layer
{
get
{
return 1;
}
}
public override int group
{
get
{
return 1;
}
}
public override bool autoload
{
get
{
return true;
}
}
public override bool hideMainMenu
{
get
{
return true;
}
}
public override bool pushstack
{
get
{
return true;
}
}
public int BUTTON_COUNT = 3;
public int CHEST_COUNT = 4;
private XGuildSignInDocument _SignInDoc;
private XGuildDocument _GuildDoc;
private XGuildLogView _LogView;
private XChestProgress m_Progress;
private List<IXUIButton> m_Buttons = new List<IXUIButton>();
private List<GameObject> m_ButtonGos = new List<GameObject>();
protected override void Init()
{
this._SignInDoc = XDocuments.GetSpecificDocument<XGuildSignInDocument>(XGuildSignInDocument.uuID);
this._SignInDoc.GuildSignInView = this;
this._GuildDoc = XDocuments.GetSpecificDocument<XGuildDocument>(XGuildDocument.uuID);
GuildCheckinBoxTable.RowData[] boxTableData = XGuildSignInDocument.GetBoxTableData();
uint num = 0u;
this.CHEST_COUNT = boxTableData.Length;
this.m_Progress = new XChestProgress(base.uiBehaviour.m_ExpProgress);
for (int i = 0; i < this.CHEST_COUNT; i++)
{
GuildCheckinBoxTable.RowData rowData = boxTableData[i];
XChest xchest = new XChest(base.uiBehaviour.m_ChestPool.FetchGameObject(false), null);
xchest.SetExp(rowData.process);
num = Math.Max(num, rowData.process);
this.m_Progress.AddChest(xchest);
}
this.m_Progress.SetExp(0u, num);
base.uiBehaviour.m_BtnLog.SetVisible(false);
this.m_Buttons.Clear();
this.m_ButtonGos.Clear();
GuildCheckinTable.RowData[] signInTableData = XGuildSignInDocument.GetSignInTableData();
this.BUTTON_COUNT = signInTableData.Length;
Vector3 tplPos = base.uiBehaviour.m_SignInButtonPool.TplPos;
for (int j = 0; j < this.BUTTON_COUNT; j++)
{
GuildCheckinTable.RowData rowData2 = signInTableData[j];
GameObject gameObject = base.uiBehaviour.m_SignInButtonPool.FetchGameObject(false);
gameObject.transform.localPosition = new Vector3(tplPos.x + (float)(base.uiBehaviour.m_SignInButtonPool.TplWidth * j), tplPos.y);
this.m_ButtonGos.Add(gameObject);
IXUILabel ixuilabel = gameObject.transform.Find("Progress").GetComponent("XUILabel") as IXUILabel;
IXUILabel ixuilabel2 = gameObject.transform.Find("Contribute").GetComponent("XUILabel") as IXUILabel;
IXUILabelSymbol ixuilabelSymbol = gameObject.transform.Find("BtnOK/Cost").GetComponent("XUILabelSymbol") as IXUILabelSymbol;
IXUIButton item = gameObject.transform.Find("BtnOK").GetComponent("XUIButton") as IXUIButton;
IXUISprite ixuisprite = gameObject.transform.Find("Bg").GetComponent("XUISprite") as IXUISprite;
IXUISprite ixuisprite2 = gameObject.transform.Find("Title").GetComponent("XUISprite") as IXUISprite;
ixuisprite.SetSprite("gh_qd_" + rowData2.type);
ixuisprite2.SetSprite("gh_qd_word_" + rowData2.type);
ixuilabel.SetText("+" + rowData2.process);
ixuilabel2.SetText("+" + rowData2.reward[1]);
ixuilabelSymbol.InputText = XLabelSymbolHelper.FormatCostWithIcon((int)rowData2.consume[1], (ItemEnum)rowData2.consume[0]);
this.m_Buttons.Add(item);
}
DlgHandlerBase.EnsureCreate<XGuildLogView>(ref this._LogView, base.uiBehaviour.m_LogPanel, null, true);
this._LogView.LogSource = this._SignInDoc;
}
protected override void OnUnload()
{
this._SignInDoc.GuildSignInView = null;
this.m_Progress.Unload();
DlgHandlerBase.EnsureUnload<XGuildLogView>(ref this._LogView);
base.OnUnload();
}
public override void RegisterEvent()
{
base.uiBehaviour.m_Close.RegisterClickEventHandler(new ButtonClickEventHandler(this._OnCloseBtnClick));
base.uiBehaviour.m_BtnLog.RegisterClickEventHandler(new ButtonClickEventHandler(this._OnLogBtnClick));
for (int i = 0; i < this.CHEST_COUNT; i++)
{
this.m_Progress.ChestList[i].m_Chest.ID = (ulong)((long)i);
this.m_Progress.ChestList[i].m_Chest.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnChestClicked));
}
for (int j = 0; j < this.BUTTON_COUNT; j++)
{
this.m_Buttons[j].ID = (ulong)((long)(j + 1));
this.m_Buttons[j].RegisterClickEventHandler(new ButtonClickEventHandler(this._OnSignInBtnClick));
}
}
protected override void OnShow()
{
this._LogView.SetVisible(false);
this._SignInDoc.ReqAllInfo();
this.RefreshProgress();
}
public override void OnUpdate()
{
base.OnUpdate();
this.m_Progress.Update(Time.deltaTime);
}
public void Refresh()
{
base.uiBehaviour.m_MemberCount.SetText(string.Format("{0}/{1}", this._SignInDoc.CurrentCount, this._SignInDoc.TotalCount));
for (int i = 0; i < this.BUTTON_COUNT; i++)
{
this.m_Buttons[i].SetEnable(this._SignInDoc.SignInSelection == 0u, false);
GameObject gameObject = this.m_Buttons[i].gameObject.transform.Find("RedPoint").gameObject;
gameObject.SetActive(false);
}
for (int j = 0; j < this.CHEST_COUNT; j++)
{
this.m_Progress.ChestList[j].Opened = this._SignInDoc.IsBoxOpen(j);
}
}
public void RefreshProgress()
{
this.m_Progress.TargetExp = this._SignInDoc.Progress;
base.uiBehaviour.m_ExpTween.SetNumberWithTween((ulong)this._SignInDoc.Progress, "", false, true);
}
public void OpenBox(int index)
{
for (int i = 0; i < this.CHEST_COUNT; i++)
{
bool flag = i != index;
if (!flag)
{
XChest xchest = this.m_Progress.ChestList[i];
xchest.Open();
break;
}
}
}
private void OnChestClicked(IXUISprite iSp)
{
uint num = (uint)iSp.ID;
bool flag = !this.m_Progress.IsExpEnough((int)num);
if (flag)
{
GuildCheckinBoxTable.RowData rowData = XGuildSignInDocument.GetBoxTableData()[(int)num];
bool flag2 = rowData == null;
if (!flag2)
{
List<uint> list = new List<uint>();
List<uint> list2 = new List<uint>();
for (int i = 0; i < rowData.viewabledrop.Count; i++)
{
list.Add(rowData.viewabledrop[i, 0]);
list2.Add(rowData.viewabledrop[i, 1]);
}
DlgBase<ItemIconListDlg, ItemIconListDlgBehaviour>.singleton.Show(list, list2, false);
DlgBase<ItemIconListDlg, ItemIconListDlgBehaviour>.singleton.SetGlobalPosition(iSp.gameObject.transform.position);
}
}
else
{
this._SignInDoc.ReqFetchBox(num);
}
}
private bool _OnCloseBtnClick(IXUIButton go)
{
this.SetVisibleWithAnimation(false, null);
return true;
}
private bool _OnSignInBtnClick(IXUIButton go)
{
this._SignInDoc.ReqSignIn((uint)go.ID);
return true;
}
private bool _OnLogBtnClick(IXUIButton go)
{
this._SignInDoc.ReqLogList();
this._LogView.SetVisible(true);
return true;
}
}
}
|