Finished first EA Version #1
+59
-3
@@ -141,18 +141,39 @@ size_flags_horizontal = 3
|
|||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
theme_override_constants/separation = 10
|
theme_override_constants/separation = 10
|
||||||
|
|
||||||
[node name="EditorWindow" type="ScrollContainer" parent="CanvasLayer/Control/MainUI/Content/CodingWindow/HBoxContainer" unique_id=2045306791]
|
[node name="EditorWindow" type="VBoxContainer" parent="CanvasLayer/Control/MainUI/Content/CodingWindow/HBoxContainer" unique_id=919757187]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
size_flags_stretch_ratio = 2.0
|
size_flags_stretch_ratio = 2.0
|
||||||
theme_override_styles/panel = SubResource("StyleBoxFlat_2irst")
|
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer/Control/MainUI/Content/CodingWindow/HBoxContainer/EditorWindow" unique_id=632191528]
|
[node name="CodeContainer" type="ScrollContainer" parent="CanvasLayer/Control/MainUI/Content/CodingWindow/HBoxContainer/EditorWindow" unique_id=2045306791]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
size_flags_vertical = 3
|
||||||
|
size_flags_stretch_ratio = 2.0
|
||||||
|
theme_override_styles/panel = SubResource("StyleBoxFlat_2irst")
|
||||||
|
horizontal_scroll_mode = 0
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer/Control/MainUI/Content/CodingWindow/HBoxContainer/EditorWindow/CodeContainer" unique_id=632191528]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
theme_override_constants/separation = 10
|
theme_override_constants/separation = 10
|
||||||
|
|
||||||
|
[node name="Buttons" type="HBoxContainer" parent="CanvasLayer/Control/MainUI/Content/CodingWindow/HBoxContainer/EditorWindow" unique_id=265797151]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_constants/separation = 20
|
||||||
|
|
||||||
|
[node name="Clear" type="Button" parent="CanvasLayer/Control/MainUI/Content/CodingWindow/HBoxContainer/EditorWindow/Buttons" unique_id=1191148341]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
text = "Clear"
|
||||||
|
|
||||||
|
[node name="Compile" type="Button" parent="CanvasLayer/Control/MainUI/Content/CodingWindow/HBoxContainer/EditorWindow/Buttons" unique_id=1559980287]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
text = "Compile"
|
||||||
|
|
||||||
[node name="Robotlist" type="ScrollContainer" parent="CanvasLayer/Control/MainUI/Content/CodingWindow/HBoxContainer" unique_id=592644944]
|
[node name="Robotlist" type="ScrollContainer" parent="CanvasLayer/Control/MainUI/Content/CodingWindow/HBoxContainer" unique_id=592644944]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
@@ -164,4 +185,39 @@ size_flags_horizontal = 3
|
|||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
theme_override_constants/separation = 10
|
theme_override_constants/separation = 10
|
||||||
|
|
||||||
|
[node name="Popup" type="PanelContainer" parent="CanvasLayer/Control" unique_id=311359170]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 8
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = -20.0
|
||||||
|
offset_top = -20.0
|
||||||
|
offset_right = 20.0
|
||||||
|
offset_bottom = 20.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="RobotNaming" type="VBoxContainer" parent="CanvasLayer/Control/Popup" unique_id=39200128]
|
||||||
|
visible = false
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="RichTextLabel" type="RichTextLabel" parent="CanvasLayer/Control/Popup/RobotNaming" unique_id=1964282829]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Name your robot:"
|
||||||
|
fit_content = true
|
||||||
|
autowrap_mode = 0
|
||||||
|
|
||||||
|
[node name="LineEdit" type="LineEdit" parent="CanvasLayer/Control/Popup/RobotNaming" unique_id=1713423672]
|
||||||
|
layout_mode = 2
|
||||||
|
placeholder_text = "Name..."
|
||||||
|
max_length = 24
|
||||||
|
|
||||||
|
[node name="Button" type="Button" parent="CanvasLayer/Control/Popup/RobotNaming" unique_id=279251707]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Submit"
|
||||||
|
|
||||||
[connection signal="color_changed" from="CanvasLayer/Control/MainUI/HeaderContainer/Header/LightColor" to="CanvasLayer/Control" method="ChangeColor"]
|
[connection signal="color_changed" from="CanvasLayer/Control/MainUI/HeaderContainer/Header/LightColor" to="CanvasLayer/Control" method="ChangeColor"]
|
||||||
|
[connection signal="button_up" from="CanvasLayer/Control/MainUI/Content/CodingWindow/HBoxContainer/EditorWindow/Buttons/Clear" to="CanvasLayer/Control/MainUI/Content/CodingWindow" method="ClearWindow"]
|
||||||
|
[connection signal="button_up" from="CanvasLayer/Control/MainUI/Content/CodingWindow/HBoxContainer/EditorWindow/Buttons/Compile" to="CanvasLayer/Control/MainUI/Content/CodingWindow" method="CompileProgram"]
|
||||||
|
|||||||
@@ -72,8 +72,23 @@ public partial class CodingWindow : PanelContainer
|
|||||||
foreach (Robot robotObject in GameData.robots)
|
foreach (Robot robotObject in GameData.robots)
|
||||||
{
|
{
|
||||||
robot = nodePrefab.Instantiate<Control>();
|
robot = nodePrefab.Instantiate<Control>();
|
||||||
robot.GetNode<RichTextLabel>("./Node/NodeContainer/NodeText").Text = robotObject.Position.ToString();
|
robot.GetNode<RichTextLabel>("./Node/NodeContainer/NodeText").Text = robotObject.Name;
|
||||||
GetNode<VBoxContainer>("./HBoxContainer/Robotlist/VBoxContainer").AddChild(robot);
|
GetNode<VBoxContainer>("./HBoxContainer/Robotlist/VBoxContainer").AddChild(robot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ClearWindow()
|
||||||
|
{
|
||||||
|
VBoxContainer nodeList = GetNode<VBoxContainer>("./HBoxContainer/EditorWindow/CodeContainer/VBoxContainer");
|
||||||
|
foreach(Node node in nodeList.GetChildren())
|
||||||
|
{
|
||||||
|
nodeList.RemoveChild(node);
|
||||||
|
node.QueueFree();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CompileProgram()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public partial class NodeDisplay : RichTextLabel
|
|||||||
{
|
{
|
||||||
if (input is InputEventMouseButton mouseEvent && mouseEvent.ButtonIndex == MouseButton.Left && mouseEvent.IsReleased())
|
if (input is InputEventMouseButton mouseEvent && mouseEvent.ButtonIndex == MouseButton.Left && mouseEvent.IsReleased())
|
||||||
{
|
{
|
||||||
GetNode<Control>("../../../EditorWindow/VBoxContainer").AddChild(node.editorDisplay.Instantiate());
|
GetNode<Control>("../../../EditorWindow/CodeContainer/VBoxContainer").AddChild(node.editorDisplay.Instantiate());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
|
||||||
public partial class UIHandler : Control
|
public partial class UIHandler : Control
|
||||||
@@ -10,7 +12,7 @@ public partial class UIHandler : Control
|
|||||||
// Called every frame. 'delta' is the elapsed time since the previous frame.
|
// Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
public override void _Process(double delta)
|
public override void _Process(double delta)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ChangeColor(Color color)
|
public void ChangeColor(Color color)
|
||||||
@@ -19,4 +21,25 @@ public partial class UIHandler : Control
|
|||||||
LightHandler.RedrawLights(color);
|
LightHandler.RedrawLights(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ShowNamingPopup(Robot robot)
|
||||||
|
{
|
||||||
|
VBoxContainer namingContainer = GetNode<VBoxContainer>("./Popup/RobotNaming");
|
||||||
|
namingContainer.Visible = true;
|
||||||
|
GameData.canMove = false;
|
||||||
|
LineEdit name = namingContainer.GetNode<LineEdit>("./LineEdit");
|
||||||
|
Button button = namingContainer.GetNode<Button>("./Button");
|
||||||
|
|
||||||
|
Action handler = null;
|
||||||
|
handler = () =>
|
||||||
|
{
|
||||||
|
robot.Name = name.Text;
|
||||||
|
name.Text = "";
|
||||||
|
namingContainer.Visible = false;
|
||||||
|
GameData.canMove = true;
|
||||||
|
button.ButtonUp -= handler;
|
||||||
|
};
|
||||||
|
|
||||||
|
button.ButtonUp += handler;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -1,3 +1,4 @@
|
|||||||
|
using System.Threading.Tasks;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
|
||||||
public partial class Robot : Node3D
|
public partial class Robot : Node3D
|
||||||
@@ -9,6 +10,6 @@ public partial class Robot : Node3D
|
|||||||
|
|
||||||
public void OnClicked()
|
public void OnClicked()
|
||||||
{
|
{
|
||||||
GD.Print("Test!");
|
GetNode<UIHandler>("/root/Main/CanvasLayer/Control").ShowNamingPopup(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ public partial class World : Node3D
|
|||||||
// Called every frame. 'delta' is the elapsed time since the previous frame.
|
// Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
public override void _Process(double delta)
|
public override void _Process(double delta)
|
||||||
{
|
{
|
||||||
|
if (!canMove) return;
|
||||||
if (Input.IsActionJustPressed("layer_up") && currentLayer > 0) currentLayer--;
|
if (Input.IsActionJustPressed("layer_up") && currentLayer > 0) currentLayer--;
|
||||||
if (Input.IsActionJustPressed("layer_down") && currentLayer < ruinSize - 1) currentLayer++;
|
if (Input.IsActionJustPressed("layer_down") && currentLayer < ruinSize - 1) currentLayer++;
|
||||||
if (currentLayer != visibleLayer)
|
if (currentLayer != visibleLayer)
|
||||||
|
|||||||
Reference in New Issue
Block a user