mirror of https://github.com/tuyoogame/YooAsset
parent
2ab045658b
commit
c395a7a750
|
@ -44,7 +44,7 @@ namespace YooAsset
|
||||||
{
|
{
|
||||||
_steps = ESteps.Done;
|
_steps = ESteps.Done;
|
||||||
Status = EOperationStatus.Failed;
|
Status = EOperationStatus.Failed;
|
||||||
Error = "Dry run 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)
|
if (File.Exists(manifestFilePath) == false)
|
||||||
|
@ -55,9 +55,10 @@ namespace YooAsset
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
YooLogger.Log($"Load manifest file in editor play mode : {manifestFilePath}");
|
YooLogger.Log($"Load manifest file : {manifestFilePath}");
|
||||||
string jsonContent = FileUtility.ReadFile(manifestFilePath);
|
string jsonContent = FileUtility.ReadFile(manifestFilePath);
|
||||||
_impl.AppPatchManifest = PatchManifest.Deserialize(jsonContent);
|
var simulatePatchManifest = PatchManifest.Deserialize(jsonContent);
|
||||||
|
_impl.SetSimulatePatchManifest(simulatePatchManifest);
|
||||||
_steps = ESteps.Done;
|
_steps = ESteps.Done;
|
||||||
Status = EOperationStatus.Succeed;
|
Status = EOperationStatus.Succeed;
|
||||||
}
|
}
|
||||||
|
@ -109,7 +110,7 @@ namespace YooAsset
|
||||||
{
|
{
|
||||||
_steps = ESteps.Done;
|
_steps = ESteps.Done;
|
||||||
Status = EOperationStatus.Succeed;
|
Status = EOperationStatus.Succeed;
|
||||||
_impl.AppPatchManifest = _appManifestLoader.Result;
|
_impl.SetAppPatchManifest(_appManifestLoader.Result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -182,8 +183,8 @@ namespace YooAsset
|
||||||
{
|
{
|
||||||
_steps = ESteps.Done;
|
_steps = ESteps.Done;
|
||||||
Status = EOperationStatus.Succeed;
|
Status = EOperationStatus.Succeed;
|
||||||
_impl.AppPatchManifest = _appManifestLoader.Result;
|
_impl.SetAppPatchManifest(_appManifestLoader.Result);
|
||||||
_impl.LocalPatchManifest = _appManifestLoader.Result;
|
_impl.SetLocalPatchManifest(_appManifestLoader.Result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,7 +201,8 @@ namespace YooAsset
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_impl.LocalPatchManifest = PatchManifest.Deserialize(content);
|
var remotePatchManifest = PatchManifest.Deserialize(content);
|
||||||
|
_impl.SetLocalPatchManifest(remotePatchManifest);
|
||||||
|
|
||||||
YooLogger.Log("Save remote patch manifest file.");
|
YooLogger.Log("Save remote patch manifest file.");
|
||||||
string savePath = PathHelper.MakePersistentLoadPath(YooAssetSettingsData.GetPatchManifestFileName(updateResourceVersion));
|
string savePath = PathHelper.MakePersistentLoadPath(YooAssetSettingsData.GetPatchManifestFileName(updateResourceVersion));
|
||||||
|
@ -223,7 +224,8 @@ namespace YooAsset
|
||||||
YooLogger.Log("Load sandbox patch manifest file.");
|
YooLogger.Log("Load sandbox patch manifest file.");
|
||||||
string filePath = PathHelper.MakePersistentLoadPath(YooAssetSettingsData.GetPatchManifestFileName(updateResourceVersion));
|
string filePath = PathHelper.MakePersistentLoadPath(YooAssetSettingsData.GetPatchManifestFileName(updateResourceVersion));
|
||||||
string jsonData = File.ReadAllText(filePath);
|
string jsonData = File.ReadAllText(filePath);
|
||||||
_impl.LocalPatchManifest = PatchManifest.Deserialize(jsonData);
|
var sandboxPatchManifest = PatchManifest.Deserialize(jsonData);
|
||||||
|
_impl.SetLocalPatchManifest(sandboxPatchManifest);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -56,6 +56,10 @@ namespace YooAsset
|
||||||
[NonSerialized]
|
[NonSerialized]
|
||||||
public readonly Dictionary<string, string> AssetPathMapping = new Dictionary<string, string>();
|
public readonly Dictionary<string, string> AssetPathMapping = new Dictionary<string, string>();
|
||||||
|
|
||||||
|
// 资源路径映射相关
|
||||||
|
private bool _isInitAssetPathMapping = false;
|
||||||
|
private bool _locationToLower = false;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取内置资源标签列表
|
/// 获取内置资源标签列表
|
||||||
|
@ -141,11 +145,65 @@ namespace YooAsset
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 初始化资源路径映射
|
||||||
|
/// </summary>
|
||||||
|
public void InitAssetPathMapping(bool locationToLower)
|
||||||
|
{
|
||||||
|
if (_isInitAssetPathMapping)
|
||||||
|
return;
|
||||||
|
_isInitAssetPathMapping = true;
|
||||||
|
|
||||||
|
if (EnableAddressable)
|
||||||
|
{
|
||||||
|
if (locationToLower)
|
||||||
|
YooLogger.Warning("Addressable not support location to lower !");
|
||||||
|
|
||||||
|
foreach (var patchAsset in AssetList)
|
||||||
|
{
|
||||||
|
string location = patchAsset.Address;
|
||||||
|
if (AssetPathMapping.ContainsKey(location))
|
||||||
|
throw new Exception($"Address have existed : {location}");
|
||||||
|
else
|
||||||
|
AssetPathMapping.Add(location, patchAsset.AssetPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_locationToLower = locationToLower;
|
||||||
|
foreach (var patchAsset in AssetList)
|
||||||
|
{
|
||||||
|
string location = patchAsset.AssetPath;
|
||||||
|
if (locationToLower)
|
||||||
|
location = location.ToLower();
|
||||||
|
|
||||||
|
// 添加原生路径的映射
|
||||||
|
if (AssetPathMapping.ContainsKey(location))
|
||||||
|
throw new Exception($"AssetPath have existed : {location}");
|
||||||
|
else
|
||||||
|
AssetPathMapping.Add(location, patchAsset.AssetPath);
|
||||||
|
|
||||||
|
// 添加无后缀名路径的映射
|
||||||
|
if (Path.HasExtension(location))
|
||||||
|
{
|
||||||
|
string locationWithoutExtension = StringUtility.RemoveExtension(location);
|
||||||
|
if (AssetPathMapping.ContainsKey(locationWithoutExtension))
|
||||||
|
YooLogger.Warning($"AssetPath have existed : {locationWithoutExtension}");
|
||||||
|
else
|
||||||
|
AssetPathMapping.Add(locationWithoutExtension, patchAsset.AssetPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 映射为资源路径
|
/// 映射为资源路径
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string MappingToAssetPath(string location)
|
public string MappingToAssetPath(string location)
|
||||||
{
|
{
|
||||||
|
if (_locationToLower)
|
||||||
|
location = location.ToLower();
|
||||||
|
|
||||||
if (AssetPathMapping.TryGetValue(location, out string assetPath))
|
if (AssetPathMapping.TryGetValue(location, out string assetPath))
|
||||||
{
|
{
|
||||||
return assetPath;
|
return assetPath;
|
||||||
|
@ -192,42 +250,6 @@ namespace YooAsset
|
||||||
patchManifest.Assets.Add(assetPath, patchAsset);
|
patchManifest.Assets.Add(assetPath, patchAsset);
|
||||||
}
|
}
|
||||||
|
|
||||||
// AssetPathMapping
|
|
||||||
if (patchManifest.EnableAddressable)
|
|
||||||
{
|
|
||||||
foreach (var patchAsset in patchManifest.AssetList)
|
|
||||||
{
|
|
||||||
string address = patchAsset.Address;
|
|
||||||
if (patchManifest.AssetPathMapping.ContainsKey(address))
|
|
||||||
throw new Exception($"Address have existed : {address}");
|
|
||||||
else
|
|
||||||
patchManifest.AssetPathMapping.Add(address, patchAsset.AssetPath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
foreach (var patchAsset in patchManifest.AssetList)
|
|
||||||
{
|
|
||||||
string assetPath = patchAsset.AssetPath;
|
|
||||||
|
|
||||||
// 添加原生路径的映射
|
|
||||||
if (patchManifest.AssetPathMapping.ContainsKey(assetPath))
|
|
||||||
throw new Exception($"AssetPath have existed : {assetPath}");
|
|
||||||
else
|
|
||||||
patchManifest.AssetPathMapping.Add(assetPath, assetPath);
|
|
||||||
|
|
||||||
// 添加无后缀名路径的映射
|
|
||||||
if (Path.HasExtension(assetPath))
|
|
||||||
{
|
|
||||||
string assetPathWithoutExtension = StringUtility.RemoveExtension(assetPath);
|
|
||||||
if (patchManifest.AssetPathMapping.ContainsKey(assetPathWithoutExtension))
|
|
||||||
YooLogger.Warning($"AssetPath have existed : {assetPathWithoutExtension}");
|
|
||||||
else
|
|
||||||
patchManifest.AssetPathMapping.Add(assetPathWithoutExtension, assetPath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return patchManifest;
|
return patchManifest;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,13 +6,15 @@ namespace YooAsset
|
||||||
{
|
{
|
||||||
internal class EditorSimulateModeImpl : IBundleServices
|
internal class EditorSimulateModeImpl : IBundleServices
|
||||||
{
|
{
|
||||||
internal PatchManifest AppPatchManifest;
|
private PatchManifest _simulatePatchManifest;
|
||||||
|
private bool _locationToLower;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 异步初始化
|
/// 异步初始化
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public InitializationOperation InitializeAsync()
|
public InitializationOperation InitializeAsync(bool locationToLower)
|
||||||
{
|
{
|
||||||
|
_locationToLower = locationToLower;
|
||||||
var operation = new EditorSimulateModeInitializationOperation(this);
|
var operation = new EditorSimulateModeInitializationOperation(this);
|
||||||
OperationSystem.ProcessOperaiton(operation);
|
OperationSystem.ProcessOperaiton(operation);
|
||||||
return operation;
|
return operation;
|
||||||
|
@ -23,9 +25,16 @@ namespace YooAsset
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int GetResourceVersion()
|
public int GetResourceVersion()
|
||||||
{
|
{
|
||||||
if (AppPatchManifest == null)
|
if (_simulatePatchManifest == null)
|
||||||
return 0;
|
return 0;
|
||||||
return AppPatchManifest.ResourceVersion;
|
return _simulatePatchManifest.ResourceVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置资源清单
|
||||||
|
internal void SetSimulatePatchManifest(PatchManifest patchManifest)
|
||||||
|
{
|
||||||
|
_simulatePatchManifest = patchManifest;
|
||||||
|
_simulatePatchManifest.InitAssetPathMapping(_locationToLower);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region IBundleServices接口
|
#region IBundleServices接口
|
||||||
|
@ -34,9 +43,9 @@ namespace YooAsset
|
||||||
if (string.IsNullOrEmpty(bundleName))
|
if (string.IsNullOrEmpty(bundleName))
|
||||||
return new BundleInfo(string.Empty);
|
return new BundleInfo(string.Empty);
|
||||||
|
|
||||||
if (AppPatchManifest.Bundles.TryGetValue(bundleName, out PatchBundle patchBundle))
|
if (_simulatePatchManifest.Bundles.TryGetValue(bundleName, out PatchBundle patchBundle))
|
||||||
{
|
{
|
||||||
string mainAssetPath = AppPatchManifest.TryGetBundleMainAssetPath(bundleName);
|
string mainAssetPath = _simulatePatchManifest.TryGetBundleMainAssetPath(bundleName);
|
||||||
BundleInfo bundleInfo = new BundleInfo(patchBundle, BundleInfo.ELoadMode.LoadFromEditor, mainAssetPath);
|
BundleInfo bundleInfo = new BundleInfo(patchBundle, BundleInfo.ELoadMode.LoadFromEditor, mainAssetPath);
|
||||||
return bundleInfo;
|
return bundleInfo;
|
||||||
}
|
}
|
||||||
|
@ -49,19 +58,19 @@ namespace YooAsset
|
||||||
}
|
}
|
||||||
AssetInfo[] IBundleServices.GetAssetInfos(string[] tags)
|
AssetInfo[] IBundleServices.GetAssetInfos(string[] tags)
|
||||||
{
|
{
|
||||||
return PatchHelper.GetAssetsInfoByTag(AppPatchManifest, tags);
|
return PatchHelper.GetAssetsInfoByTag(_simulatePatchManifest, tags);
|
||||||
}
|
}
|
||||||
string IBundleServices.MappingToAssetPath(string location)
|
string IBundleServices.MappingToAssetPath(string location)
|
||||||
{
|
{
|
||||||
return AppPatchManifest.MappingToAssetPath(location);
|
return _simulatePatchManifest.MappingToAssetPath(location);
|
||||||
}
|
}
|
||||||
string IBundleServices.GetBundleName(string assetPath)
|
string IBundleServices.GetBundleName(string assetPath)
|
||||||
{
|
{
|
||||||
return AppPatchManifest.GetBundleName(assetPath);
|
return _simulatePatchManifest.GetBundleName(assetPath);
|
||||||
}
|
}
|
||||||
string[] IBundleServices.GetAllDependencies(string assetPath)
|
string[] IBundleServices.GetAllDependencies(string assetPath)
|
||||||
{
|
{
|
||||||
return AppPatchManifest.GetAllDependencies(assetPath);
|
return _simulatePatchManifest.GetAllDependencies(assetPath);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,10 +8,11 @@ namespace YooAsset
|
||||||
internal class HostPlayModeImpl : IBundleServices
|
internal class HostPlayModeImpl : IBundleServices
|
||||||
{
|
{
|
||||||
// 补丁清单
|
// 补丁清单
|
||||||
internal PatchManifest AppPatchManifest;
|
internal PatchManifest AppPatchManifest { private set; get; }
|
||||||
internal PatchManifest LocalPatchManifest;
|
internal PatchManifest LocalPatchManifest { private set; get; }
|
||||||
|
|
||||||
// 参数相关
|
// 参数相关
|
||||||
|
internal bool LocationToLower { private set; get; }
|
||||||
internal bool ClearCacheWhenDirty { private set; get; }
|
internal bool ClearCacheWhenDirty { private set; get; }
|
||||||
private string _defaultHostServer;
|
private string _defaultHostServer;
|
||||||
private string _fallbackHostServer;
|
private string _fallbackHostServer;
|
||||||
|
@ -19,8 +20,9 @@ namespace YooAsset
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 异步初始化
|
/// 异步初始化
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public InitializationOperation InitializeAsync(bool clearCacheWhenDirty, string defaultHostServer, string fallbackHostServer)
|
public InitializationOperation InitializeAsync(bool locationToLower, bool clearCacheWhenDirty, string defaultHostServer, string fallbackHostServer)
|
||||||
{
|
{
|
||||||
|
LocationToLower = locationToLower;
|
||||||
ClearCacheWhenDirty = clearCacheWhenDirty;
|
ClearCacheWhenDirty = clearCacheWhenDirty;
|
||||||
_defaultHostServer = defaultHostServer;
|
_defaultHostServer = defaultHostServer;
|
||||||
_fallbackHostServer = fallbackHostServer;
|
_fallbackHostServer = fallbackHostServer;
|
||||||
|
@ -274,6 +276,17 @@ namespace YooAsset
|
||||||
return bundleInfo;
|
return bundleInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 设置资源清单
|
||||||
|
internal void SetAppPatchManifest(PatchManifest patchManifest)
|
||||||
|
{
|
||||||
|
AppPatchManifest = patchManifest;
|
||||||
|
}
|
||||||
|
internal void SetLocalPatchManifest(PatchManifest patchManifest)
|
||||||
|
{
|
||||||
|
LocalPatchManifest = patchManifest;
|
||||||
|
LocalPatchManifest.InitAssetPathMapping(LocationToLower);
|
||||||
|
}
|
||||||
|
|
||||||
#region IBundleServices接口
|
#region IBundleServices接口
|
||||||
BundleInfo IBundleServices.GetBundleInfo(string bundleName)
|
BundleInfo IBundleServices.GetBundleInfo(string bundleName)
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,13 +6,15 @@ namespace YooAsset
|
||||||
{
|
{
|
||||||
internal class OfflinePlayModeImpl : IBundleServices
|
internal class OfflinePlayModeImpl : IBundleServices
|
||||||
{
|
{
|
||||||
internal PatchManifest AppPatchManifest;
|
private PatchManifest _appPatchManifest;
|
||||||
|
private bool _locationToLower;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 异步初始化
|
/// 异步初始化
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public InitializationOperation InitializeAsync()
|
public InitializationOperation InitializeAsync(bool locationToLower)
|
||||||
{
|
{
|
||||||
|
_locationToLower = locationToLower;
|
||||||
var operation = new OfflinePlayModeInitializationOperation(this);
|
var operation = new OfflinePlayModeInitializationOperation(this);
|
||||||
OperationSystem.ProcessOperaiton(operation);
|
OperationSystem.ProcessOperaiton(operation);
|
||||||
return operation;
|
return operation;
|
||||||
|
@ -23,9 +25,9 @@ namespace YooAsset
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int GetResourceVersion()
|
public int GetResourceVersion()
|
||||||
{
|
{
|
||||||
if (AppPatchManifest == null)
|
if (_appPatchManifest == null)
|
||||||
return 0;
|
return 0;
|
||||||
return AppPatchManifest.ResourceVersion;
|
return _appPatchManifest.ResourceVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -33,18 +35,25 @@ namespace YooAsset
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public PatchUnpackerOperation CreatePatchUnpackerByTags(string[] tags, int fileUpackingMaxNumber, int failedTryAgain)
|
public PatchUnpackerOperation CreatePatchUnpackerByTags(string[] tags, int fileUpackingMaxNumber, int failedTryAgain)
|
||||||
{
|
{
|
||||||
List<BundleInfo> unpcakList = PatchHelper.GetUnpackListByTags(AppPatchManifest, tags);
|
List<BundleInfo> unpcakList = PatchHelper.GetUnpackListByTags(_appPatchManifest, tags);
|
||||||
var operation = new PatchUnpackerOperation(unpcakList, fileUpackingMaxNumber, failedTryAgain);
|
var operation = new PatchUnpackerOperation(unpcakList, fileUpackingMaxNumber, failedTryAgain);
|
||||||
return operation;
|
return operation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 设置资源清单
|
||||||
|
internal void SetAppPatchManifest(PatchManifest patchManifest)
|
||||||
|
{
|
||||||
|
_appPatchManifest = patchManifest;
|
||||||
|
_appPatchManifest.InitAssetPathMapping(_locationToLower);
|
||||||
|
}
|
||||||
|
|
||||||
#region IBundleServices接口
|
#region IBundleServices接口
|
||||||
BundleInfo IBundleServices.GetBundleInfo(string bundleName)
|
BundleInfo IBundleServices.GetBundleInfo(string bundleName)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(bundleName))
|
if (string.IsNullOrEmpty(bundleName))
|
||||||
return new BundleInfo(string.Empty);
|
return new BundleInfo(string.Empty);
|
||||||
|
|
||||||
if (AppPatchManifest.Bundles.TryGetValue(bundleName, out PatchBundle patchBundle))
|
if (_appPatchManifest.Bundles.TryGetValue(bundleName, out PatchBundle patchBundle))
|
||||||
{
|
{
|
||||||
BundleInfo bundleInfo = new BundleInfo(patchBundle, BundleInfo.ELoadMode.LoadFromStreaming);
|
BundleInfo bundleInfo = new BundleInfo(patchBundle, BundleInfo.ELoadMode.LoadFromStreaming);
|
||||||
return bundleInfo;
|
return bundleInfo;
|
||||||
|
@ -58,19 +67,19 @@ namespace YooAsset
|
||||||
}
|
}
|
||||||
AssetInfo[] IBundleServices.GetAssetInfos(string[] tags)
|
AssetInfo[] IBundleServices.GetAssetInfos(string[] tags)
|
||||||
{
|
{
|
||||||
return PatchHelper.GetAssetsInfoByTag(AppPatchManifest, tags);
|
return PatchHelper.GetAssetsInfoByTag(_appPatchManifest, tags);
|
||||||
}
|
}
|
||||||
string IBundleServices.MappingToAssetPath(string location)
|
string IBundleServices.MappingToAssetPath(string location)
|
||||||
{
|
{
|
||||||
return AppPatchManifest.MappingToAssetPath(location);
|
return _appPatchManifest.MappingToAssetPath(location);
|
||||||
}
|
}
|
||||||
string IBundleServices.GetBundleName(string assetPath)
|
string IBundleServices.GetBundleName(string assetPath)
|
||||||
{
|
{
|
||||||
return AppPatchManifest.GetBundleName(assetPath);
|
return _appPatchManifest.GetBundleName(assetPath);
|
||||||
}
|
}
|
||||||
string[] IBundleServices.GetAllDependencies(string assetPath)
|
string[] IBundleServices.GetAllDependencies(string assetPath)
|
||||||
{
|
{
|
||||||
return AppPatchManifest.GetAllDependencies(assetPath);
|
return _appPatchManifest.GetAllDependencies(assetPath);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,11 @@ namespace YooAsset
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class CreateParameters
|
public abstract class CreateParameters
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 资源定位地址为小写地址
|
||||||
|
/// </summary>
|
||||||
|
public bool LocationToLower = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 资源定位服务接口
|
/// 资源定位服务接口
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -123,7 +128,7 @@ namespace YooAsset
|
||||||
|
|
||||||
#if !UNITY_EDITOR
|
#if !UNITY_EDITOR
|
||||||
if (parameters is EditorSimulateModeParameters)
|
if (parameters is EditorSimulateModeParameters)
|
||||||
throw new Exception($"Editor play mode only support unity editor.");
|
throw new Exception($"Editor simulate mode only support unity editor.");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// 创建驱动器
|
// 创建驱动器
|
||||||
|
@ -182,14 +187,14 @@ 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();
|
initializeOperation = _editorSimulateModeImpl.InitializeAsync(parameters.LocationToLower);
|
||||||
}
|
}
|
||||||
else if (_playMode == EPlayMode.OfflinePlayMode)
|
else if (_playMode == EPlayMode.OfflinePlayMode)
|
||||||
{
|
{
|
||||||
_offlinePlayModeImpl = new OfflinePlayModeImpl();
|
_offlinePlayModeImpl = new OfflinePlayModeImpl();
|
||||||
_bundleServices = _offlinePlayModeImpl;
|
_bundleServices = _offlinePlayModeImpl;
|
||||||
AssetSystem.Initialize(false, parameters.AssetLoadingMaxNumber, parameters.DecryptionServices, _bundleServices);
|
AssetSystem.Initialize(false, parameters.AssetLoadingMaxNumber, parameters.DecryptionServices, _bundleServices);
|
||||||
initializeOperation = _offlinePlayModeImpl.InitializeAsync();
|
initializeOperation = _offlinePlayModeImpl.InitializeAsync(parameters.LocationToLower);
|
||||||
}
|
}
|
||||||
else if (_playMode == EPlayMode.HostPlayMode)
|
else if (_playMode == EPlayMode.HostPlayMode)
|
||||||
{
|
{
|
||||||
|
@ -198,6 +203,7 @@ namespace YooAsset
|
||||||
AssetSystem.Initialize(false, parameters.AssetLoadingMaxNumber, parameters.DecryptionServices, _bundleServices);
|
AssetSystem.Initialize(false, parameters.AssetLoadingMaxNumber, parameters.DecryptionServices, _bundleServices);
|
||||||
var hostPlayModeParameters = parameters as HostPlayModeParameters;
|
var hostPlayModeParameters = parameters as HostPlayModeParameters;
|
||||||
initializeOperation = _hostPlayModeImpl.InitializeAsync(
|
initializeOperation = _hostPlayModeImpl.InitializeAsync(
|
||||||
|
hostPlayModeParameters.LocationToLower,
|
||||||
hostPlayModeParameters.ClearCacheWhenDirty,
|
hostPlayModeParameters.ClearCacheWhenDirty,
|
||||||
hostPlayModeParameters.DefaultHostServer,
|
hostPlayModeParameters.DefaultHostServer,
|
||||||
hostPlayModeParameters.FallbackHostServer);
|
hostPlayModeParameters.FallbackHostServer);
|
||||||
|
@ -881,7 +887,7 @@ namespace YooAsset
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 资源定位地址转换为资源完整路径
|
/// 资源定位地址转换为资源完整路径
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string MappingToAssetPath(string location)
|
internal static string MappingToAssetPath(string location)
|
||||||
{
|
{
|
||||||
DebugCheckLocation(location);
|
DebugCheckLocation(location);
|
||||||
return _bundleServices.MappingToAssetPath(location);
|
return _bundleServices.MappingToAssetPath(location);
|
||||||
|
|
Loading…
Reference in New Issue