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
|
using System;
using System.Collections.Generic;
using KKSG;
using UILib;
using UnityEngine;
using XMainClient.UI;
using XMainClient.UI.UICommon;
using XUtliPoolLib;
namespace XMainClient
{
internal class XBackFlowTargetHandler : DlgHandlerBase
{
protected override string FileName
{
get
{
return "Hall/BfTargetHandler";
}
}
private IUIDummy _playerDummy;
private Transform _itemsRoot;
private SeqList<int> _itemDataList;
private IXUIProgress _progress;
private IXUISprite _proSpite;
protected XUIPool _itemPool = new XUIPool(XSingleton<XGameUI>.singleton.m_uiTool);
private OutLook _outLook = new OutLook();
private List<uint> _fashionList = new List<uint>();
private XDummy _dummy;
private IXUIButton _nestBtn;
private IXUIButton _dragonBtn;
private IXUILabel _pointLabel;
private IXUILabel _dragonDescLabel;
private IXUILabel _dragonPointLabel;
private IXUILabel _nestDescLabel;
private IXUILabel _nestPointLabel;
private IXUILabel _nestLeftTimes;
private IXUILabel _dragonLeftTimes;
protected override void Init()
{
base.Init();
this._pointLabel = (base.transform.Find("Progress/PointValue").GetComponent("XUILabel") as IXUILabel);
this._playerDummy = (base.transform.Find("Snapshot").GetComponent("UIDummy") as IUIDummy);
Transform transform = base.transform.Find("Progress/Items/ItemTpl");
this._itemsRoot = base.transform.Find("Progress/Items");
this._itemPool.SetupPool(this._itemsRoot.gameObject, transform.gameObject, 5u, false);
this._itemDataList = XSingleton<XGlobalConfig>.singleton.GetSequence3List("BackFlowTreasure", false);
this._progress = (base.transform.Find("Progress").GetComponent("XUIProgress") as IXUIProgress);
this._proSpite = (base.transform.Find("Progress").GetComponent("XUISprite") as IXUISprite);
List<uint> backflowDataByTypeAndWorldLevel = XBackFlowDocument.Doc.GetBackflowDataByTypeAndWorldLevel(1u);
backflowDataByTypeAndWorldLevel.Sort();
this._dragonDescLabel = (base.transform.Find("LB/Label").GetComponent("XUILabel") as IXUILabel);
this._dragonPointLabel = (base.transform.Find("LB/Labeltex").GetComponent("XUILabel") as IXUILabel);
this._dragonDescLabel.SetText(XStringDefineProxy.GetString("BackFlowDragonDes"));
uint num = (backflowDataByTypeAndWorldLevel.Count > 1) ? backflowDataByTypeAndWorldLevel[1] : 20u;
this._dragonPointLabel.SetText(string.Format(XSingleton<UiUtility>.singleton.ReplaceReturn(XStringDefineProxy.GetString("BackFlowDragonPoint")), num));
this._nestDescLabel = (base.transform.Find("CX/Label").GetComponent("XUILabel") as IXUILabel);
this._nestPointLabel = (base.transform.Find("CX/Labeltex").GetComponent("XUILabel") as IXUILabel);
this._nestDescLabel.SetText(XStringDefineProxy.GetString("BackFlowNestDes"));
uint num2 = (backflowDataByTypeAndWorldLevel.Count > 0) ? backflowDataByTypeAndWorldLevel[0] : 10u;
this._nestPointLabel.SetText(string.Format(XSingleton<UiUtility>.singleton.ReplaceReturn(XStringDefineProxy.GetString("BackFlowNestPoint")), num2));
this._nestLeftTimes = (base.transform.Find("CX/Limit").GetComponent("XUILabel") as IXUILabel);
this._dragonLeftTimes = (base.transform.Find("LB/Limit").GetComponent("XUILabel") as IXUILabel);
this._fashionList.Clear();
for (int i = 0; i < (int)this._itemDataList.Count; i++)
{
this._fashionList.Add((uint)this._itemDataList[i, 1]);
}
this._nestBtn = (base.transform.Find("CX/BtnGo").GetComponent("XUIButton") as IXUIButton);
this._dragonBtn = (base.transform.Find("LB/BtnGo").GetComponent("XUIButton") as IXUIButton);
this._nestBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnGotoNest));
this._dragonBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnGotoDragon));
}
private bool OnGotoNest(IXUIButton button)
{
XSingleton<XGameSysMgr>.singleton.OpenSystem(XSysDefine.XSys_Activity_Nest, 0UL);
return true;
}
private bool OnGotoDragon(IXUIButton button)
{
DlgBase<XDragonNestView, XDragonNestBehaviour>.singleton.ShowDragonNestByTypeAndDiff(1u, 0u);
return true;
}
public override void RegisterEvent()
{
base.RegisterEvent();
}
protected override void OnShow()
{
base.OnShow();
base.Alloc3DAvatarPool("BackFlowTarget", 1);
this.InitOutlook();
XBackFlowDocument.Doc.SendBackFlowActivityOperation(BackFlowActOp.BackFlowAct_TreasureData, 0u);
}
protected override void OnHide()
{
this.DiscardOutlook();
base.OnHide();
}
private void DiscardOutlook()
{
this._outLook = null;
bool flag = this.m_dummPool != -1;
if (flag)
{
XSingleton<X3DAvatarMgr>.singleton.DestroyDummy(this.m_dummPool, this._dummy);
}
base.Return3DAvatarPool();
}
public override void OnUnload()
{
this.DiscardOutlook();
base.OnUnload();
}
public override void RefreshData()
{
base.RefreshData();
this.RefreshUI();
}
private void RefreshUI()
{
XPlayerAttributes xplayerData = XSingleton<XAttributeMgr>.singleton.XPlayerData;
uint unitType = (uint)XFastEnumIntEqualityComparer<RoleType>.ToInt(xplayerData.Profession);
this._dummy = XSingleton<X3DAvatarMgr>.singleton.CreateCommonRoleDummy(this.m_dummPool, xplayerData.RoleID, unitType, this._outLook, this._playerDummy, this._dummy);
this._itemPool.ReturnAll(false);
float num = (float)(this._proSpite.spriteWidth / (int)this._itemDataList.Count);
int num2 = 0;
for (int i = 0; i < (int)this._itemDataList.Count; i++)
{
GameObject gameObject = this._itemPool.FetchGameObject(false);
gameObject.transform.localPosition = this._itemPool.TplPos + Vector3.right * (float)(i + 1) * num;
int num3 = this._itemDataList[i, 0];
int itemid = this._itemDataList[i, 1];
int itemCount = this._itemDataList[i, 2];
IXUILabel ixuilabel = gameObject.transform.Find("Exp").GetComponent("XUILabel") as IXUILabel;
ixuilabel.SetText(num3.ToString());
IXUISprite ixuisprite = gameObject.transform.Find("Icon").GetComponent("XUISprite") as IXUISprite;
ixuisprite.ID = (ulong)((long)i);
ixuisprite.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnItemIconClicked));
XSingleton<XItemDrawerMgr>.singleton.normalItemDrawer.DrawItem(gameObject, itemid, itemCount, false);
Transform transform = gameObject.transform.Find("ylq");
Transform transform2 = gameObject.transform.Find("klq");
int targetPoint = (int)XBackFlowDocument.Doc.TargetPoint;
bool flag = targetPoint >= num3;
if (flag)
{
num2 = i + 1;
}
transform2.gameObject.SetActive(!XBackFlowDocument.Doc.RewardedTargetIDList.Contains((uint)i) && targetPoint >= num3);
transform.gameObject.SetActive(XBackFlowDocument.Doc.RewardedTargetIDList.Contains((uint)i));
}
this._progress.value = (float)num2 / (float)this._itemDataList.Count;
this._pointLabel.SetText(XBackFlowDocument.Doc.TargetPoint.ToString());
this._dragonLeftTimes.SetText(XBackFlowDocument.Doc.DragonLeftTimes + "/" + XSingleton<XGlobalConfig>.singleton.GetInt("BackFlowDragonFinishCountLimit"));
this._nestLeftTimes.SetText(XBackFlowDocument.Doc.NestLeftTimes + "/" + XSingleton<XGlobalConfig>.singleton.GetInt("BackFlowNestFinishCountLimit"));
}
private void InitOutlook()
{
this._outLook = new OutLook();
this._outLook.display_fashion = new OutLookDisplayFashion();
this._outLook.display_fashion.display_fashions.AddRange(this._fashionList);
this._outLook.display_fashion.hair_color_id = 0u;
this._outLook.display_fashion.special_effects_id = 0u;
}
private void OnItemIconClicked(IXUISprite iSp)
{
int num = (int)iSp.ID;
bool flag = num < (int)this._itemDataList.Count;
if (flag)
{
int num2 = this._itemDataList[num, 0];
int targetPoint = (int)XBackFlowDocument.Doc.TargetPoint;
bool flag2 = !XBackFlowDocument.Doc.RewardedTargetIDList.Contains((uint)num) && targetPoint >= num2;
if (flag2)
{
XBackFlowDocument.Doc.SendBackFlowActivityOperation(BackFlowActOp.BackFlowAct_GetTreasure, (uint)num);
}
else
{
int itemID = this._itemDataList[num, 1];
XItem mainItem = XBagDocument.MakeXItem(itemID, false);
XSingleton<UiUtility>.singleton.ShowTooltipDialogWithSearchingCompare(mainItem, iSp, false, 0u);
}
}
}
}
}
|