From edf4925a7aefd0e5fc260abab7838920a92f3776 Mon Sep 17 00:00:00 2001 From: ALEXTANG <574809918@qq.com> Date: Thu, 7 Dec 2023 16:32:54 +0800 Subject: [PATCH] =?UTF-8?q?UIWidget=E5=A2=9E=E5=8A=A0Visible=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit UIWidget增加Visible设置 --- .../Runtime/Modules/UIModule/UIWidget.cs | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/UnityProject/Assets/TEngine/Runtime/Modules/UIModule/UIWidget.cs b/UnityProject/Assets/TEngine/Runtime/Modules/UIModule/UIWidget.cs index cbc2ad88..fc7ad4ac 100644 --- a/UnityProject/Assets/TEngine/Runtime/Modules/UIModule/UIWidget.cs +++ b/UnityProject/Assets/TEngine/Runtime/Modules/UIModule/UIWidget.cs @@ -52,6 +52,20 @@ namespace TEngine return null; } } + + /// + /// 窗口可见性 + /// + public bool Visible + { + get => gameObject.activeSelf; + + set + { + gameObject.SetActive(value); + OnSetVisible(value); + } + } internal bool InternalUpdate() { @@ -205,6 +219,13 @@ namespace TEngine { gameObject.SetActive(false); } + else + { + if (!gameObject.activeSelf) + { + gameObject.SetActive(true); + } + } return true; }