[+] Procedure

[+] Procedure
This commit is contained in:
ALEXTANG
2023-04-13 14:37:49 +08:00
parent a6958f39e7
commit 51254bba57
29 changed files with 1077 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
using System;
using Cysharp.Threading.Tasks;
using TEngine;
using YooAsset;
using ProcedureOwner = TEngine.IFsm<TEngine.IProcedureManager>;
namespace GameMain
{
/// <summary>
/// 流程 => 用户尝试更新清单
/// </summary>
public class ProcedureUpdateManifest: ProcedureBase
{
public override bool UseNativeDialog { get; }
protected override void OnEnter(ProcedureOwner procedureOwner)
{
Log.Info("更新资源清单!!!");
UILoadMgr.Show(UIDefine.UILoadUpdate,$"更新清单文件...");
UpdateManifest(procedureOwner).Forget();
}
private async UniTaskVoid UpdateManifest(ProcedureOwner procedureOwner)
{
await UniTask.Delay(TimeSpan.FromSeconds(0.5f));
var operation = GameModule.Resource.UpdatePackageManifestAsync(GameModule.Resource.PackageVersion);
await operation.ToUniTask();
if(operation.Status == EOperationStatus.Succeed)
{
ChangeState<ProcedureCreateDownloader>(procedureOwner);
}
else
{
Log.Error(operation.Error);
UILoadTip.ShowMessageBox($"用户尝试更新清单失败!点击确认重试 \n \n <color=#FF0000>原因{operation.Error}</color>", MessageShowType.TwoButton,
LoadStyle.StyleEnum.Style_Retry
, () => { ChangeState<ProcedureUpdateManifest>(procedureOwner); }, UnityEngine.Application.Quit);
}
}
}
}