This commit is contained in:
CortexCore
2024-03-31 23:31:00 +08:00
parent e179d2eb53
commit b7b89ee71a
641 changed files with 31286 additions and 22134 deletions

View File

@@ -71,9 +71,10 @@ namespace BITKit.UX.Components
[System.Serializable]
public sealed class BoolEvent : DataComponents
{
public UnityEvent<bool> outputEvent;
public UnityEvent ifTrueEvent;
public UnityEvent ifFlaseEvent;
[SerializeField]private UnityEvent<bool> outputEvent;
[SerializeField]private UnityEvent ifTrueEvent;
[SerializeField]private UnityEvent ifFlaseEvent;
private readonly Optional<bool> _current = new();
public override void OnStart()
{
Data.AddListener<bool>(key, OnSetBool, true);
@@ -84,6 +85,11 @@ namespace BITKit.UX.Components
}
async void OnSetBool(bool boolean)
{
if (_current.Allow)
{
if (_current.Value == boolean) return;
}
_current.SetValueThenAllow(boolean);
try
{
await UniTask.SwitchToMainThread(BITApp.CancellationToken);