From 1fe4ffba72f56ccc6a89d1896142425c666887d4 Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 27 Jan 2021 14:15:08 +0800 Subject: =?UTF-8?q?+UILib=20=E5=8F=8D=E7=BC=96=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Client/Assets/Scripts/XMainClient/XComponentMgr.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Client/Assets/Scripts/XMainClient/XComponentMgr.cs') diff --git a/Client/Assets/Scripts/XMainClient/XComponentMgr.cs b/Client/Assets/Scripts/XMainClient/XComponentMgr.cs index e690d0c5..9aba5136 100644 --- a/Client/Assets/Scripts/XMainClient/XComponentMgr.cs +++ b/Client/Assets/Scripts/XMainClient/XComponentMgr.cs @@ -8,6 +8,7 @@ namespace XMainClient { private Dictionary _slots = new Dictionary(); + // 复用component的池子 private Dictionary _componentCache = new Dictionary(); public static int ComponenCreatetCount = 0; @@ -329,6 +330,7 @@ namespace XMainClient { XComponent xcomponent = null; XComponentMgr.ComponentCache componentCache = null; + // 先从池子中取 bool flag = this._componentCache.TryGetValue(uuid, out componentCache); if (flag) { @@ -379,6 +381,7 @@ namespace XMainClient bool flag2 = this._componentCache.TryGetValue(c.ID, out componentCache); if (flag2) { + // 放到池子里 componentCache.componentCache.Enqueue(c); } } -- cgit v1.1-26-g67d0