24 lines
674 B
C#
24 lines
674 B
C#
using Godot;
|
|
using Newlon.Components.GUI.Seedpackets;
|
|
|
|
namespace Newlon.Components.GUI;
|
|
|
|
public partial class GridLoader : GridContainer
|
|
{
|
|
private const string PLANT_RESOURCE_PATH = "res://resources/plants/";
|
|
private PackedScene _plantCard;
|
|
|
|
public override void _Ready()
|
|
{
|
|
_plantCard = ResourceLoader.Load<PackedScene>("res://scenes/gui/seedpacket.tscn");
|
|
|
|
foreach(var resource in GameRegistry.GetPlants())
|
|
{
|
|
Seedpacket slot = _plantCard.Instantiate<Seedpacket>();
|
|
AddChild(slot);
|
|
|
|
slot.SetResource(resource);
|
|
slot.SetHandler(new ChoosableHandler(slot));
|
|
}
|
|
}
|
|
}
|