Added basic window for programming with the DSL. Need to add functionality to it.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user