From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../XMainClient/Team/XTeamMonitorStateMgr.cs | 74 ++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamMonitorStateMgr.cs (limited to 'Client/Assets/Scripts/XMainClient/Team/XTeamMonitorStateMgr.cs') diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamMonitorStateMgr.cs b/Client/Assets/Scripts/XMainClient/Team/XTeamMonitorStateMgr.cs new file mode 100644 index 00000000..0778bae2 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamMonitorStateMgr.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections.Generic; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XTeamMonitorStateMgr + { + private Dictionary m_EntityStates = new Dictionary(); + + private HashSet m_LoadingEntities = new HashSet(); + + private HashSet m_Entities = new HashSet(); + + 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 list) + { + this.m_Entities.Clear(); + for (int i = 0; i < list.Count; i++) + { + bool flag = list[i].uid != XSingleton.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; + } + } +} -- cgit v1.1-26-g67d0