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
|
using System;
using System.Collections.Generic;
using UILib;
using UnityEngine;
using XUtliPoolLib;
namespace XMainClient.UI
{
internal class NestStarRewardHandler : DlgHandlerBase
{
protected override string FileName
{
get
{
return "OperatingActivity/NestStarReward";
}
}
private IXUIButton m_Close;
private GameObject m_itemParentGo;
private XUIPool m_ItemPool1 = new XUIPool(XSingleton<XGameUI>.singleton.m_uiTool);
private XUIPool m_ItemPool2 = new XUIPool(XSingleton<XGameUI>.singleton.m_uiTool);
private XNestDocument m_doc;
protected override void Init()
{
base.Init();
this.m_Close = (base.transform.Find("Close").GetComponent("XUIButton") as IXUIButton);
this.m_itemParentGo = base.transform.Find("Panel/List").gameObject;
Transform transform = this.m_itemParentGo.transform.Find("Tpl");
this.m_ItemPool1.SetupPool(this.m_itemParentGo, transform.gameObject, 5u, false);
this.m_ItemPool2.SetupPool(transform.gameObject, this.m_itemParentGo.transform.Find("Item").gameObject, 4u, false);
this.m_doc = XDocuments.GetSpecificDocument<XNestDocument>(XNestDocument.uuID);
}
public override void RegisterEvent()
{
base.RegisterEvent();
this.m_Close.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnCloseClicked));
}
protected override void OnShow()
{
base.OnShow();
this.FillContent();
}
protected override void OnHide()
{
this.m_ItemPool1.ReturnAll(false);
this.m_ItemPool2.ReturnAll(false);
base.OnHide();
}
public override void StackRefresh()
{
base.StackRefresh();
}
public override void OnUnload()
{
this.m_ItemPool1.ReturnAll(false);
this.m_ItemPool2.ReturnAll(false);
base.OnUnload();
}
private void FillContent()
{
this.m_ItemPool1.ReturnAll(false);
this.m_ItemPool2.ReturnAll(false);
List<NestStarReward.RowData> nestStarRewards = this.m_doc.GetNestStarRewards(this.m_doc.NestType);
for (int i = 0; i < nestStarRewards.Count; i++)
{
NestStarReward.RowData rowData = nestStarRewards[i];
bool flag = rowData == null;
if (!flag)
{
GameObject gameObject = this.m_ItemPool1.FetchGameObject(false);
gameObject.transform.parent = this.m_itemParentGo.transform;
gameObject.name = i.ToString();
gameObject.transform.localScale = Vector3.one;
gameObject.transform.localPosition = new Vector3(0f, (float)(-(float)this.m_ItemPool1.TplHeight * i), 0f);
IXUILabel ixuilabel = gameObject.transform.Find("T").GetComponent("XUILabel") as IXUILabel;
ixuilabel.SetText(rowData.Tittle);
ixuilabel = (gameObject.transform.Find("ch").GetComponent("XUILabel") as IXUILabel);
ixuilabel.SetText(XStringDefineProxy.GetString("FirstPassPlayerTittle"));
ixuilabel.gameObject.SetActive(rowData.IsHadTittle == 1u);
ixuilabel = (gameObject.transform.Find("Image/Rank").GetComponent("XUILabel") as IXUILabel);
ixuilabel.SetText(rowData.Stars.ToString());
this.FillItem(rowData, gameObject);
}
}
}
private void FillItem(NestStarReward.RowData data, GameObject parentGo)
{
for (int i = 0; i < data.Reward.Count; i++)
{
GameObject gameObject = this.m_ItemPool2.FetchGameObject(false);
gameObject.transform.parent = parentGo.transform;
gameObject.transform.localScale = Vector3.one;
gameObject.transform.localPosition = new Vector3((float)(-170 + this.m_ItemPool2.TplWidth * i), -16f, 0f);
IXUISprite ixuisprite = gameObject.transform.Find("Icon").GetComponent("XUISprite") as IXUISprite;
ixuisprite.ID = (ulong)data.Reward[i, 0];
XSingleton<XItemDrawerMgr>.singleton.normalItemDrawer.DrawItem(gameObject, (int)data.Reward[i, 0], (int)data.Reward[i, 1], false);
ixuisprite.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(XSingleton<UiUtility>.singleton.OnItemClick));
}
}
public bool OnCloseClicked(IXUIButton sp)
{
base.SetVisible(false);
return true;
}
}
}
|