style : 统一小游戏编码规范和命名规范

This commit is contained in:
何冠峰
2025-07-24 11:21:37 +08:00
parent b9b9f4e37d
commit fb56959c61
13 changed files with 44 additions and 45 deletions

View File

@@ -48,7 +48,7 @@ internal class TTFSDownloadFileOperation : FSDownloadFileOperation
_webCacheRequestOp.UpdateOperation(); _webCacheRequestOp.UpdateOperation();
Progress = _webCacheRequestOp.Progress; Progress = _webCacheRequestOp.Progress;
DownloadProgress = _webCacheRequestOp.DownloadProgress; DownloadProgress = _webCacheRequestOp.DownloadProgress;
DownloadedBytes = (long)_webCacheRequestOp.DownloadedBytes; DownloadedBytes = _webCacheRequestOp.DownloadedBytes;
if (_webCacheRequestOp.IsDone == false) if (_webCacheRequestOp.IsDone == false)
return; return;
@@ -57,7 +57,7 @@ internal class TTFSDownloadFileOperation : FSDownloadFileOperation
_steps = ESteps.Done; _steps = ESteps.Done;
Status = EOperationStatus.Succeed; Status = EOperationStatus.Succeed;
//TODO 需要验证抖音插件请求器的下载进度 //TODO 需要验证插件请求器的下载进度
DownloadProgress = 1f; DownloadProgress = 1f;
DownloadedBytes = Bundle.FileSize; DownloadedBytes = Bundle.FileSize;
Progress = 1f; Progress = 1f;

View File

