From 2b9ad10f802dd95b5742dbe079ebf6358b9f3e82 Mon Sep 17 00:00:00 2001 From: Lsy <379338943@qq.com> Date: Thu, 17 Oct 2024 14:34:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E6=9C=80=E6=96=B0REF?= =?UTF-8?q?=E6=94=B9=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Genericity/EventHandle/UIEventHandleP0.cs | 2 +- .../Genericity/EventHandle/UIEventHandleP1.cs | 2 +- .../Genericity/EventHandle/UIEventHandleP2.cs | 2 +- .../Genericity/EventHandle/UIEventHandleP3.cs | 2 +- .../Genericity/EventHandle/UIEventHandleP4.cs | 2 +- .../Genericity/EventHandle/UIEventHandleP5.cs | 2 +- .../EventHandle/UITaskEventHandleP0.cs | 2 +- .../EventHandle/UITaskEventHandleP1.cs | 2 +- .../EventHandle/UITaskEventHandleP2.cs | 2 +- .../EventHandle/UITaskEventHandleP3.cs | 2 +- .../EventHandle/UITaskEventHandleP4.cs | 2 +- .../EventHandle/UITaskEventHandleP5.cs | 2 +- .../System/Load/YIUILoadComponentSystem.cs | 2 +- .../System/Panel/YIUIPanelComponentSystem.cs | 3 ++- .../System/UIMgr/YIUIMgrComponentSystem.cs | 2 +- .../Window/YIUIWindowComponentSystem.cs | 1 + .../Component/Common/YIUICommonComponent.cs | 6 +++++- .../Client/Component/Panel/PanelInfo.cs | 20 ++++++++++++++++--- .../Component/Panel/YIUIPanelComponent.cs | 8 +++++++- .../Component/View/YIUIViewComponent.cs | 6 +++++- .../Component/Window/YIUIWindowComponent.cs | 14 +++++++++---- 21 files changed, 61 insertions(+), 25 deletions(-) diff --git a/Runtime/Core/YIUIBind/Code/Event/Code/Genericity/EventHandle/UIEventHandleP0.cs b/Runtime/Core/YIUIBind/Code/Event/Code/Genericity/EventHandle/UIEventHandleP0.cs index 1990a1f..5444fa4 100644 --- a/Runtime/Core/YIUIBind/Code/Event/Code/Genericity/EventHandle/UIEventHandleP0.cs +++ b/Runtime/Core/YIUIBind/Code/Event/Code/Genericity/EventHandle/UIEventHandleP0.cs @@ -85,7 +85,7 @@ public void Dispose() { OnEventInvokeType = null; UIEventParamDelegate = null; - m_Trigger = null; + m_Trigger = default; if (m_UIEventList == null || m_UIEventNode == null) return; m_UIEventList.Remove(m_UIEventNode); m_UIEventNode = null; diff --git a/Runtime/Core/YIUIBind/Code/Event/Code/Genericity/EventHandle/UIEventHandleP1.cs b/Runtime/Core/YIUIBind/Code/Event/Code/Genericity/EventHandle/UIEventHandleP1.cs index 573c757..62236d5 100644 --- a/Runtime/Core/YIUIBind/Code/Event/Code/Genericity/EventHandle/UIEventHandleP1.cs +++ b/Runtime/Core/YIUIBind/Code/Event/Code/Genericity/EventHandle/UIEventHandleP1.cs @@ -85,7 +85,7 @@ public void Dispose() { OnEventInvokeType = null; UIEventParamDelegate = null; - m_Trigger = null; + m_Trigger = default; if (m_UIEventList == null || m_UIEventNode == null) return; m_UIEventList.Remove(m_UIEventNode); m_UIEventNode = null; diff --git a/Runtime/Core/YIUIBind/Code/Event/Code/Genericity/EventHandle/UIEventHandleP2.cs b/Runtime/Core/YIUIBind/Code/Event/Code/Genericity/EventHandle/UIEventHandleP2.cs index dbb50bc..f3d87bd 100644 --- a/Runtime/Core/YIUIBind/Code/Event/Code/Genericity/EventHandle/UIEventHandleP2.cs +++ b/Runtime/Core/YIUIBind/Code/Event/Code/Genericity/EventHandle/UIEventHandleP2.cs @@ -85,7 +85,7 @@ public void Dispose() { OnEventInvokeType = null; UIEventParamDelegate = null; - m_Trigger = null; + m_Trigger = default; if (m_UIEventList == null || m_UIEventNode == null) return; m_UIEventList.Remove(m_UIEventNode); m_UIEventNode = null; diff --git a/Runtime/Core/YIUIBind/Code/Event/Code/Genericity/EventHandle/UIEventHandleP3.cs b/Runtime/Core/YIUIBind/Code/Event/Code/Genericity/EventHandle/UIEventHandleP3.cs index e522822..e32789c 100644 --- a/Runtime/Core/YIUIBind/Code/Event/Code/Genericity/EventHandle/UIEventHandleP3.cs +++ b/Runtime/Core/YIUIBind/Code/Event/Code/Genericity/EventHandle/UIEventHandleP3.cs @@ -85,7 +85,7 @@ public void Dispose() { OnEventInvokeType = null; UIEventParamDelegate = null; - m_Trigger = null; + m_Trigger = default; if (m_UIEventList == null || m_UIEventNode == null) return; m_UIEventList.Remove(m_UIEventNode); m_UIEventNode = null; diff --git a/Runtime/Core/YIUIBind/Code/Event/Code/Genericity/EventHandle/UIEventHandleP4.cs b/Runtime/Core/YIUIBind/Code/Event/Code/Genericity/EventHandle/UIEventHandleP4.cs index b82da7f..30ef282 100644 --- a/Runtime/Core/YIUIBind/Code/Event/Code/Genericity/EventHandle/UIEventHandleP4.cs +++ b/Runtime/Core/YIUIBind/Code/Event/Code/Genericity/EventHandle/UIEventHandleP4.cs @@ -85,7 +85,7 @@ public void Dispose() { OnEventInvokeType = null; UIEventParamDelegate = null; - m_Trigger = null; + m_Trigger = default; if (m_UIEventList == null || m_UIEventNode == null) return; m_UIEventList.Remove(m_UIEventNode); m_UIEventNode = null; diff --git a/Runtime/Core/YIUIBind/Code/Event/Code/Genericity/EventHandle/UIEventHandleP5.cs b/Runtime/Core/YIUIBind/Code/Event/Code/Genericity/EventHandle/UIEventHandleP5.cs index 03b5f80..0faa3e2 100644 --- a/Runtime/Core/YIUIBind/Code/Event/Code/Genericity/EventHandle/UIEventHandleP5.cs +++ b/Runtime/Core/YIUIBind/Code/Event/Code/Genericity/EventHandle/UIEventHandleP5.cs @@ -85,7 +85,7 @@ public void Dispose() { OnEventInvokeType = null; UIEventParamDelegate = null; - m_Trigger = null; + m_Trigger = default; if (m_UIEventList == null || m_UIEventNode == null) return; m_UIEventList.Remove(m_UIEventNode); m_UIEventNode = null; diff --git a/Runtime/Core/YIUIBind/Code/TaskEvent/Code/Genericity/EventHandle/UITaskEventHandleP0.cs b/Runtime/Core/YIUIBind/Code/TaskEvent/Code/Genericity/EventHandle/UITaskEventHandleP0.cs index f9af1e7..21c5604 100644 --- a/Runtime/Core/YIUIBind/Code/TaskEvent/Code/Genericity/EventHandle/UITaskEventHandleP0.cs +++ b/Runtime/Core/YIUIBind/Code/TaskEvent/Code/Genericity/EventHandle/UITaskEventHandleP0.cs @@ -82,7 +82,7 @@ public void Dispose() { OnEventInvokeType = null; UITaskEventParamDelegate = null; - m_Trigger = null; + m_Trigger = default; if (m_UITaskEventList == null || m_UITaskEventNode == null) return; m_UITaskEventList.Remove(m_UITaskEventNode); m_UITaskEventNode = null; diff --git a/Runtime/Core/YIUIBind/Code/TaskEvent/Code/Genericity/EventHandle/UITaskEventHandleP1.cs b/Runtime/Core/YIUIBind/Code/TaskEvent/Code/Genericity/EventHandle/UITaskEventHandleP1.cs index 7b73bb3..5a0e4bb 100644 --- a/Runtime/Core/YIUIBind/Code/TaskEvent/Code/Genericity/EventHandle/UITaskEventHandleP1.cs +++ b/Runtime/Core/YIUIBind/Code/TaskEvent/Code/Genericity/EventHandle/UITaskEventHandleP1.cs @@ -82,7 +82,7 @@ public void Dispose() { OnEventInvokeType = null; UITaskEventParamDelegate = null; - m_Trigger = null; + m_Trigger = default; if (m_UITaskEventList == null || m_UITaskEventNode == null) return; m_UITaskEventList.Remove(m_UITaskEventNode); m_UITaskEventNode = null; diff --git a/Runtime/Core/YIUIBind/Code/TaskEvent/Code/Genericity/EventHandle/UITaskEventHandleP2.cs b/Runtime/Core/YIUIBind/Code/TaskEvent/Code/Genericity/EventHandle/UITaskEventHandleP2.cs index ee7abaf..372e93b 100644 --- a/Runtime/Core/YIUIBind/Code/TaskEvent/Code/Genericity/EventHandle/UITaskEventHandleP2.cs +++ b/Runtime/Core/YIUIBind/Code/TaskEvent/Code/Genericity/EventHandle/UITaskEventHandleP2.cs @@ -82,7 +82,7 @@ public void Dispose() { OnEventInvokeType = null; UITaskEventParamDelegate = null; - m_Trigger = null; + m_Trigger = default; if (m_UITaskEventList == null || m_UITaskEventNode == null) return; m_UITaskEventList.Remove(m_UITaskEventNode); m_UITaskEventNode = null; diff --git a/Runtime/Core/YIUIBind/Code/TaskEvent/Code/Genericity/EventHandle/UITaskEventHandleP3.cs b/Runtime/Core/YIUIBind/Code/TaskEvent/Code/Genericity/EventHandle/UITaskEventHandleP3.cs index 475728d..b31ce14 100644 --- a/Runtime/Core/YIUIBind/Code/TaskEvent/Code/Genericity/EventHandle/UITaskEventHandleP3.cs +++ b/Runtime/Core/YIUIBind/Code/TaskEvent/Code/Genericity/EventHandle/UITaskEventHandleP3.cs @@ -82,7 +82,7 @@ public void Dispose() { OnEventInvokeType = null; UITaskEventParamDelegate = null; - m_Trigger = null; + m_Trigger = default; if (m_UITaskEventList == null || m_UITaskEventNode == null) return; m_UITaskEventList.Remove(m_UITaskEventNode); m_UITaskEventNode = null; diff --git a/Runtime/Core/YIUIBind/Code/TaskEvent/Code/Genericity/EventHandle/UITaskEventHandleP4.cs b/Runtime/Core/YIUIBind/Code/TaskEvent/Code/Genericity/EventHandle/UITaskEventHandleP4.cs index 86bf6bc..19c7abb 100644 --- a/Runtime/Core/YIUIBind/Code/TaskEvent/Code/Genericity/EventHandle/UITaskEventHandleP4.cs +++ b/Runtime/Core/YIUIBind/Code/TaskEvent/Code/Genericity/EventHandle/UITaskEventHandleP4.cs @@ -82,7 +82,7 @@ public void Dispose() { OnEventInvokeType = null; UITaskEventParamDelegate = null; - m_Trigger = null; + m_Trigger = default; if (m_UITaskEventList == null || m_UITaskEventNode == null) return; m_UITaskEventList.Remove(m_UITaskEventNode); m_UITaskEventNode = null; diff --git a/Runtime/Core/YIUIBind/Code/TaskEvent/Code/Genericity/EventHandle/UITaskEventHandleP5.cs b/Runtime/Core/YIUIBind/Code/TaskEvent/Code/Genericity/EventHandle/UITaskEventHandleP5.cs index 0f9f3f5..901728e 100644 --- a/Runtime/Core/YIUIBind/Code/TaskEvent/Code/Genericity/EventHandle/UITaskEventHandleP5.cs +++ b/Runtime/Core/YIUIBind/Code/TaskEvent/Code/Genericity/EventHandle/UITaskEventHandleP5.cs @@ -82,7 +82,7 @@ public void Dispose() { OnEventInvokeType = null; UITaskEventParamDelegate = null; - m_Trigger = null; + m_Trigger = default; if (m_UITaskEventList == null || m_UITaskEventNode == null) return; m_UITaskEventList.Remove(m_UITaskEventNode); m_UITaskEventNode = null; diff --git a/Scripts/HotfixView/Client/System/Load/YIUILoadComponentSystem.cs b/Scripts/HotfixView/Client/System/Load/YIUILoadComponentSystem.cs index df14e7d..5ddfa2e 100644 --- a/Scripts/HotfixView/Client/System/Load/YIUILoadComponentSystem.cs +++ b/Scripts/HotfixView/Client/System/Load/YIUILoadComponentSystem.cs @@ -24,7 +24,7 @@ private static void Awake(this YIUILoadComponent self) [EntitySystem] private static void Destroy(this YIUILoadComponent self) { - YIUILoadComponent.m_InstRef = null; + YIUILoadComponent.m_InstRef = default; } public static async ETTask Initialize(this YIUILoadComponent self) diff --git a/Scripts/HotfixView/Client/System/Panel/YIUIPanelComponentSystem.cs b/Scripts/HotfixView/Client/System/Panel/YIUIPanelComponentSystem.cs index ad0ccea..9a2d2d1 100644 --- a/Scripts/HotfixView/Client/System/Panel/YIUIPanelComponentSystem.cs +++ b/Scripts/HotfixView/Client/System/Panel/YIUIPanelComponentSystem.cs @@ -16,6 +16,7 @@ public static partial class YIUIPanelComponentSystem [EntitySystem] private static void Awake(this YIUIPanelComponent self) { + self.UIBindVo = self.UIBase.UIBindVo; } [EntitySystem] @@ -30,7 +31,7 @@ private static void Destroy(this YIUIPanelComponent self) self.StopCountDownDestroyPanel(); EventSystem.Instance?.YIUIInvokeSync(new YIUIInvokeDestroyPanel { - PanelName = self.UIBase.UIBindVo.ComponentType.Name + PanelName = self.UIBindVo.ComponentType.Name }); } } diff --git a/Scripts/HotfixView/Client/System/UIMgr/YIUIMgrComponentSystem.cs b/Scripts/HotfixView/Client/System/UIMgr/YIUIMgrComponentSystem.cs index a424d3e..c7364a5 100644 --- a/Scripts/HotfixView/Client/System/UIMgr/YIUIMgrComponentSystem.cs +++ b/Scripts/HotfixView/Client/System/UIMgr/YIUIMgrComponentSystem.cs @@ -27,7 +27,7 @@ private static void Destroy(this YIUIMgrComponent self) YIUIBindHelper.Reset(); YIUISingletonHelper.DisposeAll(); self.ResetRoot(); - YIUIMgrComponent.m_InstRef = null; + YIUIMgrComponent.m_InstRef = default; } } } diff --git a/Scripts/HotfixView/Client/System/Window/YIUIWindowComponentSystem.cs b/Scripts/HotfixView/Client/System/Window/YIUIWindowComponentSystem.cs index 7482173..9625e00 100644 --- a/Scripts/HotfixView/Client/System/Window/YIUIWindowComponentSystem.cs +++ b/Scripts/HotfixView/Client/System/Window/YIUIWindowComponentSystem.cs @@ -20,6 +20,7 @@ public static partial class YIUIWindowComponentSystem [EntitySystem] private static void Awake(this YIUIWindowComponent self) { + self.UIBindVo = self.UIBase.UIBindVo; } [EntitySystem] diff --git a/Scripts/ModelView/Client/Component/Common/YIUICommonComponent.cs b/Scripts/ModelView/Client/Component/Common/YIUICommonComponent.cs index 6d2abe9..71f6383 100644 --- a/Scripts/ModelView/Client/Component/Common/YIUICommonComponent.cs +++ b/Scripts/ModelView/Client/Component/Common/YIUICommonComponent.cs @@ -21,7 +21,11 @@ public YIUIChild UIBase { if (_UIBase == null) { - _uiBase = this.GetParent(); + var yiuiChild = this.GetParent(); + if (yiuiChild is { IsDisposed: false }) + { + _uiBase = yiuiChild; + } } return _UIBase; diff --git a/Scripts/ModelView/Client/Component/Panel/PanelInfo.cs b/Scripts/ModelView/Client/Component/Panel/PanelInfo.cs index b9c6c88..9519f87 100644 --- a/Scripts/ModelView/Client/Component/Panel/PanelInfo.cs +++ b/Scripts/ModelView/Client/Component/Panel/PanelInfo.cs @@ -56,12 +56,26 @@ public PanelInfo(YIUIBindVo vo) public void ResetUI(YIUIChild uiBase) { - m_UIBase = uiBase; + if (uiBase is { IsDisposed: false }) + { + m_UIBase = uiBase; + } + else + { + m_UIBase = default; + } } public void ResetEntity(Entity entity) { - m_OwnerUIEntity = entity; + if (entity is { IsDisposed: false }) + { + m_OwnerUIEntity = entity; + } + else + { + m_OwnerUIEntity = default; + } } } -} +} \ No newline at end of file diff --git a/Scripts/ModelView/Client/Component/Panel/YIUIPanelComponent.cs b/Scripts/ModelView/Client/Component/Panel/YIUIPanelComponent.cs index 6aa0c60..1a9a7ed 100644 --- a/Scripts/ModelView/Client/Component/Panel/YIUIPanelComponent.cs +++ b/Scripts/ModelView/Client/Component/Panel/YIUIPanelComponent.cs @@ -14,6 +14,8 @@ namespace ET.Client [ComponentOf(typeof(YIUIChild))] public partial class YIUIPanelComponent : Entity, IAwake, IYIUIInitialize, IDestroy { + public YIUIBindVo UIBindVo; + private EntityRef _uiBase; private YIUIChild _UIBase => _uiBase; @@ -23,7 +25,11 @@ public YIUIChild UIBase { if (_UIBase == null) { - _uiBase = this.GetParent(); + var yiuiChild = this.GetParent(); + if (yiuiChild is { IsDisposed: false }) + { + _uiBase = yiuiChild; + } } return _UIBase; diff --git a/Scripts/ModelView/Client/Component/View/YIUIViewComponent.cs b/Scripts/ModelView/Client/Component/View/YIUIViewComponent.cs index 62b67b1..7b098cd 100644 --- a/Scripts/ModelView/Client/Component/View/YIUIViewComponent.cs +++ b/Scripts/ModelView/Client/Component/View/YIUIViewComponent.cs @@ -23,7 +23,11 @@ public YIUIChild UIBase { if (_UIBase == null) { - _uiBase = this.GetParent(); + var yiuiChild = this.GetParent(); + if (yiuiChild is { IsDisposed: false }) + { + _uiBase = yiuiChild; + } } return _UIBase; diff --git a/Scripts/ModelView/Client/Component/Window/YIUIWindowComponent.cs b/Scripts/ModelView/Client/Component/Window/YIUIWindowComponent.cs index 1d529ed..cd35542 100644 --- a/Scripts/ModelView/Client/Component/Window/YIUIWindowComponent.cs +++ b/Scripts/ModelView/Client/Component/Window/YIUIWindowComponent.cs @@ -19,6 +19,8 @@ public partial class YIUIWindowComponent : Entity, IAwake, IDestroy public ETTask _LastOpenETTask; public ETTask _LastCloseETTask; + public YIUIBindVo UIBindVo; + private EntityRef _uiBase; private YIUIChild _UIBase => _uiBase; @@ -28,7 +30,11 @@ public YIUIChild UIBase { if (_UIBase == null) { - _uiBase = this.GetParent(); + var yiuiChild = this.GetParent(); + if (yiuiChild is { IsDisposed: false }) + { + _uiBase = yiuiChild; + } } return _UIBase; @@ -58,7 +64,7 @@ public Entity OwnerUIEntity /// public EWindowOption WindowOption = EWindowOption.None; - public bool m_FirstOpenTween; - public bool m_FirstCloseTween; + public bool m_FirstOpenTween; + public bool m_FirstCloseTween; } -} +} \ No newline at end of file