From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../Scripts/XMainClient/Buff/XBuffManipulate.cs | 73 ++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/Buff/XBuffManipulate.cs (limited to 'Client/Assets/Scripts/XMainClient/Buff/XBuffManipulate.cs') diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffManipulate.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffManipulate.cs new file mode 100644 index 00000000..dc3028d1 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffManipulate.cs @@ -0,0 +1,73 @@ +using System; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XBuffManipulate : BuffEffect + { + private XEntity _entity; + + private XBuff _Buff; + + private long _Token; + + public static bool TryCreate(BuffTable.RowData rowData, XBuff buff) + { + bool flag = rowData.Manipulate == null || rowData.Manipulate.Length == 0; + bool result; + if (flag) + { + result = false; + } + else + { + buff.AddEffect(new XBuffManipulate(buff)); + result = true; + } + return result; + } + + public XBuffManipulate(XBuff buff) + { + this._Buff = buff; + } + + private float _GetParam(int index) + { + bool flag = this._Buff.BuffInfo.Manipulate == null || this._Buff.BuffInfo.Manipulate.Length <= index; + float result; + if (flag) + { + result = 0f; + } + else + { + result = this._Buff.BuffInfo.Manipulate[index]; + } + return result; + } + + public override void OnAdd(XEntity entity, CombatEffectHelper pEffectHelper) + { + this._entity = entity; + XManipulationData xmanipulationData = new XManipulationData(); + xmanipulationData.Degree = 360f; + xmanipulationData.Force = this._GetParam(0); + xmanipulationData.Radius = this._GetParam(1); + xmanipulationData.TargetIsOpponent = ((int)this._GetParam(2) == 0); + XManipulationOnEventArgs @event = XEventPool.GetEvent(); + @event.data = xmanipulationData; + @event.Firer = this._entity; + this._Token = @event.Token; + XSingleton.singleton.FireEvent(@event); + } + + public override void OnRemove(XEntity entity, bool IsReplaced) + { + XManipulationOffEventArgs @event = XEventPool.GetEvent(); + @event.DenyToken = this._Token; + @event.Firer = entity; + XSingleton.singleton.FireEvent(@event); + } + } +} -- cgit v1.1-26-g67d0