Browse Source

fixed popup bugs

master
jkpete 1 month ago
parent
commit
72eccbae0d
  1. 5
      Example/SaveSystem/Script/ViewSaveSystem.cs
  2. 58
      addons/EGFramework/Module/GenerateTools/Templete/Godot/EGCreate.cs

5
Example/SaveSystem/Script/ViewSaveSystem.cs

@ -39,9 +39,10 @@ namespace EGFramework.Examples.Test { @@ -39,9 +39,10 @@ namespace EGFramework.Examples.Test {
// editParam.Init(new KeyValuePair<string, object>("数量",1));
this.ExecuteAfterSecond(() =>
{
this.EGAlert("-----~!");
this.EGConfirm("fixed?", isconfirm => { GD.Print(isconfirm); });
},1.0f);
this.EGAlert("-----~!");
}, 1.0f);
}
public override void _ExitTree()

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

@ -13,24 +13,50 @@ namespace EGFramework{ @@ -13,24 +13,50 @@ namespace EGFramework{
public class EGSingletonNode : IEGFramework, IModule
{
public IOCContainer NodeContainer = new IOCContainer();
public Queue<Window> WindowCache = new Queue<Window>();
public Stack<Window> WindowCache = new Stack<Window>();
public Window CurrentWindow { set; get; }
private bool PopUpFlag { set; get; }
public void Init()
{
}
public void ReturnToLastWindow()
public void PopupNode(Window window)
{
PopUpFlag = true;
if (CurrentWindow != null)
{
this.CurrentWindow.Hide();
CurrentWindow.VisibilityChanged -= OnPopUpUnitVisibleChanged;
WindowCache.Push(CurrentWindow);
}
window.PopupCentered();
this.CurrentWindow = window;
CurrentWindow.VisibilityChanged += OnPopUpUnitVisibleChanged;
GD.Print(WindowCache.Count);
PopUpFlag = false;
}
public void OnPopUpUnitVisibleChanged()
{
if (CurrentWindow != null && !CurrentWindow.Visible)
if (CurrentWindow != null && !CurrentWindow.Visible && !PopUpFlag)
{
GD.Print("-----");
CurrentWindow.VisibilityChanged -= OnPopUpUnitVisibleChanged;
if (this.WindowCache.Count > 0)
{
this.CurrentWindow.VisibilityChanged -= ReturnToLastWindow;
this.CurrentWindow.Hide();
this.CurrentWindow = this.WindowCache.Dequeue();
this.CurrentWindow?.PopupCentered();
CurrentWindow.Hide();
Window lastWindow = WindowCache.Pop();
CurrentWindow = lastWindow;
CurrentWindow.PopupCentered();
CurrentWindow.VisibilityChanged += OnPopUpUnitVisibleChanged;
}
else
{
CurrentWindow.Hide();
CurrentWindow = null;
}
}
}
@ -89,24 +115,8 @@ namespace EGFramework{ @@ -89,24 +115,8 @@ namespace EGFramework{
nodeData = self.GetTree().Root.CreateNode<TWindowNode>();
singletonNode.NodeContainer.Register(nodeData);
}
singletonNode.WindowCache.Enqueue(nodeData);
singletonNode.PopupNode(nodeData);
nodeData.Name = name;
// nodeData.CloseRequested += () =>
// {
// if (!nodeData.Visible)
// {
// GD.Print("-----");
// if (singletonNode.WindowCache.Count > 0)
// {
// singletonNode.CurrentWindow = singletonNode.WindowCache.Dequeue();
// singletonNode.CurrentWindow?.PopupCentered();
// }
// }
// };
singletonNode.CurrentWindow?.Hide();
nodeData.PopupCentered();
singletonNode.CurrentWindow = nodeData;
// nodeData.VisibilityChanged += singletonNode.ReturnToLastWindow;
return nodeData;
}

Loading…
Cancel
Save