From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- Client/Assets/Scripts/XMainClient/XRole.cs | 213 +++++++++++++++++++++++++++++ 1 file changed, 213 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/XRole.cs (limited to 'Client/Assets/Scripts/XMainClient/XRole.cs') diff --git a/Client/Assets/Scripts/XMainClient/XRole.cs b/Client/Assets/Scripts/XMainClient/XRole.cs new file mode 100644 index 00000000..75687aec --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/XRole.cs @@ -0,0 +1,213 @@ +using System; +using KKSG; +using UnityEngine; +using XMainClient.UI; +using XMainClient.UI.UICommon; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XRole : XEntity + { + public uint BasicTypeID + { + get + { + return this._attr.BasicTypeID; + } + } + + public override uint SkillCasterTypeID + { + get + { + return base.IsTransform ? this._transformer.TypeID : ((base.Skill != null && base.Skill.IsSkillReplaced) ? base.Skill.ReplacedByTypeID : 0u); + } + } + + private Vector3 _capsule1 = Vector3.zero; + + private Vector3 _capsule2 = Vector3.zero; + + public static int RoleLayer = LayerMask.NameToLayer("Role"); + + public override bool Initilize(int flag) + { + this._eEntity_Type |= XEntity.EnitityType.Entity_Role; + this._layer = LayerMask.NameToLayer("Role"); + this._using_cc_move = false; + this._present = (XSingleton.singleton.CreateComponent(this, XPresentComponent.uuID) as XPresentComponent); + this._machine = (XSingleton.singleton.CreateComponent(this, XStateMachine.uuID) as XStateMachine); + bool flag2 = XSingleton.singleton.CurrentStage.Stage == EXStage.World; + if (flag2) + { + this._skill = (XSingleton.singleton.CreateComponent(this, XSkillComponent.uuID) as XSkillComponent); + XSingleton.singleton.CreateComponent(this, XEndureComponent.uuID); + } + this._net = (XSingleton.singleton.CreateComponent(this, XNetComponent.uuID) as XNetComponent); + this.AddMoveComponents(); + this._machine.SetDefaultState(base.GetXComponent(XIdleComponent.uuID) as XIdleComponent); + this._buff = (XSingleton.singleton.CreateComponent(this, XBuffComponent.uuID) as XBuffComponent); + bool flag3 = XSingleton.singleton.CurrentStage.Stage == EXStage.World; + if (flag3) + { + this._death = (XSingleton.singleton.CreateComponent(this, XDeathComponent.uuID) as XDeathComponent); + } + bool flag4 = XSingleton.singleton.SceneType == SceneType.SCENE_MOBA; + if (flag4) + { + XSingleton.singleton.CreateComponent(this, XMobaBillboardComponent.uuID); + } + else + { + this._billboard = (XSingleton.singleton.CreateComponent(this, XBillboardComponent.uuID) as XBillboardComponent); + } + XSingleton.singleton.CreateComponent(this, XCharacterShowChatComponent.uuID); + bool flag5 = XSingleton.singleton.SceneType == SceneType.SCENE_CASTLE_FIGHT || XSingleton.singleton.SceneType == SceneType.SCENE_CASTLE_WAIT; + if (flag5) + { + XSingleton.singleton.CreateComponent(this, XTerritoryComponent.uuID); + } + this._audio = (XSingleton.singleton.CreateComponent(this, XAudioComponent.uuID) as XAudioComponent); + bool flag6 = XSingleton.singleton.SceneType == SceneType.SCENE_ARENA; + if (flag6) + { + this._ai = (XSingleton.singleton.CreateComponent(this, XAIComponent.uuID) as XAIComponent); + } + bool flag7 = XSingleton.singleton.CurrentStage.Stage == EXStage.World; + if (flag7) + { + this._qte = (XSingleton.singleton.CreateComponent(this, XQuickTimeEventComponent.uuID) as XQuickTimeEventComponent); + } + bool flag8 = !XSingleton.singleton.SyncMode; + if (flag8) + { + XSingleton.singleton.CreateComponent(this, XManipulationComponent.uuID); + } + bool isNotEmptyObject = this._xobject.IsNotEmptyObject; + if (isNotEmptyObject) + { + this._equip = (XSingleton.singleton.CreateComponent(this, XEquipComponent.uuID) as XEquipComponent); + bool flag9 = this._equip != null; + if (flag9) + { + this._equip.IsUIAvatar = false; + } + bool flag10 = XSingleton.singleton.CurrentStage.Stage == EXStage.World && this.CastFakeShadow(); + if (flag10) + { + XSingleton.singleton.CreateComponent(this, XFootFxComponent.uuID); + } + } + return true; + } + + public override void OnCreated() + { + XRoleAttributes xroleAttributes = this._attr as XRoleAttributes; + bool flag = this._xobject.IsNotEmptyObject && xroleAttributes != null && !xroleAttributes.IsLocalFake; + if (flag) + { + this._render = XRenderComponent.AddRenderComponent(this); + XSingleton.singleton.CreateComponent(this, XShadowComponent.uuID); + } + bool flag2 = DlgBase.singleton.CanRenderOtherPalyers(); + bool flag3 = this._render != null; + if (flag3) + { + int entityLayer = flag2 ? this._layer : XQualitySetting.InVisiblityLayer; + this._render.SetEntityLayer(entityLayer); + this._render.PostCreateComponent(); + } + base.OnCreated(); + bool flag4 = !flag2; + if (flag4) + { + XBillboardShowCtrlEventArgs @event = XEventPool.GetEvent(); + @event.show = false; + @event.Firer = this; + @event.type = BillBoardHideType.Photo; + XSingleton.singleton.FireEvent(@event); + } + } + + public override void Died() + { + } + + public virtual void Revive() + { + this.Attributes.IsDead = false; + XOnRevivedArgs @event = XEventPool.GetEvent(); + @event.entity = this; + @event.Firer = this; + XSingleton.singleton.FireEvent(@event); + XOnRevivedArgs event2 = XEventPool.GetEvent(); + event2.entity = this; + event2.Firer = XSingleton.singleton.Doc; + XSingleton.singleton.FireEvent(event2); + } + + public override void PlaySpecifiedAnimation(string anim) + { + XSingleton.singleton.Idled(this); + base.OverrideAnimClip("Idle", anim, true, null, false); + base.Ator.CrossFade("Stand", 0.05f, 0, 0f); + } + + public float PlaySpecifiedAnimationGetLength(string anim) + { + XSingleton.singleton.Idled(this); + float result = base.OverrideAnimClipGetLength("Idle", anim, true); + base.Ator.CrossFade("Stand", 0.05f, 0, 0f); + return result; + } + + public void PlayStateBack() + { + XSingleton.singleton.Idled(this); + XPresentComponent xpresentComponent = base.IsTransform ? base.Transformer.Present : base.Present; + bool flag = xpresentComponent != null; + if (flag) + { + bool flag2 = XSingleton.singleton.CurrentStage.Stage == EXStage.World && !string.IsNullOrEmpty(xpresentComponent.PresentLib.AttackIdle); + if (flag2) + { + base.OverrideAnimClip("Idle", xpresentComponent.PresentLib.AttackIdle, true, false); + } + else + { + base.OverrideAnimClip("Idle", xpresentComponent.PresentLib.Idle, true, false); + } + } + } + + private void AddMoveComponents() + { + bool flag = XSingleton.singleton.CurrentStage.Stage == EXStage.Hall; + bool flag2 = !flag; + if (flag2) + { + this._behit = (XSingleton.singleton.CreateComponent(this, XBeHitComponent.uuID) as XBeHitComponent); + } + bool flag3 = !flag; + if (flag3) + { + XSingleton.singleton.CreateComponent(this, XFreezeComponent.uuID); + } + XSingleton.singleton.CreateComponent(this, XIdleComponent.uuID); + this._rotate = (XSingleton.singleton.CreateComponent(this, XRotationComponent.uuID) as XRotationComponent); + XSingleton.singleton.CreateComponent(this, XMoveComponent.uuID); + bool flag4 = !flag; + if (flag4) + { + XSingleton.singleton.CreateComponent(this, XChargeComponent.uuID); + } + } + + public override bool CastFakeShadow() + { + return XQualitySetting.GetQuality(EFun.ERoleShadow); + } + } +} -- cgit v1.1-26-g67d0