1
This commit is contained in:
@@ -27,7 +27,7 @@ namespace BITKit.UX
|
||||
}
|
||||
public void Set(int value)
|
||||
{
|
||||
float w = Mathf.Clamp((float)value / 100 * 100, 0f, 100f);
|
||||
var w =Mathf.Clamp(value * 0.01f, 0f, 100f);
|
||||
Set(w);
|
||||
}
|
||||
public async void Set(float value)
|
||||
@@ -54,15 +54,23 @@ namespace BITKit.UX
|
||||
|
||||
}
|
||||
}
|
||||
public async void SetDirect(float progess,string label)
|
||||
|
||||
public async void SetDirect(float progess, string label)
|
||||
{
|
||||
await UniTask.SwitchToMainThread(cancellationToken);
|
||||
Set(progess);
|
||||
if (labelElement is not null)
|
||||
try
|
||||
{
|
||||
await UniTask.SwitchToMainThread(cancellationToken);
|
||||
Set(progess);
|
||||
if (labelElement is not null)
|
||||
{
|
||||
labelElement.text = label;
|
||||
}
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
labelElement.text = label;
|
||||
}
|
||||
}
|
||||
|
||||
float IProvider<float>.Get()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
|
@@ -12,16 +12,12 @@ namespace BITKit.UX
|
||||
[Header(Constant.Header.Events)]
|
||||
public UnityEvent onClick = new();
|
||||
public UnityEvent onRightClick = new();
|
||||
|
||||
[SerializeField] private BITKit.Events.UnityEvent clicked=new();
|
||||
public override void OnStart()
|
||||
{
|
||||
try
|
||||
{
|
||||
visualElement.clicked += Click;
|
||||
}
|
||||
catch (System.Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
|
||||
if (allowRightClick)
|
||||
{
|
||||
foreach (var x in visualElement.Children())
|
||||
@@ -38,18 +34,19 @@ namespace BITKit.UX
|
||||
base.Set(active);
|
||||
visualElement.SetEnabled(active);
|
||||
}
|
||||
void Click()
|
||||
private void Click()
|
||||
{
|
||||
onClick.Invoke();
|
||||
clicked.Invoke();
|
||||
}
|
||||
void OnMouseDown(MouseDownEvent mouseEvent)
|
||||
private void OnMouseDown(MouseDownEvent mouseEvent)
|
||||
{
|
||||
if (mouseEvent.button is 1)
|
||||
{
|
||||
onRightClick.Invoke();
|
||||
}
|
||||
}
|
||||
void OnMouseUp(MouseUpEvent mouseEvent)
|
||||
private void OnMouseUp(MouseUpEvent mouseEvent)
|
||||
{
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user