Update Samples

This commit is contained in:
hevinci
2022-07-18 14:56:12 +08:00
parent e340af90ed
commit 1fdeeb781f
357 changed files with 37151 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
using System.Collections;
using YooAsset;
public class FsmDownloadWebFiles : IFsmNode
{
public string Name { private set; get; } = nameof(FsmDownloadWebFiles);
void IFsmNode.OnEnter()
{
PatchEventDispatcher.SendPatchStepsChangeMsg(EPatchStates.DownloadWebFiles);
BootScene.Instance.StartCoroutine(BeginDownload());
}
void IFsmNode.OnUpdate()
{
}
void IFsmNode.OnExit()
{
}
private IEnumerator BeginDownload()
{
var downloader = PatchUpdater.Downloader;
// 注册下载回调
downloader.OnDownloadErrorCallback = PatchEventDispatcher.SendWebFileDownloadFailedMsg;
downloader.OnDownloadProgressCallback = PatchEventDispatcher.SendDownloadProgressUpdateMsg;
downloader.BeginDownload();
yield return downloader;
// 检测下载结果
if (downloader.Status != EOperationStatus.Succeed)
yield break;
FsmManager.Transition(nameof(FsmPatchDone));
}
}