32 lines
874 B
C#
32 lines
874 B
C#
using Godot;
|
|
|
|
public partial class ForNodeDisplay : NodeDisplay
|
|
{
|
|
protected override ProgramNode CreateProgramNode()
|
|
{
|
|
return new ForNode();
|
|
}
|
|
|
|
protected override void LoadContent(NodeDisplay display, string content)
|
|
{
|
|
HBoxContainer valueContainer = GetValueContainer(display);
|
|
string[] parts = content.Split(",");
|
|
string amountExecuted = parts[1].Replace("AmountExecuted:", "").Trim();
|
|
ForNode forNode = display.node as ForNode;
|
|
if (forNode != null)
|
|
{
|
|
forNode.amountExecuted = int.Parse(amountExecuted);
|
|
}
|
|
string amountString = parts[2].Replace("Amount:", "").Trim();
|
|
valueContainer.GetNode<SpinBox>("./Amount").Value = int.Parse(amountString);
|
|
}
|
|
|
|
public override void ReadParameters()
|
|
{
|
|
ForNode forNode = node as ForNode;
|
|
if (forNode == null) return;
|
|
|
|
forNode.amount = (int)GetValueContainer().GetNode<SpinBox>("./Amount").Value;
|
|
}
|
|
}
|