update extension sample

pull/497/head
何冠峰 2025-02-25 14:06:36 +08:00
parent c758aa81ff
commit 6cb74760b0
24 changed files with 98 additions and 108 deletions

View File

@ -42,25 +42,21 @@ namespace YooAsset
public override FSLoadAssetOperation LoadAssetAsync(AssetInfo assetInfo)
{
var operation = new AssetBundleLoadAssetOperation(_packageBundle, _assetBundle, assetInfo);
OperationSystem.StartOperation(_fileSystem.PackageName, operation);
return operation;
}
public override FSLoadAllAssetsOperation LoadAllAssetsAsync(AssetInfo assetInfo)
{
var operation = new AssetBundleLoadAllAssetsOperation(_packageBundle, _assetBundle, assetInfo);
OperationSystem.StartOperation(_fileSystem.PackageName, operation);
return operation;
}
public override FSLoadSubAssetsOperation LoadSubAssetsAsync(AssetInfo assetInfo)
{
var operation = new AssetBundleLoadSubAssetsOperation(_packageBundle, _assetBundle, assetInfo);
OperationSystem.StartOperation(_fileSystem.PackageName, operation);
return operation;
}
public override FSLoadSceneOperation LoadSceneOperation(AssetInfo assetInfo, LoadSceneParameters loadParams, bool suspendLoad)
{
var operation = new AssetBundleLoadSceneOperation(assetInfo, loadParams, suspendLoad);
OperationSystem.StartOperation(_fileSystem.PackageName, operation);
return operation;
}
}

View File

@ -12,11 +12,11 @@ internal class TTFSDownloadFileOperation : DefaultDownloadFileOperation
{
_fileSystem = fileSystem;
}
internal override void InternalOnStart()
internal override void InternalStart()
{
_steps = ESteps.CreateRequest;
}
internal override void InternalOnUpdate()
internal override void InternalUpdate()
{
// 创建下载器
if (_steps == ESteps.CreateRequest)

View File

@ -9,11 +9,11 @@ internal partial class TTFSInitializeOperation : FSInitializeFileSystemOperation
{
_fileSystem = fileSystem;
}
internal override void InternalOnStart()
internal override void InternalStart()
{
Status = EOperationStatus.Succeed;
}
internal override void InternalOnUpdate()
internal override void InternalUpdate()
{
}
}

View File

@ -22,11 +22,11 @@ internal class TTFSLoadBundleOperation : FSLoadBundleOperation
_fileSystem = fileSystem;
_bundle = bundle;
}
internal override void InternalOnStart()
internal override void InternalStart()
{
_steps = ESteps.DownloadAssetBundle;
}
internal override void InternalOnUpdate()
internal override void InternalUpdate()
{
if (_steps == ESteps.None || _steps == ESteps.Done)
return;
@ -42,15 +42,18 @@ internal class TTFSLoadBundleOperation : FSLoadBundleOperation
if (_bundle.Encrypted)
{
_downloadAssetBundleOp = new DownloadWebEncryptAssetBundleOperation(false, _fileSystem.DecryptionServices, _bundle, downloadParam);
OperationSystem.StartOperation(_fileSystem.PackageName, _downloadAssetBundleOp);
_downloadAssetBundleOp.StartOperation();
AddChildOperation(_downloadAssetBundleOp);
}
else
{
_downloadAssetBundleOp = new DownloadTiktokAssetBundleOperation(_bundle, downloadParam);
OperationSystem.StartOperation(_fileSystem.PackageName, _downloadAssetBundleOp);
_downloadAssetBundleOp.StartOperation();
AddChildOperation(_downloadAssetBundleOp);
}
}
_downloadAssetBundleOp.UpdateOperation();
DownloadProgress = _downloadAssetBundleOp.DownloadProgress;
DownloadedBytes = (long)_downloadAssetBundleOp.DownloadedBytes;
Progress = DownloadProgress;
@ -91,13 +94,5 @@ internal class TTFSLoadBundleOperation : FSLoadBundleOperation
UnityEngine.Debug.LogError(Error);
}
}
public override void AbortDownloadOperation()
{
if (_steps == ESteps.DownloadAssetBundle)
{
if (_downloadAssetBundleOp != null)
_downloadAssetBundleOp.SetAbort();
}
}
}
#endif

