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
|
using System;
using System.Collections.Generic;
using KKSG;
using UILib;
using UnityEngine;
using XMainClient.UI.UICommon;
using XUtliPoolLib;
namespace XMainClient.UI
{
internal class DanceMotionHandler : DlgHandlerBase
{
private IXUIList m_MotionList;
private XUIPool m_MotionPool;
private IXUISprite m_MotionPanelBg;
private GameObject m_MotionPanel;
private GameObject m_ConditionPanel;
private IXUIList m_ConditionList;
private XUIPool m_ConditionPool;
private IXUISprite m_ConditionPanelBg;
private List<DanceMotionData> m_listMotionData;
private GameObject m_LastSelect;
protected override void Init()
{
this.m_MotionPanel = base.PanelObject.transform.Find("MotionFrame").gameObject;
this.m_MotionPanelBg = (base.transform.Find("MotionFrame/Bg").GetComponent("XUISprite") as IXUISprite);
this.m_MotionList = (base.transform.Find("MotionFrame/MotionSV/MotionList").GetComponent("XUIList") as IXUIList);
GameObject gameObject = this.m_MotionList.gameObject.transform.Find("DanceTpl").gameObject;
this.m_MotionPool = new XUIPool(XSingleton<XGameUI>.singleton.m_uiTool);
this.m_MotionPool.SetupPool(this.m_MotionList.gameObject, gameObject, 3u, false);
this.m_MotionList.Refresh();
this.m_ConditionPanel = base.PanelObject.transform.Find("UnlockFrame").gameObject;
this.m_ConditionPanel.SetActive(false);
this.m_ConditionList = (base.transform.Find("UnlockFrame/Condition/ScrollView/ConditionList").GetComponent("XUIList") as IXUIList);
this.m_ConditionPanelBg = (base.PanelObject.transform.Find("UnlockFrame/Bg").GetComponent("XUISprite") as IXUISprite);
GameObject gameObject2 = this.m_ConditionList.gameObject.transform.Find("tpl").gameObject;
this.m_ConditionPool = new XUIPool(XSingleton<XGameUI>.singleton.m_uiTool);
this.m_ConditionPool.SetupPool(this.m_ConditionList.gameObject, gameObject2, 3u, false);
this.m_ConditionList.Refresh();
base.Init();
}
public override void RegisterEvent()
{
base.RegisterEvent();
this.m_MotionPanelBg.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnMotionPanelClicked));
this.m_ConditionPanelBg.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnConditionPanelClose));
}
protected override void OnShow()
{
base.OnShow();
Vector3 position = this.m_MotionPanel.transform.position;
position.y = DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.GetSelectDanceMotionBtnPos().y;
this.m_MotionPanel.transform.position = position;
position = this.m_ConditionPanel.transform.position;
position.y = DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.GetSelectDanceMotionBtnPos().y;
this.m_ConditionPanel.transform.position = position;
}
protected override void OnHide()
{
base.OnHide();
this.ShowUnlockPanel(false, 0u, 0u);
bool flag = this.m_LastSelect != null;
if (flag)
{
this.m_LastSelect.SetActive(false);
}
}
private void OnMotionPanelClicked(IXUISprite btn)
{
base.SetVisible(false);
}
private void OnConditionPanelClose(IXUISprite btn)
{
this.ShowUnlockPanel(false, 0u, 0u);
}
public void RefreshMotionPanel(List<DanceMotionData> listMotionData)
{
bool flag = !base.IsVisible() || !this.m_MotionPanel.activeSelf;
if (!flag)
{
this.m_listMotionData = listMotionData;
this.m_MotionPool.FakeReturnAll();
for (int i = 0; i < listMotionData.Count; i++)
{
DanceConfig.RowData danceConfig = XDanceDocument.GetDanceConfig(listMotionData[i].motionID);
GameObject gameObject = this.m_MotionPool.FetchGameObject(false);
gameObject.name = string.Format("DanceBtn{0}", i);
gameObject.transform.parent = this.m_MotionList.gameObject.transform;
IXUISprite ixuisprite = gameObject.transform.Find("Icon").GetComponent("XUISprite") as IXUISprite;
ixuisprite.SetSprite(danceConfig.HallBtnIcon, danceConfig.IconAtlas, false);
ixuisprite.MakePixelPerfect();
GameObject gameObject2 = gameObject.transform.Find("Lock").gameObject;
gameObject2.SetActive(!XDanceDocument.Doc.IsUnlock(listMotionData[i].valid, danceConfig.Condition));
IXUIButton ixuibutton = gameObject.transform.GetComponent("XUIButton") as IXUIButton;
ixuibutton.ID = (ulong)((long)i);
ixuibutton.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnDanceMotionBtnClicked));
GameObject gameObject3 = ixuibutton.gameObject.transform.Find("Select").gameObject;
gameObject3.SetActive(false);
}
this.m_MotionPool.ActualReturnAll(false);
this.m_MotionList.Refresh();
this.ShowUnlockPanel(false, 0u, 0u);
}
}
private bool OnDanceMotionBtnClicked(IXUIButton btn)
{
bool flag = this.m_LastSelect != null;
if (flag)
{
this.m_LastSelect.SetActive(false);
}
this.m_LastSelect = btn.gameObject.transform.Find("Select").gameObject;
this.m_LastSelect.SetActive(true);
int num = (int)btn.ID;
bool flag2 = this.m_listMotionData != null && num < this.m_listMotionData.Count;
if (flag2)
{
uint motionID = this.m_listMotionData[num].motionID;
GameObject gameObject = btn.gameObject.transform.Find("Lock").gameObject;
bool activeSelf = gameObject.activeSelf;
if (activeSelf)
{
this.ShowUnlockPanel(true, motionID, this.m_listMotionData[num].valid);
}
else
{
this.ShowUnlockPanel(false, 0u, 0u);
XDanceDocument.Doc.ReqStartJustDance(motionID);
}
}
return true;
}
private void ShowUnlockPanel(bool show, uint motionID = 0u, uint valid = 0u)
{
this.m_ConditionPanel.SetActive(show);
DanceConfig.RowData danceConfig = XDanceDocument.GetDanceConfig(motionID);
bool flag = show && danceConfig != null;
if (flag)
{
this.m_ConditionPool.FakeReturnAll();
for (int i = 0; i < danceConfig.Condition.Count; i++)
{
GameObject gameObject = this.m_ConditionPool.FetchGameObject(false);
gameObject.transform.parent = this.m_ConditionList.gameObject.transform;
IXUILabel ixuilabel = gameObject.transform.Find("condition1").GetComponent("XUILabel") as IXUILabel;
ixuilabel.SetText((i < danceConfig.ConditionDesc.Length) ? danceConfig.ConditionDesc[i] : "?");
IXUILabel ixuilabel2 = gameObject.transform.Find("Label").GetComponent("XUILabel") as IXUILabel;
ixuilabel2.SetText((i < danceConfig.GoText.Length) ? danceConfig.GoText[i] : "?");
ixuilabel2.ID = (ulong)((long)((i < danceConfig.GoSystemID.Length) ? danceConfig.GoSystemID[i] : 0));
ixuilabel2.RegisterLabelClickEventHandler(new LabelClickEventHandler(this.OnGoSystemBtnClicked));
ixuilabel2.SetVisible(!XDanceDocument.Doc.IsUnlock(valid, danceConfig.Condition[i, 0]));
GameObject gameObject2 = gameObject.transform.Find("ok").gameObject;
gameObject2.SetActive(XDanceDocument.Doc.IsUnlock(valid, danceConfig.Condition[i, 0]));
}
this.m_ConditionPool.ActualReturnAll(false);
this.m_ConditionList.Refresh();
}
}
private void OnGoSystemBtnClicked(IXUILabel label)
{
int sys = (int)label.ID;
bool flag = !XSingleton<XGameSysMgr>.singleton.IsSystemOpen(sys);
if (flag)
{
XSingleton<UiUtility>.singleton.ShowSystemTip(ErrorCode.ERR_SYS_NOTOPEN, "fece00");
}
else
{
XSingleton<XGameSysMgr>.singleton.OpenSystem(sys);
}
}
}
}
|