From 953cba40c67f1d0debb1009fb1be4f9a803c98c9 Mon Sep 17 00:00:00 2001 From: Zenny Date: Fri, 8 Aug 2025 23:43:57 -0700 Subject: [PATCH] Add minimap to sidebar --- .../Game/state/GameState.Input.cs | 2 -- .../Game/state/GameState.Output.cs | 4 ---- .../gamestates/GameState.State.InGame..cs | 7 ------- .../GameState.State.MiniMapScreen..cs | 20 ------------------ .../UI/InGameUI/state/InGameUILogic.Input.cs | 2 -- .../UI/InGameUI/state/InGameUILogic.Output.cs | 2 -- .../state/States/InGameUI.State.Active.cs | 3 +-- .../States/InGameUI.State.MinimapOpen.cs | 21 ------------------- Zennysoft.Game.Ma/project.godot | 11 +++++----- .../src/data_viewer/DataViewer.cs | 2 +- Zennysoft.Game.Ma/src/game/Game.cs | 10 --------- Zennysoft.Game.Ma/src/minimap/Minimap.tscn | 12 ++++++----- .../src/ui/in_game_ui/InGameUI.cs | 13 ------------ .../src/ui/in_game_ui/InGameUI.tscn | 1 - 14 files changed, 14 insertions(+), 96 deletions(-) delete mode 100644 Zennysoft.Game.Ma.Implementation/Game/state/gamestates/GameState.State.MiniMapScreen..cs delete mode 100644 Zennysoft.Game.Ma.Implementation/UI/InGameUI/state/States/InGameUI.State.MinimapOpen.cs diff --git a/Zennysoft.Game.Ma.Implementation/Game/state/GameState.Input.cs b/Zennysoft.Game.Ma.Implementation/Game/state/GameState.Input.cs index 1d586ee9..febc8928 100644 --- a/Zennysoft.Game.Ma.Implementation/Game/state/GameState.Input.cs +++ b/Zennysoft.Game.Ma.Implementation/Game/state/GameState.Input.cs @@ -16,8 +16,6 @@ public partial class GameState public readonly record struct InventoryButtonPressed; - public readonly record struct MiniMapButtonPressed; - public readonly record struct PauseButtonPressed; public readonly record struct DebugButtonPressed; diff --git a/Zennysoft.Game.Ma.Implementation/Game/state/GameState.Output.cs b/Zennysoft.Game.Ma.Implementation/Game/state/GameState.Output.cs index 0a4cd8c7..dfbfc140 100644 --- a/Zennysoft.Game.Ma.Implementation/Game/state/GameState.Output.cs +++ b/Zennysoft.Game.Ma.Implementation/Game/state/GameState.Output.cs @@ -12,10 +12,6 @@ public partial class GameState public readonly record struct CloseInventoryMenu; - public readonly record struct OpenMiniMap; - - public readonly record struct CloseMiniMap; - public readonly record struct OpenPauseScreen; public readonly record struct ClosePauseScreen; diff --git a/Zennysoft.Game.Ma.Implementation/Game/state/gamestates/GameState.State.InGame..cs b/Zennysoft.Game.Ma.Implementation/Game/state/gamestates/GameState.State.InGame..cs index cffde3ca..6aab56b1 100644 --- a/Zennysoft.Game.Ma.Implementation/Game/state/gamestates/GameState.State.InGame..cs +++ b/Zennysoft.Game.Ma.Implementation/Game/state/gamestates/GameState.State.InGame..cs @@ -10,7 +10,6 @@ public partial class GameState [Meta, LogicBlock(typeof(State), Diagram = true)] public partial record InGame : State, IGet, - IGet, IGet, IGet, IGet, @@ -22,12 +21,6 @@ public partial class GameState return To(); } - public Transition On(in Input.MiniMapButtonPressed input) - { - Output(new Output.OpenMiniMap()); - return To(); - } - public Transition On(in Input.PauseButtonPressed input) { Output(new Output.OpenPauseScreen()); diff --git a/Zennysoft.Game.Ma.Implementation/Game/state/gamestates/GameState.State.MiniMapScreen..cs b/Zennysoft.Game.Ma.Implementation/Game/state/gamestates/GameState.State.MiniMapScreen..cs deleted file mode 100644 index 766492e7..00000000 --- a/Zennysoft.Game.Ma.Implementation/Game/state/gamestates/GameState.State.MiniMapScreen..cs +++ /dev/null @@ -1,20 +0,0 @@ -using Chickensoft.Introspection; -using Chickensoft.LogicBlocks; - -namespace Zennysoft.Ma.Adapter; - -public partial class GameState -{ - public partial record State - { - [Meta, LogicBlock(typeof(State), Diagram = true)] - public partial record MiniMapScreen : State, IGet - { - public Transition On(in Input.MiniMapButtonPressed input) - { - Output(new Output.CloseMiniMap()); - return To(); - } - } - } -} diff --git a/Zennysoft.Game.Ma.Implementation/UI/InGameUI/state/InGameUILogic.Input.cs b/Zennysoft.Game.Ma.Implementation/UI/InGameUI/state/InGameUILogic.Input.cs index 1b263ba3..89ec244e 100644 --- a/Zennysoft.Game.Ma.Implementation/UI/InGameUI/state/InGameUILogic.Input.cs +++ b/Zennysoft.Game.Ma.Implementation/UI/InGameUI/state/InGameUILogic.Input.cs @@ -3,8 +3,6 @@ public partial class InGameUILogic { public static class Input { - public readonly record struct ShowMinimap; - public readonly record struct HideMinimap; public readonly record struct ShowInventory; public readonly record struct HideInventory; } diff --git a/Zennysoft.Game.Ma.Implementation/UI/InGameUI/state/InGameUILogic.Output.cs b/Zennysoft.Game.Ma.Implementation/UI/InGameUI/state/InGameUILogic.Output.cs index a017a4fe..97bcb9a6 100644 --- a/Zennysoft.Game.Ma.Implementation/UI/InGameUI/state/InGameUILogic.Output.cs +++ b/Zennysoft.Game.Ma.Implementation/UI/InGameUI/state/InGameUILogic.Output.cs @@ -8,8 +8,6 @@ public partial class InGameUILogic public readonly record struct AnnounceMessageOnMainScreen(string Message); public readonly record struct AnnounceMessageInInventory(string Message); public readonly record struct RemoveItemFromInventory(InventoryItem Item); - public readonly record struct DisplayMinimap; - public readonly record struct HideMinimap; public readonly record struct ShowInventory; public readonly record struct HideInventory; } diff --git a/Zennysoft.Game.Ma.Implementation/UI/InGameUI/state/States/InGameUI.State.Active.cs b/Zennysoft.Game.Ma.Implementation/UI/InGameUI/state/States/InGameUI.State.Active.cs index 463d8c90..66782489 100644 --- a/Zennysoft.Game.Ma.Implementation/UI/InGameUI/state/States/InGameUI.State.Active.cs +++ b/Zennysoft.Game.Ma.Implementation/UI/InGameUI/state/States/InGameUI.State.Active.cs @@ -7,9 +7,8 @@ public partial class InGameUILogic public partial record State { [Meta] - public partial record Active : State, IGet, IGet + public partial record Active : State, IGet { - public Transition On(in Input.ShowMinimap input) => To(); public Transition On(in Input.ShowInventory input) => To(); } } diff --git a/Zennysoft.Game.Ma.Implementation/UI/InGameUI/state/States/InGameUI.State.MinimapOpen.cs b/Zennysoft.Game.Ma.Implementation/UI/InGameUI/state/States/InGameUI.State.MinimapOpen.cs deleted file mode 100644 index 5dc70509..00000000 --- a/Zennysoft.Game.Ma.Implementation/UI/InGameUI/state/States/InGameUI.State.MinimapOpen.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Chickensoft.Introspection; - -namespace Zennysoft.Ma.Adapter; - -public partial class InGameUILogic -{ - public partial record State - { - [Meta] - public partial record MinimapOpen : State, IGet - { - public MinimapOpen() - { - OnAttach(() => { Get().Pause(); Output(new Output.DisplayMinimap()); }); - OnDetach(() => { Get().Resume(); Output(new Output.HideMinimap()); }); - } - - public Transition On(in Input.HideMinimap input) => To(); - } - } -} diff --git a/Zennysoft.Game.Ma/project.godot b/Zennysoft.Game.Ma/project.godot index 6c617e93..ebcb8a8f 100644 --- a/Zennysoft.Game.Ma/project.godot +++ b/Zennysoft.Game.Ma/project.godot @@ -141,12 +141,6 @@ Sprint={ , Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":7,"pressure":0.0,"pressed":true,"script":null) ] } -MiniMap={ -"deadzone": 0.5, -"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194306,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) -, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":2,"pressure":0.0,"pressed":false,"script":null) -] -} Inventory={ "deadzone": 0.5, "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":69,"key_label":0,"unicode":101,"location":0,"echo":false,"script":null) @@ -209,6 +203,11 @@ Debug={ , Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":45,"key_label":0,"unicode":45,"location":0,"echo":false,"script":null) ] } +AltAttack={ +"deadzone": 0.2, +"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":2,"canceled":false,"pressed":false,"double_click":false,"script":null) +] +} [internationalization] diff --git a/Zennysoft.Game.Ma/src/data_viewer/DataViewer.cs b/Zennysoft.Game.Ma/src/data_viewer/DataViewer.cs index 1f25e668..ce0456b3 100644 --- a/Zennysoft.Game.Ma/src/data_viewer/DataViewer.cs +++ b/Zennysoft.Game.Ma/src/data_viewer/DataViewer.cs @@ -56,7 +56,7 @@ public partial class DataViewer : Control if (Input.IsActionJustPressed(GameInputs.Attack)) _currentModel.PlayPrimaryAttackAnimation(); - if (Input.IsActionJustPressed(GameInputs.MiniMap)) + if (Input.IsActionJustPressed(GameInputs.AltAttack)) _currentModel.PlaySecondaryAttackAnimation(); if (Input.IsActionJustPressed(GameInputs.Inventory) && _currentModel is ICanActivate canActivate) canActivate.Activate(); diff --git a/Zennysoft.Game.Ma/src/game/Game.cs b/Zennysoft.Game.Ma/src/game/Game.cs index 851b56fe..0d9bcfd0 100644 --- a/Zennysoft.Game.Ma/src/game/Game.cs +++ b/Zennysoft.Game.Ma/src/game/Game.cs @@ -189,16 +189,6 @@ public partial class Game : Node3D, IGame InGameUI.InventoryMenu.Hide(); InGameUI.InventoryMenu.SetProcessInput(false); }) - .Handle((in GameState.Output.OpenMiniMap _) => - { - InGameUI.MiniMap.SetProcessUnhandledInput(true); - InGameUI.MiniMap.Show(); - }) - .Handle((in GameState.Output.CloseMiniMap _) => - { - InGameUI.MiniMap.SetProcessUnhandledInput(false); - InGameUI.MiniMap.Hide(); - }) .Handle((in GameState.Output.OpenDebugMenu _) => { InGameUI.DebugMenu.Show(); diff --git a/Zennysoft.Game.Ma/src/minimap/Minimap.tscn b/Zennysoft.Game.Ma/src/minimap/Minimap.tscn index 87489f76..13740966 100644 --- a/Zennysoft.Game.Ma/src/minimap/Minimap.tscn +++ b/Zennysoft.Game.Ma/src/minimap/Minimap.tscn @@ -8,9 +8,11 @@ process_mode = 3 light_mask = 2 visibility_layer = 2 layout_mode = 3 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 grow_horizontal = 2 grow_vertical = 2 @@ -23,13 +25,13 @@ grow_horizontal = 2 grow_vertical = 2 [node name="SubViewportContainer" type="SubViewportContainer" parent="CenterContainer"] -custom_minimum_size = Vector2(800, 800) +custom_minimum_size = Vector2(300, 300) layout_mode = 2 [node name="SubViewport" type="SubViewport" parent="CenterContainer/SubViewportContainer"] transparent_bg = true handle_input_locally = false -size = Vector2i(800, 800) +size = Vector2i(500, 500) render_target_update_mode = 4 [node name="Minimap Camera" type="Camera3D" parent="CenterContainer/SubViewportContainer/SubViewport"] diff --git a/Zennysoft.Game.Ma/src/ui/in_game_ui/InGameUI.cs b/Zennysoft.Game.Ma/src/ui/in_game_ui/InGameUI.cs index 69c66994..8505774f 100644 --- a/Zennysoft.Game.Ma/src/ui/in_game_ui/InGameUI.cs +++ b/Zennysoft.Game.Ma/src/ui/in_game_ui/InGameUI.cs @@ -48,8 +48,6 @@ public partial class InGameUI : Control, IInGameUI .Handle((in InGameUILogic.Output.AnnounceMessageOnMainScreen output) => { InventoryMessageUI.DisplayMessage(output.Message); }) .Handle((in InGameUILogic.Output.AnnounceMessageInInventory output) => { InventoryMenu.DisplayMessage(output.Message); }) .Handle((in InGameUILogic.Output.RemoveItemFromInventory output) => { InventoryMenu.RemoveItem(output.Item); }) - .Handle((in InGameUILogic.Output.DisplayMinimap _) => { MiniMap.SetProcessUnhandledInput(true); MiniMap.Show(); }) - .Handle((in InGameUILogic.Output.HideMinimap _) => { MiniMap.SetProcessUnhandledInput(false); MiniMap.Hide(); }) .Handle((in InGameUILogic.Output.ShowInventory _) => { InventoryMenu.RefreshInventoryScreen(); InventoryMenu.Show(); InventoryMenu.SetProcessInput(true); }) .Handle((in InGameUILogic.Output.HideInventory _) => { CloseInventory(); }); @@ -64,17 +62,6 @@ public partial class InGameUI : Control, IInGameUI public override void _UnhandledInput(InputEvent @event) { - if (@event.IsActionPressed(GameInputs.MiniMap)) - { - GD.Print("MiniMap button pressed"); - InGameUILogic.Input(new InGameUILogic.Input.ShowMinimap()); - } - if (@event.IsActionReleased(GameInputs.MiniMap)) - { - GD.Print("MiniMap button released"); - InGameUILogic.Input(new InGameUILogic.Input.HideMinimap()); - } - if (@event.IsActionPressed(GameInputs.Inventory)) { GD.Print("Inventory button pressed"); diff --git a/Zennysoft.Game.Ma/src/ui/in_game_ui/InGameUI.tscn b/Zennysoft.Game.Ma/src/ui/in_game_ui/InGameUI.tscn index 28f7c057..392dfe48 100644 --- a/Zennysoft.Game.Ma/src/ui/in_game_ui/InGameUI.tscn +++ b/Zennysoft.Game.Ma/src/ui/in_game_ui/InGameUI.tscn @@ -106,7 +106,6 @@ size_flags_vertical = 3 [node name="MiniMap" parent="HBoxContainer/Panel/MarginContainer/VBoxContainer" instance=ExtResource("2_6sfje")] unique_name_in_owner = true -visible = false layout_mode = 2 [node name="Sigil Marker" type="ReferenceRect" parent="HBoxContainer/Panel/MarginContainer/VBoxContainer"]