View File

@ -25,11 +25,11 @@ internal class TTFSLoadPackageManifestOperation : FSLoadPackageManifestOperation
_packageVersion = packageVersion;
_timeout = timeout;
}
internal override void InternalOnStart()
internal override void InternalStart()
{
_steps = ESteps.RequestPackageHash;
}
internal override void InternalOnUpdate()
internal override void InternalUpdate()
{
if (_steps == ESteps.None || _steps == ESteps.Done)
return;
@ -39,9 +39,11 @@ internal class TTFSLoadPackageManifestOperation : FSLoadPackageManifestOperation
if (_requestPackageHashOp == null)
{
_requestPackageHashOp = new RequestTiktokPackageHashOperation(_fileSystem, _packageVersion, _timeout);
OperationSystem.StartOperation(_fileSystem.PackageName, _requestPackageHashOp);
_requestPackageHashOp.StartOperation();
AddChildOperation(_requestPackageHashOp);
}
_requestPackageHashOp.UpdateOperation();
if (_requestPackageHashOp.IsDone == false)
return;
@ -63,9 +65,11 @@ internal class TTFSLoadPackageManifestOperation : FSLoadPackageManifestOperation
{
string packageHash = _requestPackageHashOp.PackageHash;
_loadPackageManifestOp = new LoadTiktokPackageManifestOperation(_fileSystem, _packageVersion, packageHash, _timeout);
OperationSystem.StartOperation(_fileSystem.PackageName, _loadPackageManifestOp);
_loadPackageManifestOp.StartOperation();
AddChildOperation(_loadPackageManifestOp);
}
_loadPackageManifestOp.UpdateOperation();
Progress = _loadPackageManifestOp.Progress;
if (_loadPackageManifestOp.IsDone == false)
return;

View File

@ -21,11 +21,11 @@ internal class TTFSRequestPackageVersionOperation : FSRequestPackageVersionOpera
_fileSystem = fileSystem;
_timeout = timeout;
}
internal override void InternalOnStart()
internal override void InternalStart()
{
_steps = ESteps.RequestPackageVersion;
}
internal override void InternalOnUpdate()
internal override void InternalUpdate()
{
if (_steps == ESteps.None || _steps == ESteps.Done)
return;
@ -35,9 +35,11 @@ internal class TTFSRequestPackageVersionOperation : FSRequestPackageVersionOpera
if (_requestPackageVersionOp == null)
{
_requestPackageVersionOp = new RequestTiktokPackageVersionOperation(_fileSystem, _timeout);
OperationSystem.StartOperation(_fileSystem.PackageName, _requestPackageVersionOp);
_requestPackageVersionOp.StartOperation();
AddChildOperation(_requestPackageVersionOp);
}
_requestPackageVersionOp.UpdateOperation();
Progress = _requestPackageVersionOp.Progress;
if (_requestPackageVersionOp.IsDone == false)
return;

View File

@ -1,6 +1,5 @@
#if UNITY_WEBGL && DOUYINMINIGAME
using UnityEngine;
using UnityEngine.Networking;
using TTSDK;
namespace YooAsset
@ -12,11 +11,11 @@ namespace YooAsset
internal DownloadTiktokAssetBundleOperation(PackageBundle bundle, DownloadParam param) : base(bundle, param)
{
}
internal override void InternalOnStart()
internal override void InternalStart()
{
_steps = ESteps.CreateRequest;
}
internal override void InternalOnUpdate()
internal override void InternalUpdate()
{
if (_steps == ESteps.None || _steps == ESteps.Done)
return;
@ -101,12 +100,12 @@ namespace YooAsset
}
}
}
internal override void InternalOnAbort()
internal override void InternalAbort()
{
_steps = ESteps.Done;
DisposeWebRequest();
}
private void CreateWebRequest()
{
_webRequest = TTAssetBundle.GetAssetBundle(_requestURL);

View File

@ -34,12 +34,12 @@ internal class LoadTiktokPackageManifestOperation : AsyncOperationBase
_packageHash = packageHash;
_timeout = timeout;
}
internal override void InternalOnStart()
internal override void InternalStart()
{
_requestCount = WebRequestCounter.GetRequestFailedCount(_fileSystem.PackageName, nameof(LoadTiktokPackageManifestOperation));
_steps = ESteps.RequestFileData;
}
internal override void InternalOnUpdate()
internal override void InternalUpdate()
{
if (_steps == ESteps.None || _steps == ESteps.Done)
return;
@ -51,9 +51,11 @@ internal class LoadTiktokPackageManifestOperation : AsyncOperationBase
string fileName = YooAssetSettingsData.GetManifestBinaryFileName(_fileSystem.PackageName, _packageVersion);
string url = GetRequestURL(fileName);
_webDataRequestOp = new UnityWebDataRequestOperation(url, _timeout);
OperationSystem.StartOperation(_fileSystem.PackageName, _webDataRequestOp);
_webDataRequestOp.StartOperation();
AddChildOperation(_webDataRequestOp);
}
_webDataRequestOp.UpdateOperation();
Progress = _webDataRequestOp.Progress;
if (_webDataRequestOp.IsDone == false)
return;
@ -91,9 +93,11 @@ internal class LoadTiktokPackageManifestOperation : AsyncOperationBase
if (_deserializer == null)
{
_deserializer = new DeserializeManifestOperation(_webDataRequestOp.Result);
OperationSystem.StartOperation(_fileSystem.PackageName, _deserializer);
_deserializer.StartOperation();
AddChildOperation(_deserializer);
}
_deserializer.UpdateOperation();
Progress = _deserializer.Progress;
if (_deserializer.IsDone == false)
return;

