(WIP) switched from previous DSL System (UI order based) to a new DSL System (node connection based)
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
using Godot;
|
||||
|
||||
public partial class MoveNodeDisplay : NodeDisplay
|
||||
{
|
||||
protected override ProgramNode CreateProgramNode()
|
||||
{
|
||||
return new MoveNode();
|
||||
}
|
||||
|
||||
protected override void LoadContent(NodeDisplay display, string content)
|
||||
{
|
||||
HBoxContainer valueContainer = GetValueContainer(display);
|
||||
string[] parts = content.Split(",");
|
||||
string positionValues = parts[1].Replace("Position:", "").Replace("(", "").Replace(")", "").Trim();
|
||||
int posX = int.Parse(positionValues.Split("|")[0]);
|
||||
int posY = int.Parse(positionValues.Split("|")[1]);
|
||||
int posZ = int.Parse(positionValues.Split("|")[2]);
|
||||
valueContainer.GetNode<SpinBox>("./CoordinateX").Value = posX;
|
||||
valueContainer.GetNode<SpinBox>("./CoordinateY").Value = posY;
|
||||
valueContainer.GetNode<SpinBox>("./CoordinateZ").Value = posZ;
|
||||
|
||||
MoveNode moveNode = display.node as MoveNode;
|
||||
if (moveNode != null)
|
||||
{
|
||||
moveNode.targetPosition = new Vector3I(posX, posY, posZ);
|
||||
}
|
||||
}
|
||||
|
||||
public override void ReadParameters()
|
||||
{
|
||||
MoveNode moveNode = node as MoveNode;
|
||||
if (moveNode == null) return;
|
||||
|
||||
HBoxContainer valueContainer = GetValueContainer();
|
||||
int posX = (int)valueContainer.GetNode<SpinBox>("./CoordinateX").Value;
|
||||
int posY = (int)valueContainer.GetNode<SpinBox>("./CoordinateY").Value;
|
||||
int posZ = (int)valueContainer.GetNode<SpinBox>("./CoordinateZ").Value;
|
||||
moveNode.targetPosition = new Vector3I(posX, posY, posZ);
|
||||
}
|
||||
|
||||
public override void SetupDisplay()
|
||||
{
|
||||
HBoxContainer valueContainer = GetValueContainer();
|
||||
valueContainer.GetNode<SpinBox>("./CoordinateX").MaxValue = GameData.layerSize;
|
||||
valueContainer.GetNode<SpinBox>("./CoordinateY").MaxValue = GameData.ruinSize;
|
||||
valueContainer.GetNode<SpinBox>("./CoordinateZ").MaxValue = GameData.layerSize;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user