Fixed grid not being sorted
This commit is contained in:
parent
8b2b904834
commit
2295f52ba8
1 changed files with 7 additions and 2 deletions
|
|
@ -12,11 +12,16 @@ public partial class GridLoader : GridContainer
|
||||||
{
|
{
|
||||||
_plantCard = ResourceLoader.Load<PackedScene>("res://scenes/gui/seedpacket.tscn");
|
_plantCard = ResourceLoader.Load<PackedScene>("res://scenes/gui/seedpacket.tscn");
|
||||||
|
|
||||||
foreach(var resource in GameRegistry.GetPlants())
|
var list = GameRegistry.GetPlants();
|
||||||
|
list.Sort((a, b) =>
|
||||||
|
{
|
||||||
|
return a.Order - b.Order;
|
||||||
|
});
|
||||||
|
foreach (var resource in list)
|
||||||
{
|
{
|
||||||
Seedpacket slot = _plantCard.Instantiate<Seedpacket>();
|
Seedpacket slot = _plantCard.Instantiate<Seedpacket>();
|
||||||
AddChild(slot);
|
AddChild(slot);
|
||||||
|
|
||||||
slot.SetResource(resource);
|
slot.SetResource(resource);
|
||||||
slot.SetHandler(new ChoosableHandler(slot));
|
slot.SetHandler(new ChoosableHandler(slot));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue