From d106f7eebb3dd300e5094822c124f0c6add36ac6 Mon Sep 17 00:00:00 2001 From: zxl Date: Wed, 13 Nov 2024 09:46:21 +0800 Subject: [PATCH] Update UIManager.cs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 优化ui操作;可能会存在ui缓存是反向的,以后注意 --- .../DemoGame/GameScript/Hotfix/UI/UIManager.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Assets/DemoGame/GameScript/Hotfix/UI/UIManager.cs b/Assets/DemoGame/GameScript/Hotfix/UI/UIManager.cs index bdce569..709a924 100644 --- a/Assets/DemoGame/GameScript/Hotfix/UI/UIManager.cs +++ b/Assets/DemoGame/GameScript/Hotfix/UI/UIManager.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using TMPro; using UnityEngine; @@ -135,6 +136,21 @@ namespace ZC uiBase.OnClose(); // TODO: _uis.Pop(); + var array = _uis.ToList(); + foreach (var ui in array) + { + if (ui == uiBase) + { + array.Remove(ui); + } + } + + _uis.Clear(); + foreach (var ui in array) + { + _uis.Push(ui); + } + return true; }