From c491ea505089651d49e44b4aad21ec58bc347334 Mon Sep 17 00:00:00 2001 From: Zenny Date: Sun, 30 Nov 2025 20:17:08 -0800 Subject: [PATCH] Gallery Menu initial implementation --- Zennysoft.Game.Ma/src/app/App.cs | 11 + Zennysoft.Game.Ma/src/app/App.tscn | 7 +- Zennysoft.Game.Ma/src/options/GalleryData.cs | 12 + .../src/options/GalleryData.cs.uid | 1 + .../src/ui/gallery/GalleryMenu.cs | 43 +++ .../src/ui/gallery/GalleryMenu.cs.uid | 1 + .../src/ui/gallery/GalleryMenu.tscn | 248 ++++++++++++++++++ .../src/ui/label_settings/HeadingFont.tres | 2 +- 8 files changed, 323 insertions(+), 2 deletions(-) create mode 100644 Zennysoft.Game.Ma/src/options/GalleryData.cs create mode 100644 Zennysoft.Game.Ma/src/options/GalleryData.cs.uid create mode 100644 Zennysoft.Game.Ma/src/ui/gallery/GalleryMenu.cs create mode 100644 Zennysoft.Game.Ma/src/ui/gallery/GalleryMenu.cs.uid create mode 100644 Zennysoft.Game.Ma/src/ui/gallery/GalleryMenu.tscn diff --git a/Zennysoft.Game.Ma/src/app/App.cs b/Zennysoft.Game.Ma/src/app/App.cs index 922d9bda..f344f40a 100644 --- a/Zennysoft.Game.Ma/src/app/App.cs +++ b/Zennysoft.Game.Ma/src/app/App.cs @@ -32,6 +32,8 @@ public partial class App : Node, IApp [Node] private OptionsMenu OptionsMenu { get; set; } + [Node] private GalleryMenu GalleryMenu { get; set; } + public IInstantiator Instantiator { get; set; } = default!; IAppRepo IProvide.Value() => AppRepo; @@ -77,6 +79,7 @@ public partial class App : Node, IApp MainMenu.StartGame += OnStartGame; MainMenu.EnemyViewer += OnEnemyViewer; + MainMenu.Gallery += OnGallery; MainMenu.Options += OnOptions; MainMenu.Quit += OnQuit; _loadedScene.Changed += OnGameLoaded; @@ -182,12 +185,20 @@ public partial class App : Node, IApp private void OnEnemyViewer() => AppLogic.Input(new AppLogic.Input.EnemyViewerOpened()); + private void OnGalleryViewer() => AppLogic.Input(new AppLogic.Input.GalleryOpened()); + private async void OnOptions() { OptionsMenu.Show(); OptionsMenu.MasterVolumeSlider.GrabFocus(); } + private async void OnGallery() + { + GalleryMenu.Show(); + GalleryMenu.Item1Thumb.GrabFocus(); + } + public void OnQuit() => AppLogic.Input(new AppLogic.Input.QuitGame()); public void OnSaveFileLoaded() diff --git a/Zennysoft.Game.Ma/src/app/App.tscn b/Zennysoft.Game.Ma/src/app/App.tscn index 45f7334d..5f031588 100644 --- a/Zennysoft.Game.Ma/src/app/App.tscn +++ b/Zennysoft.Game.Ma/src/app/App.tscn @@ -1,9 +1,10 @@ -[gd_scene load_steps=5 format=3 uid="uid://cagfc5ridmteu"] +[gd_scene load_steps=6 format=3 uid="uid://cagfc5ridmteu"] [ext_resource type="Script" uid="uid://d1f8blk5ucqvq" path="res://src/app/App.cs" id="1_rt73h"] [ext_resource type="PackedScene" uid="uid://rfvnddfqufho" path="res://src/menu/MainMenu.tscn" id="2_1uiag"] [ext_resource type="PackedScene" uid="uid://drkl3btdy6uxj" path="res://src/options/OptionsMenu.tscn" id="2_v0mgf"] [ext_resource type="PackedScene" uid="uid://cpjlj7kxdhv16" path="res://src/menu/LoadingScreen.tscn" id="3_3st5l"] +[ext_resource type="PackedScene" uid="uid://cm6fo70yb2hip" path="res://src/ui/gallery/GalleryMenu.tscn" id="5_iuu71"] [node name="App" type="Node"] process_mode = 3 @@ -18,3 +19,7 @@ visible = false [node name="MainMenu" parent="." instance=ExtResource("2_1uiag")] unique_name_in_owner = true + +[node name="GalleryMenu" parent="." instance=ExtResource("5_iuu71")] +unique_name_in_owner = true +visible = false diff --git a/Zennysoft.Game.Ma/src/options/GalleryData.cs b/Zennysoft.Game.Ma/src/options/GalleryData.cs new file mode 100644 index 00000000..b0eb081f --- /dev/null +++ b/Zennysoft.Game.Ma/src/options/GalleryData.cs @@ -0,0 +1,12 @@ +using Chickensoft.Introspection; +using Chickensoft.Serialization; +using Godot; + +namespace Zennysoft.Game.Ma; + +[Meta, Id("gallery_data")] +public partial class GalleryData : Node +{ + [Save("PlaceholderImage1")] + public required bool PlaceholderImage1 { get; set; } +} \ No newline at end of file diff --git a/Zennysoft.Game.Ma/src/options/GalleryData.cs.uid b/Zennysoft.Game.Ma/src/options/GalleryData.cs.uid new file mode 100644 index 00000000..ecc5fa2c --- /dev/null +++ b/Zennysoft.Game.Ma/src/options/GalleryData.cs.uid @@ -0,0 +1 @@ +uid://cy2vuwwvm727f diff --git a/Zennysoft.Game.Ma/src/ui/gallery/GalleryMenu.cs b/Zennysoft.Game.Ma/src/ui/gallery/GalleryMenu.cs new file mode 100644 index 00000000..3070ebcd --- /dev/null +++ b/Zennysoft.Game.Ma/src/ui/gallery/GalleryMenu.cs @@ -0,0 +1,43 @@ +using Chickensoft.AutoInject; +using Chickensoft.Introspection; +using Godot; +using Zennysoft.Game.Ma; + +[Meta(typeof(IAutoNode))] +public partial class GalleryMenu : Control +{ + public override void _Notification(int what) => this.Notify(what); + + [Node] public Label Item1Label { get; set; } + [Node] public Label Item2Label { get; set; } + [Node] public Label Item3Label { get; set; } + [Node] public Label Item4Label { get; set; } + [Node] public Label Item5Label { get; set; } + [Node] public Label Item6Label { get; set; } + [Node] public Label Item7Label { get; set; } + [Node] public Label Item8Label { get; set; } + + [Node] public ColorRect Item1Thumb { get; set; } + [Node] public ColorRect Item2Thumb { get; set; } + [Node] public ColorRect Item3Thumb { get; set; } + [Node] public ColorRect Item4Thumb { get; set; } + [Node] public ColorRect Item5Thumb { get; set; } + [Node] public ColorRect Item6Thumb { get; set; } + [Node] public ColorRect Item7Thumb { get; set; } + [Node] public ColorRect Item8Thumb { get; set; } + + public GalleryData GalleryData { get; set; } + + public void OnReady() + { + GalleryData = new GalleryData() { PlaceholderImage1 = true }; + if (GalleryData.PlaceholderImage1) + Item1Label.Text = "Placeholder"; + } + + public void Load(GalleryData galleryData) + { + if (galleryData.PlaceholderImage1) + Item1Label.Text = "Placeholder"; + } +} diff --git a/Zennysoft.Game.Ma/src/ui/gallery/GalleryMenu.cs.uid b/Zennysoft.Game.Ma/src/ui/gallery/GalleryMenu.cs.uid new file mode 100644 index 00000000..cfaef48a --- /dev/null +++ b/Zennysoft.Game.Ma/src/ui/gallery/GalleryMenu.cs.uid @@ -0,0 +1 @@ +uid://cl0fi7kgimquk diff --git a/Zennysoft.Game.Ma/src/ui/gallery/GalleryMenu.tscn b/Zennysoft.Game.Ma/src/ui/gallery/GalleryMenu.tscn new file mode 100644 index 00000000..8723353c --- /dev/null +++ b/Zennysoft.Game.Ma/src/ui/gallery/GalleryMenu.tscn @@ -0,0 +1,248 @@ +[gd_scene load_steps=5 format=3 uid="uid://cm6fo70yb2hip"] + +[ext_resource type="Script" uid="uid://cl0fi7kgimquk" path="res://src/ui/gallery/GalleryMenu.cs" id="1_lvvvw"] +[ext_resource type="LabelSettings" uid="uid://wc363u5t1yi2" path="res://src/ui/label_settings/HeadingFont.tres" id="1_qekcq"] + +[sub_resource type="Gradient" id="Gradient_6y3ag"] +offsets = PackedFloat32Array(0.0501636, 0.745911, 1) +colors = PackedColorArray(0.0770514, 0.225922, 0.0437089, 1, 0.198692, 0.388726, 0.192961, 1, 3.85046e-07, 0.276787, 0.0375416, 1) + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_qekcq"] +gradient = SubResource("Gradient_6y3ag") + +[node name="GalleryMenu" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +script = ExtResource("1_lvvvw") + +[node name="TextureRect" type="TextureRect" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +texture = SubResource("GradientTexture2D_qekcq") + +[node name="MarginContainer" type="MarginContainer" parent="TextureRect"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_constants/margin_left = 95 +theme_override_constants/margin_top = 33 +theme_override_constants/margin_right = 70 +theme_override_constants/margin_bottom = 100 + +[node name="VBoxContainer" type="VBoxContainer" parent="TextureRect/MarginContainer"] +layout_mode = 2 +theme_override_constants/separation = 10 + +[node name="ColorRect" type="ColorRect" parent="TextureRect/MarginContainer/VBoxContainer"] +custom_minimum_size = Vector2(427, 100) +layout_mode = 2 +size_flags_horizontal = 0 +color = Color(0.0941176, 0.0941176, 0.0941176, 0.980392) + +[node name="MarginContainer" type="MarginContainer" parent="TextureRect/MarginContainer/VBoxContainer/ColorRect"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_constants/margin_left = 15 + +[node name="Label" type="Label" parent="TextureRect/MarginContainer/VBoxContainer/ColorRect/MarginContainer"] +layout_mode = 2 +text = "Gallery" +label_settings = ExtResource("1_qekcq") + +[node name="ColorRect2" type="ColorRect" parent="TextureRect/MarginContainer/VBoxContainer"] +layout_mode = 2 +size_flags_vertical = 3 +color = Color(0.0941176, 0.0941176, 0.0941176, 0.980392) + +[node name="MarginContainer" type="MarginContainer" parent="TextureRect/MarginContainer/VBoxContainer/ColorRect2"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +size_flags_vertical = 3 +theme_override_constants/margin_left = 10 +theme_override_constants/margin_top = 10 +theme_override_constants/margin_right = 10 +theme_override_constants/margin_bottom = 10 + +[node name="ReferenceRect" type="ReferenceRect" parent="TextureRect/MarginContainer/VBoxContainer/ColorRect2/MarginContainer"] +layout_mode = 2 +border_color = Color(1, 1, 1, 1) +border_width = 2.0 +editor_only = false + +[node name="MarginContainer" type="MarginContainer" parent="TextureRect/MarginContainer/VBoxContainer/ColorRect2/MarginContainer/ReferenceRect"] +layout_mode = 0 +offset_right = 40.0 +offset_bottom = 40.0 +theme_override_constants/margin_left = 25 +theme_override_constants/margin_top = 80 +theme_override_constants/margin_right = 15 +theme_override_constants/margin_bottom = 10 + +[node name="VBoxContainer" type="VBoxContainer" parent="TextureRect/MarginContainer/VBoxContainer/ColorRect2/MarginContainer/ReferenceRect/MarginContainer"] +layout_mode = 2 +theme_override_constants/separation = 25 + +[node name="VFlowContainer" type="VFlowContainer" parent="TextureRect/MarginContainer/VBoxContainer/ColorRect2/MarginContainer/ReferenceRect/MarginContainer/VBoxContainer"] +layout_mode = 2 +theme_override_constants/h_separation = 25 + +[node name="Item1Thumb" type="ColorRect" parent="TextureRect/MarginContainer/VBoxContainer/ColorRect2/MarginContainer/ReferenceRect/MarginContainer/VBoxContainer/VFlowContainer"] +unique_name_in_owner = true +custom_minimum_size = Vector2(400, 200) +layout_mode = 2 + +[node name="Item2Thumb" type="ColorRect" parent="TextureRect/MarginContainer/VBoxContainer/ColorRect2/MarginContainer/ReferenceRect/MarginContainer/VBoxContainer/VFlowContainer"] +unique_name_in_owner = true +custom_minimum_size = Vector2(400, 200) +layout_mode = 2 + +[node name="Item3Thumb" type="ColorRect" parent="TextureRect/MarginContainer/VBoxContainer/ColorRect2/MarginContainer/ReferenceRect/MarginContainer/VBoxContainer/VFlowContainer"] +unique_name_in_owner = true +custom_minimum_size = Vector2(400, 200) +layout_mode = 2 + +[node name="Item4Thumb" type="ColorRect" parent="TextureRect/MarginContainer/VBoxContainer/ColorRect2/MarginContainer/ReferenceRect/MarginContainer/VBoxContainer/VFlowContainer"] +unique_name_in_owner = true +custom_minimum_size = Vector2(400, 200) +layout_mode = 2 + +[node name="VFlowContainer3" type="VFlowContainer" parent="TextureRect/MarginContainer/VBoxContainer/ColorRect2/MarginContainer/ReferenceRect/MarginContainer/VBoxContainer"] +layout_mode = 2 +theme_override_constants/h_separation = 25 + +[node name="CenterContainer" type="CenterContainer" parent="TextureRect/MarginContainer/VBoxContainer/ColorRect2/MarginContainer/ReferenceRect/MarginContainer/VBoxContainer/VFlowContainer3"] +custom_minimum_size = Vector2(400, 0) +layout_mode = 2 +size_flags_vertical = 3 + +[node name="Item1Label" type="Label" parent="TextureRect/MarginContainer/VBoxContainer/ColorRect2/MarginContainer/ReferenceRect/MarginContainer/VBoxContainer/VFlowContainer3/CenterContainer"] +unique_name_in_owner = true +layout_mode = 2 +text = "???" +label_settings = ExtResource("1_qekcq") + +[node name="CenterContainer2" type="CenterContainer" parent="TextureRect/MarginContainer/VBoxContainer/ColorRect2/MarginContainer/ReferenceRect/MarginContainer/VBoxContainer/VFlowContainer3"] +custom_minimum_size = Vector2(400, 0) +layout_mode = 2 +size_flags_vertical = 3 + +[node name="Item2Label" type="Label" parent="TextureRect/MarginContainer/VBoxContainer/ColorRect2/MarginContainer/ReferenceRect/MarginContainer/VBoxContainer/VFlowContainer3/CenterContainer2"] +unique_name_in_owner = true +layout_mode = 2 +text = "???" +label_settings = ExtResource("1_qekcq") + +[node name="CenterContainer3" type="CenterContainer" parent="TextureRect/MarginContainer/VBoxContainer/ColorRect2/MarginContainer/ReferenceRect/MarginContainer/VBoxContainer/VFlowContainer3"] +custom_minimum_size = Vector2(400, 0) +layout_mode = 2 +size_flags_vertical = 3 + +[node name="Item3Label" type="Label" parent="TextureRect/MarginContainer/VBoxContainer/ColorRect2/MarginContainer/ReferenceRect/MarginContainer/VBoxContainer/VFlowContainer3/CenterContainer3"] +unique_name_in_owner = true +layout_mode = 2 +text = "???" +label_settings = ExtResource("1_qekcq") + +[node name="CenterContainer4" type="CenterContainer" parent="TextureRect/MarginContainer/VBoxContainer/ColorRect2/MarginContainer/ReferenceRect/MarginContainer/VBoxContainer/VFlowContainer3"] +custom_minimum_size = Vector2(400, 0) +layout_mode = 2 +size_flags_vertical = 3 + +[node name="Item4Label" type="Label" parent="TextureRect/MarginContainer/VBoxContainer/ColorRect2/MarginContainer/ReferenceRect/MarginContainer/VBoxContainer/VFlowContainer3/CenterContainer4"] +unique_name_in_owner = true +layout_mode = 2 +text = "???" +label_settings = ExtResource("1_qekcq") + +[node name="VFlowContainer2" type="VFlowContainer" parent="TextureRect/MarginContainer/VBoxContainer/ColorRect2/MarginContainer/ReferenceRect/MarginContainer/VBoxContainer"] +layout_mode = 2 +theme_override_constants/h_separation = 25 + +[node name="Item5Thumb" type="ColorRect" parent="TextureRect/MarginContainer/VBoxContainer/ColorRect2/MarginContainer/ReferenceRect/MarginContainer/VBoxContainer/VFlowContainer2"] +unique_name_in_owner = true +custom_minimum_size = Vector2(400, 200) +layout_mode = 2 + +[node name="Item6Thumb" type="ColorRect" parent="TextureRect/MarginContainer/VBoxContainer/ColorRect2/MarginContainer/ReferenceRect/MarginContainer/VBoxContainer/VFlowContainer2"] +unique_name_in_owner = true +custom_minimum_size = Vector2(400, 200) +layout_mode = 2 + +[node name="Item7Thumb" type="ColorRect" parent="TextureRect/MarginContainer/VBoxContainer/ColorRect2/MarginContainer/ReferenceRect/MarginContainer/VBoxContainer/VFlowContainer2"] +unique_name_in_owner = true +custom_minimum_size = Vector2(400, 200) +layout_mode = 2 + +[node name="Item8Thumb" type="ColorRect" parent="TextureRect/MarginContainer/VBoxContainer/ColorRect2/MarginContainer/ReferenceRect/MarginContainer/VBoxContainer/VFlowContainer2"] +unique_name_in_owner = true +custom_minimum_size = Vector2(400, 200) +layout_mode = 2 + +[node name="VFlowContainer4" type="VFlowContainer" parent="TextureRect/MarginContainer/VBoxContainer/ColorRect2/MarginContainer/ReferenceRect/MarginContainer/VBoxContainer"] +layout_mode = 2 +theme_override_constants/h_separation = 25 + +[node name="CenterContainer" type="CenterContainer" parent="TextureRect/MarginContainer/VBoxContainer/ColorRect2/MarginContainer/ReferenceRect/MarginContainer/VBoxContainer/VFlowContainer4"] +custom_minimum_size = Vector2(400, 0) +layout_mode = 2 +size_flags_vertical = 3 + +[node name="Item5Label" type="Label" parent="TextureRect/MarginContainer/VBoxContainer/ColorRect2/MarginContainer/ReferenceRect/MarginContainer/VBoxContainer/VFlowContainer4/CenterContainer"] +unique_name_in_owner = true +layout_mode = 2 +text = "???" +label_settings = ExtResource("1_qekcq") + +[node name="CenterContainer2" type="CenterContainer" parent="TextureRect/MarginContainer/VBoxContainer/ColorRect2/MarginContainer/ReferenceRect/MarginContainer/VBoxContainer/VFlowContainer4"] +custom_minimum_size = Vector2(400, 0) +layout_mode = 2 +size_flags_vertical = 3 + +[node name="Item6Label" type="Label" parent="TextureRect/MarginContainer/VBoxContainer/ColorRect2/MarginContainer/ReferenceRect/MarginContainer/VBoxContainer/VFlowContainer4/CenterContainer2"] +unique_name_in_owner = true +layout_mode = 2 +text = "???" +label_settings = ExtResource("1_qekcq") + +[node name="CenterContainer3" type="CenterContainer" parent="TextureRect/MarginContainer/VBoxContainer/ColorRect2/MarginContainer/ReferenceRect/MarginContainer/VBoxContainer/VFlowContainer4"] +custom_minimum_size = Vector2(400, 0) +layout_mode = 2 +size_flags_vertical = 3 + +[node name="Item7Label" type="Label" parent="TextureRect/MarginContainer/VBoxContainer/ColorRect2/MarginContainer/ReferenceRect/MarginContainer/VBoxContainer/VFlowContainer4/CenterContainer3"] +unique_name_in_owner = true +layout_mode = 2 +text = "???" +label_settings = ExtResource("1_qekcq") + +[node name="CenterContainer4" type="CenterContainer" parent="TextureRect/MarginContainer/VBoxContainer/ColorRect2/MarginContainer/ReferenceRect/MarginContainer/VBoxContainer/VFlowContainer4"] +custom_minimum_size = Vector2(400, 0) +layout_mode = 2 +size_flags_vertical = 3 + +[node name="Item8Label" type="Label" parent="TextureRect/MarginContainer/VBoxContainer/ColorRect2/MarginContainer/ReferenceRect/MarginContainer/VBoxContainer/VFlowContainer4/CenterContainer4"] +unique_name_in_owner = true +layout_mode = 2 +text = "???" +label_settings = ExtResource("1_qekcq") diff --git a/Zennysoft.Game.Ma/src/ui/label_settings/HeadingFont.tres b/Zennysoft.Game.Ma/src/ui/label_settings/HeadingFont.tres index 41ab2c32..30e9bdd1 100644 --- a/Zennysoft.Game.Ma/src/ui/label_settings/HeadingFont.tres +++ b/Zennysoft.Game.Ma/src/ui/label_settings/HeadingFont.tres @@ -4,5 +4,5 @@ [resource] font = ExtResource("1_olalj") -font_size = 48 +font_size = 70 font_color = Color(0.737255, 0.705882, 0.690196, 1)