Added basic components for DSL. Working on functionality next.

This commit is contained in:
=
2026-04-28 13:52:57 +02:00
parent 287cb4df78
commit b926be307e
22 changed files with 293 additions and 45 deletions
+29 -10
View File
@@ -3,9 +3,16 @@ using System;
public partial class CodingWindow : PanelContainer
{
public PackedScene movePrefab;
public PackedScene craftPrefab;
public PackedScene harvestPrefab;
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
movePrefab = ResourceLoader.LoadMoveNodePrefab();
craftPrefab = ResourceLoader.LoadCraftNodePrefab();
harvestPrefab = ResourceLoader.LoadHarvestNodePrefab();
GenerateCodingBlocks();
}
@@ -15,6 +22,7 @@ public partial class CodingWindow : PanelContainer
if (Input.IsActionJustPressed("codingwindow"))
{
Visible = !Visible;
GameData.canMove = !Visible;
if (Visible)
{
ReloadRobots();
@@ -25,18 +33,29 @@ public partial class CodingWindow : PanelContainer
//Move, Harvest, Craft
public void GenerateCodingBlocks()
{
PackedScene nodePrefab = ResourceLoader.LoadProgramNodePrefab();
Control node1 = nodePrefab.Instantiate<Control>();
node1.GetNode<RichTextLabel>("./Node/NodeContainer/NodeText").Text = "Move";
GetNode<VBoxContainer>("./HBoxContainer/CodeBlocks/VBoxContainer").AddChild(node1);
VBoxContainer codingBlocks = GetNode<VBoxContainer>("./HBoxContainer/CodeBlocks/VBoxContainer");
Control node2 = nodePrefab.Instantiate<Control>();
node2.GetNode<RichTextLabel>("./Node/NodeContainer/NodeText").Text = "Harvest";
GetNode<VBoxContainer>("./HBoxContainer/CodeBlocks/VBoxContainer").AddChild(node2);
NodeDisplay node = new NodeDisplay();
MoveNode move = new MoveNode();
move.editorDisplay = movePrefab;
node.SetNode(move);
node.SetupUIElement();
codingBlocks.AddChild(node);
Control node3 = nodePrefab.Instantiate<Control>();
node3.GetNode<RichTextLabel>("./Node/NodeContainer/NodeText").Text = "Craft";
GetNode<VBoxContainer>("./HBoxContainer/CodeBlocks/VBoxContainer").AddChild(node3);
node = new NodeDisplay();
CraftNode craft = new CraftNode();
craft.editorDisplay = craftPrefab;
node.SetNode(craft);
node.SetupUIElement();
codingBlocks.AddChild(node);
node = new NodeDisplay();
HarvestNode harvest = new HarvestNode();
harvest.editorDisplay = harvestPrefab;
node.SetNode(harvest);
node.SetupUIElement();
codingBlocks.AddChild(node);
}
public void ReloadRobots()