Support fast build mode.

支持快速构建模式,真实的实现EditorPlayMode的运行时环境。
This commit is contained in:
hevinci
2022-05-02 23:15:09 +08:00
parent 8d02406211
commit 665a16fe60
39 changed files with 492 additions and 383 deletions

View File

@@ -1,5 +1,6 @@
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
namespace YooAsset
@@ -16,12 +17,50 @@ namespace YooAsset
/// </summary>
internal sealed class EditorPlayModeInitializationOperation : InitializationOperation
{
private enum ESteps
{
None,
Builder,
Done,
}
private readonly EditorPlayModeImpl _impl;
private ESteps _steps = ESteps.None;
internal EditorPlayModeInitializationOperation(EditorPlayModeImpl impl)
{
_impl = impl;
}
internal override void Start()
{
Status = EOperationStatus.Succeed;
_steps = ESteps.Builder;
}
internal override void Update()
{
if (_steps == ESteps.Builder)
{
string manifestFilePath = EditorPlayModeHelper.DryRunBuild();
if (string.IsNullOrEmpty(manifestFilePath))
{
_steps = ESteps.Done;
Status = EOperationStatus.Failed;
Error = "Dry run build failed, see the detail info on the console window.";
return;
}
if (File.Exists(manifestFilePath) == false)
{
_steps = ESteps.Done;
Status = EOperationStatus.Failed;
Error = $"Manifest file not found : {manifestFilePath}";
return;
}
YooLogger.Log($"Load manifest file in editor play mode : {manifestFilePath}");
string jsonContent = FileUtility.ReadFile(manifestFilePath);
_impl.AppPatchManifest = PatchManifest.Deserialize(jsonContent);
_steps = ESteps.Done;
Status = EOperationStatus.Succeed;
}
}
}
@@ -152,6 +191,7 @@ namespace YooAsset
}
}
/// <summary>
/// 内置补丁清单加载器
/// </summary>