Add minimap to sidebar
This commit is contained in:
@@ -16,8 +16,6 @@ public partial class GameState
|
|||||||
|
|
||||||
public readonly record struct InventoryButtonPressed;
|
public readonly record struct InventoryButtonPressed;
|
||||||
|
|
||||||
public readonly record struct MiniMapButtonPressed;
|
|
||||||
|
|
||||||
public readonly record struct PauseButtonPressed;
|
public readonly record struct PauseButtonPressed;
|
||||||
|
|
||||||
public readonly record struct DebugButtonPressed;
|
public readonly record struct DebugButtonPressed;
|
||||||
|
|||||||
@@ -12,10 +12,6 @@ public partial class GameState
|
|||||||
|
|
||||||
public readonly record struct CloseInventoryMenu;
|
public readonly record struct CloseInventoryMenu;
|
||||||
|
|
||||||
public readonly record struct OpenMiniMap;
|
|
||||||
|
|
||||||
public readonly record struct CloseMiniMap;
|
|
||||||
|
|
||||||
public readonly record struct OpenPauseScreen;
|
public readonly record struct OpenPauseScreen;
|
||||||
|
|
||||||
public readonly record struct ClosePauseScreen;
|
public readonly record struct ClosePauseScreen;
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ public partial class GameState
|
|||||||
[Meta, LogicBlock(typeof(State), Diagram = true)]
|
[Meta, LogicBlock(typeof(State), Diagram = true)]
|
||||||
public partial record InGame : State,
|
public partial record InGame : State,
|
||||||
IGet<Input.InventoryButtonPressed>,
|
IGet<Input.InventoryButtonPressed>,
|
||||||
IGet<Input.MiniMapButtonPressed>,
|
|
||||||
IGet<Input.PauseButtonPressed>,
|
IGet<Input.PauseButtonPressed>,
|
||||||
IGet<Input.DebugButtonPressed>,
|
IGet<Input.DebugButtonPressed>,
|
||||||
IGet<Input.FloorExitEntered>,
|
IGet<Input.FloorExitEntered>,
|
||||||
@@ -22,12 +21,6 @@ public partial class GameState
|
|||||||
return To<InventoryScreen>();
|
return To<InventoryScreen>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Transition On(in Input.MiniMapButtonPressed input)
|
|
||||||
{
|
|
||||||
Output(new Output.OpenMiniMap());
|
|
||||||
return To<MiniMapScreen>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Transition On(in Input.PauseButtonPressed input)
|
public Transition On(in Input.PauseButtonPressed input)
|
||||||
{
|
{
|
||||||
Output(new Output.OpenPauseScreen());
|
Output(new Output.OpenPauseScreen());
|
||||||
|
|||||||
@@ -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>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -3,8 +3,6 @@ public partial class InGameUILogic
|
|||||||
{
|
{
|
||||||
public static class Input
|
public static class Input
|
||||||
{
|
{
|
||||||
public readonly record struct ShowMinimap;
|
|
||||||
public readonly record struct HideMinimap;
|
|
||||||
public readonly record struct ShowInventory;
|
public readonly record struct ShowInventory;
|
||||||
public readonly record struct HideInventory;
|
public readonly record struct HideInventory;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,8 +8,6 @@ public partial class InGameUILogic
|
|||||||
public readonly record struct AnnounceMessageOnMainScreen(string Message);
|
public readonly record struct AnnounceMessageOnMainScreen(string Message);
|
||||||
public readonly record struct AnnounceMessageInInventory(string Message);
|
public readonly record struct AnnounceMessageInInventory(string Message);
|
||||||
public readonly record struct RemoveItemFromInventory(InventoryItem Item);
|
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 ShowInventory;
|
||||||
public readonly record struct HideInventory;
|
public readonly record struct HideInventory;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,9 +7,8 @@ public partial class InGameUILogic
|
|||||||
public partial record State
|
public partial record State
|
||||||
{
|
{
|
||||||
[Meta]
|
[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>();
|
public Transition On(in Input.ShowInventory input) => To<InventoryOpen>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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)
|
, 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={
|
Inventory={
|
||||||
"deadzone": 0.5,
|
"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)
|
"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)
|
, 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]
|
[internationalization]
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public partial class DataViewer : Control
|
|||||||
|
|
||||||
if (Input.IsActionJustPressed(GameInputs.Attack))
|
if (Input.IsActionJustPressed(GameInputs.Attack))
|
||||||
_currentModel.PlayPrimaryAttackAnimation();
|
_currentModel.PlayPrimaryAttackAnimation();
|
||||||
if (Input.IsActionJustPressed(GameInputs.MiniMap))
|
if (Input.IsActionJustPressed(GameInputs.AltAttack))
|
||||||
_currentModel.PlaySecondaryAttackAnimation();
|
_currentModel.PlaySecondaryAttackAnimation();
|
||||||
if (Input.IsActionJustPressed(GameInputs.Inventory) && _currentModel is ICanActivate canActivate)
|
if (Input.IsActionJustPressed(GameInputs.Inventory) && _currentModel is ICanActivate canActivate)
|
||||||
canActivate.Activate();
|
canActivate.Activate();
|
||||||
|
|||||||
@@ -189,16 +189,6 @@ public partial class Game : Node3D, IGame
|
|||||||
InGameUI.InventoryMenu.Hide();
|
InGameUI.InventoryMenu.Hide();
|
||||||
InGameUI.InventoryMenu.SetProcessInput(false);
|
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 _) =>
|
.Handle((in GameState.Output.OpenDebugMenu _) =>
|
||||||
{
|
{
|
||||||
InGameUI.DebugMenu.Show();
|
InGameUI.DebugMenu.Show();
|
||||||
|
|||||||
@@ -8,9 +8,11 @@ process_mode = 3
|
|||||||
light_mask = 2
|
light_mask = 2
|
||||||
visibility_layer = 2
|
visibility_layer = 2
|
||||||
layout_mode = 3
|
layout_mode = 3
|
||||||
anchors_preset = 15
|
anchors_preset = 8
|
||||||
anchor_right = 1.0
|
anchor_left = 0.5
|
||||||
anchor_bottom = 1.0
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
|
|
||||||
@@ -23,13 +25,13 @@ grow_horizontal = 2
|
|||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
|
|
||||||
[node name="SubViewportContainer" type="SubViewportContainer" parent="CenterContainer"]
|
[node name="SubViewportContainer" type="SubViewportContainer" parent="CenterContainer"]
|
||||||
custom_minimum_size = Vector2(800, 800)
|
custom_minimum_size = Vector2(300, 300)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
[node name="SubViewport" type="SubViewport" parent="CenterContainer/SubViewportContainer"]
|
[node name="SubViewport" type="SubViewport" parent="CenterContainer/SubViewportContainer"]
|
||||||
transparent_bg = true
|
transparent_bg = true
|
||||||
handle_input_locally = false
|
handle_input_locally = false
|
||||||
size = Vector2i(800, 800)
|
size = Vector2i(500, 500)
|
||||||
render_target_update_mode = 4
|
render_target_update_mode = 4
|
||||||
|
|
||||||
[node name="Minimap Camera" type="Camera3D" parent="CenterContainer/SubViewportContainer/SubViewport"]
|
[node name="Minimap Camera" type="Camera3D" parent="CenterContainer/SubViewportContainer/SubViewport"]
|
||||||
|
|||||||
@@ -48,8 +48,6 @@ public partial class InGameUI : Control, IInGameUI
|
|||||||
.Handle((in InGameUILogic.Output.AnnounceMessageOnMainScreen output) => { InventoryMessageUI.DisplayMessage(output.Message); })
|
.Handle((in InGameUILogic.Output.AnnounceMessageOnMainScreen output) => { InventoryMessageUI.DisplayMessage(output.Message); })
|
||||||
.Handle((in InGameUILogic.Output.AnnounceMessageInInventory output) => { InventoryMenu.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.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.ShowInventory _) => { InventoryMenu.RefreshInventoryScreen(); InventoryMenu.Show(); InventoryMenu.SetProcessInput(true); })
|
||||||
.Handle((in InGameUILogic.Output.HideInventory _) => { CloseInventory(); });
|
.Handle((in InGameUILogic.Output.HideInventory _) => { CloseInventory(); });
|
||||||
|
|
||||||
@@ -64,17 +62,6 @@ public partial class InGameUI : Control, IInGameUI
|
|||||||
|
|
||||||
public override void _UnhandledInput(InputEvent @event)
|
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))
|
if (@event.IsActionPressed(GameInputs.Inventory))
|
||||||
{
|
{
|
||||||
GD.Print("Inventory button pressed");
|
GD.Print("Inventory button pressed");
|
||||||
|
|||||||
@@ -106,7 +106,6 @@ size_flags_vertical = 3
|
|||||||
|
|
||||||
[node name="MiniMap" parent="HBoxContainer/Panel/MarginContainer/VBoxContainer" instance=ExtResource("2_6sfje")]
|
[node name="MiniMap" parent="HBoxContainer/Panel/MarginContainer/VBoxContainer" instance=ExtResource("2_6sfje")]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
visible = false
|
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
[node name="Sigil Marker" type="ReferenceRect" parent="HBoxContainer/Panel/MarginContainer/VBoxContainer"]
|
[node name="Sigil Marker" type="ReferenceRect" parent="HBoxContainer/Panel/MarginContainer/VBoxContainer"]
|
||||||
|
|||||||
Reference in New Issue
Block a user