mirror of https://github.com/tuyoogame/YooAsset
update docs
parent
0d57565cae
commit
e278883958
|
@ -80,17 +80,17 @@
|
|||
|
||||
### 补丁清单
|
||||
|
||||
补丁清单文件是上图中以PatchManifest开头命名的文件。
|
||||
补丁清单文件是上图中以PackageManifest开头命名的文件。
|
||||
|
||||
- PatchManifest_DefaultPackage_xxxxxx.hash
|
||||
- PackageManifest_DefaultPackage_xxxxxx.hash
|
||||
|
||||
记录了补丁清单文件的哈希值。
|
||||
|
||||
- PatchManifest_DefaultPackage_xxxxxx.json
|
||||
- PackageManifest_DefaultPackage_xxxxxx.json
|
||||
|
||||
该文件为Json文本格式,主要用于开发者预览信息。
|
||||
|
||||
- PatchManifest_DefaultPackage_xxxxxx.bytes
|
||||
- PackageManifest_DefaultPackage_xxxxxx.bytes
|
||||
|
||||
该文件为二进制格式,主要用于程序内读取加载。
|
||||
|
||||
|
|
|
@ -90,9 +90,8 @@
|
|||
可寻址规则,规则可以自定义扩展。下面是内置规则:
|
||||
|
||||
- AddressByFileName 以文件名为定位地址。
|
||||
|
||||
- AddressByFilePath 以文件路径为定位地址。
|
||||
- AddressByGrouperAndFileName 以分组名+文件名为定位地址。
|
||||
|
||||
- AddressByFolderAndFileName 以文件夹名+文件名为定位地址。
|
||||
|
||||
````c#
|
||||
|
|
|
@ -26,15 +26,15 @@ v1.0 代表的是APP版本,不是资源版本。在没有更换安装包的情
|
|||
|
||||
例如:我们游戏的当前APP版本是v1.0,那么每次生成的补丁文件全部覆盖到v1.0的目录下即可。
|
||||
|
||||
下面的示例里一共上传过2次补丁包。第二次上传的补丁包会把第一次的版本记录文件(PatchManifest_DefaultPackage.version)覆盖掉。当我们想回退资源版本的时候,把第一次生成的版本记录文件覆盖到同目录下即可。
|
||||
下面的示例里一共上传过2次补丁包。第二次上传的补丁包会把第一次的版本记录文件(PackageManifest_DefaultPackage.version)覆盖掉。当我们想回退资源版本的时候,把第一次生成的版本记录文件覆盖到同目录下即可。
|
||||
|
||||
````
|
||||
v1.0(游戏版本)
|
||||
├─PatchManifest_DefaultPackage.version
|
||||
├─PatchManifest_DefaultPackage_2023-02-01-654.hash
|
||||
├─PatchManifest_DefaultPackage_2023-02-01-654.bytes
|
||||
├─PatchManifest_DefaultPackage_2023-02-12-789.hash
|
||||
├─PatchManifest_DefaultPackage_2023-02-12-789.bytes
|
||||
├─PackageManifest_DefaultPackage.version
|
||||
├─PackageManifest_DefaultPackage_2023-02-01-654.hash
|
||||
├─PackageManifest_DefaultPackage_2023-02-01-654.bytes
|
||||
├─PackageManifest_DefaultPackage_2023-02-12-789.hash
|
||||
├─PackageManifest_DefaultPackage_2023-02-12-789.bytes
|
||||
├─2bb5a28d37dabf27df8bc6a4706b8f80.bundle
|
||||
├─2dbea9c3056c8839bc03d80a2aebd105.bundle
|
||||
├─6e8c3003a64ead36a0bd2d5cdebfbcf4.bundle
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
YooAssets.Initialize();
|
||||
|
||||
// 创建默认的资源包
|
||||
var package = YooAssets.CreateAssetsPackage("DefaultPackage");
|
||||
var package = YooAssets.CreatePackage("DefaultPackage");
|
||||
|
||||
// 设置该资源包为默认的资源包,可以使用YooAssets相关加载接口加载该资源包内容。
|
||||
YooAssets.SetDefaultAssetsPackage(package);
|
||||
YooAssets.SetDefaultPackage(package);
|
||||
```
|
||||
|
||||
资源系统的运行模式支持三种:编辑器模拟模式,单机运行模式,联机运行模式。
|
||||
|
@ -26,7 +26,7 @@ private IEnumerator InitializeYooAsset()
|
|||
{
|
||||
var initParameters = new EditorSimulateModeParameters();
|
||||
initParameters.SimulatePatchManifestPath = EditorSimulateModeHelper.SimulateBuild("DefaultPackage");
|
||||
yield return defaultPackage.InitializeAsync(initParameters);
|
||||
yield return package.InitializeAsync(initParameters);
|
||||
}
|
||||
````
|
||||
|
||||
|
@ -40,7 +40,7 @@ private IEnumerator InitializeYooAsset()
|
|||
private IEnumerator InitializeYooAsset()
|
||||
{
|
||||
var initParameters = new OfflinePlayModeParameters();
|
||||
yield return defaultPackage.InitializeAsync(initParameters);
|
||||
yield return package.InitializeAsync(initParameters);
|
||||
}
|
||||
````
|
||||
|
||||
|
@ -65,7 +65,7 @@ private IEnumerator InitializeYooAsset()
|
|||
initParameters.QueryServices = new QueryStreamingAssetsFileServices();
|
||||
initParameters.DefaultHostServer = "http://127.0.0.1/CDN1/Android/v1.0";
|
||||
initParameters.FallbackHostServer = "http://127.0.0.1/CDN2/Android/v1.0";
|
||||
yield return defaultPackage.InitializeAsync(initParameters);
|
||||
yield return package.InitializeAsync(initParameters);
|
||||
}
|
||||
|
||||
// 内置文件查询服务类
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
该资源版本可以通过YooAssets提供的接口来更新,也可以通过HTTP访问游戏服务器来获取。
|
||||
|
||||
````c#
|
||||
private IEnumerator UpdateStaticVersion()
|
||||
private IEnumerator UpdatePackageVersion()
|
||||
{
|
||||
var package = YooAssets.GetAssetsPackage("DefaultPackage");
|
||||
var package = YooAssets.GetPackage("DefaultPackage");
|
||||
var operation = package.UpdatePackageVersionAsync();
|
||||
yield return operation;
|
||||
|
||||
|
@ -32,9 +32,9 @@ private IEnumerator UpdateStaticVersion()
|
|||
对于联机运行模式,在获取到资源版本号之后,就可以更新资源清单了。
|
||||
|
||||
````c#
|
||||
private IEnumerator UpdatePatchManifest()
|
||||
private IEnumerator UpdatePackageManifest()
|
||||
{
|
||||
var package = YooAssets.GetAssetsPackage("DefaultPackage");
|
||||
var package = YooAssets.GetPackage("DefaultPackage");
|
||||
var operation = package.UpdatePackageManifestAsync(packageVersion);
|
||||
yield return operation;
|
||||
|
||||
|
@ -58,11 +58,11 @@ private IEnumerator UpdatePatchManifest()
|
|||
|
||||
补丁包下载接口:
|
||||
|
||||
- YooAssets.CreatePatchDownloader(int downloadingMaxNumber, int failedTryAgain, int timeout)
|
||||
- YooAssets.CreateResourceDownloader(int downloadingMaxNumber, int failedTryAgain, int timeout)
|
||||
|
||||
用于下载更新当前资源版本所有的资源包文件。
|
||||
|
||||
- YooAssets.CreatePatchDownloader(string[] tags, int downloadingMaxNumber, int failedTryAgain, int timeout)
|
||||
- YooAssets.CreateResourceDownloader(string[] tags, int downloadingMaxNumber, int failedTryAgain, int timeout)
|
||||
|
||||
用于下载更新资源标签指定的资源包文件。
|
||||
|
||||
|
@ -76,8 +76,8 @@ IEnumerator Download()
|
|||
int downloadingMaxNum = 10;
|
||||
int failedTryAgain = 3;
|
||||
int timeout = 60;
|
||||
var package = YooAssets.GetAssetsPackage("DefaultPackage");
|
||||
var downloader = package.CreatePatchDownloader(downloadingMaxNum, failedTryAgain, timeout);
|
||||
var package = YooAssets.GetPackage("DefaultPackage");
|
||||
var downloader = package.CreateResourceDownloader(downloadingMaxNum, failedTryAgain, timeout);
|
||||
|
||||
//没有需要下载的资源
|
||||
if (downloader.TotalDownloadCount == 0)
|
||||
|
@ -118,7 +118,7 @@ IEnumerator Download()
|
|||
````c#
|
||||
private IEnumerator Start()
|
||||
{
|
||||
var package = YooAssets.GetAssetsPackage("DefaultPackage");
|
||||
var package = YooAssets.GetPackage("DefaultPackage");
|
||||
var operation = package.UpdatePackageVersionAsync(30);
|
||||
yield return operation;
|
||||
if (operation.Status == EOperationStatus.Succeed)
|
||||
|
@ -131,7 +131,7 @@ private IEnumerator Start()
|
|||
// 如果获取远端资源版本失败,说明当前网络无连接。
|
||||
// 在正常开始游戏之前,需要验证本地清单内容的完整性。
|
||||
string packageVersion = package.GetPackageVersion();
|
||||
var operation = package.PreDownloadPackageAsync(packageVersion);
|
||||
var operation = package.PreDownloadContentAsync(packageVersion);
|
||||
yield return operation;
|
||||
if (operation.Status != EOperationStatus.Succeed)
|
||||
{
|
||||
|
@ -142,7 +142,7 @@ private IEnumerator Start()
|
|||
int downloadingMaxNum = 10;
|
||||
int failedTryAgain = 3;
|
||||
int timeout = 60;
|
||||
var downloader = operation.CreatePatchDownloader(downloadingMaxNum, failedTryAgain, timeout);
|
||||
var downloader = operation.CreateResourceDownloader(downloadingMaxNum, failedTryAgain, timeout);
|
||||
if (downloader.TotalDownloadCount > 0)
|
||||
{
|
||||
// 资源内容本地并不完整,需要提示玩家联网更新。
|
||||
|
|
|
@ -2,12 +2,11 @@
|
|||
|
||||
**加载方法**
|
||||
|
||||
- LoadSceneAsync() 异步加载场景
|
||||
- LoadAssetSync() 同步加载资源对象
|
||||
- LoadAssetAsync() 异步加载资源对象
|
||||
- LoadSubAssetsSync() 同步加载子资源对象
|
||||
- LoadSubAssetsAsync() 异步加载子资源对象
|
||||
- LoadSceneSync() 同步加载场景
|
||||
- LoadSceneAsync() 异步加载场景
|
||||
- LoadRawFileSync() 同步获取原生文件
|
||||
- LoadRawFileAsync() 异步获取原生文件
|
||||
|
||||
|
|
|
@ -13,8 +13,8 @@ private object LoadFunc(string name, string extension, System.Type type, out Des
|
|||
{
|
||||
method = DestroyMethod.None; //注意:这里一定要设置为None
|
||||
string location = $"Assets/FairyRes/{name}{extension}";
|
||||
var assetPackage = YooAssets.GetAssetsPackage("DefaultPackage");
|
||||
var handle = assetPackage.LoadAssetSync(location , type);
|
||||
var package = YooAssets.GetPackage("DefaultPackage");
|
||||
var handle = package.LoadAssetSync(location , type);
|
||||
_handles.Add(handle);
|
||||
return handle.AssetObject;
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ IEnumerator Start()
|
|||
YooAssets.Initialize();
|
||||
|
||||
// 创建资源包实例
|
||||
var package = YooAssets.CreateAssetPackage("DefaultPackage");
|
||||
var package = YooAssets.CreatePackage("DefaultPackage");
|
||||
|
||||
// 初始化资源包
|
||||
......
|
||||
|
|
|
@ -8,5 +8,5 @@
|
|||
|
||||
配置说明:
|
||||
|
||||
- **Patch Manifest File Name** : 补丁清单文件名称
|
||||
- **Manifest File Name** : 补丁清单文件名称
|
||||
|
||||
|
|
Loading…
Reference in New Issue