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
|
using System;
using System.Collections.Generic;
using UILib;
using UnityEngine;
using XMainClient.UI;
using XUtliPoolLib;
namespace XMainClient
{
internal class PointRewardHandler : DlgHandlerBase
{
protected override string FileName
{
get
{
return "GameSystem/PointRewardHandler";
}
}
private List<PointRewardData> m_Data;
public XSysDefine Sys;
public IXUIButton m_Close;
public XUIPool m_RewardPool = new XUIPool(XSingleton<XGameUI>.singleton.m_uiTool);
public XUIPool m_ItemPool = new XUIPool(XSingleton<XGameUI>.singleton.m_uiTool);
public IXUILabel m_CurrentText;
public IXUILabel m_CurrentPoint;
public IXUILabel m_BottomText;
public IXUILabel m_RightText;
public IXUILabel m_TitleText;
public IXUIScrollView m_ScrollView;
protected override void Init()
{
base.Init();
Transform transform = base.transform.Find("Bg");
this.m_Close = (transform.Find("Close").GetComponent("XUIButton") as IXUIButton);
this.m_CurrentText = (transform.Find("CurrentPoint").GetComponent("XUILabel") as IXUILabel);
this.m_CurrentPoint = (transform.Find("CurrentPoint/Text").GetComponent("XUILabel") as IXUILabel);
this.m_BottomText = (transform.Find("BottomText").GetComponent("XUILabel") as IXUILabel);
this.m_RightText = (transform.Find("RightText").GetComponent("XUILabel") as IXUILabel);
this.m_TitleText = (transform.Find("Title/Label").GetComponent("XUILabel") as IXUILabel);
this.m_ScrollView = (transform.Find("ScrollView").GetComponent("XUIScrollView") as IXUIScrollView);
this.m_RewardPool.SetupPool(null, transform.Find("ScrollView/RewardTpl").gameObject, 8u, false);
this.m_ItemPool.SetupPool(null, transform.Find("ScrollView/ItemTpl").gameObject, 5u, false);
}
public override void RegisterEvent()
{
base.RegisterEvent();
this.m_Close.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnCloseClicked));
}
public bool OnCloseClicked(IXUIButton btn)
{
base.SetVisible(false);
return true;
}
protected override void OnShow()
{
base.OnShow();
this.RefreshList(true);
this.RefreshText();
}
public override void OnUnload()
{
base.OnUnload();
}
public void SetData(List<PointRewardData> data, XSysDefine sys)
{
this.m_Data = data;
this.Sys = sys;
}
public void RefreshList(bool resetPos = true)
{
bool flag = this.m_Data == null;
if (!flag)
{
this.m_RewardPool.FakeReturnAll();
this.m_ItemPool.FakeReturnAll();
for (int i = 0; i < this.m_Data.Count; i++)
{
GameObject gameObject = this.m_RewardPool.FetchGameObject(false);
IXUILabel ixuilabel = gameObject.transform.Find("Bg/Point/Num").GetComponent("XUILabel") as IXUILabel;
ixuilabel.SetText(this.m_Data[i].point.ToString());
for (int j = 0; j < this.m_Data[i].rewardItem.size; j++)
{
GameObject gameObject2 = this.m_ItemPool.FetchGameObject(false);
XSingleton<XItemDrawerMgr>.singleton.normalItemDrawer.DrawItem(gameObject2, this.m_Data[i].rewardItem.BufferKeys[j], this.m_Data[i].rewardItem.BufferValues[j], false);
IXUISprite ixuisprite = gameObject2.transform.Find("Icon").GetComponent("XUISprite") as IXUISprite;
ixuisprite.ID = (ulong)((long)this.m_Data[i].rewardItem.BufferKeys[j]);
ixuisprite.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(XSingleton<UiUtility>.singleton.OnItemClick));
gameObject2.transform.parent = gameObject.transform;
gameObject2.transform.localPosition = new Vector3(this.m_ItemPool.TplPos.x - this.m_RewardPool.TplPos.x + (float)(this.m_ItemPool.TplWidth * j), 0f);
}
gameObject.transform.localPosition = new Vector3(0f, (float)(-(float)this.m_RewardPool.TplHeight * i)) + this.m_RewardPool.TplPos;
this.RefreshItemText(gameObject, this.m_Data[i]);
}
this.m_ItemPool.ActualReturnAll(false);
this.m_RewardPool.ActualReturnAll(false);
if (resetPos)
{
this.m_ScrollView.ResetPosition();
}
}
}
private void RefreshText()
{
this.m_RightText.gameObject.SetActive(false);
this.m_BottomText.gameObject.SetActive(false);
this.m_CurrentText.gameObject.SetActive(false);
this.m_TitleText.SetText(XStringDefineProxy.GetString("POINT_REWARD"));
XSysDefine sys = this.Sys;
if (sys != XSysDefine.XSys_BigMelee)
{
if (sys != XSysDefine.XSys_Battlefield)
{
if (sys == XSysDefine.XSys_MulActivity_SkyArena)
{
this.m_RightText.gameObject.SetActive(true);
this.m_RightText.SetText(XStringDefineProxy.GetString("POINT_REWARD_RIGHT_TIP"));
this.m_TitleText.SetText(XStringDefineProxy.GetString("PREVIEW_REWARD"));
}
}
else
{
this.m_RightText.gameObject.SetActive(true);
this.m_BottomText.gameObject.SetActive(true);
this.m_RightText.SetText(XStringDefineProxy.GetString("POINT_REWARD_RIGHT_TIP"));
this.m_BottomText.SetText(XStringDefineProxy.GetString("BATTLEFIELD_POINT_REWARD_BOTTOM_TIP"));
}
}
else
{
this.m_RightText.gameObject.SetActive(true);
this.m_BottomText.gameObject.SetActive(true);
this.m_RightText.SetText(XStringDefineProxy.GetString("POINT_REWARD_RIGHT_TIP"));
this.m_BottomText.SetText(XStringDefineProxy.GetString("BIG_MELEE_POINT_REWARD_BOTTOM_TIP"));
}
}
private void RefreshItemText(GameObject go, PointRewardData data)
{
IXUILabel ixuilabel = go.transform.Find("Bg/Count").GetComponent("XUILabel") as IXUILabel;
IXUILabel ixuilabel2 = go.transform.Find("Bg/Point").GetComponent("XUILabel") as IXUILabel;
ixuilabel.gameObject.SetActive(false);
ixuilabel2.SetText(XStringDefineProxy.GetString("POINT_REACH"));
XSysDefine sys = this.Sys;
if (sys != XSysDefine.XSys_Battlefield)
{
if (sys == XSysDefine.XSys_MulActivity_SkyArena)
{
ixuilabel2.SetText(XStringDefineProxy.GetString("FLOOR_REACH"));
}
}
else
{
ixuilabel.gameObject.SetActive(true);
uint pointRewardGetCount = XBattleFieldEntranceDocument.Doc.GetPointRewardGetCount(data.id);
BattleFieldPointReward.RowData curPointRewardList = XBattleFieldEntranceDocument.Doc.GetCurPointRewardList(data.id);
string arg = (curPointRewardList.count - pointRewardGetCount).ToString();
ixuilabel.SetText(string.Format("{0}/{1}", arg, curPointRewardList.count.ToString()));
}
}
}
}
|