Compare commits

..

11 Commits

Author SHA1 Message Date
何冠峰
17d2c8bf0a Update CHANGELOG.md 2025-01-14 14:32:21 +08:00
何冠峰
3dec5ac004 Update LICENSE.md 2025-01-14 14:32:11 +08:00
何冠峰
cf2ada8f2b Update package.json 2025-01-14 14:32:08 +08:00
何冠峰
c801f601d3 fix #438 2025-01-14 14:19:24 +08:00
何冠峰
6a97704dab update test sample 2025-01-07 15:14:43 +08:00
何冠峰
ee6c8301c4 update asset bundle builder 2025-01-07 10:06:03 +08:00
何冠峰
de35f4308d update extension sample
修复小游戏插件验证清单方法不对的问题
2025-01-04 15:59:12 +08:00
何冠峰
3d4ed38f17 update extension sample
修正扩展文件系统类编译错误
2025-01-04 14:10:10 +08:00
何冠峰
a84f981147 update test scene 2025-01-03 19:15:51 +08:00
何冠峰
b70d821384 update space shooter 2025-01-03 19:15:38 +08:00
何冠峰
bc7c6c1f33 update package invoke builder
新增包裹构建器,运行时构建资源包裹
2025-01-03 19:15:29 +08:00
39 changed files with 544 additions and 145 deletions

View File