View File

@ -29,12 +29,12 @@ internal class RequestTiktokPackageHashOperation : AsyncOperationBase
_packageVersion = packageVersion;
_timeout = timeout;
}
internal override void InternalOnStart()
internal override void InternalStart()
{
_requestCount = WebRequestCounter.GetRequestFailedCount(_fileSystem.PackageName, nameof(RequestTiktokPackageHashOperation));
_steps = ESteps.RequestPackageHash;
}
internal override void InternalOnUpdate()
internal override void InternalUpdate()
{
if (_steps == ESteps.None || _steps == ESteps.Done)
return;
@ -46,9 +46,11 @@ internal class RequestTiktokPackageHashOperation : AsyncOperationBase
string fileName = YooAssetSettingsData.GetPackageHashFileName(_fileSystem.PackageName, _packageVersion);
string url = GetRequestURL(fileName);
_webTextRequestOp = new UnityWebTextRequestOperation(url, _timeout);
OperationSystem.StartOperation(_fileSystem.PackageName, _webTextRequestOp);
_webTextRequestOp.StartOperation();
AddChildOperation(_webTextRequestOp);
}
_webTextRequestOp.UpdateOperation();
Progress = _webTextRequestOp.Progress;
if (_webTextRequestOp.IsDone == false)
return;

View File

