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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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