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
|
using System;
using UILib;
using XMainClient.UI.UICommon;
using XUpdater;
using XUtliPoolLib;
namespace XMainClient.UI
{
internal class BattleDramaDlg : DlgBase<BattleDramaDlg, BattleDramaDlgBehaviour>
{
public override string fileName
{
get
{
return "Battle/BattleDramaDlg";
}
}
public override int layer
{
get
{
return 1;
}
}
public override bool exclusive
{
get
{
return true;
}
}
public override bool autoload
{
get
{
return true;
}
}
private string leftTalker = "";
private string rightTalker = "";
private XDummy m_rightDummy;
private XDummy m_leftDummy;
private uint _close_timer = 0u;
public override void RegisterEvent()
{
IXUISprite ixuisprite = base.uiBehaviour.m_TaskArea.GetComponent("XUISprite") as IXUISprite;
ixuisprite.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.GotoNextTalk));
}
protected override void OnShow()
{
base.OnShow();
base.Alloc3DAvatarPool("BattleDramaDlg");
XSingleton<XLevelAIMgr>.singleton.EnableAllAI(false);
bool autoPlayOn = XSingleton<XEntityMgr>.singleton.Player.PlayerAttributes.AutoPlayOn;
if (autoPlayOn)
{
float interval = float.Parse(XSingleton<XGlobalConfig>.singleton.GetValue("CloseDramaDlgTime"));
this._close_timer = XSingleton<XTimerMgr>.singleton.SetTimer(interval, new XTimerMgr.ElapsedEventHandler(this.AutoClose), null);
}
}
protected override void OnHide()
{
base.OnHide();
XSingleton<X3DAvatarMgr>.singleton.ClearDummy(this.m_dummPool);
XSingleton<XTutorialHelper>.singleton.BattleNPCTalkEnd = true;
XSingleton<XLevelAIMgr>.singleton.EnableAllAI(true);
this.leftTalker = "";
this.rightTalker = "";
XSingleton<X3DAvatarMgr>.singleton.EnableMainDummy(false, null);
bool flag = base.uiBehaviour.m_rightSnapshot != null;
if (flag)
{
base.uiBehaviour.m_rightSnapshot.RefreshRenderQueue = null;
}
bool flag2 = base.uiBehaviour.m_leftSnapshot != null;
if (flag2)
{
base.uiBehaviour.m_leftSnapshot.RefreshRenderQueue = null;
}
this.m_leftDummy = null;
this.m_rightDummy = null;
bool flag3 = this._close_timer > 0u;
if (flag3)
{
XSingleton<XTimerMgr>.singleton.KillTimer(this._close_timer);
this._close_timer = 0u;
}
}
protected override void OnUnload()
{
XSingleton<XShell>.singleton.Pause = false;
this.leftTalker = "";
this.rightTalker = "";
base.Return3DAvatarPool();
this.m_leftDummy = null;
this.m_rightDummy = null;
base.OnUnload();
}
private void AutoClose(object obj)
{
bool flag = base.IsVisible();
if (flag)
{
this.GotoNextTalk(null);
this._close_timer = XSingleton<XTimerMgr>.singleton.SetTimer(0.5f, new XTimerMgr.ElapsedEventHandler(this.AutoClose), null);
}
}
protected void GotoNextTalk(IXUISprite sp)
{
XSingleton<XLevelScriptMgr>.singleton.ExecuteNextCmd();
}
public void SetRightAvatar(string talker, string content, string voice)
{
bool onReconnect = XSingleton<XClientNetwork>.singleton.XConnect.OnReconnect;
if (!onReconnect)
{
XSingleton<XVirtualTab>.singleton.Cancel();
bool flag = DlgBase<BattleMain, BattleMainBehaviour>.singleton.IsLoaded();
if (flag)
{
DlgBase<BattleMain, BattleMainBehaviour>.singleton.SkillHandler.ResetPressState();
}
this.SetVisible(true, true);
base.uiBehaviour.m_RightText.gameObject.SetActive(true);
base.uiBehaviour.m_name.gameObject.SetActive(true);
base.uiBehaviour.m_LeftText.gameObject.SetActive(false);
base.uiBehaviour.m_rightSnapshot.transform.localPosition = base.uiBehaviour.m_rightDummyPos;
base.uiBehaviour.m_leftSnapshot.transform.localPosition = XGameUI.Far_Far_Away;
string text = "";
bool flag2 = talker == "[player]";
if (flag2)
{
XSingleton<X3DAvatarMgr>.singleton.EnableMainDummy(false, null);
XSingleton<X3DAvatarMgr>.singleton.EnableMainDummy(true, base.uiBehaviour.m_rightSnapshot);
XEntityPresentation.RowData byPresentID = XSingleton<XEntityMgr>.singleton.EntityInfo.GetByPresentID(XSingleton<XAttributeMgr>.singleton.XPlayerData.PresentID);
bool flag3 = byPresentID != null && byPresentID.AvatarPos != null;
if (flag3)
{
int num = XSingleton<XCommon>.singleton.RandomInt(0, byPresentID.AvatarPos.Length);
XSingleton<X3DAvatarMgr>.singleton.SetMainAnimation(byPresentID.AvatarPos[num]);
}
}
else
{
uint key = uint.Parse(talker);
XNpcInfo.RowData byNPCID = XSingleton<XEntityMgr>.singleton.NpcInfo.GetByNPCID(key);
text = byNPCID.Name;
this.m_rightDummy = XSingleton<X3DAvatarMgr>.singleton.CreateCommonEntityDummy(this.m_dummPool, byNPCID.PresentID, base.uiBehaviour.m_rightSnapshot, this.m_rightDummy, 1f);
XEntityPresentation.RowData byPresentID2 = XSingleton<XEntityMgr>.singleton.EntityInfo.GetByPresentID(byNPCID.PresentID);
bool flag4 = byPresentID2 != null && byPresentID2.AvatarPos != null;
if (flag4)
{
int num2 = XSingleton<XCommon>.singleton.RandomInt(0, byPresentID2.AvatarPos.Length);
this.m_rightDummy.SetAnimation(byPresentID2.AvatarPos[num2]);
}
}
base.uiBehaviour.m_name.SetText(text);
base.uiBehaviour.m_RightText.SetText(content);
bool flag5 = !string.IsNullOrEmpty(voice);
if (flag5)
{
XSingleton<XAudioMgr>.singleton.PlayUISound(this.GetProfVoice(voice), true, AudioChannel.Action);
}
this.rightTalker = talker;
}
}
public void SetLeftAvatar(string talker, string content, string voice)
{
bool onReconnect = XSingleton<XClientNetwork>.singleton.XConnect.OnReconnect;
if (!onReconnect)
{
XSingleton<XVirtualTab>.singleton.Cancel();
bool flag = DlgBase<BattleMain, BattleMainBehaviour>.singleton.IsLoaded();
if (flag)
{
DlgBase<BattleMain, BattleMainBehaviour>.singleton.SkillHandler.ResetPressState();
}
this.SetVisible(true, true);
base.uiBehaviour.m_RightText.gameObject.SetActive(false);
base.uiBehaviour.m_name.gameObject.SetActive(false);
base.uiBehaviour.m_LeftText.gameObject.SetActive(true);
base.uiBehaviour.m_rightSnapshot.transform.localPosition = XGameUI.Far_Far_Away;
base.uiBehaviour.m_leftSnapshot.transform.localPosition = base.uiBehaviour.m_leftDummyPos;
string text = "";
bool flag2 = talker == "[player]";
if (flag2)
{
XSingleton<X3DAvatarMgr>.singleton.EnableMainDummy(false, null);
XSingleton<X3DAvatarMgr>.singleton.EnableMainDummy(true, base.uiBehaviour.m_leftSnapshot);
XEntityPresentation.RowData byPresentID = XSingleton<XEntityMgr>.singleton.EntityInfo.GetByPresentID(XSingleton<XAttributeMgr>.singleton.XPlayerData.PresentID);
bool flag3 = byPresentID != null && byPresentID.AvatarPos != null;
if (flag3)
{
int num = XSingleton<XCommon>.singleton.RandomInt(0, byPresentID.AvatarPos.Length);
XSingleton<X3DAvatarMgr>.singleton.SetMainAnimation(byPresentID.AvatarPos[num]);
}
}
else
{
uint key = uint.Parse(talker);
XNpcInfo.RowData byNPCID = XSingleton<XEntityMgr>.singleton.NpcInfo.GetByNPCID(key);
text = byNPCID.Name;
this.m_leftDummy = XSingleton<X3DAvatarMgr>.singleton.CreateCommonEntityDummy(this.m_dummPool, byNPCID.PresentID, base.uiBehaviour.m_leftSnapshot, this.m_leftDummy, 1f);
XEntityPresentation.RowData byPresentID2 = XSingleton<XEntityMgr>.singleton.EntityInfo.GetByPresentID(byNPCID.PresentID);
bool flag4 = byPresentID2 != null && byPresentID2.AvatarPos != null;
if (flag4)
{
int num2 = XSingleton<XCommon>.singleton.RandomInt(0, byPresentID2.AvatarPos.Length);
this.m_leftDummy.SetAnimation(byPresentID2.AvatarPos[num2]);
}
}
base.uiBehaviour.m_name.SetText(text);
base.uiBehaviour.m_LeftText.SetText(content);
bool flag5 = !string.IsNullOrEmpty(voice);
if (flag5)
{
XSingleton<XAudioMgr>.singleton.PlayUISound(this.GetProfVoice(voice), true, AudioChannel.Action);
}
this.leftTalker = talker;
}
}
protected string GetProfVoice(string voice)
{
string[] array = voice.Split(new char[]
{
'|'
});
uint basicTypeID = XSingleton<XAttributeMgr>.singleton.XPlayerData.BasicTypeID;
bool flag = (ulong)basicTypeID <= (ulong)((long)array.Length);
string result;
if (flag)
{
result = array[(int)(basicTypeID - 1u)];
}
else
{
result = array[0];
}
return result;
}
}
}
|