From 6e3175fb99a47a24465cd26ba097446a4a152d49 Mon Sep 17 00:00:00 2001 From: Zenny Date: Thu, 19 Feb 2026 02:12:32 -0800 Subject: [PATCH] Add more implementation for gallery menu --- Zennysoft.Game.Ma/project.godot | 1 + Zennysoft.Game.Ma/src/app/App.cs | 7 +- Zennysoft.Game.Ma/src/menu/MainMenu.cs | 29 +- .../src/ui/gallery/GalleryMenu.cs | 173 +++++- .../src/ui/gallery/GalleryMenu.tscn | 557 +++++++++++------- 5 files changed, 522 insertions(+), 245 deletions(-) diff --git a/Zennysoft.Game.Ma/project.godot b/Zennysoft.Game.Ma/project.godot index 80874f99e..5b1af4dff 100644 --- a/Zennysoft.Game.Ma/project.godot +++ b/Zennysoft.Game.Ma/project.godot @@ -40,6 +40,7 @@ runtime/advanced/uses_dotnet=true window/size/viewport_width=1920 window/size/viewport_height=1080 window/stretch/mode="canvas_items" +window/stretch/aspect="expand" [dotnet] diff --git a/Zennysoft.Game.Ma/src/app/App.cs b/Zennysoft.Game.Ma/src/app/App.cs index b9910e44f..828758be5 100644 --- a/Zennysoft.Game.Ma/src/app/App.cs +++ b/Zennysoft.Game.Ma/src/app/App.cs @@ -219,6 +219,7 @@ public partial class App : Node, IApp private async Task LoadSceneInternal(string sceneName) { LoadingScreen.ShowLoadingScreen(); + MainMenu.Hide(); LoadingScreen.ProgressBar.Value = 0; var sceneLoader = new SceneLoader(); CallDeferred(MethodName.AddChild, sceneLoader); @@ -238,11 +239,7 @@ public partial class App : Node, IApp OptionsMenu.GameTab.GrabFocus(); } - private async void OnGallery() - { - GalleryMenu.Show(); - GalleryMenu.ItemButton1.GrabFocus(); - } + private async void OnGallery() => GalleryMenu.Show(); public void OnQuit() => AppLogic.Input(new AppLogic.Input.QuitGame()); diff --git a/Zennysoft.Game.Ma/src/menu/MainMenu.cs b/Zennysoft.Game.Ma/src/menu/MainMenu.cs index 4b5650d45..beb0d4a56 100644 --- a/Zennysoft.Game.Ma/src/menu/MainMenu.cs +++ b/Zennysoft.Game.Ma/src/menu/MainMenu.cs @@ -43,27 +43,30 @@ public partial class MainMenu : Control, IMainMenu public void OnReady() { - StartGameButton.Pressed += OnStartGamePressed; - EnemyViewerButton.Pressed += EnemyViewerButton_Pressed; - GalleryButton.Pressed += GalleryButton_Pressed; - OptionsButton.Pressed += OptionsButton_Pressed; - QuitButton.Pressed += OnQuitPressed; - StartGameButton.GrabFocus(); + StartGameButton.Pressed += OnStartGamePressed; + EnemyViewerButton.Pressed += EnemyViewerButton_Pressed; + GalleryButton.Pressed += GalleryButton_Pressed; + OptionsButton.Pressed += OptionsButton_Pressed; + QuitButton.Pressed += OnQuitPressed; + StartGameButton.GrabFocus(); + VisibilityChanged += MainMenu_VisibilityChanged; } + private void MainMenu_VisibilityChanged() => FocusMode = Visible ? FocusModeEnum.None : FocusModeEnum.All; + public void FadeIn() { - StartGameButton.GrabFocus(); - Show(); + StartGameButton.GrabFocus(); + Show(); } public void OnExitTree() { - StartGameButton.Pressed -= OnStartGamePressed; - EnemyViewerButton.Pressed -= EnemyViewerButton_Pressed; - GalleryButton.Pressed -= GalleryButton_Pressed; - OptionsButton.Pressed -= OptionsButton_Pressed; - QuitButton.Pressed -= OnQuitPressed; + StartGameButton.Pressed -= OnStartGamePressed; + EnemyViewerButton.Pressed -= EnemyViewerButton_Pressed; + GalleryButton.Pressed -= GalleryButton_Pressed; + OptionsButton.Pressed -= OptionsButton_Pressed; + QuitButton.Pressed -= OnQuitPressed; } public void OnStartGamePressed() => EmitSignal(SignalName.StartGame); diff --git a/Zennysoft.Game.Ma/src/ui/gallery/GalleryMenu.cs b/Zennysoft.Game.Ma/src/ui/gallery/GalleryMenu.cs index 03165036a..2cbbc57d7 100644 --- a/Zennysoft.Game.Ma/src/ui/gallery/GalleryMenu.cs +++ b/Zennysoft.Game.Ma/src/ui/gallery/GalleryMenu.cs @@ -2,6 +2,11 @@ using Chickensoft.AutoInject; using Chickensoft.Introspection; using Godot; using NathanHoad; +using Org.BouncyCastle.Asn1.X509; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.IO; +using System.Linq; using Zennysoft.Game.Ma; [Meta(typeof(IAutoNode))] @@ -10,28 +15,16 @@ public partial class GalleryMenu : Control public override void _Notification(int what) => this.Notify(what); #region ItemLabels - [Node] public Label ItemLabel1 { get; set; } - [Node] public Label ItemLabel2 { get; set; } - [Node] public Label ItemLabel3 { get; set; } - [Node] public Label ItemLabel4 { get; set; } - [Node] public Label ItemLabel5 { get; set; } - [Node] public Label ItemLabel6 { get; set; } - [Node] public Label ItemLabel7 { get; set; } - [Node] public Label ItemLabel8 { get; set; } - [Node] public Label ItemLabel9 { get; set; } - [Node] public Label ItemLabel10 { get; set; } - #endregion - #region Buttons - [Node] public TextureButton ItemButton1 { get; set; } - [Node] public TextureButton ItemButton2 { get; set; } - [Node] public TextureButton ItemButton3 { get; set; } - [Node] public TextureButton ItemButton4 { get; set; } - [Node] public TextureButton ItemButton5 { get; set; } - [Node] public TextureButton ItemButton6 { get; set; } - [Node] public TextureButton ItemButton7 { get; set; } - [Node] public TextureButton ItemButton8 { get; set; } - [Node] public TextureButton ItemButton9 { get; set; } - [Node] public TextureButton ItemButton10 { get; set; } + [Node] public Button ItemLabel1 { get; set; } + [Node] public Button ItemLabel2 { get; set; } + [Node] public Button ItemLabel3 { get; set; } + [Node] public Button ItemLabel4 { get; set; } + [Node] public Button ItemLabel5 { get; set; } + [Node] public Button ItemLabel6 { get; set; } + [Node] public Button ItemLabel7 { get; set; } + [Node] public Button ItemLabel8 { get; set; } + [Node] public Button ItemLabel9 { get; set; } + [Node] public Button ItemLabel10 { get; set; } #endregion #region Thumbnails [Node] public TextureRect ItemThumb1 { get; set; } @@ -50,23 +43,147 @@ public partial class GalleryMenu : Control [Node] public TextureButton NextButton { get; set; } [Node] public TextureButton BackButton { get; set; } + [Node] public Control FullSize { get; set; } + [Node] public Control ThumbnailView { get; set; } + [Node] public TextureRect FullSizeImage { get; set; } + public GalleryData GalleryData { get; set; } [Signal] public delegate void GalleryExitedEventHandler(); + private List