This commit is contained in:
Rendo 2025-07-03 19:34:09 +05:00
commit b932e82555
39 changed files with 575 additions and 78 deletions

View file

@ -17,7 +17,7 @@ public partial class GridLoader : GridContainer
Seedpacket slot = _plantCard.Instantiate<Seedpacket>();
AddChild(slot);
slot.SetPlantResource(resource);
slot.SetResource(resource);
slot.SetHandler(new ChoosableHandler(slot));
}
}

View file

@ -1,11 +1,12 @@
using Godot;
using Newlon;
using Newlon.Components;
using Newlon.Components.GUI.Seedpackets;
using Newlon.Components.Plants;
public partial class Previewport : SubViewport
{
private RuntimePlantData current_display;
private Node current_display;
private Texture2D start_Field;
[Export] private Label title;
@ -19,13 +20,14 @@ public partial class Previewport : SubViewport
public void OnFocusChanged(Control node)
{
if (GetParent<Control>().IsVisibleInTree() == false) return;
if (node is Seedpacket packet)
{
ChangeDisplay(packet.GetPlantResource());
ChangeDisplay(packet.GetResource());
}
}
private void ChangeDisplay(PlantResource resource)
private void ChangeDisplay(DisplayResource resource)
{
// Expand with updates
if (current_display != null)
@ -38,11 +40,12 @@ public partial class Previewport : SubViewport
}
else
GetNode<Sprite2D>("FrameField").Texture = start_Field;
current_display = resource.Scene.Instantiate<RuntimePlantData>();
current_display = resource.Scene.Instantiate();
title.Text = resource.display_name;
description.Text = resource.display_description;
AddChild(current_display);
current_display.DisableBrain();
if (current_display is IEntity entity)
entity.DisableBrain();
}
}