Moved robots to separate folders and a dedicated robotlist in the UI
This commit is contained in:
@@ -6,12 +6,8 @@ public partial class CodingWindow : PanelContainer
|
||||
{
|
||||
[Export] VBoxContainer codeBlocks;
|
||||
[Export] VBoxContainer editorWindow;
|
||||
[Export] VBoxContainer robotList;
|
||||
[Signal]
|
||||
public delegate void OnRobotClickedEventHandler(Robot robot);
|
||||
[Signal]
|
||||
public delegate void OnInformationEventHandler(string title, string text);
|
||||
public Dictionary<ProgramNode, PackedScene> DSLNodes;
|
||||
|
||||
|
||||
// Called when the node enters the scene tree for the first time.
|
||||
public override void _Ready()
|
||||
@@ -23,14 +19,10 @@ public partial class CodingWindow : PanelContainer
|
||||
// Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
//TODO: If robot that was pressed has a script, load script
|
||||
if (Input.IsActionJustPressed("codingwindow"))
|
||||
{
|
||||
Visible = !Visible;
|
||||
GameData.canMove = !Visible;
|
||||
if (Visible)
|
||||
{
|
||||
ReloadRobots();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,30 +46,6 @@ public partial class CodingWindow : PanelContainer
|
||||
}
|
||||
}
|
||||
|
||||
public void ReloadRobots()
|
||||
{
|
||||
foreach (Node node in robotList.GetChildren())
|
||||
{
|
||||
robotList.RemoveChild(node);
|
||||
node.QueueFree();
|
||||
}
|
||||
Button button;
|
||||
|
||||
foreach (Robot robotObject in GameData.robots)
|
||||
{
|
||||
button = new Button
|
||||
{
|
||||
Text = robotObject.Name,
|
||||
Name = robotObject.Name
|
||||
};
|
||||
button.Pressed += () =>
|
||||
{
|
||||
EmitSignal(SignalName.OnRobotClicked, robotObject);
|
||||
};
|
||||
robotList.AddChild(button);
|
||||
}
|
||||
}
|
||||
|
||||
public void ClearWindow()
|
||||
{
|
||||
foreach (Node node in editorWindow.GetChildren())
|
||||
@@ -89,7 +57,6 @@ public partial class CodingWindow : PanelContainer
|
||||
|
||||
public void CompileProgram()
|
||||
{
|
||||
string errorMessage = "";
|
||||
bool didCompile;
|
||||
|
||||
for (int i = 0; i < editorWindow.GetChildCount(); i++)
|
||||
@@ -106,7 +73,7 @@ public partial class CodingWindow : PanelContainer
|
||||
|
||||
if (!didCompile)
|
||||
{
|
||||
EmitSignal(SignalName.OnInformation, "ERROR", "Compilation failed " + errorMessage);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
uid://dcxom1paffp0p
|
||||
Reference in New Issue
Block a user