Debug menu items spawn buttons

This commit is contained in:
Marco 2025-05-20 17:46:35 +02:00
commit 4c58436a74
9 changed files with 216 additions and 33 deletions

View file

@ -0,0 +1,25 @@
using Cirno.Scripts.Resources;
using Godot;
namespace Cirno.Scripts.UI;
[Tool]
public partial class DebugItemButton : Button
{
[Export] public LootItem Item { get; set; }
public override void _Ready()
{
if (Item is null) return;
this.Icon = Item.InventorySprite;
if (Engine.IsEditorHint()) return;
this.Pressed += OnPressed;
}
private void OnPressed()
{
if (Engine.IsEditorHint()) return;
InventoryManager.Instance.AddItem(Item);
}
}