mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-24 09:40:11 +00:00
Update document
This commit is contained in:
@@ -98,7 +98,7 @@ private static void BuildInternal(BuildTarget buildTarget)
|
||||
buildParameters.BuildTarget = buildTarget;
|
||||
buildParameters.BuildVersion = buildVersion;
|
||||
buildParameters.CompressOption = ECompressOption.LZ4;
|
||||
buildParameters.AppendFileExtension = false;
|
||||
buildParameters.AppendFileExtension = false;
|
||||
buildParameters.IsForceRebuild = isForceBuild;
|
||||
buildParameters.BuildinTags = "buildin";
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ public class CollectScene : IFilterRule
|
||||
|
||||
````xml
|
||||
<root>
|
||||
<Collector Directory="Assets/GameRes/UIAtlas/" PackRule="PackExplicit" FilterRule="CollectAll" DontWriteAssetPath="0" AssetTags=""/>
|
||||
<Collector Directory="Assets/GameRes/UIAtlas/" PackRule="PackExplicit" FilterRule="CollectAll" DontWriteAssetPath="0" AssetTags=""/>
|
||||
<Collector Directory="Assets/GameRes/UIPanel/" PackRule="PackExplicit" FilterRule="CollectAll" DontWriteAssetPath="0" AssetTags=""/>
|
||||
</root>
|
||||
````
|
||||
|
||||
@@ -54,7 +54,7 @@ private IEnumerator InitializeYooAsset()
|
||||
private IEnumerator InitializeYooAsset()
|
||||
{
|
||||
var createParameters = new YooAssets.HostPlayModeParameters();
|
||||
createParameters.LocationRoot = "Assets/GameRes";
|
||||
createParameters.LocationRoot = "Assets/GameRes";
|
||||
createParameters.DecryptServices = null;
|
||||
createParameters.ClearCacheWhenDirty = false;
|
||||
createParameters.IgnoreResourceVersion = false;
|
||||
|
||||
@@ -57,7 +57,7 @@ async Task AsyncLoad()
|
||||
{
|
||||
AssetOperationHandle handle = YooAssets.LoadAssetAsync<AudioClip>("Audio/bgMusic.mp3");
|
||||
await handle.Task;
|
||||
AudioClip audioClip = handle.AssetObject as AudioClip;
|
||||
AudioClip audioClip = handle.AssetObject as AudioClip;
|
||||
}
|
||||
````
|
||||
|
||||
|
||||
@@ -9,18 +9,18 @@
|
||||
````c#
|
||||
private IEnumerator UpdatePatchManifest()
|
||||
{
|
||||
int updateResourceVersion = 123;
|
||||
int timeout = 30;
|
||||
int updateResourceVersion = 123;
|
||||
int timeout = 30;
|
||||
UpdateManifestOperation operation = YooAssets.UpdateManifestAsync(updateResourceVersion, timeout);
|
||||
yield return operation;
|
||||
|
||||
if(operation.Status == EOperationStatus.Succeed)
|
||||
yield return operation;
|
||||
|
||||
if (operation.Status == EOperationStatus.Succeed)
|
||||
{
|
||||
//更新成功
|
||||
}
|
||||
else
|
||||
{
|
||||
//更新失败
|
||||
//更新失败
|
||||
Debug.LogError(operation.Error);
|
||||
}
|
||||
}
|
||||
@@ -41,19 +41,19 @@ private PatchDownloader _downloader;
|
||||
private void CreateDownloader()
|
||||
{
|
||||
string[] tags = { "buildin", "config" };
|
||||
int downloadingMaxNum = 10;
|
||||
int failedTryAgain = 3;
|
||||
_downloader = YooAssets.CreateDLCDownloader(tags, 10, 3);
|
||||
if (_downloader.TotalDownloadCount == 0)
|
||||
{
|
||||
//没有需要下载的资源
|
||||
}
|
||||
else
|
||||
{
|
||||
//需要下载的文件总数和总大小
|
||||
int totalDownloadCount = _downloader.TotalDownloadCount;
|
||||
int downloadingMaxNum = 10;
|
||||
int failedTryAgain = 3;
|
||||
_downloader = YooAssets.CreateDLCDownloader(tags, 10, 3);
|
||||
if (_downloader.TotalDownloadCount == 0)
|
||||
{
|
||||
//没有需要下载的资源
|
||||
}
|
||||
else
|
||||
{
|
||||
//需要下载的文件总数和总大小
|
||||
int totalDownloadCount = _downloader.TotalDownloadCount;
|
||||
long totalDownloadBytes = _downloader.TotalDownloadBytes;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -61,8 +61,8 @@ private void CreateDownloader()
|
||||
/// </summary>
|
||||
private void UpdateDownloader()
|
||||
{
|
||||
if(_downloader != null)
|
||||
_downloader.Update();
|
||||
if (_downloader != null)
|
||||
_downloader.Update();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -73,19 +73,19 @@ private IEnumerator Download()
|
||||
//注册下载回调
|
||||
_downloader.OnPatchFileDownloadFailedCallback = OnPatchFileDownloadFailed;
|
||||
_downloader.OnDownloadProgressCallback = OnDownloadProgressUpdate;
|
||||
_downloader.OnDownloadOverCallback = OnDownloadOver;
|
||||
_downloader.OnDownloadOverCallback = OnDownloadOver;
|
||||
_downloader.Download();
|
||||
yield return _downloader;
|
||||
|
||||
//检测下载结果
|
||||
if (_downloader.DownloadStates == EDownloaderStates.Succeed)
|
||||
{
|
||||
//下载成功
|
||||
}
|
||||
else
|
||||
{
|
||||
//下载失败
|
||||
}
|
||||
{
|
||||
//下载成功
|
||||
}
|
||||
else
|
||||
{
|
||||
//下载失败
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -93,7 +93,7 @@ private IEnumerator Download()
|
||||
/// </summary>
|
||||
private void OnPatchFileDownloadFailed(string fileName)
|
||||
{
|
||||
Debug.LogError($"File download failed : {fileName}");
|
||||
Debug.LogError($"File download failed : {fileName}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user