mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-21 07:50:20 +00:00
Support fast build mode.
支持快速构建模式,真实的实现EditorPlayMode的运行时环境。
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user