Update basic sample

pull/51/head
hevinci 2022-10-18 11:56:55 +08:00
parent 9bc5580229
commit a283c8bbad
4 changed files with 41 additions and 1 deletions

View File

@ -0,0 +1,28 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
internal class FsmClearCache : IFsmNode
{
public string Name { private set; get; } = nameof(FsmClearCache);
void IFsmNode.OnEnter()
{
Debug.Log("清理未使用的缓存文件!");
var operation = YooAsset.YooAssets.ClearUnusedCacheFiles();
operation.Completed += Operation_Completed;
}
private void Operation_Completed(YooAsset.AsyncOperationBase obj)
{
Debug.Log("开始游戏!");
YooAsset.YooAssets.LoadSceneAsync("GameScene1");
}
void IFsmNode.OnUpdate()
{
}
void IFsmNode.OnExit()
{
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1d83ce785f1442a40a1ad0f837073b69
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -11,7 +11,7 @@ internal class FsmPatchDone : IFsmNode
PatchEventDispatcher.SendPatchStepsChangeMsg(EPatchStates.PatchDone);
Debug.Log("补丁流程更新完毕!");
YooAsset.YooAssets.LoadSceneAsync("GameScene1");
FsmManager.Transition(nameof(FsmClearCache));
}
void IFsmNode.OnUpdate()
{

View File

@ -36,6 +36,7 @@ public static class PatchUpdater
FsmManager.AddNode(new FsmCreateDownloader());
FsmManager.AddNode(new FsmDownloadWebFiles());
FsmManager.AddNode(new FsmPatchDone());
FsmManager.AddNode(new FsmClearCache());
FsmManager.Run(nameof(FsmPatchInit));
}
else