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
|
using System;
using KKSG;
using UnityEngine;
using XMainClient.UI;
using XUtliPoolLib;
namespace XMainClient
{
internal class XAffiliate : XEntity
{
public override string Prefab
{
get
{
return this._present.PresentLib.Prefab;
}
}
public override uint PresentID
{
get
{
return this._present_id;
}
}
public bool MirrorState
{
get
{
return this._mirror_state;
}
set
{
this._mirror_state = value;
}
}
private ulong _id = 0UL;
private uint _present_id;
private bool _mirror_state = true;
private XEntity _mainbody = null;
public static CommandCallback _changeSpriteMatColorCb = new CommandCallback(XAffiliate._ChangeSpriteMatColor);
public bool Initilize(XEntity mainbody, uint present_id)
{
this._eEntity_Type |= XEntity.EnitityType.Entity_Affiliate;
this._id = ((mainbody.ID & 1152921504606846975UL) | XAttributes.GetTypePrefix(EntitySpecies.Species_Affiliate));
this._mainbody = mainbody;
string prefab = XSingleton<XEntityMgr>.singleton.EntityInfo.GetByPresentID(present_id).Prefab;
this._xobject = XGameObject.CreateXGameObject("Prefabs/" + prefab, true, true);
this._xobject.UID = this._id;
this._xobject.Name = this._id.ToString();
this._present_id = present_id;
return this.Initilize(0);
}
public bool Initilize(XEntity mainbody, uint present_id, XGameObject go)
{
this._eEntity_Type |= XEntity.EnitityType.Entity_Affiliate;
this._id = ((mainbody.ID & 1152921504606846975UL) | XAttributes.GetTypePrefix(EntitySpecies.Species_Affiliate));
this._mainbody = mainbody;
this._xobject = go;
bool flag = this._xobject != null;
if (flag)
{
this._xobject.UID = this._id;
this._xobject.Name = this._id.ToString();
}
this._present_id = present_id;
return this.Initilize(0);
}
public override bool Initilize(int flag)
{
this._present = (XSingleton<XComponentMgr>.singleton.CreateComponent(this, XPresentComponent.uuID) as XPresentComponent);
this.InitAnim();
return true;
}
public void InitAnim()
{
base.Scale = base.Present.PresentLib.Scale;
bool flag = base.Ator != null;
if (flag)
{
bool flag2 = XSingleton<XGame>.singleton.CurrentStage.Stage == EXStage.World && !string.IsNullOrEmpty(base.Present.PresentLib.AttackIdle);
if (flag2)
{
base.OverrideAnimClip("Idle", base.Present.PresentLib.AttackIdle, true, false);
}
else
{
base.OverrideAnimClip("Idle", base.Present.PresentLib.Idle, true, false);
}
bool flag3 = XSingleton<XGame>.singleton.CurrentStage.Stage == EXStage.World && !string.IsNullOrEmpty(base.Present.PresentLib.AttackIdle);
if (flag3)
{
base.OverrideAnimClip("Walk", base.Present.PresentLib.AttackWalk, true, false);
base.OverrideAnimClip("Run", base.Present.PresentLib.AttackRun, true, false);
}
else
{
base.OverrideAnimClip("Walk", base.Present.PresentLib.Walk, true, false);
base.OverrideAnimClip("Run", base.Present.PresentLib.Run, true, false);
}
bool flag4 = XSingleton<XGame>.singleton.CurrentStage.Stage == EXStage.World;
if (flag4)
{
base.OverrideAnimClip("Death", base.Present.PresentLib.Death, true, false);
}
}
}
public void Presentation(string animation, string fx = null, string audio = null)
{
bool mirrorState = this.MirrorState;
if (!mirrorState)
{
base.OverrideAnimClip("Idle", animation, true, false);
}
}
public void OnMount()
{
bool mirrorState = this.MirrorState;
if (!mirrorState)
{
bool flag = XSingleton<XGame>.singleton.CurrentStage.Stage == EXStage.World && !string.IsNullOrEmpty(base.Present.PresentLib.AttackIdle);
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()
{
for (int i = 0; i < base.Components.Count; i++)
{
bool flag = base.Components[i] != null;
if (flag)
{
base.Components[i].Attached();
}
}
this._mainbody.Affiliates.Add(this);
}
public override void OnDestroy()
{
bool flag = this._xobject != null;
if (flag)
{
XRenderComponent.RemoveObj(this._mainbody, this._xobject.Get());
}
this._mainbody = null;
base.OnDestroy();
this.Uninitilize();
}
public void Replace(uint present_id, XGameObject go)
{
bool flag = go == this._xobject;
if (!flag)
{
bool flag2 = this._xobject != null;
if (flag2)
{
XRenderComponent.RemoveObj(this._mainbody, this._xobject.Get());
XGameObject.DestroyXGameObject(this._xobject);
}
this._xobject = go;
bool flag3 = this._xobject != null;
if (flag3)
{
this._xobject.UID = this._id;
this._xobject.Name = this._id.ToString();
}
this._present_id = present_id;
bool flag4 = this._present != null;
if (flag4)
{
this._present.InitPresent(this._present_id);
}
else
{
this._present = (XSingleton<XComponentMgr>.singleton.CreateComponent(this, XPresentComponent.uuID) as XPresentComponent);
}
this.InitAnim();
this._present.Attached();
}
}
private static void _ChangeSpriteMatColor(XGameObject gameObject, object o, int commandID)
{
SpriteTable.RowData rowData = o as SpriteTable.RowData;
bool flag = rowData == null;
if (!flag)
{
Color color = XSingleton<UiUtility>.singleton.StringToColor(rowData.Color);
Transform transform = gameObject.Find("");
bool flag2 = transform != null;
if (flag2)
{
XCommon.tmpRender.Clear();
transform.GetComponentsInChildren<Renderer>(XCommon.tmpRender);
int count = XCommon.tmpRender.Count;
for (int i = 0; i < count; i++)
{
Renderer renderer = XCommon.tmpRender[i];
Material material = renderer.material;
bool flag3 = material == null;
if (!flag3)
{
material.SetColor("_Color", color);
}
}
XCommon.tmpRender.Clear();
}
}
}
public void ChangeSpriteMatColor()
{
XSpriteSystemDocument specificDocument = XDocuments.GetSpecificDocument<XSpriteSystemDocument>(XSpriteSystemDocument.uuID);
SpriteTable.RowData byPresentID = specificDocument._SpriteTable.GetByPresentID(this._present_id);
bool flag = byPresentID != null;
if (flag)
{
this._xobject.CallCommand(XAffiliate._changeSpriteMatColorCb, byPresentID, -1, false);
}
}
}
}
|