From b869a052201975a9a9451b50e83a11354efcf814 Mon Sep 17 00:00:00 2001 From: Alex-Rachel <574809918@qq.com> Date: Sun, 22 Dec 2024 13:13:59 +0800 Subject: [PATCH] =?UTF-8?q?#104=20=E7=9B=AE=E5=89=8D=E8=B0=83=E7=94=A8=20H?= =?UTF-8?q?ideUI=20=E4=BC=9A=E5=B0=86=20UIWindow=20=E7=9A=84=20Visible=20?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E4=B8=BA=20false=EF=BC=8C=E4=BD=86=E6=98=AF?= =?UTF-8?q?=E5=A6=82=E6=9E=9C=E5=8F=88=E8=B0=83=E7=94=A8=20CloseUI=20?= =?UTF-8?q?=E6=96=B9=E6=B3=95=EF=BC=8C=E4=BC=9A=E5=B0=86=E5=88=9A=E6=89=8D?= =?UTF-8?q?=20Visible=20=E8=AE=BE=E7=BD=AE=E4=B8=BA=20false=20=E7=9A=84?= =?UTF-8?q?=E7=AA=97=E5=8F=A3=E9=87=8D=E6=96=B0=E8=AE=BE=E7=BD=AE=E4=B8=BA?= =?UTF-8?q?=20true=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TEngine/Runtime/Modules/UIModule/UIModule.cs | 12 +++++++++++- .../TEngine/Runtime/Modules/UIModule/UIWindow.cs | 12 +++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/UnityProject/Assets/TEngine/Runtime/Modules/UIModule/UIModule.cs b/UnityProject/Assets/TEngine/Runtime/Modules/UIModule/UIModule.cs index 530c7525..626d1854 100644 --- a/UnityProject/Assets/TEngine/Runtime/Modules/UIModule/UIModule.cs +++ b/UnityProject/Assets/TEngine/Runtime/Modules/UIModule/UIModule.cs @@ -382,12 +382,18 @@ namespace TEngine CloseUI(type); return; } - + window.Visible = false; + window.IsHide = true; window.HideTimerId = GameModule.Timer.AddTimer((arg) => { CloseUI(type); },window.HideTimeToClose); + + if (window.FullScreen) + { + OnSetWindowVisible(); + } } /// @@ -469,6 +475,10 @@ namespace TEngine UIWindow window = _stack[i]; if (isHideNext == false) { + if (window.IsHide) + { + continue; + } window.Visible = true; if (window.IsPrepare && window.FullScreen) { diff --git a/UnityProject/Assets/TEngine/Runtime/Modules/UIModule/UIWindow.cs b/UnityProject/Assets/TEngine/Runtime/Modules/UIModule/UIWindow.cs index 71ab89d0..c8068b0c 100644 --- a/UnityProject/Assets/TEngine/Runtime/Modules/UIModule/UIWindow.cs +++ b/UnityProject/Assets/TEngine/Runtime/Modules/UIModule/UIWindow.cs @@ -18,10 +18,14 @@ namespace TEngine private GameObject _panel; private Canvas _canvas; + + protected Canvas Canvas => _canvas; private Canvas[] _childCanvas; private GraphicRaycaster _raycaster; + + protected GraphicRaycaster GraphicRaycaster => _raycaster; private GraphicRaycaster[] _childRaycaster; @@ -204,6 +208,11 @@ namespace TEngine internal bool IsLoadDone = false; internal bool IsDestroyed = false; + + /// + /// UI是否隐藏标志位。 + /// + public bool IsHide { internal set; get; } = false; #endregion public void Init(string name, int layer, bool fullScreen, string assetName, bool fromResources, int hideTimeToClose) @@ -218,6 +227,7 @@ namespace TEngine internal void TryInvoke(System.Action prepareCallback, System.Object[] userDatas) { + CancelHideToCloseTimer(); base.userDatas = userDatas; if (IsPrepare) { @@ -227,7 +237,6 @@ namespace TEngine { _prepareCallback = prepareCallback; } - CancelHideToCloseTimer(); } internal async UniTaskVoid InternalLoad(string location, Action prepareCallback, bool isAsync, System.Object[] userDatas) @@ -437,6 +446,7 @@ namespace TEngine internal void CancelHideToCloseTimer() { + IsHide = false; if (HideTimerId > 0) { GameModule.Timer.RemoveTimer(HideTimerId);