@ -27,12 +27,12 @@ internal class RequestTiktokPackageVersionOperation : AsyncOperationBase
_fileSystem = fileSystem;
_timeout = timeout;
}
internal override void InternalOnStart()
internal override void InternalStart()
{
_requestCount = WebRequestCounter.GetRequestFailedCount(_fileSystem.PackageName, nameof(RequestTiktokPackageVersionOperation));
_steps = ESteps.RequestPackageVersion;
}
internal override void InternalOnUpdate()
internal override void InternalUpdate()
{
if (_steps == ESteps.None || _steps == ESteps.Done)
return;
@ -44,9 +44,11 @@ internal class RequestTiktokPackageVersionOperation : AsyncOperationBase
string fileName = YooAssetSettingsData.GetPackageVersionFileName(_fileSystem.PackageName);
string url = GetRequestURL(fileName);
_webTextRequestOp = new UnityWebTextRequestOperation(url, _timeout);
OperationSystem.StartOperation(_fileSystem.PackageName, _webTextRequestOp);
_webTextRequestOp.StartOperation();
AddChildOperation(_webTextRequestOp);
}
_webTextRequestOp.UpdateOperation();
Progress = _webTextRequestOp.Progress;
if (_webTextRequestOp.IsDone == false)
return;

View File

@ -112,25 +112,21 @@ internal class TiktokFileSystem : IFileSystem
public virtual FSInitializeFileSystemOperation InitializeFileSystemAsync()
{
var operation = new TTFSInitializeOperation(this);
OperationSystem.StartOperation(PackageName, operation);
return operation;
}
public virtual FSLoadPackageManifestOperation LoadPackageManifestAsync(string packageVersion, int timeout)
{
var operation = new TTFSLoadPackageManifestOperation(this, packageVersion, timeout);
OperationSystem.StartOperation(PackageName, operation);
return operation;
}
public virtual FSRequestPackageVersionOperation RequestPackageVersionAsync(bool appendTimeTicks, int timeout)
{
var operation = new TTFSRequestPackageVersionOperation(this, timeout);
OperationSystem.StartOperation(PackageName, operation);
return operation;
}
public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(PackageManifest manifest, string clearMode, object clearParam)
{
var operation = new FSClearCacheFilesCompleteOperation();
OperationSystem.StartOperation(PackageName, operation);
return operation;
}
public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadParam param)
@ -138,7 +134,6 @@ internal class TiktokFileSystem : IFileSystem
param.MainURL = RemoteServices.GetRemoteMainURL(bundle.FileName);
param.FallbackURL = RemoteServices.GetRemoteFallbackURL(bundle.FileName);
var operation = new TTFSDownloadFileOperation(this, bundle, param);
OperationSystem.StartOperation(PackageName, operation);
return operation;
}
public virtual FSLoadBundleOperation LoadBundleFile(PackageBundle bundle)
@ -146,14 +141,12 @@ internal class TiktokFileSystem : IFileSystem
if (bundle.BundleType == (int)EBuildBundleType.AssetBundle)
{
var operation = new TTFSLoadBundleOperation(this, bundle);
OperationSystem.StartOperation(PackageName, operation);
return operation;
}
else
{
string error = $"{nameof(TiktokFileSystem)} not support load bundle type : {bundle.BundleType}";
var operation = new FSLoadBundleCompleteOperation(error);
OperationSystem.StartOperation(PackageName, operation);
return operation;
}
}
@ -192,7 +185,7 @@ internal class TiktokFileSystem : IFileSystem
_fileSystemMgr = TT.GetFileSystemManager();
}
public virtual void OnUpdate()
public virtual void OnDestroy()
{
}

View File

@ -42,25 +42,21 @@ namespace YooAsset
public override FSLoadAssetOperation LoadAssetAsync(AssetInfo assetInfo)
{
var operation = new AssetBundleLoadAssetOperation(_packageBundle, _assetBundle, assetInfo);
OperationSystem.StartOperation(_fileSystem.PackageName, operation);
return operation;
}
public override FSLoadAllAssetsOperation LoadAllAssetsAsync(AssetInfo assetInfo)
{
var operation = new AssetBundleLoadAllAssetsOperation(_packageBundle, _assetBundle, assetInfo);
OperationSystem.StartOperation(_fileSystem.PackageName, operation);
return operation;
}
public override FSLoadSubAssetsOperation LoadSubAssetsAsync(AssetInfo assetInfo)
{
var operation = new AssetBundleLoadSubAssetsOperation(_packageBundle, _assetBundle, assetInfo);
OperationSystem.StartOperation(_fileSystem.PackageName, operation);
return operation;
}
public override FSLoadSceneOperation LoadSceneOperation(AssetInfo assetInfo, LoadSceneParameters loadParams, bool suspendLoad)
{
var operation = new AssetBundleLoadSceneOperation(assetInfo, loadParams, suspendLoad);
OperationSystem.StartOperation(_fileSystem.PackageName, operation);
return operation;
}
}

