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
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
|
using System;
using KKSG;
using UILib;
using UnityEngine;
using XUtliPoolLib;
namespace XMainClient
{
internal sealed class XDummy : XEntity, IXDummy
{
public bool AutoAdded
{
get
{
return this._autoAdd;
}
}
public XShowUpComponent Show
{
get
{
return this._show;
}
}
public ulong RefID { get; set; }
public float DefaultRotation
{
get
{
return this._defaultRotation;
}
}
public XOutlookData OutlookData
{
get
{
return this._data;
}
}
public bool IsUI
{
get
{
return this.isUI;
}
}
public bool IsEnableUIRim
{
get
{
return this.enableUIRim;
}
set
{
bool flag = this.enableUIRim != value;
if (flag)
{
this.enableUIRim = value;
bool flag2 = this.enableUIRim;
if (flag2)
{
XDummy.visibleDummyCount++;
}
else
{
XDummy.visibleDummyCount--;
}
bool flag3 = XDummy.visibleDummyCount > 0;
if (flag3)
{
Shader.SetGlobalFloat("uirim", 1f);
}
else
{
Shader.SetGlobalFloat("uirim", 0f);
}
}
}
}
public override uint PresentID
{
get
{
return this._present_id;
}
}
public override uint TypeID
{
get
{
return this._type_id;
}
}
public override ulong ID
{
get
{
return this._id;
}
}
private ulong _id = 0UL;
private uint _present_id;
private uint _type_id;
private int srcLayer = -1;
private bool isUI = false;
private int renderQueue = -1;
private bool enableUIRim = false;
private XShowUpComponent _show = null;
private bool _demonstration;
private bool _autoAdd;
private bool _mainDummy = false;
private XOutlookData _data = null;
public static int visibleDummyCount = 0;
private static CommandCallback _setLayerCb = new CommandCallback(XDummy._SetLayer);
private static CommandCallback _setRenderQueueCb = new CommandCallback(XDummy._SetRenderQueue);
private float _defaultRotation;
public bool Initilize(uint type_id, Vector3 position, Quaternion rotation)
{
this._eEntity_Type |= XEntity.EnitityType.Entity_Dummy;
this._id = (ulong)(((long)XSingleton<XCommon>.singleton.New_id & 1152921504606846975L) | (long)XAttributes.GetTypePrefix(EntitySpecies.Species_Dummy));
XEntityStatistics.RowData byID = XSingleton<XEntityMgr>.singleton.EntityStatistics.GetByID(type_id);
XEntityPresentation.RowData byPresentID = XSingleton<XEntityMgr>.singleton.EntityInfo.GetByPresentID(byID.PresentID);
string value = XSingleton<XGlobalConfig>.singleton.PreFilterPrefab(byPresentID.Prefab);
bool flag = string.IsNullOrEmpty(value);
if (flag)
{
this._xobject = XGameObject.CreateXGameObject("", position, rotation, true, true);
}
else
{
this._xobject = XGameObject.CreateXGameObject("Prefabs/" + byPresentID.Prefab, position, rotation, true, true);
}
this._xobject.UID = this._id;
this._xobject.Name = this._id.ToString();
this._present_id = byID.PresentID;
this._type_id = type_id;
this._data = null;
this._demonstration = false;
this._autoAdd = false;
return this.Initilize(0);
}
public bool Initilize(uint present_id, uint type_id, XOutlookData outlookData, bool autoAdd, bool demonstration, bool asyncLoad)
{
this._eEntity_Type |= XEntity.EnitityType.Entity_Dummy;
this._id = (ulong)(((long)XSingleton<XCommon>.singleton.New_id & 1152921504606846975L) | (long)XAttributes.GetTypePrefix(EntitySpecies.Species_Dummy));
XEntityPresentation.RowData byPresentID = XSingleton<XEntityMgr>.singleton.EntityInfo.GetByPresentID(present_id);
this._defaultRotation = byPresentID.UIAvatarAngle;
string value = XSingleton<XGlobalConfig>.singleton.PreFilterPrefab(byPresentID.Prefab);
bool flag = string.IsNullOrEmpty(value);
if (flag)
{
this._xobject = XGameObject.CreateXGameObject("", asyncLoad, true);
}
else
{
this._xobject = XGameObject.CreateXGameObject("Prefabs/" + byPresentID.Prefab, asyncLoad, true);
}
this._xobject.UID = this._id;
this._xobject.Name = this._id.ToString();
this._present_id = present_id;
this._type_id = type_id;
this._data = outlookData;
bool flag2 = this._data != null;
if (flag2)
{
this._mainDummy = this._data.isMainDummy;
this._data.SetProfType(this._type_id);
}
this._demonstration = demonstration;
this._autoAdd = autoAdd;
base.Scale = 1f;
return this.Initilize(0);
}
public override bool Initilize(int flag)
{
this._present = (XSingleton<XComponentMgr>.singleton.CreateComponent(this, XPresentComponent.uuID) as XPresentComponent);
bool demonstration = this._demonstration;
if (demonstration)
{
this._machine = (XSingleton<XComponentMgr>.singleton.CreateComponent(this, XStateMachine.uuID) as XStateMachine);
this._machine.SetDefaultState(XSingleton<XComponentMgr>.singleton.CreateComponent(this, XIdleComponent.uuID) as XIdleComponent);
this._skill = (XSingleton<XComponentMgr>.singleton.CreateComponent(this, XSkillComponent.uuID) as XSkillComponent);
this._show = (XSingleton<XComponentMgr>.singleton.CreateComponent(this, XShowUpComponent.uuID) as XShowUpComponent);
this._buff = (XSingleton<XComponentMgr>.singleton.CreateComponent(this, XBuffComponent.uuID) as XBuffComponent);
XSingleton<XComponentMgr>.singleton.CreateComponent(this, XChargeComponent.uuID);
}
bool flag2 = this._data != null;
if (flag2)
{
this._equip = (XSingleton<XComponentMgr>.singleton.CreateComponent(this, XEquipComponent.uuID) as XEquipComponent);
}
this.ResetAnimation();
this._xobject.Ator.cullingMode = 0;
this._audio = (XSingleton<XComponentMgr>.singleton.CreateComponent(this, XAudioComponent.uuID) as XAudioComponent);
this._xobject.EnableCC = false;
return true;
}
public void SetAnimation(string anim)
{
base.OverrideAnimClip("Idle", anim, true, false);
}
public float SetAnimationGetLength(string anim)
{
return base.OverrideAnimClipGetLength("Idle", anim, true);
}
public void PlaySpecifiedState(string state = "Stand")
{
base.Ator.CrossFade(state, 0.05f, 0, 0f);
}
public void ResetAnimation()
{
bool flag = XSingleton<XGame>.singleton.CurrentStage.Stage == EXStage.World && base.Present.PresentLib.AttackIdle.Length > 0;
if (flag)
{
base.OverrideAnimClip("Idle", base.Present.PresentLib.AttackIdle, true, false);
}
else
{
base.OverrideAnimClip("Idle", base.Present.PresentLib.Idle, true, false);
}
}
public override void OnCreated()
{
XSingleton<XEntityMgr>.singleton.Puppets(this, false, false);
for (int i = 0; i < base.Components.Count; i++)
{
bool flag = base.Components[i] != null;
if (flag)
{
base.Components[i].Attached();
}
}
this._layer = 19;
base.SetCollisionLayer(this._layer);
bool flag2 = this._equip != null;
if (flag2)
{
this._equip.IsUIAvatar = this._data.uiAvatar;
this._equip.SetEnhanceMaster(this._data.enhanceMasterLevel);
this._equip.SetSuitFx(this._data.suitEffectID);
this._equip.EquipFromVisibleList(this._data.OutlookList, this._data.hairColorID, this._data.suitEffectID);
this._equip.SpriteFromData(this._data.sprite);
}
this._data = null;
XSingleton<XEntityMgr>.singleton.Puppets(this, false, false);
}
public override void OnDestroy()
{
base.OnDestroy();
bool flag = !this._autoAdd;
if (flag)
{
this.Uninitilize();
}
}
protected sealed override void Move()
{
base.MoveObj.Position += this._movement;
this._movement = Vector3.zero;
}
private static void _SetLayer(XGameObject gameObject, object o, int commandID)
{
XDummy xdummy = o as XDummy;
bool flag = xdummy != null && gameObject != null;
if (flag)
{
bool flag2 = xdummy.srcLayer < 0;
if (!flag2)
{
Transform transform = gameObject.Find("");
bool flag3 = transform != null;
if (flag3)
{
XCommon.tmpRender.Clear();
transform.GetComponentsInChildren<Renderer>(true, XCommon.tmpRender);
int count = XCommon.tmpRender.Count;
for (int i = 0; i < count; i++)
{
Renderer renderer = XCommon.tmpRender[i];
renderer.gameObject.layer = xdummy.srcLayer;
}
XCommon.tmpRender.Clear();
}
}
}
}
private static void _SetRenderQueue(XGameObject gameObject, object o, int commandID)
{
XDummy xdummy = o as XDummy;
bool flag = xdummy != null && gameObject != null;
if (flag)
{
Transform transform = gameObject.Find("");
bool flag2 = transform != null;
if (flag2)
{
transform.GetComponentsInChildren<Renderer>(XCommon.tmpRender);
int count = XCommon.tmpRender.Count;
for (int i = 0; i < count; i++)
{
Renderer renderer = XCommon.tmpRender[i];
bool flag3 = renderer.CompareTag("BindedRes") || renderer.CompareTag("Mount_BindedRes");
if (flag3)
{
int j = 0;
int num = renderer.materials.Length;
while (j < num)
{
renderer.materials[j].renderQueue = xdummy.renderQueue;
j++;
}
}
}
XCommon.tmpRender.Clear();
}
}
}
public void SetupUIDummy(bool ui)
{
this.isUI = ui;
this.srcLayer = (this.isUI ? XQualitySetting.UILayer : this._xobject.Layer);
bool flag = this._equip != null;
if (flag)
{
this._equip.IsUIAvatar = ui;
}
else
{
bool flag2 = this._xobject != null;
if (flag2)
{
this._xobject.CallCommand(XDummy._setLayerCb, this, -1, false);
}
}
}
public void SetupRenderQueue(IUIDummy uiDummy)
{
bool flag = uiDummy != null;
if (flag)
{
uiDummy.Reset();
uiDummy.RefreshRenderQueue = new RefreshRenderQueueCb(this.RenderQueueCb);
}
}
private void RenderQueueCb(int rq)
{
bool flag = this.renderQueue != rq;
if (flag)
{
this.renderQueue = rq;
bool flag2 = this._equip != null;
if (flag2)
{
this._equip.SetRenderQueue(this.renderQueue);
}
else
{
bool flag3 = this._xobject != null;
if (flag3)
{
this._xobject.CallCommand(XDummy._setRenderQueueCb, this, -1, false);
}
}
}
}
public bool IsMainDummy()
{
return this._mainDummy;
}
public void SetOutlook(XOutlookData outlookData)
{
bool flag = this._equip != null && outlookData != null;
if (flag)
{
this._equip.IsUIAvatar = outlookData.uiAvatar;
this._equip.SetEnhanceMaster(outlookData.enhanceMasterLevel);
this._equip.SetSuitFx(outlookData.suitEffectID);
this._equip.EquipFromVisibleList(outlookData.OutlookList, outlookData.hairColorID, outlookData.suitEffectID);
this._equip.SpriteFromData(outlookData.sprite);
}
}
}
}
|