From cc4f2801df6a8da52a0ffd1bee00d55b1718070e Mon Sep 17 00:00:00 2001 From: dgflash Date: Mon, 23 Jun 2025 13:53:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/module/common/ModuleUtil.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/assets/module/common/ModuleUtil.ts b/assets/module/common/ModuleUtil.ts index 9591757..3ec7dae 100644 --- a/assets/module/common/ModuleUtil.ts +++ b/assets/module/common/ModuleUtil.ts @@ -97,10 +97,22 @@ export class ModuleUtil { const comp = node.getComponent(DelegateComponent); if (comp) { - comp.onCloseWindowBefore = () => { + if (comp.vp.callbacks.onBeforeRemove) { + comp.onCloseWindowBefore = () => { + ent.remove(ctor, isDestroy); + if (onRemoved) onRemoved(); + }; + } + else if (comp.vp.callbacks.onRemoved) { + comp.onCloseWindow = () => { + ent.remove(ctor, isDestroy); + if (onRemoved) onRemoved(); + }; + } + else { ent.remove(ctor, isDestroy); if (onRemoved) onRemoved(); - }; + } } else { ent.remove(ctor, isDestroy);