View File

@ -22,11 +22,11 @@ internal class WXFSClearAllBundleFilesOperation : FSClearCacheFilesOperation
{
_fileSystem = fileSystem;
}
internal override void InternalOnStart()
internal override void InternalStart()
{
_steps = ESteps.ClearAllCacheFiles;
}
internal override void InternalOnUpdate()
internal override void InternalUpdate()
{
if (_steps == ESteps.None || _steps == ESteps.Done)
return;

View File

@ -1,10 +1,8 @@
#if UNITY_WEBGL && WEIXINMINIGAME
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using YooAsset;
using WeChatWASM;
using static UnityEngine.Networking.UnityWebRequest;
internal class WXFSClearUnusedBundleFilesAsync : FSClearCacheFilesOperation
{
@ -28,11 +26,11 @@ internal class WXFSClearUnusedBundleFilesAsync : FSClearCacheFilesOperation
_fileSystem = fileSystem;
_manifest = manifest;
}
internal override void InternalOnStart()
internal override void InternalStart()
{
_steps = ESteps.GetUnusedCacheFiles;
}
internal override void InternalOnUpdate()
internal override void InternalUpdate()
{
if (_steps == ESteps.None || _steps == ESteps.Done)
return;

View File

@ -13,11 +13,11 @@ internal class WXFSDownloadFileOperation : DefaultDownloadFileOperation
{
_fileSystem = fileSystem;
}
internal override void InternalOnStart()
internal override void InternalStart()
{
_steps = ESteps.CreateRequest;
}
internal override void InternalOnUpdate()
internal override void InternalUpdate()
{
// 创建下载器
if (_steps == ESteps.CreateRequest)

View File

@ -9,11 +9,11 @@ internal partial class WXFSInitializeOperation : FSInitializeFileSystemOperation
{
_fileSystem = fileSystem;
}
internal override void InternalOnStart()
internal override void InternalStart()
{
Status = EOperationStatus.Succeed;
}
internal override void InternalOnUpdate()
internal override void InternalUpdate()
{
}
}

View File

@ -14,17 +14,17 @@ internal class WXFSLoadBundleOperation : FSLoadBundleOperation
private readonly PackageBundle _bundle;
private DownloadAssetBundleOperation _downloadAssetBundleOp;
private ESteps _steps = ESteps.None;
internal WXFSLoadBundleOperation(WechatFileSystem fileSystem, PackageBundle bundle)
{
_fileSystem = fileSystem;
_bundle = bundle;
}
internal override void InternalOnStart()
internal override void InternalStart()
{
_steps = ESteps.DownloadAssetBundle;
}
internal override void InternalOnUpdate()
internal override void InternalUpdate()
{
if (_steps == ESteps.None || _steps == ESteps.Done)
return;
@ -40,15 +40,18 @@ internal class WXFSLoadBundleOperation : FSLoadBundleOperation
if (_bundle.Encrypted)
{
_downloadAssetBundleOp = new DownloadWebEncryptAssetBundleOperation(false, _fileSystem.DecryptionServices, _bundle, downloadParam);
OperationSystem.StartOperation(_fileSystem.PackageName, _downloadAssetBundleOp);
_downloadAssetBundleOp.StartOperation();
AddChildOperation(_downloadAssetBundleOp);
}
else
{
_downloadAssetBundleOp = new DownloadWechatAssetBundleOperation(_bundle, downloadParam);
OperationSystem.StartOperation(_fileSystem.PackageName, _downloadAssetBundleOp);
_downloadAssetBundleOp.StartOperation();
AddChildOperation(_downloadAssetBundleOp);
}
}
_downloadAssetBundleOp.UpdateOperation();
DownloadProgress = _downloadAssetBundleOp.DownloadProgress;
DownloadedBytes = (long)_downloadAssetBundleOp.DownloadedBytes;
Progress = DownloadProgress;
@ -89,13 +92,5 @@ internal class WXFSLoadBundleOperation : FSLoadBundleOperation
UnityEngine.Debug.LogError(Error);
}
}
public override void AbortDownloadOperation()
{
if (_steps == ESteps.DownloadAssetBundle)
{
if (_downloadAssetBundleOp != null)
_downloadAssetBundleOp.SetAbort();
}
}
}
#endif

