// Copyright © Gamesmiths Guild.
#if TOOLS
using System;
using Gamesmiths.Forge.Godot.Resources.Statescript;
using Gamesmiths.Forge.Godot.Resources.Statescript.Resolvers;
using Gamesmiths.Forge.Statescript;
using Godot;
namespace Gamesmiths.Forge.Godot.Editor.Statescript.Resolvers;
///
/// Resolver editor for the ability activation magnitude. No configuration is needed, it simply reads the magnitude from
/// the at runtime. Only compatible with inputs.
///
[Tool]
internal sealed partial class MagnitudeResolverEditor : NodeEditorProperty
{
///
public override string DisplayName => "Magnitude";
///
public override string ResolverTypeId => "Magnitude";
///
public override bool IsCompatibleWith(Type expectedType)
{
return expectedType == typeof(float) || expectedType == typeof(Variant128);
}
///
public override void Setup(
StatescriptGraph graph,
StatescriptNodeProperty? property,
Type expectedType,
Action onChanged,
bool isArray)
{
SizeFlagsHorizontal = SizeFlags.ExpandFill;
var label = new Label
{
Text = "Ability Magnitude",
HorizontalAlignment = HorizontalAlignment.Center,
SizeFlagsHorizontal = SizeFlags.ExpandFill,
};
AddChild(label);
}
///
public override void SaveTo(StatescriptNodeProperty property)
{
property.Resolver = new MagnitudeResolverResource();
}
}
#endif