Add more interactive effects to inventory menu

This commit is contained in:
2024-09-10 19:40:19 -07:00
parent 081bde1d9a
commit d854f159b4
21 changed files with 279 additions and 112 deletions

View File

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