Browse Source

add execute in end of frame and complete the PopUp Node

master
jkpete 1 month ago
parent
commit
5b4b9b5259
  1. 4
      addons/EGFramework/Module/GenerateTools/Templete/Godot/Dialog/EGodotEditDialog.cs
  2. 6
      addons/EGFramework/Module/GenerateTools/Templete/Godot/EGCreate.cs
  3. 15
      addons/EGFramework/Module/NodeExtension/EGThread.cs

4
addons/EGFramework/Module/GenerateTools/Templete/Godot/Dialog/EGodotEditDialog.cs

@ -95,9 +95,9 @@ namespace EGFramework.UI
{ {
public static EGodotEditDialog EGEditDialog(this Node self, Dictionary<string, object> data, Action<Dictionary<string, object>> onDataEdit, string title = "Edit") public static EGodotEditDialog EGEditDialog(this Node self, Dictionary<string, object> data, Action<Dictionary<string, object>> onDataEdit, string title = "Edit")
{ {
EGodotEditDialog editDialog = self.SingletoneNode<EGodotEditDialog>("Edit"); EGodotEditDialog editDialog = self.PopupNode<EGodotEditDialog>("Edit");
editDialog.InitDialog(data, onDataEdit, title); editDialog.InitDialog(data, onDataEdit, title);
editDialog.PopupCentered(); // editDialog.PopupCentered();
return editDialog; return editDialog;
} }
} }

6
addons/EGFramework/Module/GenerateTools/Templete/Godot/EGCreate.cs

@ -35,7 +35,6 @@ namespace EGFramework{
window.PopupCentered(); window.PopupCentered();
this.CurrentWindow = window; this.CurrentWindow = window;
CurrentWindow.VisibilityChanged += OnPopUpUnitVisibleChanged; CurrentWindow.VisibilityChanged += OnPopUpUnitVisibleChanged;
GD.Print(WindowCache.Count);
PopUpFlag = false; PopUpFlag = false;
} }
@ -43,19 +42,16 @@ namespace EGFramework{
{ {
if (CurrentWindow != null && !CurrentWindow.Visible && !PopUpFlag) if (CurrentWindow != null && !CurrentWindow.Visible && !PopUpFlag)
{ {
GD.Print("-----");
CurrentWindow.VisibilityChanged -= OnPopUpUnitVisibleChanged; CurrentWindow.VisibilityChanged -= OnPopUpUnitVisibleChanged;
if (this.WindowCache.Count > 0) if (this.WindowCache.Count > 0)
{ {
CurrentWindow.Hide();
Window lastWindow = WindowCache.Pop(); Window lastWindow = WindowCache.Pop();
CurrentWindow = lastWindow; CurrentWindow = lastWindow;
CurrentWindow.PopupCentered(); Callable.From(() => CurrentWindow.PopupCentered()).CallDeferred();
CurrentWindow.VisibilityChanged += OnPopUpUnitVisibleChanged; CurrentWindow.VisibilityChanged += OnPopUpUnitVisibleChanged;
} }
else else
{ {
CurrentWindow.Hide();
CurrentWindow = null; CurrentWindow = null;
} }
} }

15
addons/EGFramework/Module/NodeExtension/EGThread.cs

@ -44,17 +44,24 @@ namespace EGFramework{
} }
public static class EGThreadExtension public static class EGThreadExtension
{ {
public static void ExecuteInMainThread(this Node self, Action action){ public static void ExecuteInMainThread(this Node self, Action action)
{
//action.Invoke(); //action.Invoke();
self.NodeModule<EGThread>().ExecuteInMainThread(action); self.NodeModule<EGThread>().ExecuteInMainThread(action);
} }
public static void ExecuteAfterSecond(this Node self, Action action,double delay){ public static void ExecuteAfterSecond(this Node self, Action action, double delay)
self.NodeModule<EGThread>().ExecuteAfterSecond(action,delay); {
self.NodeModule<EGThread>().ExecuteAfterSecond(action, delay);
} }
public static void EGEnabledThread(this Node self){ public static void EGEnabledThread(this Node self)
{
self.NodeModule<EGThread>(); self.NodeModule<EGThread>();
} }
public static void ExecuteInEndOfFrame(this object self, Action action)
{
Callable.From(action).CallDeferred();
}
} }
} }
Loading…
Cancel
Save