From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../Assets/Scripts/XUtliPoolLib/XRedpointExMgr.cs | 100 +++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 Client/Assets/Scripts/XUtliPoolLib/XRedpointExMgr.cs (limited to 'Client/Assets/Scripts/XUtliPoolLib/XRedpointExMgr.cs') 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> mSysForbidLevelsDic = new Dictionary>(); + + public void AddSysForbidLevels(int sys, uint level) + { + HashSet hashSet = null; + bool flag = !this.mSysForbidLevelsDic.TryGetValue(sys, out hashSet); + if (flag) + { + hashSet = new HashSet(); + 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 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> 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 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); + } + } +} -- cgit v1.1-26-g67d0