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/XBuffExclusive.cs | 81 ++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/Buff/XBuffExclusive.cs (limited to 'Client/Assets/Scripts/XMainClient/Buff/XBuffExclusive.cs') diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffExclusive.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffExclusive.cs new file mode 100644 index 00000000..9bbe0322 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffExclusive.cs @@ -0,0 +1,81 @@ +using System; +using System.Collections.Generic; +using XUtliPoolLib; + +namespace XMainClient +{ + internal struct XBuffExclusive + { + private HashSet _ClearTypes; + + private HashSet _SingleEffects; + + public void Set(BuffTable.RowData rowData) + { + bool flag = rowData == null; + if (!flag) + { + bool flag2 = rowData.ClearTypes != null && rowData.ClearTypes.Length != 0; + if (flag2) + { + this._ClearTypes = HashPool.Get(); + for (int i = 0; i < rowData.ClearTypes.Length; i++) + { + this._ClearTypes.Add(rowData.ClearTypes[i]); + } + } + bool flag3 = rowData.BuffState != null && rowData.BuffState.Length != 0; + if (flag3) + { + this._SingleEffects = HashPool.Get(); + for (int j = 0; j < rowData.BuffState.Length; j++) + { + XBuffType xbuffType = (XBuffType)rowData.BuffState[j]; + if (xbuffType == XBuffType.XBuffType_Transform || xbuffType == XBuffType.XBuffType_Scale) + { + this._SingleEffects.Add(rowData.BuffState[j]); + } + } + } + } + } + + public bool CanAdd(byte clearType) + { + bool flag = this._ClearTypes == null; + return flag || !this._ClearTypes.Contains(clearType); + } + + public bool IsSingleEffectConflict(XBuffExclusive other) + { + return XBuffExclusive._Overlaped(this._SingleEffects, other._SingleEffects); + } + + private static bool _Overlaped(HashSet left, HashSet right) + { + bool flag = left == null || right == null || left.Count == 0 || right.Count == 0; + return !flag && left.Overlaps(right); + } + + public bool ShouldClear(byte clearType) + { + return this.CanAdd(clearType); + } + + public void Destroy() + { + bool flag = this._ClearTypes != null; + if (flag) + { + HashPool.Release(this._ClearTypes); + this._ClearTypes = null; + } + bool flag2 = this._SingleEffects != null; + if (flag2) + { + HashPool.Release(this._SingleEffects); + this._SingleEffects = null; + } + } + } +} -- cgit v1.1-26-g67d0