summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XUtliPoolLib/XRedpointExMgr.cs
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2021-01-25 14:28:30 +0800
committerchai <chaifix@163.com>2021-01-25 14:28:30 +0800
commit6eb915c129fc90c6f4c82ae097dd6ffad5239efc (patch)
tree7dd2be50edf41f36b60fac84696e731c13afe617 /Client/Assets/Scripts/XUtliPoolLib/XRedpointExMgr.cs
+scripts
Diffstat (limited to 'Client/Assets/Scripts/XUtliPoolLib/XRedpointExMgr.cs')
-rw-r--r--Client/Assets/Scripts/XUtliPoolLib/XRedpointExMgr.cs100
1 files changed, 100 insertions, 0 deletions
diff --git a/Client/Assets/Scripts/XUtliPoolLib/XRedpointExMgr.cs b/Client/Assets/Scripts/XUtliPoolLib/XRedpointExMgr.cs
new file mode 100644
index 00000000..086ff966
--- /dev/null
+++ b/Client/Assets/Scripts/XUtliPoolLib/XRedpointExMgr.cs
@@ -0,0 +1,100 @@
+using System;
+using System.Collections.Generic;
+
+namespace XUtliPoolLib
+{
+ public class XRedpointExMgr : XRedpointMgr, IXRedpointExMgr, IXRedpointMgr, IXRedpointRelationMgr, IXRedpointForbidMgr
+ {
+ protected uint mCurrentLevel;
+
+ protected Dictionary<int, HashSet<uint>> mSysForbidLevelsDic = new Dictionary<int, HashSet<uint>>();
+
+ public void AddSysForbidLevels(int sys, uint level)
+ {
+ HashSet<uint> hashSet = null;
+ bool flag = !this.mSysForbidLevelsDic.TryGetValue(sys, out hashSet);
+ if (flag)
+ {
+ hashSet = new HashSet<uint>();
+ this.mSysForbidLevelsDic[sys] = hashSet;
+ }
+ bool flag2 = hashSet.Add(level);
+ if (flag2)
+ {
+ bool flag3 = this.mCurrentLevel == level;
+ if (flag3)
+ {
+ this._RefreshSysRedpointUI(sys, base._GetSysRedpointState(sys));
+ }
+ }
+ }
+
+ public void RemoveSysForbidLevels(int sys, uint level)
+ {
+ HashSet<uint> hashSet = null;
+ bool flag = this.mSysForbidLevelsDic.TryGetValue(sys, out hashSet);
+ if (flag)
+ {
+ bool flag2 = hashSet.Remove(level);
+ if (flag2)
+ {
+ bool flag3 = hashSet.Count <= 0;
+ if (flag3)
+ {
+ this.mSysForbidLevelsDic.Remove(sys);
+ }
+ bool flag4 = this.mCurrentLevel == level;
+ if (flag4)
+ {
+ this._RefreshSysRedpointUI(sys, base._GetSysRedpointState(sys));
+ }
+ }
+ }
+ }
+
+ public void InitCurrentLevel(uint level)
+ {
+ this.mCurrentLevel = level;
+ }
+
+ public void SetCurrentLevel(uint level)
+ {
+ bool flag = level != this.mCurrentLevel;
+ if (flag)
+ {
+ this.mCurrentLevel = level;
+ foreach (KeyValuePair<int, HashSet<uint>> keyValuePair in this.mSysForbidLevelsDic)
+ {
+ bool flag2 = keyValuePair.Value.Contains(level);
+ if (flag2)
+ {
+ bool flag3 = base._GetSysRedpointState(keyValuePair.Key);
+ if (flag3)
+ {
+ this._RefreshSysRedpointUI(keyValuePair.Key, false);
+ }
+ }
+ }
+ }
+ }
+
+ protected override void _RefreshSysRedpointUI(int sys, bool redpoint)
+ {
+ bool flag = redpoint;
+ if (flag)
+ {
+ HashSet<uint> hashSet = null;
+ bool flag2 = this.mSysForbidLevelsDic.TryGetValue(sys, out hashSet);
+ if (flag2)
+ {
+ bool flag3 = hashSet.Contains(this.mCurrentLevel);
+ if (flag3)
+ {
+ redpoint = false;
+ }
+ }
+ }
+ base._RefreshSysRedpointUI(sys, redpoint);
+ }
+ }
+}