Add minimap to sidebar

This commit is contained in:
2025-08-08 23:43:57 -07:00
parent bd6794dafd
commit 953cba40c6
14 changed files with 14 additions and 96 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -10,7 +10,6 @@ public partial class GameState
[Meta, LogicBlock(typeof(State), Diagram = true)]
public partial record InGame : State,
IGet<Input.InventoryButtonPressed>,
IGet<Input.MiniMapButtonPressed>,
IGet<Input.PauseButtonPressed>,
IGet<Input.DebugButtonPressed>,
IGet<Input.FloorExitEntered>,
@@ -22,12 +21,6 @@ public partial class GameState
return To<InventoryScreen>();
}
public Transition On(in Input.MiniMapButtonPressed input)
{
Output(new Output.OpenMiniMap());
return To<MiniMapScreen>();
}
public Transition On(in Input.PauseButtonPressed input)
{
Output(new Output.OpenPauseScreen());

View File

@@ -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<Input.MiniMapButtonPressed>
{
public Transition On(in Input.MiniMapButtonPressed input)
{
Output(new Output.CloseMiniMap());
return To<InGame>();
}
}
}
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -7,9 +7,8 @@ public partial class InGameUILogic
public partial record State
{
[Meta]
public partial record Active : State, IGet<Input.ShowMinimap>, IGet<Input.ShowInventory>
public partial record Active : State, IGet<Input.ShowInventory>
{
public Transition On(in Input.ShowMinimap input) => To<MinimapOpen>();
public Transition On(in Input.ShowInventory input) => To<InventoryOpen>();
}
}

View File

@@ -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<Input.HideMinimap>
{
public MinimapOpen()
{
OnAttach(() => { Get<IGameRepo>().Pause(); Output(new Output.DisplayMinimap()); });
OnDetach(() => { Get<IGameRepo>().Resume(); Output(new Output.HideMinimap()); });
}
public Transition On(in Input.HideMinimap input) => To<Active>();
}
}
}

View File

@@ -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]

View File

@@ -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();

View File

@@ -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();

View File

@@ -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"]

View File

@@ -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");

View File

@@ -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"]