From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../Scripts/XUtliPoolLib/XRedpointForbidMgr.cs | 104 +++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 Client/Assets/Scripts/XUtliPoolLib/XRedpointForbidMgr.cs (limited to 'Client/Assets/Scripts/XUtliPoolLib/XRedpointForbidMgr.cs') diff --git a/Client/Assets/Scripts/XUtliPoolLib/XRedpointForbidMgr.cs b/Client/Assets/Scripts/XUtliPoolLib/XRedpointForbidMgr.cs new file mode 100644 index 00000000..0bca720e --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/XRedpointForbidMgr.cs @@ -0,0 +1,104 @@ +using System; +using System.Collections.Generic; + +namespace XUtliPoolLib +{ + public abstract class XRedpointForbidMgr : XRedpointRelationMgr, IXRedpointForbidMgr + { + protected HashSet mForbidHashSet = new HashSet(); + + public void AddForbid(int sys, bool bImmUpdateUI = true) + { + bool flag = this.mForbidHashSet.Add(sys); + if (flag) + { + if (bImmUpdateUI) + { + this._RefreshSysRedpointUI(sys, base._GetSysRedpointState(sys)); + } + else + { + this.mDirtySysList.Add(sys); + } + } + } + + public void AddForbids(int[] systems, bool bImmUpdateUI = true) + { + bool flag = systems == null || systems.Length == 0; + if (!flag) + { + for (int i = 0; i < systems.Length; i++) + { + bool flag2 = this.mForbidHashSet.Add(systems[i]); + if (flag2) + { + if (bImmUpdateUI) + { + this._RefreshSysRedpointUI(systems[i], base._GetSysRedpointState(systems[i])); + } + else + { + this.mDirtySysList.Add(systems[i]); + } + } + } + } + } + + public void RemoveForbid(int sys, bool bImmUpdateUI = true) + { + bool flag = this.mForbidHashSet.Remove(sys); + if (flag) + { + if (bImmUpdateUI) + { + this._RefreshSysRedpointUI(sys, base._GetSysRedpointState(sys)); + } + else + { + this.mDirtySysList.Add(sys); + } + } + } + + public void RemoveForbids(int[] systems, bool bImmUpdateUI = true) + { + bool flag = systems == null || systems.Length == 0; + if (!flag) + { + for (int i = 0; i < systems.Length; i++) + { + bool flag2 = this.mForbidHashSet.Remove(systems[i]); + if (flag2) + { + if (bImmUpdateUI) + { + this._RefreshSysRedpointUI(systems[i], base._GetSysRedpointState(systems[i])); + } + else + { + this.mDirtySysList.Add(systems[i]); + } + } + } + } + } + + public void ClearForbids(bool bImmUpdateUI = true) + { + foreach (int num in this.mForbidHashSet) + { + if (bImmUpdateUI) + { + this._RefreshSysRedpointUI(num, base._GetSysRedpointState(num)); + } + else + { + this.mDirtySysList.Add(num); + } + } + this.mForbidHashSet.Clear(); + } + } +} -- cgit v1.1-26-g67d0