This commit is contained in:
CortexCore
2024-11-20 11:36:51 +08:00
parent 5d19061fab
commit ce049035e2
20 changed files with 180 additions and 184 deletions

View File

@@ -2,10 +2,10 @@ using System.Collections;
using System.Collections.Generic;
using System.IO;
using AYellowpaper.SerializedCollections;
using YooAsset;
#if UNITY_EDITOR
using UnityEditor;
using YooAsset;
#endif
using UnityEngine;

View File

@@ -111,6 +111,7 @@ namespace BITKit.UX
private readonly IUXService _uxService;
private VisualElement _root;
private VisualElement _container;
private bool _isInitialized = false;
public UXContextMenu(IUXService uxService)
{
_uxService = uxService;
@@ -121,7 +122,7 @@ namespace BITKit.UX
private async void InitializeAsync()
{
var go = new GameObject("UXConsole");
var go = new GameObject(nameof(UXContextMenu));
Object.DontDestroyOnLoad(go);
var document = go.AddComponent<UIDocument>();
document.sortingOrder = 1;
@@ -143,6 +144,7 @@ namespace BITKit.UX
{
Close();
});
_isInitialized = true;
Close();
}
public void Create(ContextMenuBuilder builder)
@@ -166,6 +168,7 @@ namespace BITKit.UX
}
private void Close()
{
if(_isInitialized is false)return;
_container.Clear();
_root.SetActive(false);
}

View File

@@ -29,6 +29,7 @@ namespace BITKit.UX
public VisualElement RootVisualElement { get; set; }
protected VisualTreeAsset VisualTreeAsset { get; private set; }
private readonly ValidHandle _isBusy = new();
public readonly UniTaskCompletionSource WaitUtilInitialized = new();
protected UIToolKitPanel(IUXService uxService)
{
UXService = uxService;
@@ -76,6 +77,8 @@ namespace BITKit.UX
UXUtils.Inject(this);
RootVisualElement.SetActive(false);
WaitUtilInitialized.TrySetResult();
}
}

View File

@@ -1,11 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using BITKit.UX;
using UnityEngine;
public class UIToolkitSubPanel
{
public UIToolkitSubPanel()
{
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 398253ee7f746d143bbbcd9effab9da1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: