Add more interactive effects to inventory menu
This commit is contained in:
@@ -7,10 +7,10 @@ using DialogueManagerRuntime;
|
||||
using Godot;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
public interface IGame : IProvide<IGameRepo>, INode3D
|
||||
public interface IGame : IProvide<IGameRepo>, IProvide<IGame>, INode3D
|
||||
{
|
||||
public void ToggleInventory();
|
||||
}
|
||||
|
||||
[Meta(typeof(IAutoNode))]
|
||||
@@ -20,6 +20,8 @@ public partial class Game : Node3D, IGame
|
||||
|
||||
IGameRepo IProvide<IGameRepo>.Value() => GameRepo;
|
||||
|
||||
IGame IProvide<IGame>.Value() => this;
|
||||
|
||||
public IInstantiator Instantiator { get; set; } = default!;
|
||||
|
||||
public IGameLogic GameLogic { get; set; } = default!;
|
||||
@@ -116,6 +118,11 @@ public partial class Game : Node3D, IGame
|
||||
this.Provide();
|
||||
}
|
||||
|
||||
public void ToggleInventory()
|
||||
{
|
||||
GameLogic.Input(new GameLogic.Input.InventoryMenuToggle());
|
||||
}
|
||||
|
||||
private void AnimationPlayer_AnimationStarted(StringName animName)
|
||||
{
|
||||
var newFloor = Floors.ElementAt(GameRepo.CurrentFloor + 1);
|
||||
@@ -130,21 +137,21 @@ public partial class Game : Node3D, IGame
|
||||
GameRepo.CurrentFloor++;
|
||||
}
|
||||
|
||||
public override void _Process(double delta)
|
||||
public override void _UnhandledInput(InputEvent @event)
|
||||
{
|
||||
if (Input.IsActionJustPressed(GameInputs.Inventory))
|
||||
if (@event.IsActionPressed(GameInputs.Inventory))
|
||||
{
|
||||
GD.Print("Inventory button pressed");
|
||||
GameLogic.Input(new GameLogic.Input.InventoryMenuButtonPressed());
|
||||
GameLogic.Input(new GameLogic.Input.InventoryMenuToggle());
|
||||
}
|
||||
|
||||
if (Input.IsActionJustPressed(GameInputs.MiniMap))
|
||||
if (@event.IsActionPressed(GameInputs.MiniMap))
|
||||
{
|
||||
GD.Print("MiniMap button pressed");
|
||||
GameLogic.Input(new GameLogic.Input.MiniMapButtonPressed());
|
||||
}
|
||||
|
||||
if (Input.IsActionJustReleased(GameInputs.MiniMap))
|
||||
if (@event.IsActionReleased(GameInputs.MiniMap))
|
||||
{
|
||||
GD.Print("MiniMap button released");
|
||||
GameLogic.Input(new GameLogic.Input.MiniMapButtonReleased());
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
public readonly record struct Initialize;
|
||||
|
||||
public readonly record struct InventoryMenuButtonPressed;
|
||||
public readonly record struct InventoryMenuToggle;
|
||||
|
||||
public readonly record struct MiniMapButtonPressed;
|
||||
|
||||
|
||||
@@ -8,14 +8,14 @@ namespace GameJamDungeon
|
||||
public partial record State
|
||||
{
|
||||
[Meta]
|
||||
public partial record InventoryOpened : State, IGet<Input.InventoryMenuButtonPressed>
|
||||
public partial record InventoryOpened : State, IGet<Input.InventoryMenuToggle>
|
||||
{
|
||||
public InventoryOpened()
|
||||
{
|
||||
this.OnEnter(() => { Get<IGameRepo>().Pause(); Output(new Output.SetInventoryMode(Get<IGameRepo>().InventoryItems.Value)); });
|
||||
this.OnExit(() => { Get<IGameRepo>().Resume(); Output(new Output.HideInventory()); });
|
||||
}
|
||||
public Transition On(in Input.InventoryMenuButtonPressed input) => To<Playing>();
|
||||
public Transition On(in Input.InventoryMenuToggle input) => To<Playing>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace GameJamDungeon
|
||||
public partial record State
|
||||
{
|
||||
[Meta]
|
||||
public partial record Paused : State, IGet<Input.InventoryMenuButtonPressed>, IGet<Input.MiniMapButtonReleased>
|
||||
public partial record Paused : State, IGet<Input.InventoryMenuToggle>, IGet<Input.MiniMapButtonReleased>
|
||||
{
|
||||
public Paused()
|
||||
{
|
||||
@@ -17,7 +17,7 @@ namespace GameJamDungeon
|
||||
}
|
||||
|
||||
|
||||
public virtual Transition On(in Input.InventoryMenuButtonPressed input) => To<Playing>();
|
||||
public virtual Transition On(in Input.InventoryMenuToggle input) => To<Playing>();
|
||||
|
||||
public virtual Transition On(in Input.MiniMapButtonReleased input) => To<Playing>();
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace GameJamDungeon
|
||||
public partial record State
|
||||
{
|
||||
[Meta]
|
||||
public partial record Playing : State, IGet<Input.InventoryMenuButtonPressed>, IGet<Input.MiniMapButtonPressed>, IGet<Input.GameOver>, IGet<Input.LoadNextFloor>
|
||||
public partial record Playing : State, IGet<Input.InventoryMenuToggle>, IGet<Input.MiniMapButtonPressed>, IGet<Input.GameOver>, IGet<Input.LoadNextFloor>
|
||||
{
|
||||
public Playing()
|
||||
{
|
||||
@@ -20,7 +20,7 @@ namespace GameJamDungeon
|
||||
|
||||
public void OnEnded() => Input(new Input.GameOver());
|
||||
|
||||
public Transition On(in Input.InventoryMenuButtonPressed input) => To<InventoryOpened>();
|
||||
public Transition On(in Input.InventoryMenuToggle input) => To<InventoryOpened>();
|
||||
|
||||
public Transition On(in Input.MiniMapButtonPressed input) => To<MinimapOpen>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user