View File

@ -25,11 +25,11 @@ internal class WXFSLoadPackageManifestOperation : FSLoadPackageManifestOperation
_packageVersion = packageVersion;
_timeout = timeout;
}
internal override void InternalOnStart()
internal override void InternalStart()
{
_steps = ESteps.RequestPackageHash;
}
internal override void InternalOnUpdate()
internal override void InternalUpdate()
{
if (_steps == ESteps.None || _steps == ESteps.Done)
return;
@ -39,9 +39,11 @@ internal class WXFSLoadPackageManifestOperation : FSLoadPackageManifestOperation
if (_requestPackageHashOp == null)
{
_requestPackageHashOp = new RequestWechatPackageHashOperation(_fileSystem, _packageVersion, _timeout);
OperationSystem.StartOperation(_fileSystem.PackageName, _requestPackageHashOp);
_requestPackageHashOp.StartOperation();
AddChildOperation(_requestPackageHashOp);
}
_requestPackageHashOp.UpdateOperation();
if (_requestPackageHashOp.IsDone == false)
return;
@ -63,9 +65,11 @@ internal class WXFSLoadPackageManifestOperation : FSLoadPackageManifestOperation
{
string packageHash = _requestPackageHashOp.PackageHash;
_loadPackageManifestOp = new LoadWechatPackageManifestOperation(_fileSystem, _packageVersion, packageHash, _timeout);
OperationSystem.StartOperation(_fileSystem.PackageName, _loadPackageManifestOp);
_loadPackageManifestOp.StartOperation();
AddChildOperation(_loadPackageManifestOp);
}
_loadPackageManifestOp.UpdateOperation();
Progress = _loadPackageManifestOp.Progress;
if (_loadPackageManifestOp.IsDone == false)
return;

View File

@ -23,11 +23,11 @@ internal class WXFSRequestPackageVersionOperation : FSRequestPackageVersionOpera
_appendTimeTicks = appendTimeTicks;
_timeout = timeout;
}
internal override void InternalOnStart()
internal override void InternalStart()
{
_steps = ESteps.RequestPackageVersion;
}
internal override void InternalOnUpdate()
internal override void InternalUpdate()
{
if (_steps == ESteps.None || _steps == ESteps.Done)
return;
@ -37,9 +37,11 @@ internal class WXFSRequestPackageVersionOperation : FSRequestPackageVersionOpera
if (_requestWebPackageVersionOp == null)
{
_requestWebPackageVersionOp = new RequestWechatPackageVersionOperation(_fileSystem, _appendTimeTicks, _timeout);
OperationSystem.StartOperation(_fileSystem.PackageName, _requestWebPackageVersionOp);
_requestWebPackageVersionOp.StartOperation();
AddChildOperation(_requestWebPackageVersionOp);
}
_requestWebPackageVersionOp.UpdateOperation();
Progress = _requestWebPackageVersionOp.Progress;
if (_requestWebPackageVersionOp.IsDone == false)
return;

View File

@ -1,6 +1,5 @@
#if UNITY_WEBGL && WEIXINMINIGAME
using UnityEngine;
using UnityEngine.Networking;
using WeChatWASM;
namespace YooAsset
@ -12,11 +11,11 @@ namespace YooAsset
internal DownloadWechatAssetBundleOperation(PackageBundle bundle, DownloadParam param) : base(bundle, param)
{
}
internal override void InternalOnStart()
internal override void InternalStart()
{
_steps = ESteps.CreateRequest;
}
internal override void InternalOnUpdate()
internal override void InternalUpdate()
{
if (_steps == ESteps.None || _steps == ESteps.Done)
return;
@ -103,7 +102,7 @@ namespace YooAsset
}
}
}
internal override void InternalOnAbort()
internal override void InternalAbort()
{
_steps = ESteps.Done;
DisposeWebRequest();

View File

@ -34,12 +34,12 @@ internal class LoadWechatPackageManifestOperation : AsyncOperationBase
_packageHash = packageHash;
_timeout = timeout;
}
internal override void InternalOnStart()
internal override void InternalStart()
{
_requestCount = WebRequestCounter.GetRequestFailedCount(_fileSystem.PackageName, nameof(LoadWechatPackageManifestOperation));
_steps = ESteps.RequestFileData;
}
internal override void InternalOnUpdate()
internal override void InternalUpdate()
{
if (_steps == ESteps.None || _steps == ESteps.Done)
return;
@ -51,9 +51,11 @@ internal class LoadWechatPackageManifestOperation : AsyncOperationBase
string fileName = YooAssetSettingsData.GetManifestBinaryFileName(_fileSystem.PackageName, _packageVersion);
string url = GetRequestURL(fileName);
_webDataRequestOp = new UnityWebDataRequestOperation(url, _timeout);
OperationSystem.StartOperation(_fileSystem.PackageName, _webDataRequestOp);
_webDataRequestOp.StartOperation();
AddChildOperation(_webDataRequestOp);
}
_webDataRequestOp.UpdateOperation();
Progress = _webDataRequestOp.Progress;
if (_webDataRequestOp.IsDone == false)
return;
@ -91,9 +93,11 @@ internal class LoadWechatPackageManifestOperation : AsyncOperationBase
if (_deserializer == null)
{
_deserializer = new DeserializeManifestOperation(_webDataRequestOp.Result);
OperationSystem.StartOperation(_fileSystem.PackageName, _deserializer);
_deserializer.StartOperation();
AddChildOperation(_deserializer);
}
_deserializer.UpdateOperation();
Progress = _deserializer.Progress;
if (_deserializer.IsDone == false)
return;

