1
This commit is contained in:
@@ -18,7 +18,7 @@ using Debug = UnityEngine.Debug;
|
||||
|
||||
namespace BITKit.UX
|
||||
{
|
||||
public abstract class UIToolKitPanel : IUXPanel
|
||||
public abstract class UIToolKitPanel : IUXPanel,IDisposable
|
||||
{
|
||||
public const string USSEntry = "transition_entry";
|
||||
public const string USSEntryAsync = "transition_entry_async";
|
||||
@@ -128,6 +128,7 @@ namespace BITKit.UX
|
||||
public virtual bool AllowCursor { get; }
|
||||
public virtual bool AllowInput { get; }
|
||||
public virtual string[] InitialUssClasses { get; } = Array.Empty<string>();
|
||||
public bool IsDisposed { get; private set; }
|
||||
|
||||
public bool IsEntered { get; set; }
|
||||
protected virtual void OnReturn()
|
||||
@@ -247,6 +248,12 @@ namespace BITKit.UX
|
||||
public virtual void OnTick(float deltaTime)
|
||||
{
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
RootVisualElement?.RemoveFromHierarchy();
|
||||
IsDisposed = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -13,6 +13,7 @@ namespace BITKit.UX
|
||||
protected readonly IUXService UXService;
|
||||
protected VisualElement RootVisualElement { get; set; }
|
||||
protected bool IsInitialized { get; private set; }
|
||||
protected readonly UniTaskCompletionSource WaitUntilInitialized = new();
|
||||
protected UIToolkitOverlay(IUXService uxService, CancellationTokenSource cancellationToken)
|
||||
{
|
||||
UXService = uxService;
|
||||
@@ -40,6 +41,8 @@ namespace BITKit.UX
|
||||
|
||||
UXUtils.Inject(this);
|
||||
IsInitialized = true;
|
||||
|
||||
WaitUntilInitialized.TrySetResult();
|
||||
}
|
||||
public virtual void Dispose()
|
||||
{
|
||||
|
@@ -71,6 +71,7 @@ namespace BITKit.UX
|
||||
/// </summary>
|
||||
public static void ClearHistory() => History.Clear();
|
||||
|
||||
public string SettingsPath { get; set; } = "ux_panel_settings";
|
||||
public object Root { get; private set; }
|
||||
public async UniTask InitializeAsync()
|
||||
{
|
||||
@@ -86,7 +87,7 @@ Object.Destroy(gameObject);
|
||||
var document = gameObject.AddComponent<UIDocument>();
|
||||
try
|
||||
{
|
||||
var panelSettings =await ModService.LoadAsset<PanelSettings>("ux_panel_settings");
|
||||
var panelSettings =await ModService.LoadAsset<PanelSettings>(SettingsPath);
|
||||
document.panelSettings = panelSettings;
|
||||
}
|
||||
catch (Exception e)
|
||||
|
Reference in New Issue
Block a user