@@ -1,5 +1,4 @@
#if UNITY_WEBGL && DOUYINMINIGAME #if UNITY_WEBGL && DOUYINMINIGAME
using UnityEngine;
using YooAsset; using YooAsset;
internal class TTFSLoadBundleOperation : FSLoadBundleOperation internal class TTFSLoadBundleOperation : FSLoadBundleOperation
@@ -7,7 +6,7 @@ internal class TTFSLoadBundleOperation : FSLoadBundleOperation
private enum ESteps private enum ESteps
{ {
None, None,
DownloadAssetBundle, LoadAssetBundle,
Done, Done,
} }
@@ -23,14 +22,14 @@ internal class TTFSLoadBundleOperation : FSLoadBundleOperation
} }
internal override void InternalStart() internal override void InternalStart()
{ {
_steps = ESteps.DownloadAssetBundle; _steps = ESteps.LoadAssetBundle;
} }
internal override void InternalUpdate() internal override void InternalUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
if (_steps == ESteps.DownloadAssetBundle) if (_steps == ESteps.LoadAssetBundle)
{ {
if (_loadWebAssetBundleOp == null) if (_loadWebAssetBundleOp == null)
{ {
@@ -56,7 +55,7 @@ internal class TTFSLoadBundleOperation : FSLoadBundleOperation
_loadWebAssetBundleOp.UpdateOperation(); _loadWebAssetBundleOp.UpdateOperation();
Progress = _loadWebAssetBundleOp.Progress; Progress = _loadWebAssetBundleOp.Progress;
DownloadProgress = _loadWebAssetBundleOp.DownloadProgress; DownloadProgress = _loadWebAssetBundleOp.DownloadProgress;
DownloadedBytes = (long)_loadWebAssetBundleOp.DownloadedBytes; DownloadedBytes = _loadWebAssetBundleOp.DownloadedBytes;
if (_loadWebAssetBundleOp.IsDone == false) if (_loadWebAssetBundleOp.IsDone == false)
return; return;

View File

@@ -16,7 +16,7 @@ namespace YooAsset
private readonly PackageBundle _bundle; private readonly PackageBundle _bundle;
private readonly DownloadFileOptions _options; private readonly DownloadFileOptions _options;
private UnityTiktokAssetBundleRequestOperation _unityTiktokAssetBundleRequestOp; private UnityTiktokAssetBundleRequestOperation _unityAssetBundleRequestOp;
private int _requestCount = 0; private int _requestCount = 0;
private float _tryAgainTimer; private float _tryAgainTimer;
@@ -42,40 +42,40 @@ namespace YooAsset
if (_steps == ESteps.CreateRequest) if (_steps == ESteps.CreateRequest)
{ {
string url = GetRequestURL(); string url = GetRequestURL();
_unityTiktokAssetBundleRequestOp = new UnityTiktokAssetBundleRequestOperation(_bundle, url); _unityAssetBundleRequestOp = new UnityTiktokAssetBundleRequestOperation(_bundle, url);
_unityTiktokAssetBundleRequestOp.StartOperation(); _unityAssetBundleRequestOp.StartOperation();
AddChildOperation(_unityTiktokAssetBundleRequestOp); AddChildOperation(_unityAssetBundleRequestOp);
_steps = ESteps.CheckRequest; _steps = ESteps.CheckRequest;
} }
// 检测下载结果 // 检测下载结果
if (_steps == ESteps.CheckRequest) if (_steps == ESteps.CheckRequest)
{ {
_unityTiktokAssetBundleRequestOp.UpdateOperation(); _unityAssetBundleRequestOp.UpdateOperation();
Progress = _unityTiktokAssetBundleRequestOp.Progress; Progress = _unityAssetBundleRequestOp.Progress;
DownloadProgress = _unityTiktokAssetBundleRequestOp.DownloadProgress; DownloadProgress = _unityAssetBundleRequestOp.DownloadProgress;
DownloadedBytes = (long)_unityTiktokAssetBundleRequestOp.DownloadedBytes; DownloadedBytes = _unityAssetBundleRequestOp.DownloadedBytes;
if (_unityTiktokAssetBundleRequestOp.IsDone == false) if (_unityAssetBundleRequestOp.IsDone == false)
return; return;
if (_unityTiktokAssetBundleRequestOp.Status == EOperationStatus.Succeed) if (_unityAssetBundleRequestOp.Status == EOperationStatus.Succeed)
{ {
_steps = ESteps.Done; _steps = ESteps.Done;
Status = EOperationStatus.Succeed; Status = EOperationStatus.Succeed;
Result = _unityTiktokAssetBundleRequestOp.Result; Result = _unityAssetBundleRequestOp.Result;
} }
else else
{ {
if (_failedTryAgain > 0) if (_failedTryAgain > 0)
{ {
_steps = ESteps.TryAgain; _steps = ESteps.TryAgain;
YooLogger.Warning($"Failed download : {_unityTiktokAssetBundleRequestOp.URL} Try again !"); YooLogger.Warning($"Failed download : {_unityAssetBundleRequestOp.URL} Try again !");
} }
else else
{ {
_steps = ESteps.Done; _steps = ESteps.Done;
Status = EOperationStatus.Failed; Status = EOperationStatus.Failed;
Error = _unityTiktokAssetBundleRequestOp.Error; Error = _unityAssetBundleRequestOp.Error;
YooLogger.Error(Error); YooLogger.Error(Error);
} }
} }

View File

@@ -62,7 +62,7 @@ internal class RequestTiktokPackageHashOperation : AsyncOperationBase
{ {
_steps = ESteps.Done; _steps = ESteps.Done;
Status = EOperationStatus.Failed; Status = EOperationStatus.Failed;
Error = $"Wechat package hash file content is empty !"; Error = $"Web package hash file content is empty !";
} }
else else
{ {

View File

@@ -62,7 +62,7 @@ internal class RequestTiktokPackageVersionOperation : AsyncOperationBase
{ {
_steps = ESteps.Done; _steps = ESteps.Done;
Status = EOperationStatus.Failed; Status = EOperationStatus.Failed;
Error = $"Wechat package version file content is empty !"; Error = $"Web package version file content is empty !";
} }
else else
{ {

View File

@@ -67,7 +67,7 @@ namespace YooAsset
Result = assetBundle; Result = assetBundle;
Status = EOperationStatus.Succeed; Status = EOperationStatus.Succeed;
//TODO 需要验证抖音插件请求器的下载进度 //TODO 需要验证插件请求器的下载进度
DownloadProgress = 1f; DownloadProgress = 1f;
DownloadedBytes = _packageBundle.FileSize; DownloadedBytes = _packageBundle.FileSize;
Progress = 1f; Progress = 1f;

View File

@@ -1,10 +1,9 @@
#if UNITY_WEBGL && DOUYINMINIGAME #if UNITY_WEBGL && DOUYINMINIGAME
using System;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using YooAsset; using YooAsset;
using TTSDK; using TTSDK;
using System.Linq;
using System;
public static class TiktokFileSystemCreater public static class TiktokFileSystemCreater
{ {

View File

@@ -49,7 +49,7 @@ internal class WXFSDownloadFileOperation : FSDownloadFileOperation
_webCacheRequestOp.UpdateOperation(); _webCacheRequestOp.UpdateOperation();
Progress = _webCacheRequestOp.Progress; Progress = _webCacheRequestOp.Progress;
DownloadProgress = _webCacheRequestOp.DownloadProgress; DownloadProgress = _webCacheRequestOp.DownloadProgress;
DownloadedBytes = (long)_webCacheRequestOp.DownloadedBytes; DownloadedBytes = _webCacheRequestOp.DownloadedBytes;
if (_webCacheRequestOp.IsDone == false) if (_webCacheRequestOp.IsDone == false)
return; return;

View File

@@ -6,7 +6,7 @@ internal class WXFSLoadBundleOperation : FSLoadBundleOperation
private enum ESteps private enum ESteps
{ {
None, None,
DownloadAssetBundle, LoadAssetBundle,
Done, Done,
} }
@@ -22,14 +22,14 @@ internal class WXFSLoadBundleOperation : FSLoadBundleOperation
} }
internal override void InternalStart() internal override void InternalStart()
{ {
_steps = ESteps.DownloadAssetBundle; _steps = ESteps.LoadAssetBundle;
} }
internal override void InternalUpdate() internal override void InternalUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
if (_steps == ESteps.DownloadAssetBundle) if (_steps == ESteps.LoadAssetBundle)
{ {
if (_loadWebAssetBundleOp == null) if (_loadWebAssetBundleOp == null)
{ {
@@ -55,7 +55,7 @@ internal class WXFSLoadBundleOperation : FSLoadBundleOperation
_loadWebAssetBundleOp.UpdateOperation(); _loadWebAssetBundleOp.UpdateOperation();
Progress = _loadWebAssetBundleOp.Progress; Progress = _loadWebAssetBundleOp.Progress;
DownloadProgress = _loadWebAssetBundleOp.DownloadProgress; DownloadProgress = _loadWebAssetBundleOp.DownloadProgress;
DownloadedBytes = (long)_loadWebAssetBundleOp.DownloadedBytes; DownloadedBytes = _loadWebAssetBundleOp.DownloadedBytes;
if (_loadWebAssetBundleOp.IsDone == false) if (_loadWebAssetBundleOp.IsDone == false)
return; return;

View File

@@ -16,7 +16,7 @@ namespace YooAsset
private readonly PackageBundle _bundle; private readonly PackageBundle _bundle;
private readonly DownloadFileOptions _options; private readonly DownloadFileOptions _options;
private UnityWechatAssetBundleRequestOperation _unityWechatAssetBundleRequestOp; private UnityWechatAssetBundleRequestOperation _unityAssetBundleRequestOp;
private int _requestCount = 0; private int _requestCount = 0;
private float _tryAgainTimer; private float _tryAgainTimer;
@@ -42,40 +42,40 @@ namespace YooAsset
if (_steps == ESteps.CreateRequest) if (_steps == ESteps.CreateRequest)
{ {
string url = GetRequestURL(); string url = GetRequestURL();
_unityWechatAssetBundleRequestOp = new UnityWechatAssetBundleRequestOperation(_bundle, url); _unityAssetBundleRequestOp = new UnityWechatAssetBundleRequestOperation(_bundle, url);
_unityWechatAssetBundleRequestOp.StartOperation(); _unityAssetBundleRequestOp.StartOperation();
AddChildOperation(_unityWechatAssetBundleRequestOp); AddChildOperation(_unityAssetBundleRequestOp);
_steps = ESteps.CheckRequest; _steps = ESteps.CheckRequest;
} }
// 检测下载结果 // 检测下载结果
if (_steps == ESteps.CheckRequest) if (_steps == ESteps.CheckRequest)
{ {
_unityWechatAssetBundleRequestOp.UpdateOperation(); _unityAssetBundleRequestOp.UpdateOperation();
Progress = _unityWechatAssetBundleRequestOp.Progress; Progress = _unityAssetBundleRequestOp.Progress;
DownloadProgress = _unityWechatAssetBundleRequestOp.DownloadProgress; DownloadProgress = _unityAssetBundleRequestOp.DownloadProgress;
DownloadedBytes = (long)_unityWechatAssetBundleRequestOp.DownloadedBytes; DownloadedBytes = _unityAssetBundleRequestOp.DownloadedBytes;
if (_unityWechatAssetBundleRequestOp.IsDone == false) if (_unityAssetBundleRequestOp.IsDone == false)
return; return;
if (_unityWechatAssetBundleRequestOp.Status == EOperationStatus.Succeed) if (_unityAssetBundleRequestOp.Status == EOperationStatus.Succeed)
{ {
_steps = ESteps.Done; _steps = ESteps.Done;
Status = EOperationStatus.Succeed; Status = EOperationStatus.Succeed;
Result = _unityWechatAssetBundleRequestOp.Result; Result = _unityAssetBundleRequestOp.Result;
} }
else else
{ {
if (_failedTryAgain > 0) if (_failedTryAgain > 0)
{ {
_steps = ESteps.TryAgain; _steps = ESteps.TryAgain;
YooLogger.Warning($"Failed download : {_unityWechatAssetBundleRequestOp.URL} Try again !"); YooLogger.Warning($"Failed download : {_unityAssetBundleRequestOp.URL} Try again !");
} }
else else
{ {
_steps = ESteps.Done; _steps = ESteps.Done;
Status = EOperationStatus.Failed; Status = EOperationStatus.Failed;
Error = _unityWechatAssetBundleRequestOp.Error; Error = _unityAssetBundleRequestOp.Error;
YooLogger.Error(Error); YooLogger.Error(Error);
} }
} }

View File

@@ -62,7 +62,7 @@ internal class RequestWechatPackageHashOperation : AsyncOperationBase
{ {
_steps = ESteps.Done; _steps = ESteps.Done;
Status = EOperationStatus.Failed; Status = EOperationStatus.Failed;
Error = $"Wechat package hash file content is empty !"; Error = $"Web package hash file content is empty !";
} }
else else
{ {

View File

@@ -62,7 +62,7 @@ internal class RequestWechatPackageVersionOperation : AsyncOperationBase
{ {
_steps = ESteps.Done; _steps = ESteps.Done;
Status = EOperationStatus.Failed; Status = EOperationStatus.Failed;
Error = $"Wechat package version file content is empty !"; Error = $"Web package version file content is empty !";
} }
else else
{ {

View File

@@ -5,6 +5,7 @@
"GUID:e34a5702dd353724aa315fb8011f08c3", "GUID:e34a5702dd353724aa315fb8011f08c3",
"GUID:5efd170ecd8084500bed5692932fe14e", "GUID:5efd170ecd8084500bed5692932fe14e",
"GUID:bb21d6197862c4c3e863390dec9859a7", "GUID:bb21d6197862c4c3e863390dec9859a7",
"GUID:870f26a2ffa82429195df0861505c5d5",
"GUID:870f26a2ffa82429195df0861505c5d5" "GUID:870f26a2ffa82429195df0861505c5d5"
], ],
"includePlatforms": [], "includePlatforms": [],