This commit is contained in:
CortexCore
2025-07-11 11:45:45 +08:00
parent fc189b98cc
commit ecae0f809c
76 changed files with 237471 additions and 33136 deletions

View File

@@ -6,6 +6,7 @@ using System.Threading;
using BITKit.Mod;
using BITKit.StateMachine;
using Cysharp.Threading.Tasks;
using Net.BITKit.Localization;
using UnityEngine;
using UnityEngine.Serialization;
using UnityEngine.InputSystem;
@@ -107,10 +108,17 @@ namespace BITKit.UX
RootVisualElement.RegisterCallback<TransitionEndEvent>(OnTransitionEnd);
RootVisualElement.RegisterCallback<TransitionCancelEvent>(OnTransitionEnd);
if (BITApp.ServiceProvider.QueryComponents(out ILocalizationService localizationService))
{
await localizationService.LocalizeAsync(RootVisualElement);
}
WaitUtilTransitionCompleted.TrySetResult();
WaitUtilInitialized.TrySetResult();
OnInitiated?.Invoke();
}
}
@@ -206,6 +214,8 @@ namespace BITKit.UX
RootVisualElement.RemoveFromClassList(USSEntry);
RootVisualElement.RemoveFromClassList(USSEntryAsync);
IsEntered = true;
}
private void OnTransitionEnd<TChangeEvent>(TChangeEvent evt)
{
@@ -219,6 +229,8 @@ namespace BITKit.UX
public override void OnStateExit(IState old, IState newState)
{
IsEntered = false;
OnPanelExit();
InputActionGroup.allowInput.RemoveElement(this);
OnExit?.Invoke();

View File

@@ -4,6 +4,7 @@ using System.Collections.Generic;
using BITKit.StateMachine;
using Cysharp.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Net.BITKit.Localization;
using UnityEngine;
using UnityEngine.UIElements;
@@ -11,16 +12,13 @@ namespace BITKit.UX
{
public class UIToolkitSubPanel<T> :IUXPanel where T : IUXPanel
{
private readonly IServiceProvider _serviceProvider;
protected readonly T Panel;
protected readonly ValidHandle IsVisible=new();
private readonly ValidHandle _busy = new();
public UIToolkitSubPanel(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
protected UIToolkitSubPanel(IServiceProvider serviceProvider)
{
Panel = serviceProvider.GetRequiredService<T>();
Panel.OnInitiated += OnInitiated;