Updated DSL node generation and added robot zoom-in function
This commit is contained in:
@@ -14,26 +14,6 @@ public partial class ResourceLoader
|
||||
{
|
||||
return GD.Load<PackedScene>($"res://Prefabs/Robot.tscn");
|
||||
}
|
||||
|
||||
public static PackedScene LoadProgramNodePrefab()
|
||||
{
|
||||
return GD.Load<PackedScene>($"res://Prefabs/ProgramNode.tscn");
|
||||
}
|
||||
|
||||
public static PackedScene LoadMoveNodePrefab()
|
||||
{
|
||||
return GD.Load<PackedScene>($"res://Prefabs/DSL/MoveNode.tscn");
|
||||
}
|
||||
|
||||
public static PackedScene LoadHarvestNodePrefab()
|
||||
{
|
||||
return GD.Load<PackedScene>($"res://Prefabs/DSL/HarvestNode.tscn");
|
||||
}
|
||||
|
||||
public static PackedScene LoadCraftNodePrefab()
|
||||
{
|
||||
return GD.Load<PackedScene>($"res://Prefabs/DSL/CraftNode.tscn");
|
||||
}
|
||||
|
||||
public static Dictionary<string, MeshInstance3D> LoadTiles()
|
||||
{
|
||||
@@ -60,4 +40,15 @@ public partial class ResourceLoader
|
||||
|
||||
return decorationMeshes;
|
||||
}
|
||||
|
||||
public static Dictionary<ProgramNode, PackedScene> LoadDSLNodes()
|
||||
{
|
||||
Dictionary<ProgramNode, PackedScene> nodes = new()
|
||||
{
|
||||
{ new MoveNode(), GD.Load<PackedScene>($"res://Prefabs/DSL/MoveNode.tscn") },
|
||||
{ new HarvestNode(), GD.Load<PackedScene>($"res://Prefabs/DSL/HarvestNode.tscn") },
|
||||
{ new CraftNode(), GD.Load<PackedScene>($"res://Prefabs/DSL/CraftNode.tscn") }
|
||||
};
|
||||
return nodes;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,9 @@ using Godot;
|
||||
|
||||
public partial class UIHandler : Control
|
||||
{
|
||||
[Export] CodingWindow codingWindow;
|
||||
[Export] PanelContainer robotNaming;
|
||||
[Export] Camera3D mainCam;
|
||||
public override void _Ready()
|
||||
{
|
||||
GetNode<ColorPickerButton>("./MainUI/HeaderContainer/Header/LightColor").Color = GameData.lightColor;
|
||||
@@ -12,7 +15,10 @@ public partial class UIHandler : Control
|
||||
// Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
|
||||
codingWindow.OnRobotClicked += (robot) =>
|
||||
{
|
||||
mainCam.Position = new Vector3(robot.Position.X, mainCam.Position.Y, robot.Position.Z);
|
||||
};
|
||||
}
|
||||
|
||||
public void ChangeColor(Color color)
|
||||
@@ -23,18 +29,18 @@ public partial class UIHandler : Control
|
||||
|
||||
public void ShowNamingPopup(Robot robot)
|
||||
{
|
||||
PanelContainer namingContainer = GetNode<PanelContainer>("../Popup/RobotNaming");
|
||||
namingContainer.Visible = true;
|
||||
robotNaming.Visible = true;
|
||||
GameData.canMove = false;
|
||||
LineEdit name = namingContainer.GetNode<LineEdit>("./VBoxContainer/LineEdit");
|
||||
Button button = namingContainer.GetNode<Button>("./VBoxContainer/Button");
|
||||
LineEdit name = robotNaming.GetNode<LineEdit>("./VBoxContainer/LineEdit");
|
||||
name.Text = robot.Name;
|
||||
Button button = robotNaming.GetNode<Button>("./VBoxContainer/Button");
|
||||
|
||||
Action handler = null;
|
||||
handler = () =>
|
||||
{
|
||||
robot.Name = name.Text;
|
||||
name.Text = "";
|
||||
namingContainer.Visible = false;
|
||||
robotNaming.Visible = false;
|
||||
GameData.canMove = true;
|
||||
button.ButtonUp -= handler;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user