Added basic window for programming with the DSL. Need to add functionality to it.
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
[gd_scene format=3 uid="uid://bst1eqq4jxq5h"]
|
||||
|
||||
[node name="ProgramNode" type="Control" unique_id=854534882]
|
||||
custom_minimum_size = Vector2(0, 20)
|
||||
layout_mode = 3
|
||||
anchors_preset = 14
|
||||
anchor_top = 0.5
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 0.5
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Node" type="PanelContainer" parent="." unique_id=545984394]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="NodeContainer" type="CenterContainer" parent="Node" unique_id=1325851867]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="NodeText" type="RichTextLabel" parent="Node/NodeContainer" unique_id=1944532693]
|
||||
layout_mode = 2
|
||||
bbcode_enabled = true
|
||||
text = "[font_size=30]Text[/font_size]"
|
||||
fit_content = true
|
||||
autowrap_mode = 0
|
||||
+46
-24
@@ -5,6 +5,7 @@
|
||||
[ext_resource type="Script" uid="uid://c7khr6oist3ku" path="res://Scripts/Camera3d.cs" id="3_7lihs"]
|
||||
[ext_resource type="Script" uid="uid://bm7knir4552j5" path="res://Scripts/Helpers/UIHandler.cs" id="4_fgofq"]
|
||||
[ext_resource type="Texture2D" uid="uid://bmcpkt6mae2qi" path="res://Assets/AlarmSign.png" id="5_b2bpf"]
|
||||
[ext_resource type="Script" uid="uid://bsd6n6b06a4pe" path="res://Scripts/CodingWindow.cs" id="6_7lihs"]
|
||||
|
||||
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_u44n3"]
|
||||
|
||||
@@ -23,6 +24,9 @@ glow_enabled = true
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_b2bpf"]
|
||||
bg_color = Color(0.053073194, 0.053073194, 0.053073194, 1)
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_7lihs"]
|
||||
bg_color = Color(0, 0, 0, 0.7647059)
|
||||
|
||||
[node name="Main" type="Node3D" unique_id=234207355]
|
||||
|
||||
[node name="World" type="Node3D" parent="." unique_id=770208789]
|
||||
@@ -52,7 +56,7 @@ size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource("4_fgofq")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="Control" unique_id=1437975209]
|
||||
[node name="MainUI" type="VBoxContainer" parent="Control" unique_id=1437975209]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
@@ -60,58 +64,76 @@ anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="PanelContainer" type="PanelContainer" parent="Control/VBoxContainer" unique_id=1744492333]
|
||||
[node name="HeaderContainer" type="PanelContainer" parent="Control/MainUI" unique_id=1744492333]
|
||||
layout_mode = 2
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_b2bpf")
|
||||
|
||||
[node name="Header" type="HBoxContainer" parent="Control/VBoxContainer/PanelContainer" unique_id=1048237062]
|
||||
[node name="Header" type="HBoxContainer" parent="Control/MainUI/HeaderContainer" unique_id=1048237062]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 200
|
||||
alignment = 1
|
||||
|
||||
[node name="Robotcount" type="RichTextLabel" parent="Control/VBoxContainer/PanelContainer/Header" unique_id=1955918671]
|
||||
[node name="Robotcount" type="RichTextLabel" parent="Control/MainUI/HeaderContainer/Header" unique_id=1955918671]
|
||||
layout_mode = 2
|
||||
text = "Roboter: 0/0"
|
||||
fit_content = true
|
||||
autowrap_mode = 0
|
||||
|
||||
[node name="RobotWarning" type="TextureRect" parent="Control/VBoxContainer/PanelContainer/Header" unique_id=759915558]
|
||||
[node name="RobotWarning" type="TextureRect" parent="Control/MainUI/HeaderContainer/Header" unique_id=759915558]
|
||||
layout_mode = 2
|
||||
texture = ExtResource("5_b2bpf")
|
||||
expand_mode = 2
|
||||
|
||||
[node name="DayCount" type="RichTextLabel" parent="Control/VBoxContainer/PanelContainer/Header" unique_id=1228850272]
|
||||
[node name="DayCount" type="RichTextLabel" parent="Control/MainUI/HeaderContainer/Header" unique_id=1228850272]
|
||||
layout_mode = 2
|
||||
text = "Tag 1"
|
||||
fit_content = true
|
||||
autowrap_mode = 0
|
||||
|
||||
[node name="Time" type="RichTextLabel" parent="Control/VBoxContainer/PanelContainer/Header" unique_id=1457538761]
|
||||
[node name="Time" type="RichTextLabel" parent="Control/MainUI/HeaderContainer/Header" unique_id=1457538761]
|
||||
layout_mode = 2
|
||||
text = "19:20"
|
||||
fit_content = true
|
||||
autowrap_mode = 0
|
||||
|
||||
[node name="Content" type="CenterContainer" parent="Control/VBoxContainer" unique_id=1233102684]
|
||||
[node name="Content" type="Control" parent="Control/MainUI" unique_id=45665557]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="CodingWindow" type="Panel" parent="Control/VBoxContainer/Content" unique_id=1765248892]
|
||||
[node name="CodingWindow" type="PanelContainer" parent="Control/MainUI/Content" unique_id=1576652491]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_7lihs")
|
||||
script = ExtResource("6_7lihs")
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="Control/MainUI/Content/CodingWindow" unique_id=1934932205]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="CodeBlocks" type="ScrollContainer" parent="Control/MainUI/Content/CodingWindow/HBoxContainer" unique_id=1196874464]
|
||||
custom_minimum_size = Vector2(200, 0)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Button" type="Button" parent="Control/VBoxContainer/Content/CodingWindow" unique_id=2015284121]
|
||||
layout_mode = 0
|
||||
offset_left = 100.0
|
||||
offset_top = 600.0
|
||||
offset_right = 400.0
|
||||
offset_bottom = 635.0
|
||||
text = "Move"
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="Control/MainUI/Content/CodingWindow/HBoxContainer/CodeBlocks" unique_id=1751038712]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
theme_override_constants/separation = 10
|
||||
|
||||
[node name="PositionInput" type="LineEdit" parent="Control/VBoxContainer/Content/CodingWindow" unique_id=1834676849]
|
||||
layout_mode = 0
|
||||
offset_left = 125.0
|
||||
offset_top = 50.0
|
||||
offset_right = 375.0
|
||||
offset_bottom = 85.0
|
||||
placeholder_text = "Position... (X/Y OR X,Y)"
|
||||
alignment = 1
|
||||
[node name="EditorWindow" type="Control" parent="Control/MainUI/Content/CodingWindow/HBoxContainer" unique_id=1904418643]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Robotlist" type="ScrollContainer" parent="Control/MainUI/Content/CodingWindow/HBoxContainer" unique_id=592644944]
|
||||
custom_minimum_size = Vector2(200, 0)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="Control/MainUI/Content/CodingWindow/HBoxContainer/Robotlist" unique_id=963718788]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
theme_override_constants/separation = 10
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class CodingWindow : PanelContainer
|
||||
{
|
||||
// Called when the node enters the scene tree for the first time.
|
||||
public override void _Ready()
|
||||
{
|
||||
GenerateCodingBlocks();
|
||||
}
|
||||
|
||||
// Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
if (Input.IsActionJustPressed("codingwindow")) Visible = !Visible;
|
||||
}
|
||||
|
||||
//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);
|
||||
|
||||
Control node2 = nodePrefab.Instantiate<Control>();
|
||||
node2.GetNode<RichTextLabel>("./Node/NodeContainer/NodeText").Text = "Harvest";
|
||||
GetNode<VBoxContainer>("./HBoxContainer/CodeBlocks/VBoxContainer").AddChild(node2);
|
||||
|
||||
Control node3 = nodePrefab.Instantiate<Control>();
|
||||
node3.GetNode<RichTextLabel>("./Node/NodeContainer/NodeText").Text = "Craft";
|
||||
GetNode<VBoxContainer>("./HBoxContainer/CodeBlocks/VBoxContainer").AddChild(node3);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://bsd6n6b06a4pe
|
||||
@@ -14,6 +14,11 @@ 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 Dictionary<string, MeshInstance3D> LoadTiles()
|
||||
{
|
||||
|
||||
@@ -10,10 +10,7 @@ public partial class UIHandler : Control
|
||||
// Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
if (Input.IsActionJustPressed("codingwindow"))
|
||||
{
|
||||
GetNode<Panel>("./CodingWindow").Visible = !GetNode<Panel>("./CodingWindow").Visible;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user