From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- Client/Assets/Scripts/XMainClient/XUICacheMgr.cs | 63 ++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/XUICacheMgr.cs (limited to 'Client/Assets/Scripts/XMainClient/XUICacheMgr.cs') diff --git a/Client/Assets/Scripts/XMainClient/XUICacheMgr.cs b/Client/Assets/Scripts/XMainClient/XUICacheMgr.cs new file mode 100644 index 00000000..7231a21f --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/XUICacheMgr.cs @@ -0,0 +1,63 @@ +using System; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XUICacheMgr : XSingleton + { + private XSysDefine m_CachedSys; + + private int m_CachedPriority; + + private EXStage m_eStage; + + public void CacheUI(XSysDefine sys, EXStage stage = EXStage.Hall) + { + OpenSystemTable.RowData sysData = XSingleton.singleton.GetSysData(XFastEnumIntEqualityComparer.ToInt(sys)); + bool flag = sysData == null; + if (!flag) + { + bool flag2 = sysData.Priority >= this.m_CachedPriority || this.m_CachedSys == XSysDefine.XSys_Invalid; + if (flag2) + { + this.m_CachedPriority = sysData.Priority; + this.m_CachedSys = sys; + this.m_eStage = stage; + } + } + } + + public void RemoveCachedUI(XSysDefine sys) + { + bool flag = this.m_CachedSys == sys; + if (flag) + { + this.m_CachedSys = XSysDefine.XSys_Invalid; + } + } + + public override bool Init() + { + this.m_CachedSys = XSysDefine.XSys_Invalid; + return true; + } + + public override void Uninit() + { + } + + public void TryShowCache() + { + bool flag = this.m_CachedSys == XSysDefine.XSys_Invalid; + if (!flag) + { + bool flag2 = XSingleton.singleton.CurrentStage.Stage != this.m_eStage; + if (!flag2) + { + XSingleton.singleton.OpenSystem(this.m_CachedSys, 0UL); + this.m_CachedSys = XSysDefine.XSys_Invalid; + } + } + } + } +} -- cgit v1.1-26-g67d0