View File

@ -29,12 +29,12 @@ internal class RequestWechatPackageHashOperation : AsyncOperationBase
_packageVersion = packageVersion;
_timeout = timeout;
}
internal override void InternalOnStart()
internal override void InternalStart()
{
_requestCount = WebRequestCounter.GetRequestFailedCount(_fileSystem.PackageName, nameof(RequestWechatPackageHashOperation));
_steps = ESteps.RequestPackageHash;
}
internal override void InternalOnUpdate()
internal override void InternalUpdate()
{
if (_steps == ESteps.None || _steps == ESteps.Done)
return;
@ -46,9 +46,11 @@ internal class RequestWechatPackageHashOperation : AsyncOperationBase
string fileName = YooAssetSettingsData.GetPackageHashFileName(_fileSystem.PackageName, _packageVersion);
string url = GetRequestURL(fileName);
_webTextRequestOp = new UnityWebTextRequestOperation(url, _timeout);
OperationSystem.StartOperation(_fileSystem.PackageName, _webTextRequestOp);
_webTextRequestOp.StartOperation();
AddChildOperation(_webTextRequestOp);
}
_webTextRequestOp.UpdateOperation();
Progress = _webTextRequestOp.Progress;
if (_webTextRequestOp.IsDone == false)
return;

View File

