Added UI Toolkit Progress
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user