更改了文件结构

This commit is contained in:
CortexCore
2023-09-02 00:51:39 +08:00
parent 5561f5c3cc
commit ebf9c1f526
6446 changed files with 0 additions and 45 deletions

View File

@@ -0,0 +1,39 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UIElements;
namespace BITKit.UX
{
public class UXSlider : UXElement<Slider>, IProvider<float>
{
public UnityEvent<float> onSetValue = new();
public Provider outputValue;
public override void OnStart()
{
base.OnStart();
visualElement.RegisterValueChangedCallback(x =>
{
onSetValue.Invoke(x.newValue);
outputValue?.Set(x.newValue);
});
}
float IProvider<float>.Get()
{
return visualElement.value;
}
void IProvider<float>.Set(float t)
{
SetValue(t);
}
public void SetValue(float t)
{
visualElement.SetValueWithoutNotify(t);
}
public void SetNormalizeValue(float t)
{
var value = Mathf.Lerp(visualElement.lowValue, visualElement.highValue, t);
visualElement.SetValueWithoutNotify(value);
}
}
}