@@ -2,6 +2,21 @@
All notable changes to this package will be documented in this file.
## [2.2.9] - 2025-01-14
### Fixed
- (#438) 修复了纯血鸿蒙加载本地文件失败的问题。
- (#445) 修复了小游戏扩展文件系统脚本编译错误。
### Changed
- EditorSimulateModeHelper.SimulateBuild()方法变更
```csharp
public static PackageInvokeBuildResult SimulateBuild(string packageName);
```
## [2.2.8-preview] - 2025-01-03
新增了单元测试用例。

View File

@@ -8,7 +8,7 @@ namespace YooAsset.Editor
/// <summary>
/// 模拟构建
/// </summary>
public static EditorSimulateBuildResult SimulateBuild(EditorSimulateBuildParam buildParam)
public static PackageInvokeBuildResult SimulateBuild(PackageInvokeBuildParam buildParam)
{
string packageName = buildParam.PackageName;
string buildPipelineName = buildParam.BuildPipelineName;
@@ -31,7 +31,7 @@ namespace YooAsset.Editor
BuildResult buildResult = pipeline.Run(buildParameters, false);
if (buildResult.Success)
{
var reulst = new EditorSimulateBuildResult();
var reulst = new PackageInvokeBuildResult();
reulst.PackageRootDirectory = buildResult.OutputPackageDirectory;
return reulst;
}

View File

@@ -75,12 +75,12 @@ namespace YooAsset.Editor
/// <summary>
/// 资源包名称样式
/// </summary>
public EFileNameStyle FileNameStyle;
public EFileNameStyle FileNameStyle = EFileNameStyle.HashName;
/// <summary>
/// 内置文件的拷贝选项
/// </summary>
public EBuildinFileCopyOption BuildinFileCopyOption;
public EBuildinFileCopyOption BuildinFileCopyOption = EBuildinFileCopyOption.None;
/// <summary>
/// 内置文件的拷贝参数
@@ -116,16 +116,6 @@ namespace YooAsset.Editor
string message = BuildLogger.GetErrorMessage(ErrorCode.NoBuildTarget, "Please select the build target platform !");
throw new Exception(message);
}
if (string.IsNullOrEmpty(PackageName))
{
string message = BuildLogger.GetErrorMessage(ErrorCode.PackageNameIsNullOrEmpty, "Package name is null or empty !");
throw new Exception(message);
}
if (string.IsNullOrEmpty(PackageVersion))
{
string message = BuildLogger.GetErrorMessage(ErrorCode.PackageVersionIsNullOrEmpty, "Package version is null or empty !");
throw new Exception(message);
}
if (string.IsNullOrEmpty(BuildOutputRoot))
{
string message = BuildLogger.GetErrorMessage(ErrorCode.BuildOutputRootIsNullOrEmpty, "Build output root is null or empty !");
@@ -136,6 +126,26 @@ namespace YooAsset.Editor
string message = BuildLogger.GetErrorMessage(ErrorCode.BuildinFileRootIsNullOrEmpty, "Buildin file root is null or empty !");
throw new Exception(message);
}
if (string.IsNullOrEmpty(BuildPipeline))
{
string message = BuildLogger.GetErrorMessage(ErrorCode.BuildPipelineIsNullOrEmpty, "Build pipeline is null or empty !");
throw new Exception(message);
}
if (BuildBundleType == (int)EBuildBundleType.Unknown)
{
string message = BuildLogger.GetErrorMessage(ErrorCode.BuildBundleTypeIsUnknown, $"Build bundle type is unknown {BuildBundleType} !");
throw new Exception(message);
}
if (string.IsNullOrEmpty(PackageName))
{
string message = BuildLogger.GetErrorMessage(ErrorCode.PackageNameIsNullOrEmpty, "Package name is null or empty !");
throw new Exception(message);
}
if (string.IsNullOrEmpty(PackageVersion))
{
string message = BuildLogger.GetErrorMessage(ErrorCode.PackageVersionIsNullOrEmpty, "Package version is null or empty !");
throw new Exception(message);
}
// 设置默认备注信息
if (string.IsNullOrEmpty(PackageNote))

View File

@@ -12,6 +12,8 @@ namespace YooAsset.Editor
BuildOutputRootIsNullOrEmpty = 113,
BuildinFileRootIsNullOrEmpty = 114,
PackageOutputDirectoryExists = 115,
BuildPipelineIsNullOrEmpty = 116,
BuildBundleTypeIsUnknown = 117,
RecommendScriptBuildPipeline = 130,
// TaskGetBuildMap

View File

@@ -187,7 +187,7 @@
identification within third-party archives.
Copyright 2018-2021 何冠峰
Copyright 2021-2023 TuYoo Games
Copyright 2021-2025 TuYoo Games
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.

View File

@@ -40,10 +40,20 @@ namespace YooAsset
else
url = StringUtility.Format("jar:file://{0}", path);
#elif UNITY_OPENHARMONY
if (path.StartsWith("jar:file://"))
url = path;
if (UnityEngine.Application.streamingAssetsPath.StartsWith("jar:file://"))
{
if (path.StartsWith("jar:file://"))
url = path;
else
url = StringUtility.Format("jar:file://{0}", path);
}
else
url = StringUtility.Format("jar:file://{0}", path);
{
if (path.StartsWith("file://"))
url = path;
else
url = StringUtility.Format("file://{0}", path);
}
#elif UNITY_STANDALONE_OSX
url = new System.Uri(path).ToString();
#elif UNITY_STANDALONE

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0c4881e782cbf0d4aa6f8309efd22865
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,38 @@

namespace YooAsset
{
public class PackageInvokeBuildParam
{
/// <summary>
/// 包裹名称
/// </summary>
public readonly string PackageName;
/// <summary>
/// 构建管线名称
/// </summary>
public string BuildPipelineName;
/// <summary>
/// 构建类所属程序集名称
/// </summary>
public string InvokeAssmeblyName;
/// <summary>
/// 构建执行的类名全称
/// 注意:类名必须包含命名空间!
/// </summary>
public string InvokeClassFullName;
/// <summary>
/// 构建执行的方法名称
/// 注意:执行方法必须满足 BindingFlags.Public | BindingFlags.Static
/// </summary>
public string InvokeMethodName;
public PackageInvokeBuildParam(string packageName)
{
PackageName = packageName;
}
}
}

View File

@@ -1,7 +1,7 @@

namespace YooAsset
{
public class EditorSimulateBuildResult
public class PackageInvokeBuildResult
{
public string PackageRootDirectory;
}

View File

@@ -0,0 +1,43 @@
#if UNITY_EDITOR
using System.Reflection;
namespace YooAsset
{
public static class PakcageInvokeBuilder
{
/// <summary>
/// 调用Editro类来执行构建资源包任务
/// </summary>
public static PackageInvokeBuildResult InvokeBuilder(PackageInvokeBuildParam buildParam)
{
var assemblyName = buildParam.InvokeAssmeblyName;
var className = buildParam.InvokeClassFullName;
var methodName = buildParam.InvokeMethodName;
var classType = Assembly.Load(assemblyName).GetType(className);
return (PackageInvokeBuildResult)InvokePublicStaticMethod(classType, methodName, buildParam);
}
private static object InvokePublicStaticMethod(System.Type type, string method, params object[] parameters)
{
var methodInfo = type.GetMethod(method, BindingFlags.Public | BindingFlags.Static);
if (methodInfo == null)
{
UnityEngine.Debug.LogError($"{type.FullName} not found method : {method}");
return null;
}
return methodInfo.Invoke(null, parameters);
}
}
}
#else
namespace YooAsset
{
public static class PakcageInvokeBuilder
{
public static PackageInvokeBuildResult InvokeBuilder(PackageInvokeBuildParam buildParam)
{
throw new System.Exception("Only support in unity editor platform !");
}
}
}
#endif

View File

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

View File

@@ -1,38 +0,0 @@

namespace YooAsset
{
public class EditorSimulateBuildParam
{
/// <summary>
/// 包裹名称
/// </summary>
public readonly string PackageName;
/// <summary>
/// 模拟构建管线名称
/// </summary>
public string BuildPipelineName = "EditorSimulateBuildPipeline";
/// <summary>
/// 模拟构建类所属程序集名称
/// </summary>
public string InvokeAssmeblyName = "YooAsset.Editor";
/// <summary>
/// 模拟构建执行的类名全称
/// 注意:类名必须包含命名空间!
/// </summary>
public string InvokeClassFullName = "YooAsset.Editor.AssetBundleSimulateBuilder";
/// <summary>
/// 模拟构建执行的方法名称
/// 注意:执行方法必须满足 BindingFlags.Public | BindingFlags.Static
/// </summary>
public string InvokeMethodName = "SimulateBuild";
public EditorSimulateBuildParam(string packageName)
{
PackageName = packageName;
}
}
}

View File

@@ -1,43 +1,16 @@
#if UNITY_EDITOR
using System.Reflection;

namespace YooAsset
{
public static class EditorSimulateModeHelper
public class EditorSimulateModeHelper
{
/// <summary>
/// 编辑器下模拟构建清单
/// </summary>
public static EditorSimulateBuildResult SimulateBuild(EditorSimulateBuildParam buildParam)
public static PackageInvokeBuildResult SimulateBuild(string packageName)
{
var assemblyName = buildParam.InvokeAssmeblyName;
var className = buildParam.InvokeClassFullName;
var methodName = buildParam.InvokeMethodName;
var classType = Assembly.Load(assemblyName).GetType(className);
return (EditorSimulateBuildResult)InvokePublicStaticMethod(classType, methodName, buildParam);
}
private static object InvokePublicStaticMethod(System.Type type, string method, params object[] parameters)
{
var methodInfo = type.GetMethod(method, BindingFlags.Public | BindingFlags.Static);
if (methodInfo == null)
{
UnityEngine.Debug.LogError($"{type.FullName} not found method : {method}");
return null;
}
return methodInfo.Invoke(null, parameters);
var buildParam = new PackageInvokeBuildParam(packageName);
buildParam.BuildPipelineName = "EditorSimulateBuildPipeline";
buildParam.InvokeAssmeblyName = "YooAsset.Editor";
buildParam.InvokeClassFullName = "YooAsset.Editor.AssetBundleSimulateBuilder";
buildParam.InvokeMethodName = "SimulateBuild";
return PakcageInvokeBuilder.InvokeBuilder(buildParam);
}
}
}
#else
namespace YooAsset
{
public static class EditorSimulateModeHelper
{
public static EditorSimulateBuildResult SimulateBuild(EditorSimulateBuildParam buildParam)
{
throw new System.Exception("Only support in unity editor !");
}
}
}
#endif
}

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 5b09fe4b7aa2d2143bc538976541b039
guid: b0a23f529c8bf4943a371ee6b360e698
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -110,9 +110,9 @@ internal class ByteGameFileSystem : IFileSystem
OperationSystem.StartOperation(PackageName, operation);
return operation;
}
public virtual FSClearCacheBundleFilesOperation ClearCacheBundleFilesAsync(PackageManifest manifest, string clearMode, object clearParam)
public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(PackageManifest manifest, string clearMode, object clearParam)
{
var operation = new FSClearCacheBundleFilesCompleteOperation(null);
var operation = new FSClearCacheFilesCompleteOperation();
OperationSystem.StartOperation(PackageName, operation);
return operation;
}

View File

@@ -73,7 +73,7 @@ internal class LoadByteGamePackageManifestOperation : AsyncOperationBase
if (_steps == ESteps.VerifyFileData)
{
string fileHash = HashUtility.BytesMD5(_webDataRequestOp.Result);
string fileHash = HashUtility.BytesCRC32(_webDataRequestOp.Result);
if (fileHash == _packageHash)
{
_steps = ESteps.LoadManifest;
@@ -82,7 +82,7 @@ internal class LoadByteGamePackageManifestOperation : AsyncOperationBase
{
_steps = ESteps.Done;
Status = EOperationStatus.Failed;
Error = "Failed to verify wechat package manifest file!";
Error = "Failed to verify package manifest file!";
}
}

View File

@@ -5,7 +5,7 @@ using UnityEngine;
using YooAsset;
using WeChatWASM;
internal class WXFSClearAllBundleFilesOperation : FSClearCacheBundleFilesOperation
internal class WXFSClearAllBundleFilesOperation : FSClearCacheFilesOperation
{
private enum ESteps
{

View File

@@ -6,7 +6,7 @@ using YooAsset;
using WeChatWASM;
internal class WXFSClearUnusedBundleFilesAsync : FSClearCacheBundleFilesOperation
internal class WXFSClearUnusedBundleFilesAsync : FSClearCacheFilesOperation
{
private enum ESteps
{

View File

@@ -73,7 +73,7 @@ internal class LoadWechatPackageManifestOperation : AsyncOperationBase
if (_steps == ESteps.VerifyFileData)
{
string fileHash = HashUtility.BytesMD5(_webDataRequestOp.Result);
string fileHash = HashUtility.BytesCRC32(_webDataRequestOp.Result);
if (fileHash == _packageHash)
{
_steps = ESteps.LoadManifest;
@@ -82,7 +82,7 @@ internal class LoadWechatPackageManifestOperation : AsyncOperationBase
{
_steps = ESteps.Done;
Status = EOperationStatus.Failed;
Error = "Failed to verify wechat package manifest file!";
Error = "Failed to verify package manifest file!";
}
}

View File

@@ -115,7 +115,7 @@ internal class WechatFileSystem : IFileSystem
OperationSystem.StartOperation(PackageName, operation);
return operation;
}
public virtual FSClearCacheBundleFilesOperation ClearCacheBundleFilesAsync(PackageManifest manifest, string clearMode, object clearParam)
public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(PackageManifest manifest, string clearMode, object clearParam)
{
if (clearMode == EFileClearMode.ClearAllBundleFiles.ToString())
{
@@ -132,7 +132,7 @@ internal class WechatFileSystem : IFileSystem
else
{
string error = $"Invalid clear mode : {clearMode}";
var operation = new FSClearCacheBundleFilesCompleteOperation(error);
var operation = new FSClearCacheFilesCompleteOperation(error);
OperationSystem.StartOperation(PackageName, operation);
return operation;
}

View File

@@ -40,9 +40,8 @@ internal class FsmInitializePackage : IStateNode
InitializationOperation initializationOperation = null;
if (playMode == EPlayMode.EditorSimulateMode)
{
var simulateBuildParam = new EditorSimulateBuildParam(packageName);
var simulateBuildResult = EditorSimulateModeHelper.SimulateBuild(simulateBuildParam);
var packageRoot = simulateBuildResult.PackageRootDirectory;
var buildResult = EditorSimulateModeHelper.SimulateBuild(packageName);
var packageRoot = buildResult.PackageRootDirectory;
var createParameters = new EditorSimulateModeParameters();
createParameters.EditorFileSystemParameters = FileSystemParameters.CreateDefaultEditorFileSystemParameters(packageRoot);
initializationOperation = package.InitializeAsync(createParameters);

View File

@@ -3,12 +3,12 @@ using UnityEngine;
using YooAsset;
using YooAsset.Editor;
public static class TestSimulateBuilder
public static class TestPackageBuilder
{
/// <summary>
/// 模拟构建
/// 构建资源包
/// </summary>
public static EditorSimulateBuildResult SimulateBuild(EditorSimulateBuildParam buildParam)
public static PackageInvokeBuildResult BuildPackage(PackageInvokeBuildParam buildParam)
{
string packageName = buildParam.PackageName;
string buildPipelineName = buildParam.BuildPipelineName;
@@ -31,7 +31,7 @@ public static class TestSimulateBuilder
BuildResult buildResult = pipeline.Run(buildParameters, false);
if (buildResult.Success)
{
var reulst = new EditorSimulateBuildResult();
var reulst = new PackageInvokeBuildResult();
reulst.PackageRootDirectory = buildResult.OutputPackageDirectory;
return reulst;
}
@@ -64,7 +64,7 @@ public static class TestSimulateBuilder
BuildResult buildResult = pipeline.Run(buildParameters, false);
if (buildResult.Success)
{
var reulst = new EditorSimulateBuildResult();
var reulst = new PackageInvokeBuildResult();
reulst.PackageRootDirectory = buildResult.OutputPackageDirectory;
return reulst;
}
@@ -97,7 +97,7 @@ public static class TestSimulateBuilder
BuildResult buildResult = pipeline.Run(buildParameters, false);
if (buildResult.Success)
{
var reulst = new EditorSimulateBuildResult();
var reulst = new PackageInvokeBuildResult();
reulst.PackageRootDirectory = buildResult.OutputPackageDirectory;
return reulst;
}
@@ -128,7 +128,7 @@ public static class TestSimulateBuilder
BuildResult buildResult = pipeline.Run(buildParameters, false);
if (buildResult.Success)
{
var reulst = new EditorSimulateBuildResult();
var reulst = new PackageInvokeBuildResult();
reulst.PackageRootDirectory = buildResult.OutputPackageDirectory;
return reulst;
}

View File

@@ -60,6 +60,17 @@ public static class AssetBundleCollectorMaker
YooAsset.Editor.AssetBundleCollectorSettingData.CreateCollector(spriteGroup, collector2);
}
// 面板
var panelGroup = YooAsset.Editor.AssetBundleCollectorSettingData.CreateGroup(testPackage, "PanelGroup");
{
var collector1 = new YooAsset.Editor.AssetBundleCollector();
collector1.CollectPath = "";
collector1.CollectorGUID = "4e9a00d6e825d644b9be75155d88daa6"; //TestRes/Panel目录
collector1.CollectorType = YooAsset.Editor.ECollectorType.MainAssetCollector;
collector1.PackRuleName = nameof(YooAsset.Editor.PackSeparately);
YooAsset.Editor.AssetBundleCollectorSettingData.CreateCollector(panelGroup, collector1);
}
// 预制体
var prefabGroup = YooAsset.Editor.AssetBundleCollectorSettingData.CreateGroup(testPackage, "PrefabGroup");
{

View File

@@ -19,23 +19,23 @@ public class BuildinFileSystemTester : IPrebuildSetup, IPostBuildCleanup
#if UNITY_EDITOR
// 构建TestPackage
{
var simulateParams = new EditorSimulateBuildParam(AssetBundleCollectorDefine.TestPackageName);
simulateParams.BuildPipelineName = "ScriptableBuildPipeline";
simulateParams.InvokeAssmeblyName = "YooAsset.Test.Editor";
simulateParams.InvokeClassFullName = "TestSimulateBuilder";
simulateParams.InvokeMethodName = "SimulateBuild";
var simulateResult = EditorSimulateModeHelper.SimulateBuild(simulateParams);
var buildParams = new PackageInvokeBuildParam(AssetBundleCollectorDefine.TestPackageName);
buildParams.BuildPipelineName = "ScriptableBuildPipeline";
buildParams.InvokeAssmeblyName = "YooAsset.Test.Editor";
buildParams.InvokeClassFullName = "TestPackageBuilder";
buildParams.InvokeMethodName = "BuildPackage";
var simulateResult = PakcageInvokeBuilder.InvokeBuilder(buildParams);
UnityEditor.EditorPrefs.SetString(BFS_TEST_PACKAGE_ROOT_KEY, simulateResult.PackageRootDirectory);
}
// 构建RawPackage
{
var simulateParams = new EditorSimulateBuildParam(AssetBundleCollectorDefine.RawPackageName);
simulateParams.BuildPipelineName = "RawFileBuildPipeline";
simulateParams.InvokeAssmeblyName = "YooAsset.Test.Editor";
simulateParams.InvokeClassFullName = "TestSimulateBuilder";
simulateParams.InvokeMethodName = "SimulateBuild";
var simulateResult = EditorSimulateModeHelper.SimulateBuild(simulateParams);
var buildParams = new PackageInvokeBuildParam(AssetBundleCollectorDefine.RawPackageName);
buildParams.BuildPipelineName = "RawFileBuildPipeline";
buildParams.InvokeAssmeblyName = "YooAsset.Test.Editor";
buildParams.InvokeClassFullName = "TestPackageBuilder";
buildParams.InvokeMethodName = "BuildPackage";
var simulateResult = PakcageInvokeBuilder.InvokeBuilder(buildParams);
UnityEditor.EditorPrefs.SetString(BFS_RAW_PACKAGE_ROOT_KEY, simulateResult.PackageRootDirectory);
}
#endif
@@ -119,6 +119,13 @@ public class BuildinFileSystemTester : IPrebuildSetup, IPostBuildCleanup
}
}
[UnityTest]
public IEnumerator TestLoadAsyncTask()
{
var tester = new TestLoadPanel();
yield return tester.RuntimeTester();
}
[UnityTest]
public IEnumerator TestLoadAudio()
{

View File

@@ -19,23 +19,23 @@ public class EditorFileSystemTester : IPrebuildSetup, IPostBuildCleanup
#if UNITY_EDITOR
// 构建TestPackage
{
var simulateParams = new EditorSimulateBuildParam(AssetBundleCollectorDefine.TestPackageName);
var simulateParams = new PackageInvokeBuildParam(AssetBundleCollectorDefine.TestPackageName);
simulateParams.BuildPipelineName = "EditorSimulateBuildPipeline";
simulateParams.InvokeAssmeblyName = "YooAsset.Test.Editor";
simulateParams.InvokeClassFullName = "TestSimulateBuilder";
simulateParams.InvokeMethodName = "SimulateBuild";
var simulateResult = EditorSimulateModeHelper.SimulateBuild(simulateParams);
simulateParams.InvokeClassFullName = "TestPackageBuilder";
simulateParams.InvokeMethodName = "BuildPackage";
var simulateResult = PakcageInvokeBuilder.InvokeBuilder(simulateParams);
UnityEditor.EditorPrefs.SetString(EFS_TEST_PACKAGE_ROOT_KEY, simulateResult.PackageRootDirectory);
}
// 构建RawPackage
{
var simulateParams = new EditorSimulateBuildParam(AssetBundleCollectorDefine.RawPackageName);
var simulateParams = new PackageInvokeBuildParam(AssetBundleCollectorDefine.RawPackageName);
simulateParams.BuildPipelineName = "EditorSimulateBuildPipeline";
simulateParams.InvokeAssmeblyName = "YooAsset.Test.Editor";
simulateParams.InvokeClassFullName = "TestSimulateBuilder";
simulateParams.InvokeMethodName = "SimulateBuild";
var simulateResult = EditorSimulateModeHelper.SimulateBuild(simulateParams);
simulateParams.InvokeClassFullName = "TestPackageBuilder";
simulateParams.InvokeMethodName = "BuildPackage";
var simulateResult = PakcageInvokeBuilder.InvokeBuilder(simulateParams);
UnityEditor.EditorPrefs.SetString(EFS_RAW_PACKAGE_ROOT_KEY, simulateResult.PackageRootDirectory);
}
#endif
@@ -148,6 +148,13 @@ public class EditorFileSystemTester : IPrebuildSetup, IPostBuildCleanup
}
}
[UnityTest]
public IEnumerator TestLoadAsyncTask()
{
var tester = new TestLoadPanel();
yield return tester.RuntimeTester();
}
[UnityTest]
public IEnumerator TestLoadAudio()
{

View File

@@ -0,0 +1,40 @@
using System;
using System.IO;
using System.Text;
using System.Collections;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.U2D;
using UnityEngine.TestTools;
using NUnit.Framework;
using YooAsset;
public class TestLoadPanel
{
public IEnumerator RuntimeTester()
{
ResourcePackage package = YooAssets.GetPackage(AssetBundleCollectorDefine.TestPackageName);
Assert.IsNotNull(package);
// 异步加载面板
{
var assetsHandle = package.LoadAssetAsync<GameObject>("panel_canvas");
var handleTask = assetsHandle.Task;
while (!handleTask.IsCompleted)
yield return null;
yield return null;
Assert.AreEqual(EOperationStatus.Succeed, assetsHandle.Status);
var instantiateOp = assetsHandle.InstantiateAsync();
var operationTask = instantiateOp.Task;
while (!handleTask.IsCompleted)
yield return null;
yield return null;
Assert.AreEqual(EOperationStatus.Succeed, instantiateOp.Status);
Assert.IsNotNull(instantiateOp.Result);
TestLogger.Log(this, instantiateOp.Result.name);
}
}
}

View File

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

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 4e9a00d6e825d644b9be75155d88daa6
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,81 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &6283027362666271047
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2037322908504346998}
- component: {fileID: 7980853937325680292}
- component: {fileID: 8207247306684829080}
m_Layer: 0
m_Name: panel_a
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2037322908504346998
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6283027362666271047}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7980853937325680292
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6283027362666271047}
m_CullTransparentMesh: 1
--- !u!114 &8207247306684829080
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6283027362666271047}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 0
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: this is panel a !

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: d60a4c3149ab06b468e38b88612419d6
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,81 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &6283027362666271047
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2037322908504346998}
- component: {fileID: 7980853937325680292}
- component: {fileID: 8207247306684829080}
m_Layer: 0
m_Name: panel_b
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2037322908504346998
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6283027362666271047}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7980853937325680292
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6283027362666271047}
m_CullTransparentMesh: 1
--- !u!114 &8207247306684829080
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6283027362666271047}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 0
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: this is panel b !

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 515c0ceab1fb10c4180748003da58232
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,70 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &6283027362666271047
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2037322908504346998}
- component: {fileID: 7980853937325680292}
- component: {fileID: -2226153785594138141}
m_Layer: 0
m_Name: panel_canvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2037322908504346998
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6283027362666271047}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7980853937325680292
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6283027362666271047}
m_CullTransparentMesh: 1
--- !u!223 &-2226153785594138141
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6283027362666271047}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 0
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_VertexColorAlwaysGammaSpace: 1
m_AdditionalShaderChannelsFlag: 0
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: bbefb050721c78a4fb44853720eaa76c
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -333,7 +333,6 @@ GameObject:
m_Component:
- component: {fileID: 2032300069}
- component: {fileID: 2032300068}
- component: {fileID: 2032300067}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
@@ -341,14 +340,6 @@ GameObject:
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!81 &2032300067
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2032300066}
m_Enabled: 1
--- !u!20 &2032300068
Camera:
m_ObjectHideFlags: 0

View File

@@ -1,7 +1,7 @@
{
"name": "com.tuyoogame.yooasset",
"displayName": "YooAsset",
"version": "2.2.8-preview",
"version": "2.2.9",
"unity": "2019.4",
"description": "unity3d resources management system.",
"author": {