From 9ccfd7f49eb3a20c5906c71a475acfadeb3654ff Mon Sep 17 00:00:00 2001 From: GeWuYou <95328647+GeWuYou@users.noreply.github.com> Date: Mon, 23 Feb 2026 10:55:50 +0800 Subject: [PATCH] =?UTF-8?q?refactor(architecture):=20=E5=B0=86=E9=94=80?= =?UTF-8?q?=E6=AF=81=E6=96=B9=E6=B3=95=E6=94=B9=E4=B8=BA=E5=BC=82=E6=AD=A5?= =?UTF-8?q?=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将Destroy方法替换为DestroyAsync异步方法 - 更新锚点绑定以使用异步销毁任务 - 在异步方法中保持相同的销毁逻辑 - 确保扩展组件正确分离和清理 - 维持原有的继承关系和调用链路 --- GFramework.Godot/architecture/AbstractArchitecture.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/GFramework.Godot/architecture/AbstractArchitecture.cs b/GFramework.Godot/architecture/AbstractArchitecture.cs index 8150f22..c7ca2f4 100644 --- a/GFramework.Godot/architecture/AbstractArchitecture.cs +++ b/GFramework.Godot/architecture/AbstractArchitecture.cs @@ -85,7 +85,7 @@ public abstract class AbstractArchitecture( Name = _architectureAnchorName }; - _anchor.Bind(Destroy); + _anchor.Bind(() => DestroyAsync().AsTask()); tree.Root.CallDeferred(Node.MethodName.AddChild, _anchor); } @@ -124,17 +124,18 @@ public abstract class AbstractArchitecture( /// 调用所有已安装扩展的OnDetach方法,并清空扩展列表。 /// 若已被销毁则直接返回。 /// - public override void Destroy() + public override async ValueTask DestroyAsync() { if (_destroyed) return; _destroyed = true; + foreach (var ext in _extensions) ext.OnDetach(); _extensions.Clear(); - base.Destroy(); + await base.DestroyAsync(); } } \ No newline at end of file