summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/Team/XTeamMonitorStateMgr.cs
blob: 0778bae27f579d3f942482a7a95686b8f3a0b4fb (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
using System;
using System.Collections.Generic;
using XUtliPoolLib;

namespace XMainClient
{
	internal class XTeamMonitorStateMgr
	{
		private Dictionary<ulong, XTeamMonitorState> m_EntityStates = new Dictionary<ulong, XTeamMonitorState>();

		private HashSet<ulong> m_LoadingEntities = new HashSet<ulong>();

		private HashSet<ulong> m_Entities = new HashSet<ulong>();

		public void SetState(ulong uid, XTeamMonitorState state)
		{
			bool flag = !this.m_Entities.Contains(uid);
			if (!flag)
			{
				this.m_EntityStates[uid] = state;
				bool flag2 = state == XTeamMonitorState.TMS_Loading;
				if (flag2)
				{
					this.m_LoadingEntities.Add(uid);
				}
				else
				{
					this.m_LoadingEntities.Remove(uid);
				}
			}
		}

		public void SetTotalCount(List<XTeamBloodUIData> list)
		{
			this.m_Entities.Clear();
			for (int i = 0; i < list.Count; i++)
			{
				bool flag = list[i].uid != XSingleton<XAttributeMgr>.singleton.XPlayerData.RoleID;
				if (flag)
				{
					this.m_Entities.Add(list[i].uid);
				}
			}
		}

		public void Reset()
		{
			this.m_EntityStates.Clear();
			this.m_LoadingEntities.Clear();
			this.m_Entities.Clear();
		}

		public XTeamMonitorState GetState(ulong uid)
		{
			XTeamMonitorState xteamMonitorState;
			bool flag = this.m_EntityStates.TryGetValue(uid, out xteamMonitorState);
			XTeamMonitorState result;
			if (flag)
			{
				result = xteamMonitorState;
			}
			else
			{
				result = XTeamMonitorState.TMS_Loading;
			}
			return result;
		}

		public bool HasLoadingEntity()
		{
			return this.m_LoadingEntities.Count > 0 || this.m_EntityStates.Count < this.m_Entities.Count;
		}
	}
}