Compare commits
No commits in common. "cd35241711a06295788a8123284ae19449323b95" and "47547df963ef66c95c28cc7df2f8a4ea8b596798" have entirely different histories.
cd35241711
...
47547df963
|
@ -60,7 +60,7 @@ namespace BITKit.Console
|
||||||
BIT4Log.Warning<UXService>("未找到ux_panel_settings");
|
BIT4Log.Warning<UXService>("未找到ux_panel_settings");
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
document.visualTreeAsset = await ModService.LoadAsset<VisualTreeAsset>("ui_console");
|
document.visualTreeAsset = await ModService.LoadAsset<VisualTreeAsset>("ux_console");
|
||||||
|
|
||||||
_rootVisualElement = document.rootVisualElement;
|
_rootVisualElement = document.rootVisualElement;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using BITKit.Mod;
|
using BITKit.Mod;
|
||||||
using Cysharp.Threading.Tasks;
|
using Cysharp.Threading.Tasks;
|
||||||
|
@ -9,8 +8,6 @@ using UnityEngine;
|
||||||
using UnityEngine.Serialization;
|
using UnityEngine.Serialization;
|
||||||
using UnityEngine.InputSystem;
|
using UnityEngine.InputSystem;
|
||||||
using UnityEngine.UIElements;
|
using UnityEngine.UIElements;
|
||||||
using Debug = UnityEngine.Debug;
|
|
||||||
|
|
||||||
// ReSharper disable MemberCanBeProtected.Global
|
// ReSharper disable MemberCanBeProtected.Global
|
||||||
// ReSharper disable ClassWithVirtualMembersNeverInherited.Global
|
// ReSharper disable ClassWithVirtualMembersNeverInherited.Global
|
||||||
// ReSharper disable UnusedMember.Global
|
// ReSharper disable UnusedMember.Global
|
||||||
|
@ -33,7 +30,6 @@ namespace BITKit.UX
|
||||||
protected VisualTreeAsset VisualTreeAsset { get; private set; }
|
protected VisualTreeAsset VisualTreeAsset { get; private set; }
|
||||||
private readonly ValidHandle _isBusy = new();
|
private readonly ValidHandle _isBusy = new();
|
||||||
public readonly UniTaskCompletionSource WaitUtilInitialized = new();
|
public readonly UniTaskCompletionSource WaitUtilInitialized = new();
|
||||||
protected UniTaskCompletionSource WaitUtilTransitionCompleted=new();
|
|
||||||
protected UIToolKitPanel(IUXService uxService)
|
protected UIToolKitPanel(IUXService uxService)
|
||||||
{
|
{
|
||||||
UXService = uxService;
|
UXService = uxService;
|
||||||
|
@ -90,26 +86,11 @@ namespace BITKit.UX
|
||||||
await OnInitiatedAsync.UniTaskFunc();
|
await OnInitiatedAsync.UniTaskFunc();
|
||||||
|
|
||||||
WaitUtilInitialized.TrySetResult();
|
WaitUtilInitialized.TrySetResult();
|
||||||
|
|
||||||
RootVisualElement.RegisterCallback<TransitionRunEvent>(OnTransitionRun);
|
|
||||||
RootVisualElement.RegisterCallback<TransitionStartEvent>(OnTransitionStart);
|
|
||||||
RootVisualElement.RegisterCallback<TransitionEndEvent>(OnTransitionEnd);
|
|
||||||
RootVisualElement.RegisterCallback<TransitionCancelEvent>(OnTransitionEnd);
|
|
||||||
|
|
||||||
WaitUtilTransitionCompleted.TrySetResult();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnTransitionStart(TransitionStartEvent evt)
|
protected virtual Optional<float> EntryDuration { get; }= new();
|
||||||
{
|
protected virtual Optional<float> ExitDuration { get; }= new();
|
||||||
WaitUtilTransitionCompleted = new();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnTransitionRun(TransitionRunEvent evt)
|
|
||||||
{
|
|
||||||
//WaitUtilTransitionCompleted = new();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected static readonly InputActionGroup InputActionGroup = new()
|
protected static readonly InputActionGroup InputActionGroup = new()
|
||||||
{
|
{
|
||||||
allowGlobalActivation = false,
|
allowGlobalActivation = false,
|
||||||
|
@ -139,21 +120,27 @@ namespace BITKit.UX
|
||||||
{
|
{
|
||||||
await InitializeAsync();
|
await InitializeAsync();
|
||||||
|
|
||||||
//WaitUtilTransitionCompleted = new();
|
|
||||||
|
|
||||||
RootVisualElement.SetActive(true);
|
RootVisualElement.SetActive(true);
|
||||||
|
|
||||||
//await UniTask.NextFrame();
|
|
||||||
|
|
||||||
RootVisualElement.AddToClassList(USSEntry);
|
RootVisualElement.AddToClassList(USSEntry);
|
||||||
|
|
||||||
await UniTask.NextFrame();
|
|
||||||
|
|
||||||
RootVisualElement.AddToClassList(USSEntryAsync);
|
RootVisualElement.AddToClassList(USSEntryAsync);
|
||||||
|
|
||||||
await UniTask.NextFrame();
|
|
||||||
|
|
||||||
await EntryAsync();
|
if (EntryDuration.Allow)
|
||||||
|
{
|
||||||
|
var task = EntryAsync();
|
||||||
|
var durationTask = UniTask.Delay(TimeSpan.FromSeconds(EntryDuration.Value));
|
||||||
|
|
||||||
|
await durationTask;
|
||||||
|
RootVisualElement.RemoveFromClassList(USSEntry);
|
||||||
|
RootVisualElement.RemoveFromClassList(USSEntryAsync);
|
||||||
|
RootVisualElement.AddToClassList(USSEntered);
|
||||||
|
|
||||||
|
await task;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await EntryAsync();
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -166,17 +153,9 @@ namespace BITKit.UX
|
||||||
{
|
{
|
||||||
BIT4Log.LogException(e);
|
BIT4Log.LogException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
await WaitUtilTransitionCompleted.Task;
|
|
||||||
|
|
||||||
RootVisualElement.AddToClassList(USSEntered);
|
}
|
||||||
}
|
public virtual UniTask EntryAsync()
|
||||||
private void OnTransitionEnd<TChangeEvent>(TChangeEvent evt)
|
|
||||||
{
|
|
||||||
WaitUtilTransitionCompleted.TrySetResult();
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual UniTask EntryAsync()
|
|
||||||
{
|
{
|
||||||
return UniTask.CompletedTask;
|
return UniTask.CompletedTask;
|
||||||
}
|
}
|
||||||
|
@ -184,13 +163,11 @@ namespace BITKit.UX
|
||||||
{
|
{
|
||||||
OnPanelEntry();
|
OnPanelEntry();
|
||||||
OnEntryCompleted?.Invoke();
|
OnEntryCompleted?.Invoke();
|
||||||
|
|
||||||
RootVisualElement.RemoveFromClassList(USSEntry);
|
|
||||||
RootVisualElement.RemoveFromClassList(USSEntryAsync);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IEntryElement.Exit()
|
void IEntryElement.Exit()
|
||||||
{
|
{
|
||||||
|
RootVisualElement?.AddToClassList(USSExit);
|
||||||
OnPanelExit();
|
OnPanelExit();
|
||||||
InputActionGroup.allowInput.RemoveElement(this);
|
InputActionGroup.allowInput.RemoveElement(this);
|
||||||
OnExit?.Invoke();
|
OnExit?.Invoke();
|
||||||
|
@ -198,26 +175,17 @@ namespace BITKit.UX
|
||||||
async UniTask IEntryElement.ExitAsync()
|
async UniTask IEntryElement.ExitAsync()
|
||||||
{
|
{
|
||||||
RootVisualElement?.RemoveFromClassList(USSEntered);
|
RootVisualElement?.RemoveFromClassList(USSEntered);
|
||||||
await UniTask.NextFrame();
|
|
||||||
|
|
||||||
RootVisualElement?.AddToClassList(USSExit);
|
|
||||||
|
|
||||||
|
|
||||||
await UniTask.NextFrame();
|
|
||||||
|
|
||||||
RootVisualElement?.AddToClassList(USSExitAsync);
|
RootVisualElement?.AddToClassList(USSExitAsync);
|
||||||
|
|
||||||
await UniTask.NextFrame();
|
|
||||||
|
|
||||||
await OnExitAsync.UniTaskFunc();
|
await OnExitAsync.UniTaskFunc();
|
||||||
|
if (EntryDuration.Allow is false) return;
|
||||||
await WaitUtilTransitionCompleted.Task;
|
await UniTask.Delay(TimeSpan.FromSeconds(EntryDuration.Value));
|
||||||
}
|
}
|
||||||
void IEntryElement.Exited()
|
void IEntryElement.Exited()
|
||||||
{
|
{
|
||||||
RootVisualElement?.RemoveFromClassList(USSExit);
|
RootVisualElement?.RemoveFromClassList(USSExit);
|
||||||
RootVisualElement?.RemoveFromClassList(USSExitAsync);
|
RootVisualElement?.RemoveFromClassList(USSExitAsync);
|
||||||
RootVisualElement?.AddToClassList(USSExited);
|
RootVisualElement?.AddToClassList(USSEntry);
|
||||||
RootVisualElement?.SetActive(false);
|
RootVisualElement?.SetActive(false);
|
||||||
|
|
||||||
if (AllowReload)
|
if (AllowReload)
|
||||||
|
|
|
@ -3,10 +3,6 @@
|
||||||
-unity-font: initial;
|
-unity-font: initial;
|
||||||
}
|
}
|
||||||
|
|
||||||
ScrollView {
|
|
||||||
--unity-metrics-single_line-height: 500px;
|
|
||||||
}
|
|
||||||
|
|
||||||
TabBar Button:disabled {
|
TabBar Button:disabled {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
@ -448,10 +444,6 @@ Foldout Toggle Label {
|
||||||
.bitkit-tool-tips.unity-label {
|
.bitkit-tool-tips.unity-label {
|
||||||
background-color: rgb(58, 58, 58);
|
background-color: rgb(58, 58, 58);
|
||||||
color: rgb(255, 255, 255);
|
color: rgb(255, 255, 255);
|
||||||
padding-top: 4px;
|
|
||||||
padding-right: 8px;
|
|
||||||
padding-bottom: 4px;
|
|
||||||
padding-left: 8px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Button.clear {
|
Button.clear {
|
||||||
|
|
Loading…
Reference in New Issue