Item HUD management

This commit is contained in:
Marco 2025-01-31 13:03:38 +01:00
commit 13c4489017
17 changed files with 215 additions and 44 deletions

View file

@ -1,12 +1,13 @@
using Godot;
using System;
using Cirno.Scripts.Resources;
public partial class Hud : CanvasLayer
{
[Signal]
public delegate void StartGameEventHandler();
private Label _healthLabel;
//private Label _healthLabel;
[Export]
public PackedScene SelectorScene { get; set; }
@ -14,10 +15,13 @@ public partial class Hud : CanvasLayer
[Export]
private Node2D _selector;
[Export] private Label _healthLabel;
[Export] private Container _itemsContainer;
public override void _Ready()
{
// Assuming the HUD has a Label node named "HealthLabel"
_healthLabel = GetNode<Label>("HealthLabel");
//_healthLabel = GetNode<Label>("HealthLabel");
}
public void ShowMessage(string text)
@ -56,4 +60,17 @@ public partial class Hud : CanvasLayer
//_selector.Position = _selector.tolo
}
public void AddInventoryItem(LootItem item)
{
TextureRect texture = new TextureRect();
texture.Texture = item.InventorySprite;
_itemsContainer.AddChild(texture);
}
public void RemoveInventoryItem(LootItem item)
{
}
}