
using Godot;
using Rokojori;
 
namespace Rokojori
{ 

  [Tool]
  [GlobalClass] 
  public partial class ShaderUINumber : Resource
  { 
    [Export]
    public FloatPropertyName floatPropertyName;

    [Export]
    public UINumber number;

    [Export]
    public TransitionSettings transitionSettings;

    public void UpdateMaterial( UIStylePropertyContainer container, Material material )
    {
      var control = container as Control;
      var numberValue = UINumber.Compute( container as Control, number, 0f );

      var allSettings = UIStyle.GetTransitionSettingsAll( container );
      var usesTransition = transitionSettings != null  || allSettings != null && allSettings.transitionAllProperties;
      
      if ( ! usesTransition )
      {
        floatPropertyName.Set( material, numberValue );
        return;
      }

      /*
      var transitionValue = ActiveStyleTransition<UINumber,FloatPropertyName>.ProcessTransition<float>(
        container, numberValue, container.GetActiveShaderUINumberTransitions(),
        number, floatPropertyName, 
        ()=>{ return UIStyle.GetTransitionSettings( container ); }

      );
      */
      
    }
  }
}