using System;
using System.Text.RegularExpressions;
using ColdMint.scripts.item;
using ColdMint.scripts.utils;
using Godot;
namespace ColdMint.scripts.inventory;
///
/// A slot in the inventory
/// 物品栏内的一个插槽
///
public partial class ItemSlotNode : MarginContainer
{
private TextureRect? _backgroundTextureRect;
private TextureRect? _iconTextureRect;
private Label? _quantityLabel;
private Control? _control;
private bool _isSelect;
private Texture2D? _backgroundTexture;
private Texture2D? _backgroundTextureWhenSelect;
private IItem? _item;
public IItem? Item
{
set
{
//Set item
//设置物品
_item = value;
UpdateAllDisplay();
}
}
public override void _Ready()
{
_backgroundTexture = GD.Load("res://sprites/ui/ItemBarEmpty.png");
_backgroundTextureWhenSelect = GD.Load("res://sprites/ui/ItemBarFocus.png");
_backgroundTextureRect =
GetNode("BackgroundTexture");
_iconTextureRect = GetNode("BackgroundTexture/IconTextureRect");
_quantityLabel = GetNode