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
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
|
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 XFlowerSendView : DlgBase<XFlowerSendView, XFlowerSendBehaviour>
{
public override string fileName
{
get
{
return "GameSystem/FlowerSendDlg";
}
}
public override bool autoload
{
get
{
return true;
}
}
private XFlowerSendDocument _doc = null;
private static readonly int SEND_FLOWER_TYPE_COUNT = 3;
private string[] sendCountType;
private List<IXUILabel> ownCount = new List<IXUILabel>();
private List<GameObject> flowerTab = new List<GameObject>();
private List<GameObject> sendItem = new List<GameObject>();
private GameObject currSelectTab;
private XFlowerSendView.SendFlowerType currSelectTabType;
private ulong roleIDSendTo;
private string roleNameSendTo;
private uint sendFlowerId;
private uint sendFlowerCount;
private uint needCostID;
private uint needCostCount;
private enum SendFlowerType
{
RED_ROSE,
WHITE_ROSE,
BLUE_ENCHANTRESS
}
protected override void Init()
{
base.Init();
this._doc = XDocuments.GetSpecificDocument<XFlowerSendDocument>(XFlowerSendDocument.uuID);
this.InitFlowerBtnInfo();
}
public override void RegisterEvent()
{
base.RegisterEvent();
base.uiBehaviour.m_Close.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnCloseClicked));
}
private void InitFlowerBtnInfo()
{
this.flowerTab.Clear();
this.sendItem.Clear();
this.ownCount.Clear();
string[] array = new string[]
{
"icon-90",
"icon-91",
"icon-92"
};
for (int i = 0; i < XFlowerSendView.SEND_FLOWER_TYPE_COUNT; i++)
{
GameObject gameObject = base.uiBehaviour.m_TabPool.FetchGameObject(false);
gameObject.transform.localPosition = gameObject.transform.localPosition + new Vector3(0f, (float)(-90 * i), 0f);
IXUISprite ixuisprite = gameObject.GetComponent("XUISprite") as IXUISprite;
IXUILabel ixuilabel = gameObject.transform.Find("T1").GetComponent("XUILabel") as IXUILabel;
IXUILabel item = gameObject.transform.Find("T2").GetComponent("XUILabel") as IXUILabel;
IXUISprite ixuisprite2 = gameObject.transform.Find("P2").GetComponent("XUISprite") as IXUISprite;
ixuisprite.ID = (ulong)((long)i);
ixuilabel.SetText(XStringDefineProxy.GetString(string.Format("FLOWER_SEND_TYPE_{0}", i)));
ixuisprite2.SetSprite(array[i]);
this.flowerTab.Add(gameObject);
this.ownCount.Add(item);
this.SetTabSelect(gameObject, false);
ixuisprite.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnSendRoseTypeClicked));
}
this.sendCountType = XSingleton<XGlobalConfig>.singleton.GetAndSeparateValue("SendFlowerCount", XGlobalConfig.ListSeparator);
for (int j = 0; j < this.sendCountType.Length; j++)
{
GameObject gameObject2 = base.uiBehaviour.m_SendItemPool.FetchGameObject(false);
gameObject2.transform.parent = base.uiBehaviour.m_SendItemList.gameObject.transform;
IXUISprite ixuisprite3 = gameObject2.GetComponent("XUISprite") as IXUISprite;
IXUILabel ixuilabel2 = gameObject2.transform.Find("T1").GetComponent("XUILabel") as IXUILabel;
ixuilabel2.SetText(string.Format("{0}{1}", this.sendCountType[j], XStringDefineProxy.GetString("FLOWER_UNIT")));
ixuisprite3.ID = (ulong)((long)j);
this.sendItem.Add(gameObject2);
ixuisprite3.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnSendItemClicked));
}
base.uiBehaviour.m_SendItemList.Refresh();
this.SelectTab(XFlowerSendView.SendFlowerType.RED_ROSE);
}
private void SelectTab(XFlowerSendView.SendFlowerType type)
{
bool flag = this.currSelectTab != null;
if (flag)
{
this.SetTabSelect(this.currSelectTab, false);
}
this.currSelectTabType = type;
int num = XFastEnumIntEqualityComparer<XFlowerSendView.SendFlowerType>.ToInt(type);
this.currSelectTab = this.flowerTab[num];
this.SetTabSelect(this.currSelectTab, true);
int num2 = XFastEnumIntEqualityComparer<ItemEnum>.ToInt(ItemEnum.FLOWER_RED_ROSE) + XFastEnumIntEqualityComparer<XFlowerSendView.SendFlowerType>.ToInt(this.currSelectTabType);
string[] andSeparateValue = XSingleton<XGlobalConfig>.singleton.GetAndSeparateValue("Flower2Charm", XGlobalConfig.AllSeparators);
int num3 = 0;
for (int i = 0; i < andSeparateValue.Length; i += 2)
{
bool flag2 = num2 == int.Parse(andSeparateValue[i]);
if (flag2)
{
num3 = int.Parse(andSeparateValue[i + 1]);
}
}
for (int j = 0; j < this.sendCountType.Length; j++)
{
GameObject gameObject = this.sendItem[j];
IXUILabel ixuilabel = gameObject.transform.Find("T3").GetComponent("XUILabel") as IXUILabel;
int num4 = int.Parse(this.sendCountType[j]) * num3;
ixuilabel.SetText("+" + num4);
}
string text = string.Format(XStringDefineProxy.GetString("FLOWER_SEND_TIP"), XStringDefineProxy.GetString(string.Format("FLOWER_SEND_TYPE_{0}", num)), num3);
base.uiBehaviour.m_PointTip.SetText(text);
}
private void OnSendRoseTypeClicked(IXUISprite sp)
{
this.SelectTab((XFlowerSendView.SendFlowerType)sp.ID);
}
private void OnSendItemClicked(IXUISprite sp)
{
int num = (int)sp.ID;
bool flag = num >= this.sendCountType.Length;
if (!flag)
{
bool flag2 = XSingleton<XScene>.singleton.SceneType != SceneType.SCENE_HALL && XSingleton<XScene>.singleton.SceneType != SceneType.SCENE_GUILD_HALL && XSingleton<XScene>.singleton.SceneType != SceneType.SCENE_FAMILYGARDEN && XSingleton<XScene>.singleton.SceneType != SceneType.SCENE_LEISURE;
if (flag2)
{
XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("FLOWER_SEND_SCENE_TIP"), "fece00");
}
else
{
uint count = uint.Parse(this.sendCountType[num]);
uint sendItemID = (uint)(XFastEnumIntEqualityComparer<ItemEnum>.ToInt(ItemEnum.FLOWER_RED_ROSE) + XFastEnumIntEqualityComparer<XFlowerSendView.SendFlowerType>.ToInt(this.currSelectTabType));
this._doc.SendFlower(this.roleIDSendTo, count, sendItemID);
}
}
}
public void FlowerNotEnough(SendFlowerArg oArg)
{
this.sendFlowerCount = oArg.count;
this.sendFlowerId = oArg.sendItemID;
string[] andSeparateValue = XSingleton<XGlobalConfig>.singleton.GetAndSeparateValue("BuyFlowerCost", XGlobalConfig.ListSeparator);
int itemCount = XSingleton<UiUtility>.singleton.GetItemCount((int)oArg.sendItemID);
for (int i = 0; i < andSeparateValue.Length; i++)
{
string[] array = andSeparateValue[i].Split(new char[]
{
'='
});
bool flag = array.Length == 3;
if (flag)
{
bool flag2 = uint.Parse(array[0]) == this.sendFlowerId;
if (flag2)
{
this.needCostID = uint.Parse(array[1]);
this.needCostCount = (this.sendFlowerCount - (uint)itemCount) * uint.Parse(array[2]);
ItemList.RowData itemConf = XBagDocument.GetItemConf((int)this.needCostID);
string label = string.Format(XStringDefineProxy.GetString("FLOWER_SEND_NOT_ENOUGH"), new object[]
{
this.roleNameSendTo,
this.sendFlowerCount,
(long)((ulong)this.sendFlowerCount - (ulong)((long)itemCount)),
this.needCostCount,
(itemConf != null) ? XSingleton<UiUtility>.singleton.ChooseProfString(itemConf.ItemName, 0u) : ""
});
string firstBtn = string.Format(XStringDefineProxy.GetString("FLOWER_SEND_NOT_ENOUGH_RIGHT"), (itemConf != null) ? XSingleton<UiUtility>.singleton.ChooseProfString(itemConf.ItemName, 0u) : "");
XSingleton<UiUtility>.singleton.ShowModalDialog(label, firstBtn, new ButtonClickEventHandler(this.OnUseMoney), 50);
DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetCloseButtonVisible(true);
break;
}
}
}
}
private bool OnGotoBuy(IXUIButton button)
{
bool flag = !XSingleton<XGameSysMgr>.singleton.IsSystemOpened(XSysDefine.XSys_GameMall);
bool result;
if (flag)
{
XSingleton<UiUtility>.singleton.ShowSystemTip(XSingleton<XStringTable>.singleton.GetString("FLOWER_MALL_NOT_OPEN"), "fece00");
result = false;
}
else
{
DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetVisible(false, true);
this.SetVisibleWithAnimation(false, null);
DlgBase<XCharacterCommonMenuView, XCharacterCommonMenuBehaviour>.singleton.SetVisible(false, true);
DlgBase<GameMallDlg, TabDlgBehaviour>.singleton.ShowWorkGameSystem(XSysDefine.XSys_GameMall_Diamond);
result = true;
}
return result;
}
private bool OnUseMoney(IXUIButton button)
{
DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetVisible(false, true);
this._doc.SendFlower(this.roleIDSendTo, this.sendFlowerCount, this.sendFlowerId, this.needCostID, this.needCostCount);
return true;
}
public void ShowLackMoneyError()
{
ItemEnum itemEnum = (ItemEnum)this.needCostID;
if (itemEnum != ItemEnum.GOLD)
{
if (itemEnum != ItemEnum.DRAGON_COIN)
{
if (itemEnum == ItemEnum.DIAMOND)
{
XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("ERR_TEAMBUY_DIAMOND_LESS"), "fece00");
}
}
else
{
XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("ERR_AUCT_DRAGONCOINLESS"), "fece00");
}
}
else
{
XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("ERR_AUCTGOLDLESS"), "fece00");
}
}
public void ShowGoToMallError(SendFlowerArg oArg)
{
ItemList.RowData itemConf = XBagDocument.GetItemConf((int)oArg.sendItemID);
string text = (itemConf != null) ? XSingleton<UiUtility>.singleton.ChooseProfString(itemConf.ItemName, 0u) : "";
XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("FLOWER_SEND_GO_TO_MALL", new object[]
{
text
}), "fece00");
}
public void RefreshSendFlowerInfo()
{
this.RefreshRoseOwnCount();
}
public void OnSendFlowerError()
{
XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("FLOWER_SEND_FAIL"), "fece00");
}
private void SetTabSelect(GameObject obj, bool select)
{
IXUISprite ixuisprite = obj.transform.Find("Select").GetComponent("XUISprite") as IXUISprite;
ixuisprite.SetAlpha((float)(select ? 1 : 0));
}
public void ShowBoard(ulong roleID, string roleName)
{
bool flag = !base.IsVisible();
if (flag)
{
this.SetVisibleWithAnimation(true, null);
}
this.roleIDSendTo = roleID;
this.roleNameSendTo = roleName;
this.RefreshRoseOwnCount();
}
private void RefreshRoseOwnCount()
{
for (int i = 0; i < XFlowerSendView.SEND_FLOWER_TYPE_COUNT; i++)
{
int itemCount = XSingleton<UiUtility>.singleton.GetItemCount(XFastEnumIntEqualityComparer<ItemEnum>.ToInt(ItemEnum.FLOWER_RED_ROSE) + i);
string text = string.Format(XStringDefineProxy.GetString("FLOWER_SEND_OWN_COUNT"), itemCount);
this.ownCount[i].SetText(text);
}
}
private bool OnCloseClicked(IXUIButton button)
{
this.SetVisibleWithAnimation(false, null);
return true;
}
}
}
|