Traveller/scripts/inventory/ItemSlotContainerDisplay.cs
Cold-Mint 234241b74a
Bind the item container to the item container display.
将物品容器和物品容器显示器绑定。
2024-09-22 23:13:59 +08:00

26 lines
678 B
C#

using ColdMint.scripts.utils;
using Godot;
namespace ColdMint.scripts.inventory;
public class ItemSlotContainerDisplay(Node rootNode) : ItemContainerDisplayTemplate
{
private readonly PackedScene? _packedScene = GD.Load<PackedScene>("res://prefab/ui/ItemSlot.tscn");
protected override void AddItemDisplay()
{
if (_packedScene == null)
{
return;
}
var itemSlotNode = NodeUtils.InstantiatePackedScene<ItemSlotNode>(_packedScene);
if (itemSlotNode == null)
{
return;
}
ItemDisplayList.Add(itemSlotNode);
NodeUtils.CallDeferredAddChild(rootNode, itemSlotNode);
}
}