mirror of https://github.com/tuyoogame/YooAsset
parent
c3c18cd555
commit
c196cd84d3
|
@ -30,8 +30,8 @@ namespace YooAsset.Editor
|
||||||
PipelineOutputDirectory = AssetBundleBuilderHelper.MakePipelineOutputDirectory(parameters.OutputRoot, parameters.BuildTarget);
|
PipelineOutputDirectory = AssetBundleBuilderHelper.MakePipelineOutputDirectory(parameters.OutputRoot, parameters.BuildTarget);
|
||||||
if (parameters.BuildMode == EBuildMode.DryRunBuild)
|
if (parameters.BuildMode == EBuildMode.DryRunBuild)
|
||||||
PipelineOutputDirectory += $"_{EBuildMode.DryRunBuild}";
|
PipelineOutputDirectory += $"_{EBuildMode.DryRunBuild}";
|
||||||
else if(parameters.BuildMode == EBuildMode.FastRunBuild)
|
else if(parameters.BuildMode == EBuildMode.SimulateBuild)
|
||||||
PipelineOutputDirectory += $"_{EBuildMode.FastRunBuild}";
|
PipelineOutputDirectory += $"_{EBuildMode.SimulateBuild}";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -53,7 +53,7 @@ namespace YooAsset.Editor
|
||||||
BuildAssetBundleOptions opt = BuildAssetBundleOptions.None;
|
BuildAssetBundleOptions opt = BuildAssetBundleOptions.None;
|
||||||
opt |= BuildAssetBundleOptions.StrictMode; //Do not allow the build to succeed if any errors are reporting during it.
|
opt |= BuildAssetBundleOptions.StrictMode; //Do not allow the build to succeed if any errors are reporting during it.
|
||||||
|
|
||||||
if (Parameters.BuildMode == EBuildMode.FastRunBuild)
|
if (Parameters.BuildMode == EBuildMode.SimulateBuild)
|
||||||
{
|
{
|
||||||
throw new Exception("Should never get here !");
|
throw new Exception("Should never get here !");
|
||||||
}
|
}
|
||||||
|
@ -132,7 +132,7 @@ namespace YooAsset.Editor
|
||||||
new TaskCopyBuildinFiles(), //拷贝内置文件
|
new TaskCopyBuildinFiles(), //拷贝内置文件
|
||||||
};
|
};
|
||||||
|
|
||||||
if (buildParameters.BuildMode == EBuildMode.FastRunBuild)
|
if (buildParameters.BuildMode == EBuildMode.SimulateBuild)
|
||||||
BuildRunner.EnableLog = false;
|
BuildRunner.EnableLog = false;
|
||||||
else
|
else
|
||||||
BuildRunner.EnableLog = true;
|
BuildRunner.EnableLog = true;
|
||||||
|
|
|
@ -1,22 +1,21 @@
|
||||||
using System;
|
using UnityEditor;
|
||||||
using UnityEditor;
|
|
||||||
|
|
||||||
namespace YooAsset.Editor
|
namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
public static class AssetBundleRuntimeBuilder
|
public static class AssetBundleSimulateBuilder
|
||||||
{
|
{
|
||||||
private static string _manifestFilePath = string.Empty;
|
private static string _manifestFilePath = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 快速模式构建
|
/// 模拟构建
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void FastBuild()
|
public static void SimulateBuild()
|
||||||
{
|
{
|
||||||
string defaultOutputRoot = AssetBundleBuilderHelper.GetDefaultOutputRoot();
|
string defaultOutputRoot = AssetBundleBuilderHelper.GetDefaultOutputRoot();
|
||||||
BuildParameters buildParameters = new BuildParameters();
|
BuildParameters buildParameters = new BuildParameters();
|
||||||
buildParameters.OutputRoot = defaultOutputRoot;
|
buildParameters.OutputRoot = defaultOutputRoot;
|
||||||
buildParameters.BuildTarget = EditorUserBuildSettings.activeBuildTarget;
|
buildParameters.BuildTarget = EditorUserBuildSettings.activeBuildTarget;
|
||||||
buildParameters.BuildMode = EBuildMode.FastRunBuild;
|
buildParameters.BuildMode = EBuildMode.SimulateBuild;
|
||||||
buildParameters.BuildVersion = AssetBundleBuilderSettingData.Setting.BuildVersion;
|
buildParameters.BuildVersion = AssetBundleBuilderSettingData.Setting.BuildVersion;
|
||||||
buildParameters.BuildinTags = AssetBundleBuilderSettingData.Setting.BuildTags;
|
buildParameters.BuildinTags = AssetBundleBuilderSettingData.Setting.BuildTags;
|
||||||
buildParameters.EnableAddressable = AssetBundleCollectorSettingData.Setting.EnableAddressable;
|
buildParameters.EnableAddressable = AssetBundleCollectorSettingData.Setting.EnableAddressable;
|
||||||
|
@ -26,7 +25,7 @@ namespace YooAsset.Editor
|
||||||
if (buildResult)
|
if (buildResult)
|
||||||
{
|
{
|
||||||
string pipelineOutputDirectory = AssetBundleBuilderHelper.MakePipelineOutputDirectory(buildParameters.OutputRoot, buildParameters.BuildTarget);
|
string pipelineOutputDirectory = AssetBundleBuilderHelper.MakePipelineOutputDirectory(buildParameters.OutputRoot, buildParameters.BuildTarget);
|
||||||
_manifestFilePath = $"{pipelineOutputDirectory}_{EBuildMode.FastRunBuild}/{YooAssetSettingsData.GetPatchManifestFileName(buildParameters.BuildVersion)}";
|
_manifestFilePath = $"{pipelineOutputDirectory}_{EBuildMode.SimulateBuild}/{YooAssetSettingsData.GetPatchManifestFileName(buildParameters.BuildVersion)}";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -35,9 +34,9 @@ namespace YooAsset.Editor
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取构建的补丁清单文件路径
|
/// 获取构建的补丁清单路径
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string GetPatchManifestFilePath()
|
public static string GetPatchManifestPath()
|
||||||
{
|
{
|
||||||
return _manifestFilePath;
|
return _manifestFilePath;
|
||||||
}
|
}
|
|
@ -10,7 +10,7 @@ namespace YooAsset.Editor
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 执行资源构建上下文
|
/// 执行资源构建上下文
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static BuildMapContext CreateBuildMap()
|
public static BuildMapContext CreateBuildMap(EBuildMode buildMode)
|
||||||
{
|
{
|
||||||
BuildMapContext context = new BuildMapContext();
|
BuildMapContext context = new BuildMapContext();
|
||||||
Dictionary<string, BuildAssetInfo> buildAssetDic = new Dictionary<string, BuildAssetInfo>(1000);
|
Dictionary<string, BuildAssetInfo> buildAssetDic = new Dictionary<string, BuildAssetInfo>(1000);
|
||||||
|
@ -19,7 +19,7 @@ namespace YooAsset.Editor
|
||||||
AssetBundleCollectorSettingData.Setting.CheckConfigError();
|
AssetBundleCollectorSettingData.Setting.CheckConfigError();
|
||||||
|
|
||||||
// 2. 获取所有主动收集的资源
|
// 2. 获取所有主动收集的资源
|
||||||
List<CollectAssetInfo> allCollectAssets = AssetBundleCollectorSettingData.Setting.GetAllCollectAssets();
|
List<CollectAssetInfo> allCollectAssets = AssetBundleCollectorSettingData.Setting.GetAllCollectAssets(buildMode);
|
||||||
|
|
||||||
// 3. 剔除未被引用的依赖资源
|
// 3. 剔除未被引用的依赖资源
|
||||||
List<CollectAssetInfo> removeDependList = new List<CollectAssetInfo>();
|
List<CollectAssetInfo> removeDependList = new List<CollectAssetInfo>();
|
||||||
|
|
|
@ -21,9 +21,9 @@ namespace YooAsset.Editor
|
||||||
var buildParametersContext = context.GetContextObject<AssetBundleBuilder.BuildParametersContext>();
|
var buildParametersContext = context.GetContextObject<AssetBundleBuilder.BuildParametersContext>();
|
||||||
var buildMapContext = context.GetContextObject<BuildMapContext>();
|
var buildMapContext = context.GetContextObject<BuildMapContext>();
|
||||||
|
|
||||||
// 快速构建模式下跳过引擎构建
|
// 模拟构建模式下跳过引擎构建
|
||||||
var buildMode = buildParametersContext.Parameters.BuildMode;
|
var buildMode = buildParametersContext.Parameters.BuildMode;
|
||||||
if (buildMode == EBuildMode.FastRunBuild)
|
if (buildMode == EBuildMode.SimulateBuild)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BuildAssetBundleOptions opt = buildParametersContext.GetPipelineBuildOptions();
|
BuildAssetBundleOptions opt = buildParametersContext.GetPipelineBuildOptions();
|
||||||
|
|
|
@ -12,7 +12,8 @@ namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
void IBuildTask.Run(BuildContext context)
|
void IBuildTask.Run(BuildContext context)
|
||||||
{
|
{
|
||||||
var buildMapContext = BuildMapCreater.CreateBuildMap();
|
var buildParametersContext = context.GetContextObject<AssetBundleBuilder.BuildParametersContext>();
|
||||||
|
var buildMapContext = BuildMapCreater.CreateBuildMap(buildParametersContext.Parameters.BuildMode);
|
||||||
context.SetContextObject(buildMapContext);
|
context.SetContextObject(buildMapContext);
|
||||||
BuildRunner.Log("构建内容准备完毕!");
|
BuildRunner.Log("构建内容准备完毕!");
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,8 @@ namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
var buildParametersContext = context.GetContextObject<AssetBundleBuilder.BuildParametersContext>();
|
var buildParametersContext = context.GetContextObject<AssetBundleBuilder.BuildParametersContext>();
|
||||||
|
|
||||||
// 快速构建模式下跳过验证
|
// 模拟构建模式下跳过验证
|
||||||
if (buildParametersContext.Parameters.BuildMode == EBuildMode.FastRunBuild)
|
if (buildParametersContext.Parameters.BuildMode == EBuildMode.SimulateBuild)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// 验证构建结果
|
// 验证构建结果
|
||||||
|
|
|
@ -16,14 +16,14 @@ namespace YooAsset.Editor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
IncrementalBuild,
|
IncrementalBuild,
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 快速构建模式
|
|
||||||
/// </summary>
|
|
||||||
FastRunBuild,
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 演练构建模式
|
/// 演练构建模式
|
||||||
/// </summary>
|
/// </summary>
|
||||||
DryRunBuild,
|
DryRunBuild,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 模拟构建模式
|
||||||
|
/// </summary>
|
||||||
|
SimulateBuild,
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -235,6 +235,10 @@ namespace YooAsset.Editor
|
||||||
}
|
}
|
||||||
private List<string> GetAllDependencies(string mainAssetPath)
|
private List<string> GetAllDependencies(string mainAssetPath)
|
||||||
{
|
{
|
||||||
|
// 注意:模拟构建模式下不需要收集依赖资源
|
||||||
|
if(AssetBundleCollectorSetting.BuildMode == EBuildMode.SimulateBuild)
|
||||||
|
return new List<string>();
|
||||||
|
|
||||||
List<string> result = new List<string>();
|
List<string> result = new List<string>();
|
||||||
string[] depends = AssetDatabase.GetDependencies(mainAssetPath, true);
|
string[] depends = AssetDatabase.GetDependencies(mainAssetPath, true);
|
||||||
foreach (string assetPath in depends)
|
foreach (string assetPath in depends)
|
||||||
|
|
|
@ -8,6 +8,8 @@ namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
public class AssetBundleCollectorSetting : ScriptableObject
|
public class AssetBundleCollectorSetting : ScriptableObject
|
||||||
{
|
{
|
||||||
|
public static EBuildMode BuildMode;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否启用可寻址资源定位
|
/// 是否启用可寻址资源定位
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -43,8 +45,10 @@ namespace YooAsset.Editor
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取打包收集的资源文件
|
/// 获取打包收集的资源文件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<CollectAssetInfo> GetAllCollectAssets()
|
public List<CollectAssetInfo> GetAllCollectAssets(EBuildMode buildMode)
|
||||||
{
|
{
|
||||||
|
BuildMode = buildMode;
|
||||||
|
|
||||||
Dictionary<string, CollectAssetInfo> result = new Dictionary<string, CollectAssetInfo>(10000);
|
Dictionary<string, CollectAssetInfo> result = new Dictionary<string, CollectAssetInfo>(10000);
|
||||||
|
|
||||||
// 收集打包资源
|
// 收集打包资源
|
||||||
|
|
|
@ -98,7 +98,7 @@ namespace YooAsset.Editor
|
||||||
List<string> allAssets = new List<string>(1000);
|
List<string> allAssets = new List<string>(1000);
|
||||||
|
|
||||||
// 获取所有打包的资源
|
// 获取所有打包的资源
|
||||||
List<CollectAssetInfo> allCollectInfos = AssetBundleCollectorSettingData.Setting.GetAllCollectAssets();
|
List<CollectAssetInfo> allCollectInfos = AssetBundleCollectorSettingData.Setting.GetAllCollectAssets(EBuildMode.DryRunBuild);
|
||||||
List<string> collectAssets = allCollectInfos.Select(t => t.AssetPath).ToList();
|
List<string> collectAssets = allCollectInfos.Select(t => t.AssetPath).ToList();
|
||||||
foreach (var assetPath in collectAssets)
|
foreach (var assetPath in collectAssets)
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,9 +13,9 @@ namespace YooAsset
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 编辑器下模拟运行的初始化操作
|
/// 编辑器下模拟模式的初始化操作
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal sealed class EditorPlayModeInitializationOperation : InitializationOperation
|
internal sealed class EditorSimulateModeInitializationOperation : InitializationOperation
|
||||||
{
|
{
|
||||||
private enum ESteps
|
private enum ESteps
|
||||||
{
|
{
|
||||||
|
@ -24,10 +24,10 @@ namespace YooAsset
|
||||||
Done,
|
Done,
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly EditorPlayModeImpl _impl;
|
private readonly EditorSimulateModeImpl _impl;
|
||||||
private ESteps _steps = ESteps.None;
|
private ESteps _steps = ESteps.None;
|
||||||
|
|
||||||
internal EditorPlayModeInitializationOperation(EditorPlayModeImpl impl)
|
internal EditorSimulateModeInitializationOperation(EditorSimulateModeImpl impl)
|
||||||
{
|
{
|
||||||
_impl = impl;
|
_impl = impl;
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ namespace YooAsset
|
||||||
{
|
{
|
||||||
if (_steps == ESteps.Builder)
|
if (_steps == ESteps.Builder)
|
||||||
{
|
{
|
||||||
string manifestFilePath = EditorPlayModeHelper.DryRunBuild();
|
string manifestFilePath = EditorSimulateModeHelper.SimulateBuild();
|
||||||
if (string.IsNullOrEmpty(manifestFilePath))
|
if (string.IsNullOrEmpty(manifestFilePath))
|
||||||
{
|
{
|
||||||
_steps = ESteps.Done;
|
_steps = ESteps.Done;
|
||||||
|
@ -65,7 +65,7 @@ namespace YooAsset
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 离线模式的初始化操作
|
/// 离线运行模式的初始化操作
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal sealed class OfflinePlayModeInitializationOperation : InitializationOperation
|
internal sealed class OfflinePlayModeInitializationOperation : InitializationOperation
|
||||||
{
|
{
|
||||||
|
@ -116,7 +116,7 @@ namespace YooAsset
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 网络模式的初始化操作
|
/// 网络运行模式的初始化操作
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal sealed class HostPlayModeInitializationOperation : InitializationOperation
|
internal sealed class HostPlayModeInitializationOperation : InitializationOperation
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,19 +3,19 @@ using System.Reflection;
|
||||||
|
|
||||||
namespace YooAsset
|
namespace YooAsset
|
||||||
{
|
{
|
||||||
internal static class EditorPlayModeHelper
|
internal static class EditorSimulateModeHelper
|
||||||
{
|
{
|
||||||
private static System.Type _classType;
|
private static System.Type _classType;
|
||||||
|
|
||||||
public static string DryRunBuild()
|
public static string SimulateBuild()
|
||||||
{
|
{
|
||||||
_classType = Assembly.Load("YooAsset.Editor").GetType("YooAsset.Editor.AssetBundleRuntimeBuilder");
|
_classType = Assembly.Load("YooAsset.Editor").GetType("YooAsset.Editor.AssetBundleSimulateBuilder");
|
||||||
InvokePublicStaticMethod(_classType, "FastBuild");
|
InvokePublicStaticMethod(_classType, "SimulateBuild");
|
||||||
return GetPatchManifestFilePath();
|
return GetPatchManifestFilePath();
|
||||||
}
|
}
|
||||||
private static string GetPatchManifestFilePath()
|
private static string GetPatchManifestFilePath()
|
||||||
{
|
{
|
||||||
return (string)InvokePublicStaticMethod(_classType, "GetPatchManifestFilePath");
|
return (string)InvokePublicStaticMethod(_classType, "GetPatchManifestPath");
|
||||||
}
|
}
|
||||||
private static object InvokePublicStaticMethod(System.Type type, string method, params object[] parameters)
|
private static object InvokePublicStaticMethod(System.Type type, string method, params object[] parameters)
|
||||||
{
|
{
|
||||||
|
@ -30,8 +30,8 @@ namespace YooAsset
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
internal static class EditorPlayModeHelper
|
internal static class EditorSimulateModeHelper
|
||||||
{
|
{
|
||||||
public static string DryRunBuild() { throw new System.Exception("Only support in unity editor !"); }
|
public static string SimulateBuild() { throw new System.Exception("Only support in unity editor !"); }
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
|
@ -4,7 +4,7 @@ using System.Collections.Generic;
|
||||||
|
|
||||||
namespace YooAsset
|
namespace YooAsset
|
||||||
{
|
{
|
||||||
internal class EditorPlayModeImpl : IBundleServices
|
internal class EditorSimulateModeImpl : IBundleServices
|
||||||
{
|
{
|
||||||
internal PatchManifest AppPatchManifest;
|
internal PatchManifest AppPatchManifest;
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ namespace YooAsset
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public InitializationOperation InitializeAsync()
|
public InitializationOperation InitializeAsync()
|
||||||
{
|
{
|
||||||
var operation = new EditorPlayModeInitializationOperation(this);
|
var operation = new EditorSimulateModeInitializationOperation(this);
|
||||||
OperationSystem.ProcessOperaiton(operation);
|
OperationSystem.ProcessOperaiton(operation);
|
||||||
return operation;
|
return operation;
|
||||||
}
|
}
|
|
@ -14,17 +14,18 @@ namespace YooAsset
|
||||||
public enum EPlayMode
|
public enum EPlayMode
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 编辑器下模拟运行模式
|
/// 编辑器下的模拟模式
|
||||||
|
/// 注意:在初始化的时候自动构建真机运行环境。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
EditorPlayMode,
|
EditorSimulateMode,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 离线模式
|
/// 离线运行模式
|
||||||
/// </summary>
|
/// </summary>
|
||||||
OfflinePlayMode,
|
OfflinePlayMode,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 网络模式
|
/// 网络运行模式
|
||||||
/// </summary>
|
/// </summary>
|
||||||
HostPlayMode,
|
HostPlayMode,
|
||||||
}
|
}
|
||||||
|
@ -56,21 +57,21 @@ namespace YooAsset
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 编辑器下模拟运行模式参数
|
/// 编辑器下模拟运行模式的初始化参数
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class EditorPlayModeParameters : CreateParameters
|
public class EditorSimulateModeParameters : CreateParameters
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 离线模式参数
|
/// 离线运行模式的初始化参数
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class OfflinePlayModeParameters : CreateParameters
|
public class OfflinePlayModeParameters : CreateParameters
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 网络模式参数
|
/// 网络运行模式的初始化参数
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class HostPlayModeParameters : CreateParameters
|
public class HostPlayModeParameters : CreateParameters
|
||||||
{
|
{
|
||||||
|
@ -102,7 +103,7 @@ namespace YooAsset
|
||||||
private static EPlayMode _playMode;
|
private static EPlayMode _playMode;
|
||||||
private static IBundleServices _bundleServices;
|
private static IBundleServices _bundleServices;
|
||||||
private static ILocationServices _locationServices;
|
private static ILocationServices _locationServices;
|
||||||
private static EditorPlayModeImpl _editorPlayModeImpl;
|
private static EditorSimulateModeImpl _editorSimulateModeImpl;
|
||||||
private static OfflinePlayModeImpl _offlinePlayModeImpl;
|
private static OfflinePlayModeImpl _offlinePlayModeImpl;
|
||||||
private static HostPlayModeImpl _hostPlayModeImpl;
|
private static HostPlayModeImpl _hostPlayModeImpl;
|
||||||
|
|
||||||
|
@ -151,8 +152,8 @@ namespace YooAsset
|
||||||
}
|
}
|
||||||
|
|
||||||
// 运行模式
|
// 运行模式
|
||||||
if (parameters is EditorPlayModeParameters)
|
if (parameters is EditorSimulateModeParameters)
|
||||||
_playMode = EPlayMode.EditorPlayMode;
|
_playMode = EPlayMode.EditorSimulateMode;
|
||||||
else if (parameters is OfflinePlayModeParameters)
|
else if (parameters is OfflinePlayModeParameters)
|
||||||
_playMode = EPlayMode.OfflinePlayMode;
|
_playMode = EPlayMode.OfflinePlayMode;
|
||||||
else if (parameters is HostPlayModeParameters)
|
else if (parameters is HostPlayModeParameters)
|
||||||
|
@ -176,12 +177,12 @@ namespace YooAsset
|
||||||
|
|
||||||
// 初始化资源系统
|
// 初始化资源系统
|
||||||
InitializationOperation initializeOperation;
|
InitializationOperation initializeOperation;
|
||||||
if (_playMode == EPlayMode.EditorPlayMode)
|
if (_playMode == EPlayMode.EditorSimulateMode)
|
||||||
{
|
{
|
||||||
_editorPlayModeImpl = new EditorPlayModeImpl();
|
_editorSimulateModeImpl = new EditorSimulateModeImpl();
|
||||||
_bundleServices = _editorPlayModeImpl;
|
_bundleServices = _editorSimulateModeImpl;
|
||||||
AssetSystem.Initialize(true, parameters.AssetLoadingMaxNumber, parameters.DecryptionServices, _bundleServices);
|
AssetSystem.Initialize(true, parameters.AssetLoadingMaxNumber, parameters.DecryptionServices, _bundleServices);
|
||||||
initializeOperation = _editorPlayModeImpl.InitializeAsync();
|
initializeOperation = _editorSimulateModeImpl.InitializeAsync();
|
||||||
}
|
}
|
||||||
else if (_playMode == EPlayMode.OfflinePlayMode)
|
else if (_playMode == EPlayMode.OfflinePlayMode)
|
||||||
{
|
{
|
||||||
|
@ -223,7 +224,7 @@ namespace YooAsset
|
||||||
public static UpdateStaticVersionOperation UpdateStaticVersionAsync(int timeout = 60)
|
public static UpdateStaticVersionOperation UpdateStaticVersionAsync(int timeout = 60)
|
||||||
{
|
{
|
||||||
DebugCheckInitialize();
|
DebugCheckInitialize();
|
||||||
if (_playMode == EPlayMode.EditorPlayMode)
|
if (_playMode == EPlayMode.EditorSimulateMode)
|
||||||
{
|
{
|
||||||
var operation = new EditorPlayModeUpdateStaticVersionOperation();
|
var operation = new EditorPlayModeUpdateStaticVersionOperation();
|
||||||
OperationSystem.ProcessOperaiton(operation);
|
OperationSystem.ProcessOperaiton(operation);
|
||||||
|
@ -255,7 +256,7 @@ namespace YooAsset
|
||||||
public static UpdateManifestOperation UpdateManifestAsync(int resourceVersion, int timeout = 60)
|
public static UpdateManifestOperation UpdateManifestAsync(int resourceVersion, int timeout = 60)
|
||||||
{
|
{
|
||||||
DebugCheckInitialize();
|
DebugCheckInitialize();
|
||||||
if (_playMode == EPlayMode.EditorPlayMode)
|
if (_playMode == EPlayMode.EditorSimulateMode)
|
||||||
{
|
{
|
||||||
var operation = new EditorPlayModeUpdateManifestOperation();
|
var operation = new EditorPlayModeUpdateManifestOperation();
|
||||||
OperationSystem.ProcessOperaiton(operation);
|
OperationSystem.ProcessOperaiton(operation);
|
||||||
|
@ -285,11 +286,11 @@ namespace YooAsset
|
||||||
public static int GetResourceVersion()
|
public static int GetResourceVersion()
|
||||||
{
|
{
|
||||||
DebugCheckInitialize();
|
DebugCheckInitialize();
|
||||||
if (_playMode == EPlayMode.EditorPlayMode)
|
if (_playMode == EPlayMode.EditorSimulateMode)
|
||||||
{
|
{
|
||||||
if (_editorPlayModeImpl == null)
|
if (_editorSimulateModeImpl == null)
|
||||||
throw new Exception("YooAsset is not initialized.");
|
throw new Exception("YooAsset is not initialized.");
|
||||||
return _editorPlayModeImpl.GetResourceVersion();
|
return _editorSimulateModeImpl.GetResourceVersion();
|
||||||
}
|
}
|
||||||
else if (_playMode == EPlayMode.OfflinePlayMode)
|
else if (_playMode == EPlayMode.OfflinePlayMode)
|
||||||
{
|
{
|
||||||
|
@ -574,7 +575,7 @@ namespace YooAsset
|
||||||
string bundleName = _bundleServices.GetBundleName(assetPath);
|
string bundleName = _bundleServices.GetBundleName(assetPath);
|
||||||
BundleInfo bundleInfo = _bundleServices.GetBundleInfo(bundleName);
|
BundleInfo bundleInfo = _bundleServices.GetBundleInfo(bundleName);
|
||||||
|
|
||||||
if (_playMode == EPlayMode.EditorPlayMode)
|
if (_playMode == EPlayMode.EditorSimulateMode)
|
||||||
{
|
{
|
||||||
RawFileOperation operation = new EditorPlayModeRawFileOperation(bundleInfo, copyPath);
|
RawFileOperation operation = new EditorPlayModeRawFileOperation(bundleInfo, copyPath);
|
||||||
OperationSystem.ProcessOperaiton(operation);
|
OperationSystem.ProcessOperaiton(operation);
|
||||||
|
@ -635,7 +636,7 @@ namespace YooAsset
|
||||||
public static PatchDownloaderOperation CreatePatchDownloader(string[] tags, int downloadingMaxNumber, int failedTryAgain)
|
public static PatchDownloaderOperation CreatePatchDownloader(string[] tags, int downloadingMaxNumber, int failedTryAgain)
|
||||||
{
|
{
|
||||||
DebugCheckInitialize();
|
DebugCheckInitialize();
|
||||||
if (_playMode == EPlayMode.EditorPlayMode || _playMode == EPlayMode.OfflinePlayMode)
|
if (_playMode == EPlayMode.EditorSimulateMode || _playMode == EPlayMode.OfflinePlayMode)
|
||||||
{
|
{
|
||||||
List<BundleInfo> downloadList = new List<BundleInfo>();
|
List<BundleInfo> downloadList = new List<BundleInfo>();
|
||||||
var operation = new PatchDownloaderOperation(downloadList, downloadingMaxNumber, failedTryAgain);
|
var operation = new PatchDownloaderOperation(downloadList, downloadingMaxNumber, failedTryAgain);
|
||||||
|
@ -661,7 +662,7 @@ namespace YooAsset
|
||||||
public static PatchDownloaderOperation CreatePatchDownloader(int downloadingMaxNumber, int failedTryAgain)
|
public static PatchDownloaderOperation CreatePatchDownloader(int downloadingMaxNumber, int failedTryAgain)
|
||||||
{
|
{
|
||||||
DebugCheckInitialize();
|
DebugCheckInitialize();
|
||||||
if (_playMode == EPlayMode.EditorPlayMode || _playMode == EPlayMode.OfflinePlayMode)
|
if (_playMode == EPlayMode.EditorSimulateMode || _playMode == EPlayMode.OfflinePlayMode)
|
||||||
{
|
{
|
||||||
List<BundleInfo> downloadList = new List<BundleInfo>();
|
List<BundleInfo> downloadList = new List<BundleInfo>();
|
||||||
var operation = new PatchDownloaderOperation(downloadList, downloadingMaxNumber, failedTryAgain);
|
var operation = new PatchDownloaderOperation(downloadList, downloadingMaxNumber, failedTryAgain);
|
||||||
|
@ -689,7 +690,7 @@ namespace YooAsset
|
||||||
public static PatchDownloaderOperation CreateBundleDownloader(string[] locations, int downloadingMaxNumber, int failedTryAgain)
|
public static PatchDownloaderOperation CreateBundleDownloader(string[] locations, int downloadingMaxNumber, int failedTryAgain)
|
||||||
{
|
{
|
||||||
DebugCheckInitialize();
|
DebugCheckInitialize();
|
||||||
if (_playMode == EPlayMode.EditorPlayMode || _playMode == EPlayMode.OfflinePlayMode)
|
if (_playMode == EPlayMode.EditorSimulateMode || _playMode == EPlayMode.OfflinePlayMode)
|
||||||
{
|
{
|
||||||
List<BundleInfo> downloadList = new List<BundleInfo>();
|
List<BundleInfo> downloadList = new List<BundleInfo>();
|
||||||
var operation = new PatchDownloaderOperation(downloadList, downloadingMaxNumber, failedTryAgain);
|
var operation = new PatchDownloaderOperation(downloadList, downloadingMaxNumber, failedTryAgain);
|
||||||
|
@ -723,7 +724,7 @@ namespace YooAsset
|
||||||
public static PatchDownloaderOperation CreateBundleDownloader(AssetInfo[] assetInfos, int downloadingMaxNumber, int failedTryAgain)
|
public static PatchDownloaderOperation CreateBundleDownloader(AssetInfo[] assetInfos, int downloadingMaxNumber, int failedTryAgain)
|
||||||
{
|
{
|
||||||
DebugCheckInitialize();
|
DebugCheckInitialize();
|
||||||
if (_playMode == EPlayMode.EditorPlayMode || _playMode == EPlayMode.OfflinePlayMode)
|
if (_playMode == EPlayMode.EditorSimulateMode || _playMode == EPlayMode.OfflinePlayMode)
|
||||||
{
|
{
|
||||||
List<BundleInfo> downloadList = new List<BundleInfo>();
|
List<BundleInfo> downloadList = new List<BundleInfo>();
|
||||||
var operation = new PatchDownloaderOperation(downloadList, downloadingMaxNumber, failedTryAgain);
|
var operation = new PatchDownloaderOperation(downloadList, downloadingMaxNumber, failedTryAgain);
|
||||||
|
@ -770,7 +771,7 @@ namespace YooAsset
|
||||||
public static PatchUnpackerOperation CreatePatchUnpacker(string[] tags, int unpackingMaxNumber, int failedTryAgain)
|
public static PatchUnpackerOperation CreatePatchUnpacker(string[] tags, int unpackingMaxNumber, int failedTryAgain)
|
||||||
{
|
{
|
||||||
DebugCheckInitialize();
|
DebugCheckInitialize();
|
||||||
if (_playMode == EPlayMode.EditorPlayMode)
|
if (_playMode == EPlayMode.EditorSimulateMode)
|
||||||
{
|
{
|
||||||
List<BundleInfo> downloadList = new List<BundleInfo>();
|
List<BundleInfo> downloadList = new List<BundleInfo>();
|
||||||
var operation = new PatchUnpackerOperation(downloadList, unpackingMaxNumber, failedTryAgain);
|
var operation = new PatchUnpackerOperation(downloadList, unpackingMaxNumber, failedTryAgain);
|
||||||
|
@ -804,7 +805,7 @@ namespace YooAsset
|
||||||
public static UpdatePackageOperation UpdatePackageAsync(int resourceVersion, int timeout = 60)
|
public static UpdatePackageOperation UpdatePackageAsync(int resourceVersion, int timeout = 60)
|
||||||
{
|
{
|
||||||
DebugCheckInitialize();
|
DebugCheckInitialize();
|
||||||
if (_playMode == EPlayMode.EditorPlayMode)
|
if (_playMode == EPlayMode.EditorSimulateMode)
|
||||||
{
|
{
|
||||||
var operation = new EditorPlayModeUpdatePackageOperation();
|
var operation = new EditorPlayModeUpdatePackageOperation();
|
||||||
OperationSystem.ProcessOperaiton(operation);
|
OperationSystem.ProcessOperaiton(operation);
|
||||||
|
@ -876,7 +877,11 @@ namespace YooAsset
|
||||||
// 轮询更新资源系统
|
// 轮询更新资源系统
|
||||||
AssetSystem.Update();
|
AssetSystem.Update();
|
||||||
}
|
}
|
||||||
internal static string MappingToAssetPath(string location)
|
|
||||||
|
/// <summary>
|
||||||
|
/// 资源定位地址转换为资源完整路径
|
||||||
|
/// </summary>
|
||||||
|
public static string MappingToAssetPath(string location)
|
||||||
{
|
{
|
||||||
DebugCheckLocation(location);
|
DebugCheckLocation(location);
|
||||||
return _bundleServices.MappingToAssetPath(location);
|
return _bundleServices.MappingToAssetPath(location);
|
||||||
|
|
Loading…
Reference in New Issue