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
|
using System;
using UILib;
using UnityEngine;
using XUtliPoolLib;
namespace XMainClient.UI
{
internal class HolidayHandler : DlgHandlerBase
{
protected override string FileName
{
get
{
return "OperatingActivity/HolidayFrame";
}
}
private XOperatingActivityDocument doc;
private IXUILabel m_Tip1;
private IXUILabel m_Tip2;
private IXUIButton m_Enter;
private IXUITexture m_Bg;
private Transform m_AwardRoot;
private XUIPool m_ItemPool = new XUIPool(XSingleton<XGameUI>.singleton.m_uiTool);
private XLeftTimeCounter m_LeftTime;
protected override void Init()
{
base.Init();
this.doc = XDocuments.GetSpecificDocument<XOperatingActivityDocument>(XOperatingActivityDocument.uuID);
this.m_Tip1 = (base.PanelObject.transform.Find("Main/Tip1").GetComponent("XUILabel") as IXUILabel);
this.m_LeftTime = new XLeftTimeCounter(this.m_Tip1, true);
this.m_LeftTime.SetTimeFormat(0, 3, 4, false);
this.m_Tip2 = (base.PanelObject.transform.Find("Main/Tip2").GetComponent("XUILabel") as IXUILabel);
this.m_Enter = (base.PanelObject.transform.Find("Main/Btns/EnterBtn").GetComponent("XUIButton") as IXUIButton);
this.m_Bg = (base.PanelObject.transform.Find("Main/Bg").GetComponent("XUITexture") as IXUITexture);
this.m_AwardRoot = base.PanelObject.transform.Find("Main/Items");
GameObject gameObject = base.PanelObject.transform.Find("Main/Items/Item").gameObject;
this.m_ItemPool.SetupPool(this.m_AwardRoot.gameObject, gameObject, 7u, false);
}
protected override void OnShow()
{
base.OnShow();
this.doc.SendQueryHolidayData();
this.Refresh();
}
protected override void OnHide()
{
base.OnHide();
this.m_Bg.SetTexturePath("");
}
public override void RegisterEvent()
{
base.RegisterEvent();
this.m_Enter.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnEnterClicked));
}
public void Refresh()
{
bool flag = !base.IsVisible();
if (!flag)
{
bool flag2 = this.doc.GetFestivalLeftTime() == 0u;
if (flag2)
{
this.m_LeftTime.SetLeftTime(1E+07f, -1);
this.m_LeftTime.SetFormatString(XSingleton<XStringTable>.singleton.GetString("HOLIDAY_TIP3"));
}
else
{
this.m_LeftTime.SetLeftTime(this.doc.GetFestivalLeftTime(), -1);
this.m_LeftTime.SetFormatString(XSingleton<XStringTable>.singleton.GetString("HOLIDAY_TIP1"));
}
this.m_Tip2.SetText(string.Format(XSingleton<XStringTable>.singleton.GetString("HOLIDAY_TIP2"), this.doc.GetFestivalLeftCount()));
this.SetAwardsInfo();
this.SetBG();
}
}
private bool OnEnterClicked(IXUIButton btn)
{
this.doc.EnterHolidayLevel();
return true;
}
private void SetBG()
{
string festivalPicPath = this.doc.GetFestivalPicPath();
bool flag = string.IsNullOrEmpty(festivalPicPath);
if (!flag)
{
this.m_Bg.SetTexturePath(festivalPicPath);
}
}
private void SetAwardsInfo()
{
this.m_ItemPool.ReturnAll(false);
uint[] festivalRewardList = this.doc.GetFestivalRewardList();
bool flag = festivalRewardList == null;
if (!flag)
{
for (int i = 0; i < festivalRewardList.Length; i++)
{
GameObject gameObject = this.m_ItemPool.FetchGameObject(false);
gameObject.transform.parent = this.m_AwardRoot;
gameObject.name = i.ToString();
gameObject.transform.localScale = Vector3.one;
gameObject.transform.localPosition = new Vector3((float)(this.m_ItemPool.TplWidth * i), 0f, 0f);
IXUISprite ixuisprite = gameObject.transform.Find("Icon").GetComponent("XUISprite") as IXUISprite;
ixuisprite.ID = (ulong)festivalRewardList[i];
XSingleton<XItemDrawerMgr>.singleton.normalItemDrawer.DrawItem(gameObject, (int)festivalRewardList[i], 0, false);
ixuisprite.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(XSingleton<UiUtility>.singleton.OnItemClick));
}
}
}
public override void OnUpdate()
{
base.OnUpdate();
this.m_LeftTime.Update();
}
}
}
|