40 lines
1.2 KiB
C#
40 lines
1.2 KiB
C#
using Cysharp.Threading.Tasks;
|
|
using AlicizaX;
|
|
using YooAsset;
|
|
|
|
namespace Unity.Startup.Procedure
|
|
{
|
|
internal sealed class ProcedurePatchInit : StateBase<UpdateProcedureState>
|
|
{
|
|
protected override async void OnEnter()
|
|
{
|
|
if (GameApp.Resource.PlayMode == EPlayMode.EditorSimulateMode)
|
|
{
|
|
await GameApp.Resource.InitPackageAsync();
|
|
SwitchState(UpdateProcedureState.ProcedureUpdateStaticVersion);
|
|
return;
|
|
}
|
|
|
|
if (GameApp.Resource.PlayMode == EPlayMode.OfflinePlayMode)
|
|
{
|
|
Log.Info("当前为离线模式,直接启动 ProcedureUpdateStaticVersion");
|
|
await GameApp.Resource.InitPackageAsync();
|
|
SwitchState(UpdateProcedureState.ProcedureUpdateStaticVersion);
|
|
return;
|
|
}
|
|
|
|
Start();
|
|
}
|
|
|
|
async void Start()
|
|
{
|
|
string bundleUrl = HttpHelper.CDNUrl;
|
|
Log.Info("下载资源的路径:" + bundleUrl);
|
|
|
|
await GameApp.Resource.InitPackageAsync(string.Empty, bundleUrl, bundleUrl);
|
|
await UniTask.DelayFrame();
|
|
SwitchState(UpdateProcedureState.ProcedureUpdateStaticVersion);
|
|
}
|
|
}
|
|
}
|