Added UI Toolkit Progress

This commit is contained in:
CortexCore
2024-12-13 16:14:20 +08:00
parent 21b4f9091a
commit d502501b27
20 changed files with 660 additions and 134 deletions

View File

@@ -95,7 +95,10 @@ namespace BITKit
stopwatch.Start();
DontDestroyOnLoad(gameObject);
// 初始化资源系统
YooAssets.Initialize();
if (YooAssets.Initialized is false)
YooAssets.Initialize();
// 创建默认的资源包
var package = YooAssets.TryGetPackage(packageName.Value) ?? YooAssets.CreatePackage(packageName.Value);
@@ -103,12 +106,25 @@ namespace BITKit
// 设置该资源包为默认的资源包可以使用YooAssets相关加载接口加载该资源包内容。
YooAssets.SetDefaultPackage(package);
if (package.InitializeStatus is EOperationStatus.Succeed)
{
YooAssets.DestroyPackage(package.PackageName);
}
InitializeParameters initParameters = new HostPlayModeParameters
{
BuildinQueryServices = buildinQueryServices,
RemoteServices = remoteServices
};
if (Application.platform is RuntimePlatform.WebGLPlayer)
{
initParameters = new WebPlayModeParameters()
{
BuildinQueryServices = buildinQueryServices,
RemoteServices = remoteServices
};
}
#if UNITY_EDITOR
if (IsEditorSimulateMode)
{
@@ -120,8 +136,21 @@ namespace BITKit
EditorSimulateModeHelper.SimulateBuild("ScriptableBuildPipeline", packageName.Value)
};
initParameters = editorParameters;
}else
#endif
}
else
{
switch (UnityEditor.EditorUserBuildSettings.activeBuildTarget)
{
case UnityEditor.BuildTarget.WebGL:
initParameters = new WebPlayModeParameters()
{
BuildinQueryServices = buildinQueryServices,
RemoteServices = remoteServices
};
break;
}
}
#endif
if (isOffline)
{
initParameters = new OfflinePlayModeParameters();
@@ -304,6 +333,9 @@ namespace BITKit
SceneManager.LoadScene(1);
}
if (document)
Destroy(document);
}
catch (Exception e)
{
@@ -311,13 +343,14 @@ namespace BITKit
_progressBar.value =0;
_progressLabel.text = e.Message;
}
if (document)
Destroy(document);
}
private void OnDestroy()
{
YooAssets.Destroy();
#if UNITY_EDITOR
YooAssets.Destroy();
#endif
}
}