Traveller/scripts/inventory/ItemSlotContainerDisplay.cs
Cold-Mint 929dfb5f2f
Unified Resource loading api, projectile weapon allows to configure spells.
统一资源加载的api,抛射体武器允许配置法术。
2024-10-09 10:49:10 +08:00

26 lines
690 B
C#

using ColdMint.scripts.utils;
using Godot;
namespace ColdMint.scripts.inventory;
public class ItemSlotContainerDisplay(Node rootNode) : ItemContainerDisplayTemplate
{
private readonly PackedScene? _packedScene = ResourceLoader.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);
}
}