28 lines
749 B
C#
28 lines
749 B
C#
using Godot;
|
|
using Newlon.Components.GUI.Seedpackets;
|
|
|
|
namespace Newlon.Components.GUI;
|
|
|
|
public partial class GridLoader : GridContainer
|
|
{
|
|
private PackedScene _plantCard;
|
|
const string SEEDPACKED_UID = "uid://e7vutg71l6f2";
|
|
public override void _Ready()
|
|
{
|
|
_plantCard = ResourceLoader.Load<PackedScene>(SEEDPACKED_UID);
|
|
|
|
var list = PlayerProgress.Instance.PlayerPlants;
|
|
list.Sort((a, b) =>
|
|
{
|
|
return a.Order - b.Order;
|
|
});
|
|
foreach (var resource in list)
|
|
{
|
|
Seedpacket slot = _plantCard.Instantiate<Seedpacket>();
|
|
AddChild(slot);
|
|
|
|
slot.SetResource(resource);
|
|
slot.SetHandler(new ChoosableHandler(slot));
|
|
}
|
|
}
|
|
}
|