parent
6dd1eee6c3
commit
ecd4973948
|
@ -21,42 +21,53 @@ namespace YooAsset
|
||||||
{
|
{
|
||||||
None,
|
None,
|
||||||
Builder,
|
Builder,
|
||||||
|
Load,
|
||||||
Done,
|
Done,
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly EditorSimulateModeImpl _impl;
|
private readonly EditorSimulateModeImpl _impl;
|
||||||
|
private string _simulatePatchManifestPath;
|
||||||
private ESteps _steps = ESteps.None;
|
private ESteps _steps = ESteps.None;
|
||||||
|
|
||||||
internal EditorSimulateModeInitializationOperation(EditorSimulateModeImpl impl)
|
internal EditorSimulateModeInitializationOperation(EditorSimulateModeImpl impl, string simulatePatchManifestPath)
|
||||||
{
|
{
|
||||||
_impl = impl;
|
_impl = impl;
|
||||||
|
_simulatePatchManifestPath = simulatePatchManifestPath;
|
||||||
}
|
}
|
||||||
internal override void Start()
|
internal override void Start()
|
||||||
{
|
{
|
||||||
_steps = ESteps.Builder;
|
if (string.IsNullOrEmpty(_simulatePatchManifestPath))
|
||||||
|
_steps = ESteps.Builder;
|
||||||
|
else
|
||||||
|
_steps = ESteps.Load;
|
||||||
}
|
}
|
||||||
internal override void Update()
|
internal override void Update()
|
||||||
{
|
{
|
||||||
if (_steps == ESteps.Builder)
|
if (_steps == ESteps.Builder)
|
||||||
{
|
{
|
||||||
string manifestFilePath = EditorSimulateModeHelper.SimulateBuild();
|
_simulatePatchManifestPath = EditorSimulateModeHelper.SimulateBuild();
|
||||||
if (string.IsNullOrEmpty(manifestFilePath))
|
if (string.IsNullOrEmpty(_simulatePatchManifestPath))
|
||||||
{
|
{
|
||||||
_steps = ESteps.Done;
|
_steps = ESteps.Done;
|
||||||
Status = EOperationStatus.Failed;
|
Status = EOperationStatus.Failed;
|
||||||
Error = "Simulate build failed, see the detail info on the console window.";
|
Error = "Simulate build failed, see the detail info on the console window.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (File.Exists(manifestFilePath) == false)
|
_steps = ESteps.Load;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_steps == ESteps.Load)
|
||||||
|
{
|
||||||
|
if (File.Exists(_simulatePatchManifestPath) == false)
|
||||||
{
|
{
|
||||||
_steps = ESteps.Done;
|
_steps = ESteps.Done;
|
||||||
Status = EOperationStatus.Failed;
|
Status = EOperationStatus.Failed;
|
||||||
Error = $"Manifest file not found : {manifestFilePath}";
|
Error = $"Manifest file not found : {_simulatePatchManifestPath}";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
YooLogger.Log($"Load manifest file : {manifestFilePath}");
|
YooLogger.Log($"Load manifest file : {_simulatePatchManifestPath}");
|
||||||
string jsonContent = FileUtility.ReadFile(manifestFilePath);
|
string jsonContent = FileUtility.ReadFile(_simulatePatchManifestPath);
|
||||||
var simulatePatchManifest = PatchManifest.Deserialize(jsonContent);
|
var simulatePatchManifest = PatchManifest.Deserialize(jsonContent);
|
||||||
_impl.SetSimulatePatchManifest(simulatePatchManifest);
|
_impl.SetSimulatePatchManifest(simulatePatchManifest);
|
||||||
_steps = ESteps.Done;
|
_steps = ESteps.Done;
|
||||||
|
|
|
@ -12,10 +12,10 @@ namespace YooAsset
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 异步初始化
|
/// 异步初始化
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public InitializationOperation InitializeAsync(bool locationToLower)
|
public InitializationOperation InitializeAsync(bool locationToLower, string simulatePatchManifestPath)
|
||||||
{
|
{
|
||||||
_locationToLower = locationToLower;
|
_locationToLower = locationToLower;
|
||||||
var operation = new EditorSimulateModeInitializationOperation(this);
|
var operation = new EditorSimulateModeInitializationOperation(this, simulatePatchManifestPath);
|
||||||
OperationSystem.ProcessOperaiton(operation);
|
OperationSystem.ProcessOperaiton(operation);
|
||||||
return operation;
|
return operation;
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,6 +66,11 @@ namespace YooAsset
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class EditorSimulateModeParameters : CreateParameters
|
public class EditorSimulateModeParameters : CreateParameters
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 用于模拟运行的资源清单路径
|
||||||
|
/// 注意:如果路径为空,会自动重新构建补丁清单。
|
||||||
|
/// </summary>
|
||||||
|
public string SimulatePatchManifestPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -187,7 +192,10 @@ namespace YooAsset
|
||||||
_editorSimulateModeImpl = new EditorSimulateModeImpl();
|
_editorSimulateModeImpl = new EditorSimulateModeImpl();
|
||||||
_bundleServices = _editorSimulateModeImpl;
|
_bundleServices = _editorSimulateModeImpl;
|
||||||
AssetSystem.Initialize(true, parameters.AssetLoadingMaxNumber, parameters.DecryptionServices, _bundleServices);
|
AssetSystem.Initialize(true, parameters.AssetLoadingMaxNumber, parameters.DecryptionServices, _bundleServices);
|
||||||
initializeOperation = _editorSimulateModeImpl.InitializeAsync(parameters.LocationToLower);
|
var editorSimulateModeParameters = parameters as EditorSimulateModeParameters;
|
||||||
|
initializeOperation = _editorSimulateModeImpl.InitializeAsync(
|
||||||
|
editorSimulateModeParameters.LocationToLower,
|
||||||
|
editorSimulateModeParameters.SimulatePatchManifestPath);
|
||||||
}
|
}
|
||||||
else if (_playMode == EPlayMode.OfflinePlayMode)
|
else if (_playMode == EPlayMode.OfflinePlayMode)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue