mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-23 09:10:11 +00:00
Compare commits
24 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8686c32ada | ||
|
|
f043c6710a | ||
|
|
acd27e36fa | ||
|
|
37f0d1e5a1 | ||
|
|
e6397559ff | ||
|
|
812c46adeb | ||
|
|
4d7fb6301a | ||
|
|
f0951f2a25 | ||
|
|
7d2defedb7 | ||
|
|
17ab618bed | ||
|
|
0f9e932616 | ||
|
|
20b0bd26ae | ||
|
|
3b395861d9 | ||
|
|
d5d1f851ab | ||
|
|
c2e2a33af1 | ||
|
|
9a729f921e | ||
|
|
1b75f4b6e9 | ||
|
|
aaab6692c3 | ||
|
|
70fc85e456 | ||
|
|
29358a7b4b | ||
|
|
b1b0563d84 | ||
|
|
21b1e5bee7 | ||
|
|
c02eeef846 | ||
|
|
e84e50708b |
@@ -2,6 +2,91 @@
|
|||||||
|
|
||||||
All notable changes to this package will be documented in this file.
|
All notable changes to this package will be documented in this file.
|
||||||
|
|
||||||
|
## [1.4.13] - 2023-05-12
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- 可寻址地址冲突时,打印冲突地址的资源路径。
|
||||||
|
- 销毁Package的时候清空该Package的缓存记录。
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- 新增方法ResoucePackage.ClearAllCacheFilesAsync()
|
||||||
|
|
||||||
|
```c#
|
||||||
|
public class ResoucePackage
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 清理包裹本地所有的缓存文件
|
||||||
|
/// </summary>
|
||||||
|
public ClearAllCacheFilesOperation ClearAllCacheFilesAsync();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
- 新增方法YooAssets.SetCacheSystemSandboxPath()
|
||||||
|
|
||||||
|
```c#
|
||||||
|
public class YooAssets
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 设置缓存系统参数,沙盒目录的存储路径
|
||||||
|
/// </summary>
|
||||||
|
public static void SetCacheSystemSandboxPath(string sandboxPath);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## [1.4.12] - 2023-04-22
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- 增加了对WEBGL平台加密选项的检测。
|
||||||
|
|
||||||
|
- 增加了YooAsset/Home Page菜单栏。
|
||||||
|
|
||||||
|
- 增加了鼠标右键创建配置的菜单。
|
||||||
|
|
||||||
|
- 增加了YooAssets.DestroyPackage()方法。
|
||||||
|
|
||||||
|
```c#
|
||||||
|
class YooAssets
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 销毁资源包
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="package">资源包对象</param>
|
||||||
|
public static void DestroyPackage(string packageName);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
- UpdatePackageManifestAsync方法增加了新参数autoSaveVersion
|
||||||
|
|
||||||
|
```c#
|
||||||
|
class ResourcePackage
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 向网络端请求并更新清单
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="packageVersion">更新的包裹版本</param>
|
||||||
|
/// <param name="autoSaveVersion">更新成功后自动保存版本号,作为下次初始化的版本。</param>
|
||||||
|
/// <param name="timeout">超时时间(默认值:60秒)</param>
|
||||||
|
public UpdatePackageManifestOperation UpdatePackageManifestAsync(string packageVersion, bool autoSaveVersion = true, int timeout = 60)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
- BuildParameters类增加了新字段。
|
||||||
|
|
||||||
|
可以自定义共享资源文件的打包规则。
|
||||||
|
|
||||||
|
```c#
|
||||||
|
class BuildParameters
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 共享资源的打包规则
|
||||||
|
/// </summary>
|
||||||
|
public IShareAssetPackRule ShareAssetPackRule = null;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## [1.4.11] - 2023-04-14
|
## [1.4.11] - 2023-04-14
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
BuildLogger.Warning($"{buildParameters.BuildMode} pipeline build failed !");
|
BuildLogger.Warning($"{buildParameters.BuildMode} pipeline build failed !");
|
||||||
BuildLogger.Error($"Build task failed : {buildResult.FailedTask}");
|
BuildLogger.Error($"Build task failed : {buildResult.FailedTask}");
|
||||||
BuildLogger.Error($"Build task error : {buildResult.FailedInfo}");
|
BuildLogger.Error(buildResult.ErrorInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
return buildResult;
|
return buildResult;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using UnityEngine;
|
|||||||
|
|
||||||
namespace YooAsset.Editor
|
namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
|
[CreateAssetMenu(fileName = "AssetBundleBuilderSetting", menuName = "YooAsset/Create AssetBundle Builder Settings")]
|
||||||
public class AssetBundleBuilderSetting : ScriptableObject
|
public class AssetBundleBuilderSetting : ScriptableObject
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ namespace YooAsset.Editor
|
|||||||
public class AssetBundleBuilderWindow : EditorWindow
|
public class AssetBundleBuilderWindow : EditorWindow
|
||||||
{
|
{
|
||||||
[MenuItem("YooAsset/AssetBundle Builder", false, 102)]
|
[MenuItem("YooAsset/AssetBundle Builder", false, 102)]
|
||||||
public static void ShowExample()
|
public static void OpenWindow()
|
||||||
{
|
{
|
||||||
AssetBundleBuilderWindow window = GetWindow<AssetBundleBuilderWindow>("资源包构建工具", true, WindowsDefine.DockedWindowTypes);
|
AssetBundleBuilderWindow window = GetWindow<AssetBundleBuilderWindow>("资源包构建工具", true, WindowsDefine.DockedWindowTypes);
|
||||||
window.minSize = new Vector2(800, 600);
|
window.minSize = new Vector2(800, 600);
|
||||||
@@ -275,6 +275,7 @@ namespace YooAsset.Editor
|
|||||||
buildParameters.PackageName = AssetBundleBuilderSettingData.Setting.BuildPackage;
|
buildParameters.PackageName = AssetBundleBuilderSettingData.Setting.BuildPackage;
|
||||||
buildParameters.PackageVersion = _buildVersionField.value;
|
buildParameters.PackageVersion = _buildVersionField.value;
|
||||||
buildParameters.VerifyBuildingResult = true;
|
buildParameters.VerifyBuildingResult = true;
|
||||||
|
buildParameters.ShareAssetPackRule = new DefaultShareAssetPackRule();
|
||||||
buildParameters.EncryptionServices = CreateEncryptionServicesInstance();
|
buildParameters.EncryptionServices = CreateEncryptionServicesInstance();
|
||||||
buildParameters.CompressOption = AssetBundleBuilderSettingData.Setting.CompressOption;
|
buildParameters.CompressOption = AssetBundleBuilderSettingData.Setting.CompressOption;
|
||||||
buildParameters.OutputNameStyle = AssetBundleBuilderSettingData.Setting.OutputNameStyle;
|
buildParameters.OutputNameStyle = AssetBundleBuilderSettingData.Setting.OutputNameStyle;
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ namespace YooAsset.Editor
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 计算共享资源包的完整包名
|
/// 计算共享资源包的完整包名
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void CalculateShareBundleName(bool uniqueBundleName, string packageName, string shadersBundleName)
|
public void CalculateShareBundleName(IShareAssetPackRule packRule, bool uniqueBundleName, string packageName, string shadersBundleName)
|
||||||
{
|
{
|
||||||
if (CollectorType != ECollectorType.None)
|
if (CollectorType != ECollectorType.None)
|
||||||
return;
|
return;
|
||||||
@@ -173,8 +173,7 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
if (_referenceBundleNames.Count > 1)
|
if (_referenceBundleNames.Count > 1)
|
||||||
{
|
{
|
||||||
IPackRule packRule = PackDirectory.StaticPackRule;
|
PackRuleResult packRuleResult = packRule.GetPackRuleResult(AssetPath);
|
||||||
PackRuleResult packRuleResult = packRule.GetPackRuleResult(new PackRuleData(AssetPath));
|
|
||||||
BundleName = packRuleResult.GetShareBundleName(packageName, uniqueBundleName);
|
BundleName = packRuleResult.GetShareBundleName(packageName, uniqueBundleName);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -78,7 +78,12 @@ namespace YooAsset.Editor
|
|||||||
public bool VerifyBuildingResult = false;
|
public bool VerifyBuildingResult = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 加密类
|
/// 共享资源的打包规则
|
||||||
|
/// </summary>
|
||||||
|
public IShareAssetPackRule ShareAssetPackRule = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 资源的加密接口
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IEncryptionServices EncryptionServices = null;
|
public IEncryptionServices EncryptionServices = null;
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace YooAsset.Editor
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 构建失败的信息
|
/// 构建失败的信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string FailedInfo;
|
public string ErrorInfo;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 输出的补丁包目录
|
/// 输出的补丁包目录
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
EditorTools.ClearProgressBar();
|
EditorTools.ClearProgressBar();
|
||||||
buildResult.FailedTask = task.GetType().Name;
|
buildResult.FailedTask = task.GetType().Name;
|
||||||
buildResult.FailedInfo = e.ToString();
|
buildResult.ErrorInfo = e.ToString();
|
||||||
buildResult.Success = false;
|
buildResult.Success = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ namespace YooAsset.Editor
|
|||||||
void IBuildTask.Run(BuildContext context)
|
void IBuildTask.Run(BuildContext context)
|
||||||
{
|
{
|
||||||
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
||||||
var buildMapContext = CreateBuildMap(buildParametersContext.Parameters.BuildMode, buildParametersContext.Parameters.PackageName);
|
var buildParameters = buildParametersContext.Parameters;
|
||||||
|
var buildMapContext = CreateBuildMap(buildParameters.BuildMode, buildParameters.ShareAssetPackRule, buildParameters.PackageName);
|
||||||
context.SetContextObject(buildMapContext);
|
context.SetContextObject(buildMapContext);
|
||||||
BuildLogger.Log("构建内容准备完毕!");
|
BuildLogger.Log("构建内容准备完毕!");
|
||||||
|
|
||||||
@@ -24,7 +25,7 @@ namespace YooAsset.Editor
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 资源构建上下文
|
/// 资源构建上下文
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public BuildMapContext CreateBuildMap(EBuildMode buildMode, string packageName)
|
public BuildMapContext CreateBuildMap(EBuildMode buildMode, IShareAssetPackRule packRule, string packageName)
|
||||||
{
|
{
|
||||||
Dictionary<string, BuildAssetInfo> allBuildAssetInfoDic = new Dictionary<string, BuildAssetInfo>(1000);
|
Dictionary<string, BuildAssetInfo> allBuildAssetInfoDic = new Dictionary<string, BuildAssetInfo>(1000);
|
||||||
|
|
||||||
@@ -101,7 +102,7 @@ namespace YooAsset.Editor
|
|||||||
var command = collectResult.Command;
|
var command = collectResult.Command;
|
||||||
foreach (var buildAssetInfo in allBuildAssetInfoDic.Values)
|
foreach (var buildAssetInfo in allBuildAssetInfoDic.Values)
|
||||||
{
|
{
|
||||||
buildAssetInfo.CalculateShareBundleName(command.UniqueBundleName, command.PackageName, command.ShadersBundleName);
|
buildAssetInfo.CalculateShareBundleName(packRule, command.UniqueBundleName, command.PackageName, command.ShadersBundleName);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 9. 移除不参与构建的资源
|
// 9. 移除不参与构建的资源
|
||||||
|
|||||||
@@ -40,6 +40,20 @@ namespace YooAsset.Editor
|
|||||||
throw new Exception("首包资源标签不能为空!");
|
throw new Exception("首包资源标签不能为空!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 检测共享资源打包规则
|
||||||
|
if (buildParameters.ShareAssetPackRule == null)
|
||||||
|
throw new Exception("共享资源打包规则不能为空!");
|
||||||
|
|
||||||
|
#if UNITY_WEBGL
|
||||||
|
if (buildParameters.EncryptionServices != null)
|
||||||
|
{
|
||||||
|
if (buildParameters.EncryptionServices.GetType() != typeof(EncryptionNone))
|
||||||
|
{
|
||||||
|
throw new Exception("WebGL平台不支持加密!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// 检测包裹输出目录是否存在
|
// 检测包裹输出目录是否存在
|
||||||
string packageOutputDirectory = buildParametersContext.GetPackageOutputDirectory();
|
string packageOutputDirectory = buildParametersContext.GetPackageOutputDirectory();
|
||||||
if (Directory.Exists(packageOutputDirectory))
|
if (Directory.Exists(packageOutputDirectory))
|
||||||
|
|||||||
@@ -197,16 +197,17 @@ namespace YooAsset.Editor
|
|||||||
// 检测可寻址地址是否重复
|
// 检测可寻址地址是否重复
|
||||||
if (command.EnableAddressable)
|
if (command.EnableAddressable)
|
||||||
{
|
{
|
||||||
HashSet<string> adressTemper = new HashSet<string>();
|
var addressTemper = new Dictionary<string, string>();
|
||||||
foreach (var collectInfoPair in result)
|
foreach (var collectInfoPair in result)
|
||||||
{
|
{
|
||||||
if (collectInfoPair.Value.CollectorType == ECollectorType.MainAssetCollector)
|
if (collectInfoPair.Value.CollectorType == ECollectorType.MainAssetCollector)
|
||||||
{
|
{
|
||||||
string address = collectInfoPair.Value.Address;
|
string address = collectInfoPair.Value.Address;
|
||||||
if (adressTemper.Contains(address) == false)
|
string assetPath = collectInfoPair.Value.AssetPath;
|
||||||
adressTemper.Add(address);
|
if (addressTemper.TryGetValue(address, out var existed) == false)
|
||||||
|
addressTemper.Add(address, assetPath);
|
||||||
else
|
else
|
||||||
throw new Exception($"The address is existed : {address} in collector : {CollectPath}");
|
throw new Exception($"The address is existed : {address} in collector : {CollectPath} \nAssetPath:\n {existed}\n {assetPath}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,16 +96,17 @@ namespace YooAsset.Editor
|
|||||||
// 检测可寻址地址是否重复
|
// 检测可寻址地址是否重复
|
||||||
if (command.EnableAddressable)
|
if (command.EnableAddressable)
|
||||||
{
|
{
|
||||||
HashSet<string> adressTemper = new HashSet<string>();
|
var addressTemper = new Dictionary<string, string>();
|
||||||
foreach (var collectInfoPair in result)
|
foreach (var collectInfoPair in result)
|
||||||
{
|
{
|
||||||
if (collectInfoPair.Value.CollectorType == ECollectorType.MainAssetCollector)
|
if (collectInfoPair.Value.CollectorType == ECollectorType.MainAssetCollector)
|
||||||
{
|
{
|
||||||
string address = collectInfoPair.Value.Address;
|
string address = collectInfoPair.Value.Address;
|
||||||
if (adressTemper.Contains(address) == false)
|
string assetPath = collectInfoPair.Value.AssetPath;
|
||||||
adressTemper.Add(address);
|
if (addressTemper.TryGetValue(address, out var existed) == false)
|
||||||
|
addressTemper.Add(address, assetPath);
|
||||||
else
|
else
|
||||||
throw new Exception($"The address is existed : {address} in group : {GroupName}");
|
throw new Exception($"The address is existed : {address} in group : {GroupName} \nAssetPath:\n {existed}\n {assetPath}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,16 +76,17 @@ namespace YooAsset.Editor
|
|||||||
// 检测可寻址地址是否重复
|
// 检测可寻址地址是否重复
|
||||||
if (command.EnableAddressable)
|
if (command.EnableAddressable)
|
||||||
{
|
{
|
||||||
HashSet<string> adressTemper = new HashSet<string>();
|
var addressTemper = new Dictionary<string, string>();
|
||||||
foreach (var collectInfoPair in result)
|
foreach (var collectInfoPair in result)
|
||||||
{
|
{
|
||||||
if (collectInfoPair.Value.CollectorType == ECollectorType.MainAssetCollector)
|
if (collectInfoPair.Value.CollectorType == ECollectorType.MainAssetCollector)
|
||||||
{
|
{
|
||||||
string address = collectInfoPair.Value.Address;
|
string address = collectInfoPair.Value.Address;
|
||||||
if (adressTemper.Contains(address) == false)
|
string assetPath = collectInfoPair.Value.AssetPath;
|
||||||
adressTemper.Add(address);
|
if (addressTemper.TryGetValue(address, out var existed) == false)
|
||||||
|
addressTemper.Add(address, assetPath);
|
||||||
else
|
else
|
||||||
throw new Exception($"The address is existed : {address}");
|
throw new Exception($"The address is existed : {address} \nAssetPath:\n {existed}\n {assetPath}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using UnityEngine;
|
|||||||
|
|
||||||
namespace YooAsset.Editor
|
namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
|
[CreateAssetMenu(fileName = "AssetBundleCollectorSetting", menuName = "YooAsset/Create AssetBundle Collector Settings")]
|
||||||
public class AssetBundleCollectorSetting : ScriptableObject
|
public class AssetBundleCollectorSetting : ScriptableObject
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ namespace YooAsset.Editor
|
|||||||
public class AssetBundleCollectorWindow : EditorWindow
|
public class AssetBundleCollectorWindow : EditorWindow
|
||||||
{
|
{
|
||||||
[MenuItem("YooAsset/AssetBundle Collector", false, 101)]
|
[MenuItem("YooAsset/AssetBundle Collector", false, 101)]
|
||||||
public static void ShowExample()
|
public static void OpenWindow()
|
||||||
{
|
{
|
||||||
AssetBundleCollectorWindow window = GetWindow<AssetBundleCollectorWindow>("资源包收集工具", true, WindowsDefine.DockedWindowTypes);
|
AssetBundleCollectorWindow window = GetWindow<AssetBundleCollectorWindow>("资源包收集工具", true, WindowsDefine.DockedWindowTypes);
|
||||||
window.minSize = new Vector2(800, 600);
|
window.minSize = new Vector2(800, 600);
|
||||||
|
|||||||
@@ -60,8 +60,6 @@ namespace YooAsset.Editor
|
|||||||
[DisplayName("资源包名: 父类文件夹路径")]
|
[DisplayName("资源包名: 父类文件夹路径")]
|
||||||
public class PackDirectory : IPackRule
|
public class PackDirectory : IPackRule
|
||||||
{
|
{
|
||||||
public static PackDirectory StaticPackRule = new PackDirectory();
|
|
||||||
|
|
||||||
PackRuleResult IPackRule.GetPackRuleResult(PackRuleData data)
|
PackRuleResult IPackRule.GetPackRuleResult(PackRuleData data)
|
||||||
{
|
{
|
||||||
string bundleName = Path.GetDirectoryName(data.AssetPath);
|
string bundleName = Path.GetDirectoryName(data.AssetPath);
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using UnityEditor;
|
||||||
|
|
||||||
|
namespace YooAsset.Editor
|
||||||
|
{
|
||||||
|
public class DefaultShareAssetPackRule : IShareAssetPackRule
|
||||||
|
{
|
||||||
|
public PackRuleResult GetPackRuleResult(string assetPath)
|
||||||
|
{
|
||||||
|
string bundleName = Path.GetDirectoryName(assetPath);
|
||||||
|
PackRuleResult result = new PackRuleResult(bundleName, DefaultPackRule.AssetBundleFileExtension);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 3b8606481370397489cb3aa21e726d9a
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
namespace YooAsset.Editor
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 共享资源的打包规则
|
||||||
|
/// </summary>
|
||||||
|
public interface IShareAssetPackRule
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取打包规则结果
|
||||||
|
/// </summary>
|
||||||
|
PackRuleResult GetPackRuleResult(string assetPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1ed930b0cc1db1742b0a131ca476bd82
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -13,7 +13,7 @@ namespace YooAsset.Editor
|
|||||||
public class AssetBundleDebuggerWindow : EditorWindow
|
public class AssetBundleDebuggerWindow : EditorWindow
|
||||||
{
|
{
|
||||||
[MenuItem("YooAsset/AssetBundle Debugger", false, 104)]
|
[MenuItem("YooAsset/AssetBundle Debugger", false, 104)]
|
||||||
public static void ShowExample()
|
public static void OpenWindow()
|
||||||
{
|
{
|
||||||
AssetBundleDebuggerWindow wnd = GetWindow<AssetBundleDebuggerWindow>("资源包调试工具", true, WindowsDefine.DockedWindowTypes);
|
AssetBundleDebuggerWindow wnd = GetWindow<AssetBundleDebuggerWindow>("资源包调试工具", true, WindowsDefine.DockedWindowTypes);
|
||||||
wnd.minSize = new Vector2(800, 600);
|
wnd.minSize = new Vector2(800, 600);
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace YooAsset.Editor
|
|||||||
public class AssetBundleReporterWindow : EditorWindow
|
public class AssetBundleReporterWindow : EditorWindow
|
||||||
{
|
{
|
||||||
[MenuItem("YooAsset/AssetBundle Reporter", false, 103)]
|
[MenuItem("YooAsset/AssetBundle Reporter", false, 103)]
|
||||||
public static void ShowExample()
|
public static void OpenWindow()
|
||||||
{
|
{
|
||||||
AssetBundleReporterWindow window = GetWindow<AssetBundleReporterWindow>("资源包报告工具", true, WindowsDefine.DockedWindowTypes);
|
AssetBundleReporterWindow window = GetWindow<AssetBundleReporterWindow>("资源包报告工具", true, WindowsDefine.DockedWindowTypes);
|
||||||
window.minSize = new Vector2(800, 600);
|
window.minSize = new Vector2(800, 600);
|
||||||
|
|||||||
17
Assets/YooAsset/Editor/HomePage.cs
Normal file
17
Assets/YooAsset/Editor/HomePage.cs
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#if UNITY_2019_4_OR_NEWER
|
||||||
|
using System;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace YooAsset.Editor
|
||||||
|
{
|
||||||
|
internal class HomePageWindow
|
||||||
|
{
|
||||||
|
[MenuItem("YooAsset/Home Page", false, 1)]
|
||||||
|
public static void OpenWindow()
|
||||||
|
{
|
||||||
|
Application.OpenURL("https://www.yooasset.com/");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
11
Assets/YooAsset/Editor/HomePage.cs.meta
Normal file
11
Assets/YooAsset/Editor/HomePage.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 901fc6964e7d483428830e2681899473
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace YooAsset.Editor
|
namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
|
[CreateAssetMenu(fileName = "ShaderVariantCollectorSetting", menuName = "YooAsset/Create ShaderVariant Collector Settings")]
|
||||||
public class ShaderVariantCollectorSetting : ScriptableObject
|
public class ShaderVariantCollectorSetting : ScriptableObject
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ namespace YooAsset.Editor
|
|||||||
public class ShaderVariantCollectorWindow : EditorWindow
|
public class ShaderVariantCollectorWindow : EditorWindow
|
||||||
{
|
{
|
||||||
[MenuItem("YooAsset/ShaderVariant Collector", false, 201)]
|
[MenuItem("YooAsset/ShaderVariant Collector", false, 201)]
|
||||||
public static void ShowExample()
|
public static void OpenWindow()
|
||||||
{
|
{
|
||||||
ShaderVariantCollectorWindow window = GetWindow<ShaderVariantCollectorWindow>("着色器变种收集工具", true, WindowsDefine.DockedWindowTypes);
|
ShaderVariantCollectorWindow window = GetWindow<ShaderVariantCollectorWindow>("着色器变种收集工具", true, WindowsDefine.DockedWindowTypes);
|
||||||
window.minSize = new Vector2(800, 600);
|
window.minSize = new Vector2(800, 600);
|
||||||
|
|||||||
@@ -187,7 +187,7 @@
|
|||||||
identification within third-party archives.
|
identification within third-party archives.
|
||||||
|
|
||||||
Copyright 2018-2021 何冠峰
|
Copyright 2018-2021 何冠峰
|
||||||
Copyright 2021-2022 TuYoo Games
|
Copyright 2021-2023 TuYoo Games
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -112,8 +112,6 @@ namespace YooAsset
|
|||||||
var retObject = assetObject as TObject;
|
var retObject = assetObject as TObject;
|
||||||
if (retObject != null)
|
if (retObject != null)
|
||||||
ret.Add(retObject);
|
ret.Add(retObject);
|
||||||
else
|
|
||||||
YooLogger.Warning($"The type conversion failed : {assetObject.name}");
|
|
||||||
}
|
}
|
||||||
return ret.ToArray();
|
return ret.ToArray();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,15 @@ namespace YooAsset
|
|||||||
_cachedDic.Clear();
|
_cachedDic.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 清空指定包裹的所有缓存数据
|
||||||
|
/// </summary>
|
||||||
|
public static void ClearPackage(string packageName)
|
||||||
|
{
|
||||||
|
var cache = GetOrCreateCache(packageName);
|
||||||
|
cache.ClearAll();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取缓存文件总数
|
/// 获取缓存文件总数
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -148,6 +157,14 @@ namespace YooAsset
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取所有的缓存文件
|
||||||
|
/// </summary>
|
||||||
|
public static List<string> GetAllCacheGUIDs(ResourcePackage package)
|
||||||
|
{
|
||||||
|
var cache = GetOrCreateCache(package.PackageName);
|
||||||
|
return cache.GetAllKeys();
|
||||||
|
}
|
||||||
|
|
||||||
private static EVerifyResult VerifyingInternal(string filePath, long fileSize, string fileCRC, EVerifyLevel verifyLevel)
|
private static EVerifyResult VerifyingInternal(string filePath, long fileSize, string fileCRC, EVerifyLevel verifyLevel)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,71 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
namespace YooAsset
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 清理本地包裹所有的缓存文件
|
||||||
|
/// </summary>
|
||||||
|
public sealed class ClearAllCacheFilesOperation : AsyncOperationBase
|
||||||
|
{
|
||||||
|
private enum ESteps
|
||||||
|
{
|
||||||
|
None,
|
||||||
|
GetAllCacheFiles,
|
||||||
|
ClearAllCacheFiles,
|
||||||
|
Done,
|
||||||
|
}
|
||||||
|
|
||||||
|
private readonly ResourcePackage _package;
|
||||||
|
private List<string> _allCacheGUIDs;
|
||||||
|
private int _fileTotalCount = 0;
|
||||||
|
private ESteps _steps = ESteps.None;
|
||||||
|
|
||||||
|
internal ClearAllCacheFilesOperation(ResourcePackage package)
|
||||||
|
{
|
||||||
|
_package = package;
|
||||||
|
}
|
||||||
|
internal override void Start()
|
||||||
|
{
|
||||||
|
_steps = ESteps.GetAllCacheFiles;
|
||||||
|
}
|
||||||
|
internal override void Update()
|
||||||
|
{
|
||||||
|
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (_steps == ESteps.GetAllCacheFiles)
|
||||||
|
{
|
||||||
|
_allCacheGUIDs = CacheSystem.GetAllCacheGUIDs(_package);
|
||||||
|
_fileTotalCount = _allCacheGUIDs.Count;
|
||||||
|
YooLogger.Log($"Found all cache file count : {_fileTotalCount}");
|
||||||
|
_steps = ESteps.ClearAllCacheFiles;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_steps == ESteps.ClearAllCacheFiles)
|
||||||
|
{
|
||||||
|
for (int i = _allCacheGUIDs.Count - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
string cacheGUID = _allCacheGUIDs[i];
|
||||||
|
CacheSystem.DiscardFile(_package.PackageName, cacheGUID);
|
||||||
|
_allCacheGUIDs.RemoveAt(i);
|
||||||
|
|
||||||
|
if (OperationSystem.IsBusy)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_fileTotalCount == 0)
|
||||||
|
Progress = 1.0f;
|
||||||
|
else
|
||||||
|
Progress = 1.0f - (_allCacheGUIDs.Count / _fileTotalCount);
|
||||||
|
|
||||||
|
if (_allCacheGUIDs.Count == 0)
|
||||||
|
{
|
||||||
|
_steps = ESteps.Done;
|
||||||
|
Status = EOperationStatus.Succeed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 4eb0b0eafee709d478ab6d81faacb304
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -45,7 +45,7 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
// BundleFiles
|
// BundleFiles
|
||||||
{
|
{
|
||||||
string rootPath = PersistentHelper.GetCachedBundleFileFolderPath(_packageName);
|
string rootPath = PersistentTools.GetCachedBundleFileFolderPath(_packageName);
|
||||||
DirectoryInfo rootDirectory = new DirectoryInfo(rootPath);
|
DirectoryInfo rootDirectory = new DirectoryInfo(rootPath);
|
||||||
if (rootDirectory.Exists)
|
if (rootDirectory.Exists)
|
||||||
{
|
{
|
||||||
@@ -56,7 +56,7 @@ namespace YooAsset
|
|||||||
|
|
||||||
// RawFiles
|
// RawFiles
|
||||||
{
|
{
|
||||||
string rootPath = PersistentHelper.GetCachedRawFileFolderPath(_packageName);
|
string rootPath = PersistentTools.GetCachedRawFileFolderPath(_packageName);
|
||||||
DirectoryInfo rootDirectory = new DirectoryInfo(rootPath);
|
DirectoryInfo rootDirectory = new DirectoryInfo(rootPath);
|
||||||
if (rootDirectory.Exists)
|
if (rootDirectory.Exists)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,14 +3,59 @@ using System.Collections.Generic;
|
|||||||
|
|
||||||
namespace YooAsset
|
namespace YooAsset
|
||||||
{
|
{
|
||||||
/// <summary>
|
internal static class PersistentTools
|
||||||
/// 资源路径帮助类
|
|
||||||
/// </summary>
|
|
||||||
internal static class PathHelper
|
|
||||||
{
|
{
|
||||||
|
private const string CacheFolderName = "CacheFiles";
|
||||||
|
private const string CachedBundleFileFolder = "BundleFiles";
|
||||||
|
private const string CachedRawFileFolder = "RawFiles";
|
||||||
|
private const string ManifestFolderName = "ManifestFiles";
|
||||||
|
private const string AppFootPrintFileName = "ApplicationFootPrint.bytes";
|
||||||
|
|
||||||
private static string _buildinPath;
|
private static string _buildinPath;
|
||||||
private static string _sandboxPath;
|
private static string _sandboxPath;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 重写沙盒跟路径
|
||||||
|
/// </summary>
|
||||||
|
public static void OverwriteSandboxPath(string sandboxPath)
|
||||||
|
{
|
||||||
|
_sandboxPath = sandboxPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取沙盒文件夹路径
|
||||||
|
/// </summary>
|
||||||
|
public static string GetPersistentRootPath()
|
||||||
|
{
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
// 注意:为了方便调试查看,编辑器下把存储目录放到项目里
|
||||||
|
if (string.IsNullOrEmpty(_sandboxPath))
|
||||||
|
{
|
||||||
|
string directory = Path.GetDirectoryName(UnityEngine.Application.dataPath);
|
||||||
|
string projectPath = GetRegularPath(directory);
|
||||||
|
_sandboxPath = StringUtility.Format("{0}/Sandbox", projectPath);
|
||||||
|
}
|
||||||
|
#elif UNITY_STANDALONE
|
||||||
|
if (string.IsNullOrEmpty(_sandboxPath))
|
||||||
|
{
|
||||||
|
_sandboxPath = StringUtility.Format("{0}/Sandbox", UnityEngine.Application.dataPath);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
if (string.IsNullOrEmpty(_sandboxPath))
|
||||||
|
{
|
||||||
|
_sandboxPath = StringUtility.Format("{0}/Sandbox", UnityEngine.Application.persistentDataPath);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return _sandboxPath;
|
||||||
|
}
|
||||||
|
private static string GetRegularPath(string path)
|
||||||
|
{
|
||||||
|
return path.Replace('\\', '/').Replace("\\", "/"); //替换为Linux路径格式
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取基于流文件夹的加载路径
|
/// 获取基于流文件夹的加载路径
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -32,33 +77,6 @@ namespace YooAsset
|
|||||||
return StringUtility.Format("{0}/{1}", root, path);
|
return StringUtility.Format("{0}/{1}", root, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 获取沙盒文件夹路径
|
|
||||||
/// </summary>
|
|
||||||
public static string GetPersistentRootPath()
|
|
||||||
{
|
|
||||||
#if UNITY_EDITOR
|
|
||||||
// 注意:为了方便调试查看,编辑器下把存储目录放到项目里
|
|
||||||
if (string.IsNullOrEmpty(_sandboxPath))
|
|
||||||
{
|
|
||||||
string directory = Path.GetDirectoryName(UnityEngine.Application.dataPath);
|
|
||||||
string projectPath = GetRegularPath(directory);
|
|
||||||
_sandboxPath = StringUtility.Format("{0}/Sandbox", projectPath);
|
|
||||||
}
|
|
||||||
return _sandboxPath;
|
|
||||||
#else
|
|
||||||
if (string.IsNullOrEmpty(_sandboxPath))
|
|
||||||
{
|
|
||||||
_sandboxPath = StringUtility.Format("{0}/Sandbox", UnityEngine.Application.persistentDataPath);
|
|
||||||
}
|
|
||||||
return _sandboxPath;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
private static string GetRegularPath(string path)
|
|
||||||
{
|
|
||||||
return path.Replace('\\', '/').Replace("\\", "/"); //替换为Linux路径格式
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取WWW加载本地资源的路径
|
/// 获取WWW加载本地资源的路径
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -76,18 +94,6 @@ namespace YooAsset
|
|||||||
return path;
|
return path;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 持久化目录帮助类
|
|
||||||
/// </summary>
|
|
||||||
internal static class PersistentHelper
|
|
||||||
{
|
|
||||||
private const string CacheFolderName = "CacheFiles";
|
|
||||||
private const string CachedBundleFileFolder = "BundleFiles";
|
|
||||||
private const string CachedRawFileFolder = "RawFiles";
|
|
||||||
private const string ManifestFolderName = "ManifestFiles";
|
|
||||||
private const string AppFootPrintFileName = "ApplicationFootPrint.bytes";
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -95,7 +101,7 @@ namespace YooAsset
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static void DeleteSandbox()
|
public static void DeleteSandbox()
|
||||||
{
|
{
|
||||||
string directoryPath = PathHelper.MakePersistentLoadPath(string.Empty);
|
string directoryPath = MakePersistentLoadPath(string.Empty);
|
||||||
if (Directory.Exists(directoryPath))
|
if (Directory.Exists(directoryPath))
|
||||||
Directory.Delete(directoryPath, true);
|
Directory.Delete(directoryPath, true);
|
||||||
}
|
}
|
||||||
@@ -105,7 +111,7 @@ namespace YooAsset
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static void DeleteCacheFolder()
|
public static void DeleteCacheFolder()
|
||||||
{
|
{
|
||||||
string root = PathHelper.MakePersistentLoadPath(CacheFolderName);
|
string root = MakePersistentLoadPath(CacheFolderName);
|
||||||
if (Directory.Exists(root))
|
if (Directory.Exists(root))
|
||||||
Directory.Delete(root, true);
|
Directory.Delete(root, true);
|
||||||
}
|
}
|
||||||
@@ -115,7 +121,7 @@ namespace YooAsset
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static void DeleteManifestFolder()
|
public static void DeleteManifestFolder()
|
||||||
{
|
{
|
||||||
string root = PathHelper.MakePersistentLoadPath(ManifestFolderName);
|
string root = MakePersistentLoadPath(ManifestFolderName);
|
||||||
if (Directory.Exists(root))
|
if (Directory.Exists(root))
|
||||||
Directory.Delete(root, true);
|
Directory.Delete(root, true);
|
||||||
}
|
}
|
||||||
@@ -129,7 +135,7 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
if (_cachedBundleFileFolder.TryGetValue(packageName, out string value) == false)
|
if (_cachedBundleFileFolder.TryGetValue(packageName, out string value) == false)
|
||||||
{
|
{
|
||||||
string root = PathHelper.MakePersistentLoadPath(CacheFolderName);
|
string root = MakePersistentLoadPath(CacheFolderName);
|
||||||
value = $"{root}/{packageName}/{CachedBundleFileFolder}";
|
value = $"{root}/{packageName}/{CachedBundleFileFolder}";
|
||||||
_cachedBundleFileFolder.Add(packageName, value);
|
_cachedBundleFileFolder.Add(packageName, value);
|
||||||
}
|
}
|
||||||
@@ -144,7 +150,7 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
if (_cachedRawFileFolder.TryGetValue(packageName, out string value) == false)
|
if (_cachedRawFileFolder.TryGetValue(packageName, out string value) == false)
|
||||||
{
|
{
|
||||||
string root = PathHelper.MakePersistentLoadPath(CacheFolderName);
|
string root = MakePersistentLoadPath(CacheFolderName);
|
||||||
value = $"{root}/{packageName}/{CachedRawFileFolder}";
|
value = $"{root}/{packageName}/{CachedRawFileFolder}";
|
||||||
_cachedRawFileFolder.Add(packageName, value);
|
_cachedRawFileFolder.Add(packageName, value);
|
||||||
}
|
}
|
||||||
@@ -156,7 +162,7 @@ namespace YooAsset
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static string GetAppFootPrintFilePath()
|
public static string GetAppFootPrintFilePath()
|
||||||
{
|
{
|
||||||
return PathHelper.MakePersistentLoadPath(AppFootPrintFileName);
|
return MakePersistentLoadPath(AppFootPrintFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -165,7 +171,7 @@ namespace YooAsset
|
|||||||
public static string GetCacheManifestFilePath(string packageName, string packageVersion)
|
public static string GetCacheManifestFilePath(string packageName, string packageVersion)
|
||||||
{
|
{
|
||||||
string fileName = YooAssetSettingsData.GetManifestBinaryFileName(packageName, packageVersion);
|
string fileName = YooAssetSettingsData.GetManifestBinaryFileName(packageName, packageVersion);
|
||||||
return PathHelper.MakePersistentLoadPath($"{ManifestFolderName}/{fileName}");
|
return MakePersistentLoadPath($"{ManifestFolderName}/{fileName}");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -174,7 +180,7 @@ namespace YooAsset
|
|||||||
public static string GetCachePackageHashFilePath(string packageName, string packageVersion)
|
public static string GetCachePackageHashFilePath(string packageName, string packageVersion)
|
||||||
{
|
{
|
||||||
string fileName = YooAssetSettingsData.GetPackageHashFileName(packageName, packageVersion);
|
string fileName = YooAssetSettingsData.GetPackageHashFileName(packageName, packageVersion);
|
||||||
return PathHelper.MakePersistentLoadPath($"{ManifestFolderName}/{fileName}");
|
return MakePersistentLoadPath($"{ManifestFolderName}/{fileName}");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -183,7 +189,7 @@ namespace YooAsset
|
|||||||
public static string GetCachePackageVersionFilePath(string packageName)
|
public static string GetCachePackageVersionFilePath(string packageName)
|
||||||
{
|
{
|
||||||
string fileName = YooAssetSettingsData.GetPackageVersionFileName(packageName);
|
string fileName = YooAssetSettingsData.GetPackageVersionFileName(packageName);
|
||||||
return PathHelper.MakePersistentLoadPath($"{ManifestFolderName}/{fileName}");
|
return MakePersistentLoadPath($"{ManifestFolderName}/{fileName}");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -193,7 +193,7 @@ namespace YooAsset
|
|||||||
public static BundleInfo GetUnpackInfo(PackageBundle packageBundle)
|
public static BundleInfo GetUnpackInfo(PackageBundle packageBundle)
|
||||||
{
|
{
|
||||||
// 注意:我们把流加载路径指定为远端下载地址
|
// 注意:我们把流加载路径指定为远端下载地址
|
||||||
string streamingPath = PathHelper.ConvertToWWWPath(packageBundle.StreamingFilePath);
|
string streamingPath = PersistentTools.ConvertToWWWPath(packageBundle.StreamingFilePath);
|
||||||
BundleInfo bundleInfo = new BundleInfo(packageBundle, BundleInfo.ELoadMode.LoadFromStreaming, streamingPath, streamingPath);
|
BundleInfo bundleInfo = new BundleInfo(packageBundle, BundleInfo.ELoadMode.LoadFromStreaming, streamingPath, streamingPath);
|
||||||
return bundleInfo;
|
return bundleInfo;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -222,7 +222,7 @@ namespace YooAsset
|
|||||||
// 如果水印发生变化,则说明覆盖安装后首次打开游戏
|
// 如果水印发生变化,则说明覆盖安装后首次打开游戏
|
||||||
if (appFootPrint.IsDirty())
|
if (appFootPrint.IsDirty())
|
||||||
{
|
{
|
||||||
PersistentHelper.DeleteManifestFolder();
|
PersistentTools.DeleteManifestFolder();
|
||||||
appFootPrint.Coverage();
|
appFootPrint.Coverage();
|
||||||
YooLogger.Log("Delete manifest files when application foot print dirty !");
|
YooLogger.Log("Delete manifest files when application foot print dirty !");
|
||||||
}
|
}
|
||||||
@@ -376,7 +376,7 @@ namespace YooAsset
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void Load()
|
public void Load()
|
||||||
{
|
{
|
||||||
string footPrintFilePath = PersistentHelper.GetAppFootPrintFilePath();
|
string footPrintFilePath = PersistentTools.GetAppFootPrintFilePath();
|
||||||
if (File.Exists(footPrintFilePath))
|
if (File.Exists(footPrintFilePath))
|
||||||
{
|
{
|
||||||
_footPrint = FileUtility.ReadAllText(footPrintFilePath);
|
_footPrint = FileUtility.ReadAllText(footPrintFilePath);
|
||||||
@@ -409,7 +409,7 @@ namespace YooAsset
|
|||||||
#else
|
#else
|
||||||
_footPrint = Application.buildGUID;
|
_footPrint = Application.buildGUID;
|
||||||
#endif
|
#endif
|
||||||
string footPrintFilePath = PersistentHelper.GetAppFootPrintFilePath();
|
string footPrintFilePath = PersistentTools.GetAppFootPrintFilePath();
|
||||||
FileUtility.CreateFile(footPrintFilePath, _footPrint);
|
FileUtility.CreateFile(footPrintFilePath, _footPrint);
|
||||||
YooLogger.Log($"Save application foot print : {_footPrint}");
|
YooLogger.Log($"Save application foot print : {_footPrint}");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
if (_downloader1 == null)
|
if (_downloader1 == null)
|
||||||
{
|
{
|
||||||
string savePath = PersistentHelper.GetCachePackageHashFilePath(_packageName, _packageVersion);
|
string savePath = PersistentTools.GetCachePackageHashFilePath(_packageName, _packageVersion);
|
||||||
string fileName = YooAssetSettingsData.GetPackageHashFileName(_packageName, _packageVersion);
|
string fileName = YooAssetSettingsData.GetPackageHashFileName(_packageName, _packageVersion);
|
||||||
string webURL = GetDownloadRequestURL(fileName);
|
string webURL = GetDownloadRequestURL(fileName);
|
||||||
YooLogger.Log($"Beginning to download package hash file : {webURL}");
|
YooLogger.Log($"Beginning to download package hash file : {webURL}");
|
||||||
@@ -71,7 +71,7 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
if (_downloader2 == null)
|
if (_downloader2 == null)
|
||||||
{
|
{
|
||||||
string savePath = PersistentHelper.GetCacheManifestFilePath(_packageName, _packageVersion);
|
string savePath = PersistentTools.GetCacheManifestFilePath(_packageName, _packageVersion);
|
||||||
string fileName = YooAssetSettingsData.GetManifestBinaryFileName(_packageName, _packageVersion);
|
string fileName = YooAssetSettingsData.GetManifestBinaryFileName(_packageName, _packageVersion);
|
||||||
string webURL = GetDownloadRequestURL(fileName);
|
string webURL = GetDownloadRequestURL(fileName);
|
||||||
YooLogger.Log($"Beginning to download manifest file : {webURL}");
|
YooLogger.Log($"Beginning to download manifest file : {webURL}");
|
||||||
|
|||||||
@@ -42,8 +42,8 @@ namespace YooAsset
|
|||||||
if (_downloader == null)
|
if (_downloader == null)
|
||||||
{
|
{
|
||||||
string fileName = YooAssetSettingsData.GetManifestBinaryFileName(_buildinPackageName, _buildinPackageVersion);
|
string fileName = YooAssetSettingsData.GetManifestBinaryFileName(_buildinPackageName, _buildinPackageVersion);
|
||||||
string filePath = PathHelper.MakeStreamingLoadPath(fileName);
|
string filePath = PersistentTools.MakeStreamingLoadPath(fileName);
|
||||||
string url = PathHelper.ConvertToWWWPath(filePath);
|
string url = PersistentTools.ConvertToWWWPath(filePath);
|
||||||
_downloader = new UnityWebDataRequester();
|
_downloader = new UnityWebDataRequester();
|
||||||
_downloader.SendRequest(url);
|
_downloader.SendRequest(url);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ namespace YooAsset
|
|||||||
|
|
||||||
if (_steps == ESteps.VerifyFileHash)
|
if (_steps == ESteps.VerifyFileHash)
|
||||||
{
|
{
|
||||||
_manifestFilePath = PersistentHelper.GetCacheManifestFilePath(_packageName, _packageVersion);
|
_manifestFilePath = PersistentTools.GetCacheManifestFilePath(_packageName, _packageVersion);
|
||||||
if (File.Exists(_manifestFilePath) == false)
|
if (File.Exists(_manifestFilePath) == false)
|
||||||
{
|
{
|
||||||
_steps = ESteps.Done;
|
_steps = ESteps.Done;
|
||||||
@@ -131,7 +131,7 @@ namespace YooAsset
|
|||||||
File.Delete(_manifestFilePath);
|
File.Delete(_manifestFilePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
string hashFilePath = PersistentHelper.GetCachePackageHashFilePath(_packageName, _packageVersion);
|
string hashFilePath = PersistentTools.GetCachePackageHashFilePath(_packageName, _packageVersion);
|
||||||
if (File.Exists(hashFilePath))
|
if (File.Exists(hashFilePath))
|
||||||
{
|
{
|
||||||
File.Delete(hashFilePath);
|
File.Delete(hashFilePath);
|
||||||
|
|||||||
@@ -38,8 +38,8 @@ namespace YooAsset
|
|||||||
if (_downloader == null)
|
if (_downloader == null)
|
||||||
{
|
{
|
||||||
string fileName = YooAssetSettingsData.GetPackageVersionFileName(_packageName);
|
string fileName = YooAssetSettingsData.GetPackageVersionFileName(_packageName);
|
||||||
string filePath = PathHelper.MakeStreamingLoadPath(fileName);
|
string filePath = PersistentTools.MakeStreamingLoadPath(fileName);
|
||||||
string url = PathHelper.ConvertToWWWPath(filePath);
|
string url = PersistentTools.ConvertToWWWPath(filePath);
|
||||||
_downloader = new UnityWebDataRequester();
|
_downloader = new UnityWebDataRequester();
|
||||||
_downloader.SendRequest(url);
|
_downloader.SendRequest(url);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ namespace YooAsset
|
|||||||
|
|
||||||
if (_steps == ESteps.LoadCachePackageHashFile)
|
if (_steps == ESteps.LoadCachePackageHashFile)
|
||||||
{
|
{
|
||||||
string filePath = PersistentHelper.GetCachePackageHashFilePath(_packageName, _packageVersion);
|
string filePath = PersistentTools.GetCachePackageHashFilePath(_packageName, _packageVersion);
|
||||||
if (File.Exists(filePath) == false)
|
if (File.Exists(filePath) == false)
|
||||||
{
|
{
|
||||||
_steps = ESteps.Done;
|
_steps = ESteps.Done;
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ namespace YooAsset
|
|||||||
|
|
||||||
if (_steps == ESteps.LoadCachePackageVersionFile)
|
if (_steps == ESteps.LoadCachePackageVersionFile)
|
||||||
{
|
{
|
||||||
string filePath = PersistentHelper.GetCachePackageVersionFilePath(_packageName);
|
string filePath = PersistentTools.GetCachePackageVersionFilePath(_packageName);
|
||||||
if (File.Exists(filePath) == false)
|
if (File.Exists(filePath) == false)
|
||||||
{
|
{
|
||||||
_steps = ESteps.Done;
|
_steps = ESteps.Done;
|
||||||
|
|||||||
@@ -35,10 +35,10 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
if (_downloader1 == null)
|
if (_downloader1 == null)
|
||||||
{
|
{
|
||||||
string savePath = PersistentHelper.GetCachePackageHashFilePath(_buildinPackageName, _buildinPackageVersion);
|
string savePath = PersistentTools.GetCachePackageHashFilePath(_buildinPackageName, _buildinPackageVersion);
|
||||||
string fileName = YooAssetSettingsData.GetPackageHashFileName(_buildinPackageName, _buildinPackageVersion);
|
string fileName = YooAssetSettingsData.GetPackageHashFileName(_buildinPackageName, _buildinPackageVersion);
|
||||||
string filePath = PathHelper.MakeStreamingLoadPath(fileName);
|
string filePath = PersistentTools.MakeStreamingLoadPath(fileName);
|
||||||
string url = PathHelper.ConvertToWWWPath(filePath);
|
string url = PersistentTools.ConvertToWWWPath(filePath);
|
||||||
_downloader1 = new UnityWebFileRequester();
|
_downloader1 = new UnityWebFileRequester();
|
||||||
_downloader1.SendRequest(url, savePath);
|
_downloader1.SendRequest(url, savePath);
|
||||||
}
|
}
|
||||||
@@ -64,10 +64,10 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
if (_downloader2 == null)
|
if (_downloader2 == null)
|
||||||
{
|
{
|
||||||
string savePath = PersistentHelper.GetCacheManifestFilePath(_buildinPackageName, _buildinPackageVersion);
|
string savePath = PersistentTools.GetCacheManifestFilePath(_buildinPackageName, _buildinPackageVersion);
|
||||||
string fileName = YooAssetSettingsData.GetManifestBinaryFileName(_buildinPackageName, _buildinPackageVersion);
|
string fileName = YooAssetSettingsData.GetManifestBinaryFileName(_buildinPackageName, _buildinPackageVersion);
|
||||||
string filePath = PathHelper.MakeStreamingLoadPath(fileName);
|
string filePath = PersistentTools.MakeStreamingLoadPath(fileName);
|
||||||
string url = PathHelper.ConvertToWWWPath(filePath);
|
string url = PersistentTools.ConvertToWWWPath(filePath);
|
||||||
_downloader2 = new UnityWebFileRequester();
|
_downloader2 = new UnityWebFileRequester();
|
||||||
_downloader2.SendRequest(url, savePath);
|
_downloader2.SendRequest(url, savePath);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ namespace YooAsset
|
|||||||
private readonly HostPlayModeImpl _impl;
|
private readonly HostPlayModeImpl _impl;
|
||||||
private readonly string _packageName;
|
private readonly string _packageName;
|
||||||
private readonly string _packageVersion;
|
private readonly string _packageVersion;
|
||||||
|
private readonly bool _autoSaveVersion;
|
||||||
private readonly int _timeout;
|
private readonly int _timeout;
|
||||||
private LoadCacheManifestOperation _tryLoadCacheManifestOp;
|
private LoadCacheManifestOperation _tryLoadCacheManifestOp;
|
||||||
private LoadCacheManifestOperation _loadCacheManifestOp;
|
private LoadCacheManifestOperation _loadCacheManifestOp;
|
||||||
@@ -76,11 +77,12 @@ namespace YooAsset
|
|||||||
private ESteps _steps = ESteps.None;
|
private ESteps _steps = ESteps.None;
|
||||||
|
|
||||||
|
|
||||||
internal HostPlayModeUpdatePackageManifestOperation(HostPlayModeImpl impl, string packageName, string packageVersion, int timeout)
|
internal HostPlayModeUpdatePackageManifestOperation(HostPlayModeImpl impl, string packageName, string packageVersion, bool autoSaveVersion, int timeout)
|
||||||
{
|
{
|
||||||
_impl = impl;
|
_impl = impl;
|
||||||
_packageName = packageName;
|
_packageName = packageName;
|
||||||
_packageVersion = packageVersion;
|
_packageVersion = packageVersion;
|
||||||
|
_autoSaveVersion = autoSaveVersion;
|
||||||
_timeout = timeout;
|
_timeout = timeout;
|
||||||
}
|
}
|
||||||
internal override void Start()
|
internal override void Start()
|
||||||
@@ -120,6 +122,8 @@ namespace YooAsset
|
|||||||
if (_tryLoadCacheManifestOp.Status == EOperationStatus.Succeed)
|
if (_tryLoadCacheManifestOp.Status == EOperationStatus.Succeed)
|
||||||
{
|
{
|
||||||
_impl.ActiveManifest = _tryLoadCacheManifestOp.Manifest;
|
_impl.ActiveManifest = _tryLoadCacheManifestOp.Manifest;
|
||||||
|
if (_autoSaveVersion)
|
||||||
|
SavePackageVersion();
|
||||||
_steps = ESteps.Done;
|
_steps = ESteps.Done;
|
||||||
Status = EOperationStatus.Succeed;
|
Status = EOperationStatus.Succeed;
|
||||||
}
|
}
|
||||||
@@ -166,6 +170,8 @@ namespace YooAsset
|
|||||||
if (_loadCacheManifestOp.Status == EOperationStatus.Succeed)
|
if (_loadCacheManifestOp.Status == EOperationStatus.Succeed)
|
||||||
{
|
{
|
||||||
_impl.ActiveManifest = _loadCacheManifestOp.Manifest;
|
_impl.ActiveManifest = _loadCacheManifestOp.Manifest;
|
||||||
|
if (_autoSaveVersion)
|
||||||
|
SavePackageVersion();
|
||||||
_steps = ESteps.Done;
|
_steps = ESteps.Done;
|
||||||
Status = EOperationStatus.Succeed;
|
Status = EOperationStatus.Succeed;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,12 +74,12 @@ namespace YooAsset
|
|||||||
string folderName = FileHash.Substring(0, 2);
|
string folderName = FileHash.Substring(0, 2);
|
||||||
if (IsRawFile)
|
if (IsRawFile)
|
||||||
{
|
{
|
||||||
string cacheRoot = PersistentHelper.GetCachedRawFileFolderPath(PackageName);
|
string cacheRoot = PersistentTools.GetCachedRawFileFolderPath(PackageName);
|
||||||
_cachedDataFilePath = $"{cacheRoot}/{folderName}/{CacheGUID}/{YooAssetSettings.CacheBundleDataFileName}{_fileExtension}";
|
_cachedDataFilePath = $"{cacheRoot}/{folderName}/{CacheGUID}/{YooAssetSettings.CacheBundleDataFileName}{_fileExtension}";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string cacheRoot = PersistentHelper.GetCachedBundleFileFolderPath(PackageName);
|
string cacheRoot = PersistentTools.GetCachedBundleFileFolderPath(PackageName);
|
||||||
_cachedDataFilePath = $"{cacheRoot}/{folderName}/{CacheGUID}/{YooAssetSettings.CacheBundleDataFileName}";
|
_cachedDataFilePath = $"{cacheRoot}/{folderName}/{CacheGUID}/{YooAssetSettings.CacheBundleDataFileName}";
|
||||||
}
|
}
|
||||||
return _cachedDataFilePath;
|
return _cachedDataFilePath;
|
||||||
@@ -100,12 +100,12 @@ namespace YooAsset
|
|||||||
string folderName = FileHash.Substring(0, 2);
|
string folderName = FileHash.Substring(0, 2);
|
||||||
if (IsRawFile)
|
if (IsRawFile)
|
||||||
{
|
{
|
||||||
string cacheRoot = PersistentHelper.GetCachedRawFileFolderPath(PackageName);
|
string cacheRoot = PersistentTools.GetCachedRawFileFolderPath(PackageName);
|
||||||
_cachedInfoFilePath = $"{cacheRoot}/{folderName}/{CacheGUID}/{YooAssetSettings.CacheBundleInfoFileName}";
|
_cachedInfoFilePath = $"{cacheRoot}/{folderName}/{CacheGUID}/{YooAssetSettings.CacheBundleInfoFileName}";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string cacheRoot = PersistentHelper.GetCachedBundleFileFolderPath(PackageName);
|
string cacheRoot = PersistentTools.GetCachedBundleFileFolderPath(PackageName);
|
||||||
_cachedInfoFilePath = $"{cacheRoot}/{folderName}/{CacheGUID}/{YooAssetSettings.CacheBundleInfoFileName}";
|
_cachedInfoFilePath = $"{cacheRoot}/{folderName}/{CacheGUID}/{YooAssetSettings.CacheBundleInfoFileName}";
|
||||||
}
|
}
|
||||||
return _cachedInfoFilePath;
|
return _cachedInfoFilePath;
|
||||||
@@ -139,7 +139,7 @@ namespace YooAsset
|
|||||||
if (string.IsNullOrEmpty(_streamingFilePath) == false)
|
if (string.IsNullOrEmpty(_streamingFilePath) == false)
|
||||||
return _streamingFilePath;
|
return _streamingFilePath;
|
||||||
|
|
||||||
_streamingFilePath = PathHelper.MakeStreamingLoadPath(FileName);
|
_streamingFilePath = PersistentTools.MakeStreamingLoadPath(FileName);
|
||||||
return _streamingFilePath;
|
return _streamingFilePath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ namespace YooAsset
|
|||||||
OperationSystem.StartOperation(operation);
|
OperationSystem.StartOperation(operation);
|
||||||
return operation;
|
return operation;
|
||||||
}
|
}
|
||||||
UpdatePackageManifestOperation IPlayModeServices.UpdatePackageManifestAsync(string packageVersion, int timeout)
|
UpdatePackageManifestOperation IPlayModeServices.UpdatePackageManifestAsync(string packageVersion, bool autoSaveVersion, int timeout)
|
||||||
{
|
{
|
||||||
var operation = new EditorPlayModeUpdatePackageManifestOperation();
|
var operation = new EditorPlayModeUpdatePackageManifestOperation();
|
||||||
OperationSystem.StartOperation(operation);
|
OperationSystem.StartOperation(operation);
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ namespace YooAsset
|
|||||||
public void FlushManifestVersionFile()
|
public void FlushManifestVersionFile()
|
||||||
{
|
{
|
||||||
if (_activeManifest != null)
|
if (_activeManifest != null)
|
||||||
PersistentHelper.SaveCachePackageVersionFile(_packageName, _activeManifest.PackageVersion);
|
PersistentTools.SaveCachePackageVersionFile(_packageName, _activeManifest.PackageVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool IsBuildinPackageBundle(PackageBundle packageBundle)
|
private bool IsBuildinPackageBundle(PackageBundle packageBundle)
|
||||||
@@ -111,9 +111,9 @@ namespace YooAsset
|
|||||||
OperationSystem.StartOperation(operation);
|
OperationSystem.StartOperation(operation);
|
||||||
return operation;
|
return operation;
|
||||||
}
|
}
|
||||||
UpdatePackageManifestOperation IPlayModeServices.UpdatePackageManifestAsync(string packageVersion, int timeout)
|
UpdatePackageManifestOperation IPlayModeServices.UpdatePackageManifestAsync(string packageVersion, bool autoSaveVersion, int timeout)
|
||||||
{
|
{
|
||||||
var operation = new HostPlayModeUpdatePackageManifestOperation(this, _packageName, packageVersion, timeout);
|
var operation = new HostPlayModeUpdatePackageManifestOperation(this, _packageName, packageVersion, autoSaveVersion, timeout);
|
||||||
OperationSystem.StartOperation(operation);
|
OperationSystem.StartOperation(operation);
|
||||||
return operation;
|
return operation;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ namespace YooAsset
|
|||||||
OperationSystem.StartOperation(operation);
|
OperationSystem.StartOperation(operation);
|
||||||
return operation;
|
return operation;
|
||||||
}
|
}
|
||||||
UpdatePackageManifestOperation IPlayModeServices.UpdatePackageManifestAsync(string packageVersion, int timeout)
|
UpdatePackageManifestOperation IPlayModeServices.UpdatePackageManifestAsync(string packageVersion, bool autoSaveVersion, int timeout)
|
||||||
{
|
{
|
||||||
var operation = new OfflinePlayModeUpdatePackageManifestOperation();
|
var operation = new OfflinePlayModeUpdatePackageManifestOperation();
|
||||||
OperationSystem.StartOperation(operation);
|
OperationSystem.StartOperation(operation);
|
||||||
|
|||||||
@@ -220,13 +220,13 @@ namespace YooAsset
|
|||||||
/// 向网络端请求并更新清单
|
/// 向网络端请求并更新清单
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="packageVersion">更新的包裹版本</param>
|
/// <param name="packageVersion">更新的包裹版本</param>
|
||||||
/// <param name="autoActiveManifest">自动激活清单</param>
|
/// <param name="autoSaveVersion">更新成功后自动保存版本号,作为下次初始化的版本。</param>
|
||||||
/// <param name="timeout">超时时间(默认值:60秒)</param>
|
/// <param name="timeout">超时时间(默认值:60秒)</param>
|
||||||
public UpdatePackageManifestOperation UpdatePackageManifestAsync(string packageVersion, int timeout = 60)
|
public UpdatePackageManifestOperation UpdatePackageManifestAsync(string packageVersion, bool autoSaveVersion = true, int timeout = 60)
|
||||||
{
|
{
|
||||||
DebugCheckInitialize();
|
DebugCheckInitialize();
|
||||||
DebugCheckUpdateManifest();
|
DebugCheckUpdateManifest();
|
||||||
return _playModeServices.UpdatePackageManifestAsync(packageVersion, timeout);
|
return _playModeServices.UpdatePackageManifestAsync(packageVersion, autoSaveVersion, timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -251,6 +251,17 @@ namespace YooAsset
|
|||||||
return operation;
|
return operation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 清理包裹本地所有的缓存文件
|
||||||
|
/// </summary>
|
||||||
|
public ClearAllCacheFilesOperation ClearAllCacheFilesAsync()
|
||||||
|
{
|
||||||
|
DebugCheckInitialize();
|
||||||
|
var operation = new ClearAllCacheFilesOperation(this);
|
||||||
|
OperationSystem.StartOperation(operation);
|
||||||
|
return operation;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取本地包裹的版本信息
|
/// 获取本地包裹的版本信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
[assembly: InternalsVisibleTo("YooAsset.Editor")]
|
[assembly: InternalsVisibleTo("YooAsset.Editor")]
|
||||||
[assembly: InternalsVisibleTo("Assembly-CSharp-Editor")]
|
|
||||||
[assembly: InternalsVisibleTo("YooAsset.EditorExtension")]
|
[assembly: InternalsVisibleTo("YooAsset.EditorExtension")]
|
||||||
[assembly: InternalsVisibleTo("YooAsset.RuntimeExtension")]
|
[assembly: InternalsVisibleTo("YooAsset.RuntimeExtension")]
|
||||||
|
[assembly: InternalsVisibleTo("Assembly-CSharp-Editor")]
|
||||||
@@ -21,7 +21,7 @@ namespace YooAsset
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 向网络端请求并更新清单
|
/// 向网络端请求并更新清单
|
||||||
/// </summary>
|
/// </summary>
|
||||||
UpdatePackageManifestOperation UpdatePackageManifestAsync(string packageVersion, int timeout);
|
UpdatePackageManifestOperation UpdatePackageManifestAsync(string packageVersion, bool autoSaveVersion, int timeout);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 预下载指定版本的包裹内容
|
/// 预下载指定版本的包裹内容
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace YooAsset
|
namespace YooAsset
|
||||||
{
|
{
|
||||||
[CreateAssetMenu(fileName = "YooAssetSettings", menuName = "YooAsset/Create Settings")]
|
[CreateAssetMenu(fileName = "YooAssetSettings", menuName = "YooAsset/Create YooAsset Settings")]
|
||||||
internal class YooAssetSettings : ScriptableObject
|
internal class YooAssetSettings : ScriptableObject
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ namespace YooAsset
|
|||||||
if (HasPackage(packageName))
|
if (HasPackage(packageName))
|
||||||
throw new Exception($"Package {packageName} already existed !");
|
throw new Exception($"Package {packageName} already existed !");
|
||||||
|
|
||||||
|
YooLogger.Log($"Create resource package : {packageName}");
|
||||||
ResourcePackage package = new ResourcePackage(packageName);
|
ResourcePackage package = new ResourcePackage(packageName);
|
||||||
_packages.Add(package);
|
_packages.Add(package);
|
||||||
return package;
|
return package;
|
||||||
@@ -136,6 +137,24 @@ namespace YooAsset
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 销毁资源包
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="packageName">资源包名称</param>
|
||||||
|
public static void DestroyPackage(string packageName)
|
||||||
|
{
|
||||||
|
ResourcePackage package = GetPackage(packageName);
|
||||||
|
if (package == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
YooLogger.Log($"Destroy resource package : {packageName}");
|
||||||
|
_packages.Remove(package);
|
||||||
|
package.DestroyPackage();
|
||||||
|
|
||||||
|
// 清空缓存
|
||||||
|
CacheSystem.ClearPackage(packageName);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 检测资源包是否存在
|
/// 检测资源包是否存在
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -215,6 +234,27 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
CacheSystem.InitVerifyLevel = verifyLevel;
|
CacheSystem.InitVerifyLevel = verifyLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置缓存系统参数,沙盒目录的存储路径
|
||||||
|
/// </summary>
|
||||||
|
public static void SetCacheSystemSandboxPath(string sandboxPath)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(sandboxPath))
|
||||||
|
{
|
||||||
|
YooLogger.Error($"Sandbox path is null or empty !");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 注意:需要确保没有任何资源系统起效之前才可以设置沙盒目录!
|
||||||
|
if (_packages.Count > 0)
|
||||||
|
{
|
||||||
|
YooLogger.Error($"Please call this method {nameof(SetCacheSystemSandboxPath)} before the package is created !");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
PersistentTools.OverwriteSandboxPath(sandboxPath);
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 沙盒相关
|
#region 沙盒相关
|
||||||
@@ -231,15 +271,16 @@ namespace YooAsset
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static string GetSandboxRoot()
|
public static string GetSandboxRoot()
|
||||||
{
|
{
|
||||||
return PathHelper.GetPersistentRootPath();
|
return PersistentTools.GetPersistentRootPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 清空沙盒目录
|
/// 清空沙盒目录(需要重启APP)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void ClearSandbox()
|
public static void ClearSandbox()
|
||||||
{
|
{
|
||||||
PersistentHelper.DeleteSandbox();
|
YooLogger.Warning("Clear sandbox folder files, Finally, restart the application !");
|
||||||
|
PersistentTools.DeleteSandbox();
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@@ -32,13 +32,13 @@ public class FsmUpdateManifest : IStateNode
|
|||||||
{
|
{
|
||||||
yield return new WaitForSecondsRealtime(0.5f);
|
yield return new WaitForSecondsRealtime(0.5f);
|
||||||
|
|
||||||
|
bool savePackageVersion = true;
|
||||||
var package = YooAssets.GetPackage("DefaultPackage");
|
var package = YooAssets.GetPackage("DefaultPackage");
|
||||||
var operation = package.UpdatePackageManifestAsync(PatchManager.Instance.PackageVersion);
|
var operation = package.UpdatePackageManifestAsync(PatchManager.Instance.PackageVersion, savePackageVersion);
|
||||||
yield return operation;
|
yield return operation;
|
||||||
|
|
||||||
if(operation.Status == EOperationStatus.Succeed)
|
if(operation.Status == EOperationStatus.Succeed)
|
||||||
{
|
{
|
||||||
operation.SavePackageVersion();
|
|
||||||
_machine.ChangeState<FsmCreateDownloader>();
|
_machine.ChangeState<FsmCreateDownloader>();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
// 作者:Stark
|
// 作者:Stark
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
|
|
||||||
#if UNITY_ANDROID
|
#if UNITY_ANDROID && UNITY_EDITOR
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 为Github对开发者的友好,采用自动补充UnityPlayerActivity.java文件的通用姿势满足各个开发者
|
/// 为Github对开发者的友好,采用自动补充UnityPlayerActivity.java文件的通用姿势满足各个开发者
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -30,7 +30,6 @@ internal class AndroidPost : UnityEditor.Android.IPostGenerateGradleAndroidProje
|
|||||||
" } \n" +
|
" } \n" +
|
||||||
" catch(java.io.IOException e) \n" +
|
" catch(java.io.IOException e) \n" +
|
||||||
" { \n" +
|
" { \n" +
|
||||||
" e.printStackTrace(); \n" +
|
|
||||||
" } \n" +
|
" } \n" +
|
||||||
" return false; \n" +
|
" return false; \n" +
|
||||||
" } \n" +
|
" } \n" +
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "com.tuyoogame.yooasset",
|
"name": "com.tuyoogame.yooasset",
|
||||||
"displayName": "YooAsset",
|
"displayName": "YooAsset",
|
||||||
"version": "1.4.11",
|
"version": "1.4.13",
|
||||||
"unity": "2019.4",
|
"unity": "2019.4",
|
||||||
"description": "unity3d resources management system.",
|
"description": "unity3d resources management system.",
|
||||||
"author": {
|
"author": {
|
||||||
|
|||||||
Reference in New Issue
Block a user