This commit is contained in:
CortexCore
2023-10-06 23:43:19 +08:00
parent ebf9c1f526
commit 2c4710bc5d
186 changed files with 111802 additions and 764 deletions

View File

@@ -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();

View File

@@ -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)
{
}

View File

@@ -21,15 +21,6 @@ namespace BITKit.UX
public const string Inspector = "inspector-container";
public const string ProcessBarFill = "fill-bar";
public const string Toggle = "context-toggle";
public class Buttons
{
public const string Button_0 = "button--0";
public const string Button_1 = "button--0";
public const string Button_2 = "button--0";
public const string Button_3 = "button--0";
public const string Button_4 = "button--0";
public const string Button_5 = "button--0";
}
}

View File

@@ -59,7 +59,7 @@ namespace BITKit.UX
[Header(Constant.Header.Settings)]
public string bindName;
[SerializeField, SerializeReference, SubclassSelector]
IReference bindNameProvider = new GetNameFromGameobject();
protected IReference bindNameProvider = new GetNameFromGameobject();
[Header(Constant.Header.InternalVariables)]
private UX m_visualElement;
protected IStyle style => visualElement.style;

View File

@@ -0,0 +1,11 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace BITKit.UX
{
public class UXJsonBasedTable : UXElement<JsonBasedTable>
{
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 459ae21f062bfeb40b34793ad97105bc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -16,7 +16,15 @@ namespace BITKit.UX
public override void OnStart()
{
base.OnStart();
visualElement.RegisterValueChangedCallback(OnValueChanged);
switch (visualElement)
{
case CustomTextField customTextField:
customTextField.OnValueChanged += OnValueChanged;
break;
default:
visualElement.RegisterValueChangedCallback(OnValueChanged);
break;
}
}
public async void Set(string t)
{
@@ -32,9 +40,13 @@ namespace BITKit.UX
return visualElement.value;
}
void OnValueChanged(ChangeEvent<string> changeEvent)
private void OnValueChanged(string value)
{
onValueChanged.Invoke(changeEvent.newValue);
onValueChanged.Invoke(value);
}
private void OnValueChanged(ChangeEvent<string> changeEvent)
{
OnValueChanged(changeEvent.newValue);
}
}
}