Update document

pull/51/head
hevinci 2022-11-21 09:52:18 +08:00
parent 3bb01ef9a8
commit 4776ab9bd8
4 changed files with 14 additions and 15 deletions

View File

@ -7,10 +7,10 @@
YooAssets.Initialize(); YooAssets.Initialize();
// 创建默认的资源包 // 创建默认的资源包
var defaultPackage = YooAssets.CreateAssetsPackage("DefaultPackage"); var package = YooAssets.CreateAssetsPackage("DefaultPackage");
// 设置该资源包为默认的资源包可以使用YooAssets相关加载接口加载该资源包内容。 // 设置该资源包为默认的资源包可以使用YooAssets相关加载接口加载该资源包内容。
YooAssets.SetDefaultAssetsPackage(defaultPackage); YooAssets.SetDefaultAssetsPackage(package);
``` ```
资源系统的运行模式支持三种:编辑器模拟模式,单机运行模式,联机运行模式。 资源系统的运行模式支持三种:编辑器模拟模式,单机运行模式,联机运行模式。

View File

@ -10,7 +10,7 @@
private IEnumerator UpdateStaticVersion() private IEnumerator UpdateStaticVersion()
{ {
var package = YooAssets.GetAssetsPackage("DefaultPackage"); var package = YooAssets.GetAssetsPackage("DefaultPackage");
var operation = package.UpdateStaticVersionAsync(); var operation = package.UpdatePackageVersionAsync();
yield return operation; yield return operation;
if (operation.Status == EOperationStatus.Succeed) if (operation.Status == EOperationStatus.Succeed)
@ -35,7 +35,7 @@ private IEnumerator UpdateStaticVersion()
private IEnumerator UpdatePatchManifest() private IEnumerator UpdatePatchManifest()
{ {
var package = YooAssets.GetAssetsPackage("DefaultPackage"); var package = YooAssets.GetAssetsPackage("DefaultPackage");
var operation = package.UpdateManifestAsync(packageVersion); var operation = package.UpdatePackageManifestAsync(packageVersion);
yield return operation; yield return operation;
if (operation.Status == EOperationStatus.Succeed) if (operation.Status == EOperationStatus.Succeed)
@ -119,7 +119,7 @@ IEnumerator Download()
private IEnumerator Start() private IEnumerator Start()
{ {
var package = YooAssets.GetAssetsPackage("DefaultPackage"); var package = YooAssets.GetAssetsPackage("DefaultPackage");
var operation = package.UpdateStaticVersionAsync(30); var operation = package.UpdatePackageVersionAsync(30);
yield return operation; yield return operation;
if (operation.Status == EOperationStatus.Succeed) if (operation.Status == EOperationStatus.Succeed)
{ {
@ -149,14 +149,14 @@ private IEnumerator Start()
- 编辑器模拟模式 - 编辑器模拟模式
UpdateStaticVersionAsync()方法和UpdateManifestAsync()方法都不起效,但是都会返回成功! UpdatePackageVersionAsync()方法和UpdatePackageManifestAsync()方法都不起效,但是都会返回成功!
- 单机运行模式 - 单机运行模式
UpdateStaticVersionAsync()方法和UpdateManifestAsync()方法都不起效,但是都会返回成功! UpdatePackageVersionAsync()方法和UpdatePackageManifestAsync()方法都不起效,但是都会返回成功!
- 联机运行模式 - 联机运行模式
UpdateManifestAsync()为资源清单更新方法。该方法的内部实现原理如下: UpdatePackageManifestAsync()为资源清单更新方法。该方法的内部实现原理如下:
![image](./Image/CodeTutorial2-img1.png) ![image](./Image/CodeTutorial2-img1.png)

View File

@ -7,7 +7,7 @@
- LoadSubAssetsSync() 同步加载子资源对象 - LoadSubAssetsSync() 同步加载子资源对象
- LoadSubAssetsAsync() 异步加载子资源对象 - LoadSubAssetsAsync() 异步加载子资源对象
- LoadSceneAsync() 异步加载场景 - LoadSceneAsync() 异步加载场景
- GetRawFileAsync() 异步获取原生文件 - LoadRawFileAsync() 异步获取原生文件
**统一约定** **统一约定**
@ -148,11 +148,10 @@ IEnumerator Start()
IEnumerator Start() IEnumerator Start()
{ {
string location = "Assets/GameRes/wwise/init.bnk"; string location = "Assets/GameRes/wwise/init.bnk";
string copyPath = $"{Application.persistentDataPath}/Audio/init.bnk"; RawFileOperationHandle handle = package.LoadRawFileAsync(location);
RawFileOperation operation = package.GetRawFileAsync(location, copyPath); yield return handle;
yield return operation; byte[] fileData = handle.GetRawFileData();
byte[] fileData = operation.GetFileData(); string fileText = handle.GetRawFileText();
string fileText = operation.GetFileText();
} }
```` ````

View File

@ -81,7 +81,7 @@ IEnumerator Start()
// 更新资源包版本 // 更新资源包版本
...... ......
var operation = package.UpdateManifestAsync(packageCRC); var operation = package.UpdatePackageManifestAsync(packageCRC);
yield return operation; yield return operation;
// 下载更新文件 // 下载更新文件