This commit is contained in:
CortexCore
2024-07-07 14:27:34 +08:00
parent e6bb3dc5fa
commit c0ded1f99b
4 changed files with 40 additions and 12 deletions

View File

@@ -30,7 +30,9 @@ namespace BITKit.UX
}
[Header(Constant.Header.Components)]
[SerializeField] protected UIDocument document;
[Header(Constant.Header.Settings)]
[SerializeField] private bool isWindow;
[SerializeField] private bool isAnimate;
[SerializeField] private bool allowCursor;
[SerializeField] private bool allowInput;
@@ -39,12 +41,12 @@ namespace BITKit.UX
[Header(Constant.Header.Settings)]
[SerializeField] private Optional<float> entryDuration;
[SerializeField] private Optional<float> exitDuration;
protected static InputActionGroup inputActionGroup = new()
{
allowGlobalActivation = false,
Source = nameof(UIToolKitPanel)
};
public bool IsWindow => isWindow;
public bool IsAnimate => isAnimate;
public bool IsValid => cancellationToken.IsCancellationRequested is false;
public string Index { get; private set; }
@@ -56,7 +58,7 @@ namespace BITKit.UX
protected float CurrentOpacity
{
get => background?.GetOpacity() ?? _currentOpacity;
set
set
{
_currentOpacity = value;
background?.SetOpacity(value);
@@ -69,6 +71,7 @@ namespace BITKit.UX
Index= typeof(UIToolKitPanel) == GetType() ? gameObject.name : GetType().Name;
document.rootVisualElement.SetActive(false);
background?.SetOpacity(0);
if (IsWindow) document.sortingOrder++;
}
protected virtual void Start()
{
@@ -119,7 +122,7 @@ namespace BITKit.UX
throw;
}
}
async UniTask IEntryElement.EntryAsync()
async UniTask IEntryElement.EntryAsync()
{
if (entryDuration.Allow is false) return;
while (CurrentOpacity < 1 && TargetOpacity is 1)