mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-08 07:55:54 +00:00
Debug menu items spawn buttons
This commit is contained in:
parent
6bf12a021f
commit
4c58436a74
9 changed files with 216 additions and 33 deletions
25
Scripts/UI/DebugItemButton.cs
Normal file
25
Scripts/UI/DebugItemButton.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue