update test sample
This commit is contained in:
+18
-34
@@ -125,30 +125,30 @@ public class T2_TestBuldinFileSystem : IPrebuildSetup, IPostBuildCleanup
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator B1_TestLoadAsyncTask()
|
||||
public IEnumerator B1_TestAsyncTask()
|
||||
{
|
||||
var tester = new TestLoadPanel();
|
||||
var tester = new TestAsyncTask();
|
||||
yield return tester.RuntimeTester();
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator B2_TestLoadAudio()
|
||||
public IEnumerator B2_TestLoadAsset()
|
||||
{
|
||||
var tester = new TestLoadAudio();
|
||||
var tester = new TestLoadAsset();
|
||||
yield return tester.RuntimeTester();
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator B3_TestLoadImage()
|
||||
public IEnumerator B3_TestLoadSubAssets()
|
||||
{
|
||||
var tester = new TestLoadImage();
|
||||
var tester = new TestLoadSubAssets();
|
||||
yield return tester.RuntimeTester();
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator B4_TestLoadPrefab()
|
||||
public IEnumerator B4_TestLoadAllAssets()
|
||||
{
|
||||
var tester = new TestLoadPrefab();
|
||||
var tester = new TestLoadAllAssets();
|
||||
yield return tester.RuntimeTester();
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ public class T2_TestBuldinFileSystem : IPrebuildSetup, IPostBuildCleanup
|
||||
var tester = new TestLoadVideo();
|
||||
yield return tester.RuntimeTester();
|
||||
}
|
||||
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator C1_TestBundleReference()
|
||||
{
|
||||
@@ -201,33 +201,17 @@ public class T2_TestBuldinFileSystem : IPrebuildSetup, IPostBuildCleanup
|
||||
yield return tester.RuntimeTester();
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator C3_TestBundleUnpacker()
|
||||
{
|
||||
var tester = new TestBundleUnpacker();
|
||||
yield return tester.RuntimeTester();
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator D_DestroyPackage()
|
||||
{
|
||||
// 销毁旧资源包
|
||||
{
|
||||
var package = YooAssets.GetPackage(TestDefine.AssetBundlePackageName);
|
||||
var destroyOp = package.DestroyAsync();
|
||||
yield return destroyOp;
|
||||
if (destroyOp.Status != EOperationStatus.Succeed)
|
||||
Debug.LogError(destroyOp.Error);
|
||||
Assert.AreEqual(EOperationStatus.Succeed, destroyOp.Status);
|
||||
|
||||
bool result = YooAssets.RemovePackage(TestDefine.AssetBundlePackageName);
|
||||
Assert.IsTrue(result);
|
||||
}
|
||||
|
||||
// 销毁旧资源包
|
||||
{
|
||||
var package = YooAssets.GetPackage(TestDefine.RawBundlePackageName);
|
||||
var destroyOp = package.DestroyAsync();
|
||||
yield return destroyOp;
|
||||
if (destroyOp.Status != EOperationStatus.Succeed)
|
||||
Debug.LogError(destroyOp.Error);
|
||||
Assert.AreEqual(EOperationStatus.Succeed, destroyOp.Status);
|
||||
|
||||
bool result = YooAssets.RemovePackage(TestDefine.RawBundlePackageName);
|
||||
Assert.IsTrue(result);
|
||||
}
|
||||
var tester = new TestDestroyPackage();
|
||||
yield return tester.RuntimeTester(true);
|
||||
}
|
||||
}
|
||||
+31
-23
@@ -16,53 +16,61 @@ public class TestBundleEncryption
|
||||
ResourcePackage package = YooAssets.GetPackage(TestDefine.AssetBundlePackageName);
|
||||
Assert.IsNotNull(package);
|
||||
|
||||
// 异步加载音乐播放预制体
|
||||
// 异步加载加密的预制体
|
||||
// 说明:测试内置文件解压
|
||||
{
|
||||
var assetHandle = package.LoadAssetAsync<GameObject>("prefab_audioA");
|
||||
var assetHandle = package.LoadAssetAsync<GameObject>("prefab_encryptA");
|
||||
yield return assetHandle;
|
||||
Assert.AreEqual(EOperationStatus.Succeed, assetHandle.Status);
|
||||
|
||||
var go = assetHandle.InstantiateSync(Vector3.zero, Quaternion.identity);
|
||||
Assert.IsNotNull(go);
|
||||
|
||||
var audioSource = go.GetComponent<AudioSource>();
|
||||
Assert.IsNotNull(audioSource.clip);
|
||||
}
|
||||
|
||||
// 同步加载音乐播放预制体
|
||||
// 同步加载加密的预制体
|
||||
// 说明:测试内置文件解压
|
||||
{
|
||||
var assetHandle = package.LoadAssetSync<GameObject>("prefab_audioB");
|
||||
yield return assetHandle;
|
||||
var assetHandle = package.LoadAssetSync<GameObject>("prefab_encryptB");
|
||||
Assert.AreEqual(EOperationStatus.Succeed, assetHandle.Status);
|
||||
|
||||
var go = assetHandle.InstantiateSync(Vector3.zero, Quaternion.identity);
|
||||
Assert.IsNotNull(go);
|
||||
|
||||
var audioSource = go.GetComponent<AudioSource>();
|
||||
Assert.IsNotNull(audioSource.clip);
|
||||
}
|
||||
|
||||
yield return new WaitForSeconds(1f);
|
||||
}
|
||||
}
|
||||
|
||||
/* 资源代码流程
|
||||
* 内置文件解压(加载器)
|
||||
* 内置文件解压(加载器触发)
|
||||
BuildinFileSystem::LoadBundleFile()
|
||||
{
|
||||
_unpackFileSystem.LoadBundleFile(bundle);
|
||||
if (IsUnpackBundleFile(bundle))
|
||||
{
|
||||
_unpackFileSystem.LoadBundleFile(bundle);
|
||||
}
|
||||
}
|
||||
UnpackFileSystem::LoadAssetBundleOperation()
|
||||
UnpackFileSystem::LoadBundleFile()
|
||||
{
|
||||
DownloadFileOptions options = new DownloadFileOptions(int.MaxValue, 60);
|
||||
_unpackFileSystem.DownloadFileAsync(_bundle, options);
|
||||
var operation = new DCFSLoadAssetBundleOperation(this, bundle);
|
||||
return operation;
|
||||
}
|
||||
DCFSLoadAssetBundleOperation::InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.DownloadFile)
|
||||
{
|
||||
DownloadFileOptions options = new DownloadFileOptions(int.MaxValue);
|
||||
_unpackFileSystem.DownloadFileAsync(_bundle, options);
|
||||
}
|
||||
}
|
||||
UnpackFileSystem::DownloadFileAsync()
|
||||
{
|
||||
//RemoteServices返回内置文件路径
|
||||
string mainURL = RemoteServices.GetRemoteMainURL(bundle.FileName);
|
||||
string fallbackURL = RemoteServices.GetRemoteFallbackURL(bundle.FileName);
|
||||
options.SetURL(mainURL, fallbackURL);
|
||||
return new DownloadPackageBundleOperation(bundle, options);
|
||||
if (string.IsNullOrEmpty(options.ImportFilePath))
|
||||
{
|
||||
//RemoteServices返回内置文件路径
|
||||
string mainURL = RemoteServices.GetRemoteMainURL(bundle.FileName);
|
||||
string fallbackURL = RemoteServices.GetRemoteFallbackURL(bundle.FileName);
|
||||
options.SetURL(mainURL, fallbackURL);
|
||||
var downloader = new DownloadPackageBundleOperation(bundle, options);
|
||||
return downloader;
|
||||
}
|
||||
}
|
||||
*/
|
||||
+11
-9
@@ -19,29 +19,31 @@ public class TestBundleUnpacker
|
||||
var resourceUnpacker = package.CreateResourceUnpacker("unpack", 10, 1);
|
||||
Assert.AreEqual(resourceUnpacker.TotalDownloadCount, 2);
|
||||
|
||||
resourceUnpacker.BeginDownload();
|
||||
yield return resourceUnpacker;
|
||||
Assert.AreEqual(EOperationStatus.Succeed, resourceUnpacker.Status);
|
||||
|
||||
// 等待一秒
|
||||
yield return new WaitForSeconds(1f);
|
||||
}
|
||||
}
|
||||
|
||||
/* 资源代码流程
|
||||
* 内置文件解压(解压器)
|
||||
* 内置文件解压(解压器触发)
|
||||
BundleInfo::CreateDownloader()
|
||||
{
|
||||
return _buildFileSystem.DownloadFileAsync(Bundle, options);
|
||||
}
|
||||
BuildinFileSystem::DownloadFileAsync()
|
||||
{
|
||||
options.ImportFilePath = xxxxxx;
|
||||
_unpackFileSystem.DownloadFileAsync(bundle, options);
|
||||
options.ImportFilePath = GetBuildinFileLoadPath(bundle);
|
||||
return _unpackFileSystem.DownloadFileAsync(bundle, options);
|
||||
}
|
||||
UnpackFileSystem::DownloadFileAsync()
|
||||
{
|
||||
string mainURL = ConvertToWWWPath(options.ImportFilePath);
|
||||
options.SetURL(mainURL, mainURL);
|
||||
return new DownloadPackageBundleOperation(bundle, options);
|
||||
if (string.IsNullOrEmpty(options.ImportFilePath) == false)
|
||||
{
|
||||
string mainURL = ConvertToWWWPath(options.ImportFilePath);
|
||||
options.SetURL(mainURL, mainURL);
|
||||
var downloader = new DownloadPackageBundleOperation(bundle, options);
|
||||
return downloader;
|
||||
}
|
||||
}
|
||||
*/
|
||||
Reference in New Issue
Block a user