using Godot; namespace Milimoe.GodotGame; public partial class SavedSelection : CanvasLayer { [Export] public Node Parent { get; set; } [Export] public bool IsSave { get; private set; } = false; public bool IsClosing { get; set; } = false; public override void _Ready() { SetProcessUnhandledInput(true); SetIsSave(IsSave); } public void SetIsSave(bool isSave) { IsSave = isSave; VBoxContainer vBoxContainer = GetNode("ColorRect")?.GetNode("ScrollContainer")?.GetNode("VBoxContainer"); if (vBoxContainer != null) { foreach (Node node in vBoxContainer.GetChildren()) { if (node is SavedNode savedNode) { savedNode.IsSave = IsSave; if (Parent != null) { savedNode.Parent = Parent; } savedNode.Config.LoadConfig(); savedNode.RefreshValue(); } } } } public override void _Input(InputEvent @event) { if (Visible && @event is InputEventMouseButton mouseButtonEvent) { if (mouseButtonEvent.ButtonIndex == MouseButton.Right) { if (mouseButtonEvent.Pressed) { GD.Print("Mouse right button pressed outside UI!"); if (Parent is ISaveSelectionEvent e) { e.OnSaveSelectionClosed(false, 0, IsSave); } } } } } }