Files
Enigmos/Manual/ModuleCharValueParameterSetter.cs
2024-06-29 06:35:23 +08:00

42 lines
1.0 KiB
C#

using Godot;
using Nocturnis.DataStructures.ConfigurableParameters;
namespace Enigmos.Manual;
public partial class ModuleCharValueParameterSetter : ModuleParameterSetter
{
private LineEdit CharInput { get; set; }
private Button Apply { get; set; }
private Label ExtraInformation { get; set; }
public void Init(ICharParameter parameter)
{
UnderlyingParameter = parameter;
InitFlag = true;
}
public new ICharParameter UnderlyingParameter
{
get => (base.UnderlyingParameter as ICharParameter)!;
set => base.UnderlyingParameter = value;
}
public override void _Ready()
{
if (!InitFlag)
throw new Exception("TODO - INIT NEED");
Description = GetNode<Label>("Description");
Apply = GetNode<Button>("Apply");
CharInput = GetNode<LineEdit>("CharInput");
ExtraInformation = GetNode<Label>("ExtraInformation");
Description.Text = UnderlyingParameter.ParameterName;
CharInput.Text = UnderlyingParameter.ParameterValue.ToString();
base._Ready();
}
private void ApplyChange()
{
UnderlyingParameter.ParameterValue = CharInput.Text[0];
}
}