summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XUtliPoolLib/XRedpointExMgr.cs
blob: 086ff966e7ac1fa60c8b55ca8128988c62448f3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
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);
		}
	}
}