From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../Assets/Scripts/XMainClient/Buff/XBuffClear.cs | 78 ++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/Buff/XBuffClear.cs (limited to 'Client/Assets/Scripts/XMainClient/Buff/XBuffClear.cs') diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffClear.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffClear.cs new file mode 100644 index 00000000..26f39e1a --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffClear.cs @@ -0,0 +1,78 @@ +using System; +using System.Collections.Generic; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XBuffClear : BuffEffect + { + private XEntity _entity; + + private HashSet m_Types; + + public static bool TryCreate(BuffTable.RowData rowData, XBuff buff) + { + bool flag = rowData.ClearTypes == null || rowData.ClearTypes.Length == 0; + bool result; + if (flag) + { + result = false; + } + else + { + buff.AddEffect(new XBuffClear(rowData.ClearTypes)); + result = true; + } + return result; + } + + public XBuffClear(byte[] _Types) + { + this.m_Types = new HashSet(); + bool flag = _Types != null; + if (flag) + { + for (int i = 0; i < _Types.Length; i++) + { + bool flag2 = _Types[i] == 0; + if (!flag2) + { + this.m_Types.Add((int)_Types[i]); + } + } + } + } + + public override void OnAdd(XEntity entity, CombatEffectHelper pEffectHelper) + { + this._entity = entity; + XBuffComponent xbuffComponent = entity.GetXComponent(XBuffComponent.uuID) as XBuffComponent; + bool flag = xbuffComponent == null; + if (!flag) + { + for (int i = 0; i < xbuffComponent.BuffList.Count; i++) + { + XBuff xbuff = xbuffComponent.BuffList[i]; + bool flag2 = xbuff.Valid && this.m_Types.Contains((int)xbuff.ClearType); + if (flag2) + { + XBuffRemoveEventArgs @event = XEventPool.GetEvent(); + @event.xBuffID = xbuff.ID; + @event.Firer = entity; + XSingleton.singleton.FireEvent(@event); + } + } + } + } + + public override void OnRemove(XEntity entity, bool IsReplaced) + { + } + + public override bool CanBuffAdd(int clearType) + { + bool flag = this.m_Types.Contains(clearType); + return !flag; + } + } +} -- cgit v1.1-26-g67d0