@ -29,12 +29,12 @@ internal class RequestWechatPackageVersionOperation : AsyncOperationBase
_appendTimeTicks = appendTimeTicks;
_timeout = timeout;
}
internal override void InternalOnStart()
internal override void InternalStart()
{
_requestCount = WebRequestCounter.GetRequestFailedCount(_fileSystem.PackageName, nameof(RequestWechatPackageVersionOperation));
_steps = ESteps.RequestPackageVersion;
}
internal override void InternalOnUpdate()
internal override void InternalUpdate()
{
if (_steps == ESteps.None || _steps == ESteps.Done)
return;
@ -46,9 +46,11 @@ internal class RequestWechatPackageVersionOperation : AsyncOperationBase
string fileName = YooAssetSettingsData.GetPackageVersionFileName(_fileSystem.PackageName);
string url = GetRequestURL(fileName);
_webTextRequestOp = new UnityWebTextRequestOperation(url, _timeout);
OperationSystem.StartOperation(_fileSystem.PackageName, _webTextRequestOp);
_webTextRequestOp.StartOperation();
AddChildOperation(_webTextRequestOp);
}
_webTextRequestOp.UpdateOperation();
Progress = _webTextRequestOp.Progress;
if (_webTextRequestOp.IsDone == false)
return;

View File

@ -113,19 +113,16 @@ internal class WechatFileSystem : IFileSystem
public virtual FSInitializeFileSystemOperation InitializeFileSystemAsync()
{
var operation = new WXFSInitializeOperation(this);
OperationSystem.StartOperation(PackageName, operation);
return operation;
}
public virtual FSLoadPackageManifestOperation LoadPackageManifestAsync(string packageVersion, int timeout)
{
var operation = new WXFSLoadPackageManifestOperation(this, packageVersion, timeout);
OperationSystem.StartOperation(PackageName, operation);
return operation;
}
public virtual FSRequestPackageVersionOperation RequestPackageVersionAsync(bool appendTimeTicks, int timeout)
{
var operation = new WXFSRequestPackageVersionOperation(this, appendTimeTicks, timeout);
OperationSystem.StartOperation(PackageName, operation);
return operation;
}
public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(PackageManifest manifest, string clearMode, object clearParam)
@ -133,20 +130,17 @@ internal class WechatFileSystem : IFileSystem
if (clearMode == EFileClearMode.ClearAllBundleFiles.ToString())
{
var operation = new WXFSClearAllBundleFilesOperation(this);
OperationSystem.StartOperation(PackageName, operation);
return operation;
}
else if (clearMode == EFileClearMode.ClearUnusedBundleFiles.ToString())
{
var operation = new WXFSClearUnusedBundleFilesAsync(this, manifest);
OperationSystem.StartOperation(PackageName, operation);
return operation;
}
else
{
string error = $"Invalid clear mode : {clearMode}";
var operation = new FSClearCacheFilesCompleteOperation(error);
OperationSystem.StartOperation(PackageName, operation);
return operation;
}
}
@ -155,7 +149,6 @@ internal class WechatFileSystem : IFileSystem
param.MainURL = RemoteServices.GetRemoteMainURL(bundle.FileName);
param.FallbackURL = RemoteServices.GetRemoteFallbackURL(bundle.FileName);
var operation = new WXFSDownloadFileOperation(this, bundle, param);
OperationSystem.StartOperation(PackageName, operation);
return operation;
}
public virtual FSLoadBundleOperation LoadBundleFile(PackageBundle bundle)
@ -163,14 +156,12 @@ internal class WechatFileSystem : IFileSystem
if (bundle.BundleType == (int)EBuildBundleType.AssetBundle)
{
var operation = new WXFSLoadBundleOperation(this, bundle);
OperationSystem.StartOperation(PackageName, operation);
return operation;
}
else
{
string error = $"{nameof(WechatFileSystem)} not support load bundle type : {bundle.BundleType}";
var operation = new FSLoadBundleCompleteOperation(error);
OperationSystem.StartOperation(PackageName, operation);
return operation;
}
}
@ -214,7 +205,7 @@ internal class WechatFileSystem : IFileSystem
_fileSystemMgr = WX.GetFileSystemManager();
}
public virtual void OnUpdate()
public virtual void OnDestroy()
{
}