Interaction manager and hud

This commit is contained in:
Marco 2025-06-12 18:03:55 +02:00
commit 5271b84923
20 changed files with 539 additions and 29 deletions

View file

@ -1,5 +1,6 @@
using Godot;
using System;
using Cirno.Scripts;
using Cirno.Scripts.Resources;
using Cirno.Scripts.Resources.DebugMenu;
using Godot.Collections;

View file

@ -54,19 +54,24 @@ public partial class InventoryMenu : TabContainer
//ItemActivated += OnItemSelected;
GameManager.Instance.GameStateChange += state =>
// TODO: Move this on the game manager/controller side
if (GameManager.Instance is not null)
{
switch (state)
GameManager.Instance.GameStateChange += state =>
{
case GameState.Inventory:
CallDeferred(MethodName.ShowInventory);
break;
default:
CallDeferred(MethodName.HideInventory);
//HideInventory();
break;
}
};
switch (state)
{
case GameState.Inventory:
CallDeferred(MethodName.ShowInventory);
break;
default:
CallDeferred(MethodName.HideInventory);
//HideInventory();
break;
}
};
}
}
private void HideInventory()

6
Scripts/UI/Selector3D.cs Normal file
View file

@ -0,0 +1,6 @@
namespace Cirno.Scripts.UI;
public partial class Selector3D
{
}

View file

@ -0,0 +1 @@
uid://beow453jk88rq

View file

@ -24,11 +24,15 @@ public partial class StatusMenu : PanelContainer
public override void _ExitTree()
{
InventoryManager.Instance.ItemAdded -= InstanceOnItemAdded;
if (InventoryManager.Instance is not null)
{
InventoryManager.Instance.ItemAdded -= InstanceOnItemAdded;
}
}
private void InitializeDeferred()
{
if (InventoryManager.Instance is null) return;
var healthExpansions = InventoryManager.Instance.GetItemCount(HealthExpansionName);
var shieldExpansions = InventoryManager.Instance.GetItemCount(ShieldExpansionName);