From 5b4b9b525956184d1abf28b311313ad35df91411 Mon Sep 17 00:00:00 2001 From: jkpete <1031139173@qq.com> Date: Mon, 30 Jun 2025 14:01:39 +0800 Subject: [PATCH] add execute in end of frame and complete the PopUp Node --- .../Templete/Godot/Dialog/EGodotEditDialog.cs | 4 ++-- .../GenerateTools/Templete/Godot/EGCreate.cs | 6 +----- .../EGFramework/Module/NodeExtension/EGThread.cs | 15 +++++++++++---- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/addons/EGFramework/Module/GenerateTools/Templete/Godot/Dialog/EGodotEditDialog.cs b/addons/EGFramework/Module/GenerateTools/Templete/Godot/Dialog/EGodotEditDialog.cs index b2239a1..24d8977 100644 --- a/addons/EGFramework/Module/GenerateTools/Templete/Godot/Dialog/EGodotEditDialog.cs +++ b/addons/EGFramework/Module/GenerateTools/Templete/Godot/Dialog/EGodotEditDialog.cs @@ -95,9 +95,9 @@ namespace EGFramework.UI { public static EGodotEditDialog EGEditDialog(this Node self, Dictionary data, Action> onDataEdit, string title = "Edit") { - EGodotEditDialog editDialog = self.SingletoneNode("Edit"); + EGodotEditDialog editDialog = self.PopupNode("Edit"); editDialog.InitDialog(data, onDataEdit, title); - editDialog.PopupCentered(); + // editDialog.PopupCentered(); return editDialog; } } diff --git a/addons/EGFramework/Module/GenerateTools/Templete/Godot/EGCreate.cs b/addons/EGFramework/Module/GenerateTools/Templete/Godot/EGCreate.cs index 25ecc08..4b1c5b1 100644 --- a/addons/EGFramework/Module/GenerateTools/Templete/Godot/EGCreate.cs +++ b/addons/EGFramework/Module/GenerateTools/Templete/Godot/EGCreate.cs @@ -35,7 +35,6 @@ namespace EGFramework{ window.PopupCentered(); this.CurrentWindow = window; CurrentWindow.VisibilityChanged += OnPopUpUnitVisibleChanged; - GD.Print(WindowCache.Count); PopUpFlag = false; } @@ -43,19 +42,16 @@ namespace EGFramework{ { if (CurrentWindow != null && !CurrentWindow.Visible && !PopUpFlag) { - GD.Print("-----"); CurrentWindow.VisibilityChanged -= OnPopUpUnitVisibleChanged; if (this.WindowCache.Count > 0) { - CurrentWindow.Hide(); Window lastWindow = WindowCache.Pop(); CurrentWindow = lastWindow; - CurrentWindow.PopupCentered(); + Callable.From(() => CurrentWindow.PopupCentered()).CallDeferred(); CurrentWindow.VisibilityChanged += OnPopUpUnitVisibleChanged; } else { - CurrentWindow.Hide(); CurrentWindow = null; } } diff --git a/addons/EGFramework/Module/NodeExtension/EGThread.cs b/addons/EGFramework/Module/NodeExtension/EGThread.cs index bf177c7..2f8d373 100644 --- a/addons/EGFramework/Module/NodeExtension/EGThread.cs +++ b/addons/EGFramework/Module/NodeExtension/EGThread.cs @@ -44,17 +44,24 @@ namespace EGFramework{ } public static class EGThreadExtension { - public static void ExecuteInMainThread(this Node self, Action action){ + public static void ExecuteInMainThread(this Node self, Action action) + { //action.Invoke(); self.NodeModule().ExecuteInMainThread(action); } - public static void ExecuteAfterSecond(this Node self, Action action,double delay){ - self.NodeModule().ExecuteAfterSecond(action,delay); + public static void ExecuteAfterSecond(this Node self, Action action, double delay) + { + self.NodeModule().ExecuteAfterSecond(action, delay); } - public static void EGEnabledThread(this Node self){ + public static void EGEnabledThread(this Node self) + { self.NodeModule(); } + public static void ExecuteInEndOfFrame(this object self, Action action) + { + Callable.From(action).CallDeferred(); + } } } \ No newline at end of file