Prepicked plants editor

This commit is contained in:
Rendo 2025-07-29 04:08:05 +05:00
commit 56f75a5d06
43 changed files with 532 additions and 50 deletions

View file

@ -7,7 +7,7 @@ namespace Newlon.Components.GUI;
public partial class GridLoader : GridContainer
{
private PackedScene _plantCard;
const string SEEDPACKED_UID = "uid://e7vutg71l6f2";
public const string SEEDPACKED_UID = "uid://e7vutg71l6f2";
public override void _Ready()
{
_plantCard = ResourceLoader.Load<PackedScene>(SEEDPACKED_UID);
@ -24,11 +24,21 @@ public partial class GridLoader : GridContainer
slot.SetResource(resource);
slot.SetForbidden(RuntimeLevelData.LevelResource.forbiddenPlants.Contains(resource.internal_id));
slot.SetForbidden(RuntimeLevelData.LevelResource.forbiddenPlants.Contains(resource.GetInternalID()));
slot.SetLocked(PlayerProgress.Instance.PlayerPlants.Contains(resource) == false);
if (GetChildCount() == 1) slot.GrabFocus();
var handler = new ChoosableHandler(slot);
slot.SetHandler(handler);
if (RuntimeLevelData.LevelResource.prepickedPlants.Contains(resource.GetInternalID()))
{
slot.SetHandler(new PrepickedDummyHandler(slot));
slot.disablePacket = true;
}
else
{
slot.SetHandler(new ChoosableHandler(slot));
}
}
}
}