Compare commits
36 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dc5f0b151b | ||
|
|
dd5bcc3d9d | ||
|
|
80188ae6e6 | ||
|
|
05e77dc166 | ||
|
|
b9b8f8e170 | ||
|
|
c9cc09cbed | ||
|
|
bef90bf3b8 | ||
|
|
a369efa429 | ||
|
|
370329b07d | ||
|
|
e743a15fbc | ||
|
|
10c8b52092 | ||
|
|
1461b91a94 | ||
|
|
b5ffd5005a | ||
|
|
f06bd83dc3 | ||
|
|
a1450ee78a | ||
|
|
4c619778c3 | ||
|
|
4e8840cd93 | ||
|
|
0a709f741a | ||
|
|
ef8229981e | ||
|
|
2a5a2626a4 | ||
|
|
f4ddaedbf4 | ||
|
|
42104eb944 | ||
|
|
fadc8e6fd6 | ||
|
|
81747462b1 | ||
|
|
c01adad2a0 | ||
|
|
e598d60439 | ||
|
|
929cd23f35 | ||
|
|
d1aca5b675 | ||
|
|
b67868868d | ||
|
|
af3bf8448c | ||
|
|
4170c60f0c | ||
|
|
0a7a883aae | ||
|
|
88a1184877 | ||
|
|
c7329fcab5 | ||
|
|
6eb9a90a03 | ||
|
|
7586882a97 |
1
.gitignore
vendored
@@ -20,7 +20,6 @@
|
|||||||
/Assets/StreamingAssets.meta
|
/Assets/StreamingAssets.meta
|
||||||
/Assets/Samples
|
/Assets/Samples
|
||||||
/Assets/Samples.meta
|
/Assets/Samples.meta
|
||||||
/Packages
|
|
||||||
/UserSettings
|
/UserSettings
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,42 @@
|
|||||||
|
|
||||||
All notable changes to this package will be documented in this file.
|
All notable changes to this package will be documented in this file.
|
||||||
|
|
||||||
|
## [2.1.2] - 2024-05-16
|
||||||
|
|
||||||
|
SBP库依赖版本升级至2.1.3
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- (#236) 修复了资源配置界面AutoCollectShader复选框没有刷新的问题。
|
||||||
|
- (#244) 修复了导入器在安卓平台导入本地下载的资源失败的问题。
|
||||||
|
- (#268) 修复了挂起场景未解除状态前无法卸载的问题。
|
||||||
|
- (#269) 优化场景挂起流程,支持中途取消挂起操作。
|
||||||
|
- (#276) 修复了HostPlayMode模式下,如果内置清单是最新版本,每次运行都会触发拷贝行为。
|
||||||
|
- (#289) 修复了Unity2019版本脚本IWebRequester编译报错。
|
||||||
|
- (#295) 解决了在安卓移动平台,华为和三星真机上有极小概率加载资源包失败 : Unable to open archive file
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- 新增GetAllCacheFileInfosOperation()获取缓存文件信息的方法。
|
||||||
|
|
||||||
|
- 新增LoadSceneSync()同步加载场景的方法。
|
||||||
|
|
||||||
|
- 新增IIgnoreRule接口,资源收集流程可以自定义。
|
||||||
|
|
||||||
|
- 新增IWechatQueryServices接口,用于微信平台本地文件查询。
|
||||||
|
|
||||||
|
后续将会通过虚拟文件系统来支持!
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- 调整了UnloadSceneOperation代码里场景的卸载顺序。
|
||||||
|
|
||||||
|
### Improvements
|
||||||
|
|
||||||
|
- 优化了资源清单的解析过程。
|
||||||
|
- 移除资源包名里的空格字符。
|
||||||
|
- 支持华为鸿蒙系统。
|
||||||
|
|
||||||
## [2.1.1] - 2024-01-17
|
## [2.1.1] - 2024-01-17
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ namespace YooAsset.Editor
|
|||||||
public static class AssetBundleBuilderHelper
|
public static class AssetBundleBuilderHelper
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取默认的输出根路录
|
/// 获取默认的输出根目录
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string GetDefaultBuildOutputRoot()
|
public static string GetDefaultBuildOutputRoot()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ namespace YooAsset.Editor
|
|||||||
buildReport.Summary.EnableAddressable = buildMapContext.Command.EnableAddressable;
|
buildReport.Summary.EnableAddressable = buildMapContext.Command.EnableAddressable;
|
||||||
buildReport.Summary.LocationToLower = buildMapContext.Command.LocationToLower;
|
buildReport.Summary.LocationToLower = buildMapContext.Command.LocationToLower;
|
||||||
buildReport.Summary.IncludeAssetGUID = buildMapContext.Command.IncludeAssetGUID;
|
buildReport.Summary.IncludeAssetGUID = buildMapContext.Command.IncludeAssetGUID;
|
||||||
buildReport.Summary.IgnoreDefaultType = buildMapContext.Command.IgnoreDefaultType;
|
buildReport.Summary.IgnoreRuleName = buildMapContext.Command.IgnoreRule.GetType().FullName;
|
||||||
buildReport.Summary.AutoCollectShaders = buildMapContext.Command.AutoCollectShaders;
|
buildReport.Summary.AutoCollectShaders = buildMapContext.Command.AutoCollectShaders;
|
||||||
|
|
||||||
// 构建参数
|
// 构建参数
|
||||||
|
|||||||
@@ -8,8 +8,15 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
public BuildResult Run(BuildParameters buildParameters, bool enableLog)
|
public BuildResult Run(BuildParameters buildParameters, bool enableLog)
|
||||||
{
|
{
|
||||||
AssetBundleBuilder builder = new AssetBundleBuilder();
|
if (buildParameters is BuiltinBuildParameters)
|
||||||
return builder.Run(buildParameters, GetDefaultBuildPipeline(), enableLog);
|
{
|
||||||
|
AssetBundleBuilder builder = new AssetBundleBuilder();
|
||||||
|
return builder.Run(buildParameters, GetDefaultBuildPipeline(), enableLog);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new Exception($"Invalid build parameter type : {buildParameters.GetType().Name}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -11,8 +11,15 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
public BuildResult Run(BuildParameters buildParameters, bool enableLog)
|
public BuildResult Run(BuildParameters buildParameters, bool enableLog)
|
||||||
{
|
{
|
||||||
AssetBundleBuilder builder = new AssetBundleBuilder();
|
if (buildParameters is RawFileBuildParameters)
|
||||||
return builder.Run(buildParameters, GetDefaultBuildPipeline(), enableLog);
|
{
|
||||||
|
AssetBundleBuilder builder = new AssetBundleBuilder();
|
||||||
|
return builder.Run(buildParameters, GetDefaultBuildPipeline(), enableLog);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new Exception($"Invalid build parameter type : {buildParameters.GetType().Name}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace UnityEditor.Build.Pipeline.Tasks
|
|||||||
#endif
|
#endif
|
||||||
buildTasks.Add(new CalculateAssetDependencyData());
|
buildTasks.Add(new CalculateAssetDependencyData());
|
||||||
buildTasks.Add(new StripUnusedSpriteSources());
|
buildTasks.Add(new StripUnusedSpriteSources());
|
||||||
buildTasks.Add(new CreateBuiltInShadersBundle(builtInShaderBundleName));
|
buildTasks.Add(new CreateBuiltInBundle(builtInShaderBundleName));
|
||||||
buildTasks.Add(new PostDependencyCallback());
|
buildTasks.Add(new PostDependencyCallback());
|
||||||
|
|
||||||
// Packing
|
// Packing
|
||||||
|
|||||||
@@ -8,8 +8,15 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
public BuildResult Run(BuildParameters buildParameters, bool enableLog)
|
public BuildResult Run(BuildParameters buildParameters, bool enableLog)
|
||||||
{
|
{
|
||||||
AssetBundleBuilder builder = new AssetBundleBuilder();
|
if (buildParameters is ScriptableBuildParameters)
|
||||||
return builder.Run(buildParameters, GetDefaultBuildPipeline(), enableLog);
|
{
|
||||||
|
AssetBundleBuilder builder = new AssetBundleBuilder();
|
||||||
|
return builder.Run(buildParameters, GetDefaultBuildPipeline(), enableLog);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new Exception($"Invalid build parameter type : {buildParameters.GetType().Name}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#if UNITY_2019_4_OR_NEWER
|
#if UNITY_2019_4_OR_NEWER
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -18,7 +18,7 @@ namespace YooAsset.Editor
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ִ<EFBFBD>й<EFBFBD><EFBFBD><EFBFBD>
|
/// 执行构建
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected override void ExecuteBuild()
|
protected override void ExecuteBuild()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#if UNITY_2019_4_OR_NEWER
|
#if UNITY_2019_4_OR_NEWER
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -20,7 +20,7 @@ namespace YooAsset.Editor
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ִ<EFBFBD>й<EFBFBD><EFBFBD><EFBFBD>
|
/// 执行构建
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected override void ExecuteBuild()
|
protected override void ExecuteBuild()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ namespace YooAsset.Editor
|
|||||||
foreach (string assetPath in findAssets)
|
foreach (string assetPath in findAssets)
|
||||||
{
|
{
|
||||||
var assetInfo = new AssetInfo(assetPath);
|
var assetInfo = new AssetInfo(assetPath);
|
||||||
if (IsValidateAsset(command, assetInfo) && IsCollectAsset(group, assetInfo))
|
if (command.IgnoreRule.IsIgnore(assetInfo) == false && IsCollectAsset(group, assetInfo))
|
||||||
{
|
{
|
||||||
if (result.ContainsKey(assetPath) == false)
|
if (result.ContainsKey(assetPath) == false)
|
||||||
{
|
{
|
||||||
@@ -228,37 +228,6 @@ namespace YooAsset.Editor
|
|||||||
return collectAssetInfo;
|
return collectAssetInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool IsValidateAsset(CollectCommand command, AssetInfo assetInfo)
|
|
||||||
{
|
|
||||||
if (assetInfo.AssetPath.StartsWith("Assets/") == false && assetInfo.AssetPath.StartsWith("Packages/") == false)
|
|
||||||
{
|
|
||||||
UnityEngine.Debug.LogError($"Invalid asset path : {assetInfo.AssetPath}");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 忽略文件夹
|
|
||||||
if (AssetDatabase.IsValidFolder(assetInfo.AssetPath))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// 忽略编辑器下的类型资源
|
|
||||||
if (assetInfo.AssetType == typeof(LightingDataAsset))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// 忽略Unity引擎无法识别的文件
|
|
||||||
if (command.IgnoreDefaultType)
|
|
||||||
{
|
|
||||||
if (assetInfo.AssetType == typeof(UnityEditor.DefaultAsset))
|
|
||||||
{
|
|
||||||
UnityEngine.Debug.LogWarning($"Cannot pack default asset : {assetInfo.AssetPath}");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (DefaultFilterRule.IsIgnoreFile(assetInfo.FileExtension))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
private bool IsCollectAsset(AssetBundleCollectorGroup group, AssetInfo assetInfo)
|
private bool IsCollectAsset(AssetBundleCollectorGroup group, AssetInfo assetInfo)
|
||||||
{
|
{
|
||||||
// 根据规则设置过滤资源文件
|
// 根据规则设置过滤资源文件
|
||||||
@@ -312,7 +281,7 @@ namespace YooAsset.Editor
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
AssetInfo assetInfo = new AssetInfo(assetPath);
|
AssetInfo assetInfo = new AssetInfo(assetPath);
|
||||||
if (IsValidateAsset(command, assetInfo))
|
if (command.IgnoreRule.IsIgnore(assetInfo) == false)
|
||||||
result.Add(assetInfo);
|
result.Add(assetInfo);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
public class AssetBundleCollectorConfig
|
public class AssetBundleCollectorConfig
|
||||||
{
|
{
|
||||||
public const string ConfigVersion = "v2.0.0";
|
public const string ConfigVersion = "v2.1";
|
||||||
|
|
||||||
public const string XmlVersion = "Version";
|
public const string XmlVersion = "Version";
|
||||||
public const string XmlCommon = "Common";
|
public const string XmlCommon = "Common";
|
||||||
@@ -25,7 +25,7 @@ namespace YooAsset.Editor
|
|||||||
public const string XmlEnableAddressable = "AutoAddressable";
|
public const string XmlEnableAddressable = "AutoAddressable";
|
||||||
public const string XmlLocationToLower = "LocationToLower";
|
public const string XmlLocationToLower = "LocationToLower";
|
||||||
public const string XmlIncludeAssetGUID = "IncludeAssetGUID";
|
public const string XmlIncludeAssetGUID = "IncludeAssetGUID";
|
||||||
public const string XmlIgnoreDefaultType = "IgnoreDefaultType";
|
public const string XmlIgnoreRuleName = "IgnoreRuleName";
|
||||||
|
|
||||||
public const string XmlGroup = "Group";
|
public const string XmlGroup = "Group";
|
||||||
public const string XmlGroupActiveRule = "GroupActiveRule";
|
public const string XmlGroupActiveRule = "GroupActiveRule";
|
||||||
@@ -101,7 +101,7 @@ namespace YooAsset.Editor
|
|||||||
package.EnableAddressable = packageElement.GetAttribute(XmlEnableAddressable) == "True" ? true : false;
|
package.EnableAddressable = packageElement.GetAttribute(XmlEnableAddressable) == "True" ? true : false;
|
||||||
package.LocationToLower = packageElement.GetAttribute(XmlLocationToLower) == "True" ? true : false;
|
package.LocationToLower = packageElement.GetAttribute(XmlLocationToLower) == "True" ? true : false;
|
||||||
package.IncludeAssetGUID = packageElement.GetAttribute(XmlIncludeAssetGUID) == "True" ? true : false;
|
package.IncludeAssetGUID = packageElement.GetAttribute(XmlIncludeAssetGUID) == "True" ? true : false;
|
||||||
package.IgnoreDefaultType = packageElement.GetAttribute(XmlIgnoreDefaultType) == "True" ? true : false;
|
package.IgnoreRuleName = packageElement.GetAttribute(XmlIgnoreRuleName);
|
||||||
packages.Add(package);
|
packages.Add(package);
|
||||||
|
|
||||||
// 读取分组配置
|
// 读取分组配置
|
||||||
@@ -213,7 +213,7 @@ namespace YooAsset.Editor
|
|||||||
packageElement.SetAttribute(XmlEnableAddressable, package.EnableAddressable.ToString());
|
packageElement.SetAttribute(XmlEnableAddressable, package.EnableAddressable.ToString());
|
||||||
packageElement.SetAttribute(XmlLocationToLower, package.LocationToLower.ToString());
|
packageElement.SetAttribute(XmlLocationToLower, package.LocationToLower.ToString());
|
||||||
packageElement.SetAttribute(XmlIncludeAssetGUID, package.IncludeAssetGUID.ToString());
|
packageElement.SetAttribute(XmlIncludeAssetGUID, package.IncludeAssetGUID.ToString());
|
||||||
packageElement.SetAttribute(XmlIgnoreDefaultType, package.IgnoreDefaultType.ToString());
|
packageElement.SetAttribute(XmlIgnoreRuleName, package.IgnoreRuleName);
|
||||||
root.AppendChild(packageElement);
|
root.AppendChild(packageElement);
|
||||||
|
|
||||||
// 设置分组配置
|
// 设置分组配置
|
||||||
@@ -258,6 +258,23 @@ namespace YooAsset.Editor
|
|||||||
if (configVersion == ConfigVersion)
|
if (configVersion == ConfigVersion)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
// v2.0.0 -> v2.1
|
||||||
|
if (configVersion == "v2.0.0")
|
||||||
|
{
|
||||||
|
// 读取包裹配置
|
||||||
|
var packageNodeList = root.GetElementsByTagName(XmlPackage);
|
||||||
|
foreach (var packageNode in packageNodeList)
|
||||||
|
{
|
||||||
|
XmlElement packageElement = packageNode as XmlElement;
|
||||||
|
if (packageElement.HasAttribute(XmlIgnoreRuleName) == false)
|
||||||
|
packageElement.SetAttribute(XmlIgnoreRuleName, nameof(NormalIgnoreRule));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新版本
|
||||||
|
root.SetAttribute(XmlVersion, "v2.1");
|
||||||
|
return UpdateXmlConfig(xmlDoc);
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,16 +35,16 @@ namespace YooAsset.Editor
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IncludeAssetGUID = false;
|
public bool IncludeAssetGUID = false;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 忽略Unity引擎无法识别的文件
|
|
||||||
/// </summary>
|
|
||||||
public bool IgnoreDefaultType = true;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 自动收集所有着色器(所有着色器存储在一个资源包内)
|
/// 自动收集所有着色器(所有着色器存储在一个资源包内)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool AutoCollectShaders = true;
|
public bool AutoCollectShaders = true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 资源忽略规则名
|
||||||
|
/// </summary>
|
||||||
|
public string IgnoreRuleName = nameof(NormalIgnoreRule);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 分组列表
|
/// 分组列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -56,6 +56,16 @@ namespace YooAsset.Editor
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void CheckConfigError()
|
public void CheckConfigError()
|
||||||
{
|
{
|
||||||
|
if (string.IsNullOrEmpty(IgnoreRuleName))
|
||||||
|
{
|
||||||
|
throw new Exception($"{nameof(IgnoreRuleName)} is null or empty !");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (AssetBundleCollectorSettingData.HasIgnoreRuleName(IgnoreRuleName) == false)
|
||||||
|
throw new Exception($"Invalid {nameof(IIgnoreRule)} class type : {IgnoreRuleName} in package : {PackageName}");
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var group in Groups)
|
foreach (var group in Groups)
|
||||||
{
|
{
|
||||||
group.CheckConfigError();
|
group.CheckConfigError();
|
||||||
@@ -68,6 +78,14 @@ namespace YooAsset.Editor
|
|||||||
public bool FixConfigError()
|
public bool FixConfigError()
|
||||||
{
|
{
|
||||||
bool isFixed = false;
|
bool isFixed = false;
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(IgnoreRuleName))
|
||||||
|
{
|
||||||
|
Debug.LogWarning($"Set the {nameof(IgnoreRuleName)} to {nameof(NormalIgnoreRule)}");
|
||||||
|
IgnoreRuleName = nameof(NormalIgnoreRule);
|
||||||
|
isFixed = true;
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var group in Groups)
|
foreach (var group in Groups)
|
||||||
{
|
{
|
||||||
if (group.FixConfigError())
|
if (group.FixConfigError())
|
||||||
@@ -75,6 +93,7 @@ namespace YooAsset.Editor
|
|||||||
isFixed = true;
|
isFixed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return isFixed;
|
return isFixed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ namespace YooAsset.Editor
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool UniqueBundleName = false;
|
public bool UniqueBundleName = false;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 包裹列表
|
/// 包裹列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -100,13 +99,13 @@ namespace YooAsset.Editor
|
|||||||
package.CheckConfigError();
|
package.CheckConfigError();
|
||||||
|
|
||||||
// 创建资源收集命令
|
// 创建资源收集命令
|
||||||
|
IIgnoreRule ignoreRule = AssetBundleCollectorSettingData.GetIgnoreRuleInstance(package.IgnoreRuleName);
|
||||||
CollectCommand command = new CollectCommand(buildMode, packageName,
|
CollectCommand command = new CollectCommand(buildMode, packageName,
|
||||||
package.EnableAddressable,
|
package.EnableAddressable,
|
||||||
package.LocationToLower,
|
package.LocationToLower,
|
||||||
package.IncludeAssetGUID,
|
package.IncludeAssetGUID,
|
||||||
package.IgnoreDefaultType,
|
|
||||||
package.AutoCollectShaders,
|
package.AutoCollectShaders,
|
||||||
UniqueBundleName);
|
UniqueBundleName, ignoreRule);
|
||||||
|
|
||||||
// 获取收集的资源集合
|
// 获取收集的资源集合
|
||||||
CollectResult collectResult = new CollectResult(command);
|
CollectResult collectResult = new CollectResult(command);
|
||||||
|
|||||||
@@ -21,6 +21,9 @@ namespace YooAsset.Editor
|
|||||||
private static readonly Dictionary<string, System.Type> _cacheFilterRuleTypes = new Dictionary<string, System.Type>();
|
private static readonly Dictionary<string, System.Type> _cacheFilterRuleTypes = new Dictionary<string, System.Type>();
|
||||||
private static readonly Dictionary<string, IFilterRule> _cacheFilterRuleInstance = new Dictionary<string, IFilterRule>();
|
private static readonly Dictionary<string, IFilterRule> _cacheFilterRuleInstance = new Dictionary<string, IFilterRule>();
|
||||||
|
|
||||||
|
private static readonly Dictionary<string, System.Type> _cacheIgnoreRuleTypes = new Dictionary<string, System.Type>();
|
||||||
|
private static readonly Dictionary<string, IIgnoreRule> _cacheIgnoreRuleInstance = new Dictionary<string, IIgnoreRule>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 配置数据是否被修改
|
/// 配置数据是否被修改
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -129,6 +132,29 @@ namespace YooAsset.Editor
|
|||||||
_cacheActiveRuleTypes.Add(type.Name, type);
|
_cacheActiveRuleTypes.Add(type.Name, type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IIgnoreRule
|
||||||
|
{
|
||||||
|
// 清空缓存集合
|
||||||
|
_cacheIgnoreRuleTypes.Clear();
|
||||||
|
_cacheIgnoreRuleInstance.Clear();
|
||||||
|
|
||||||
|
// 获取所有类型
|
||||||
|
List<Type> types = new List<Type>(100)
|
||||||
|
{
|
||||||
|
typeof(NormalIgnoreRule),
|
||||||
|
typeof(RawFileIgnoreRule),
|
||||||
|
};
|
||||||
|
|
||||||
|
var customTypes = EditorTools.GetAssignableTypes(typeof(IIgnoreRule));
|
||||||
|
types.AddRange(customTypes);
|
||||||
|
for (int i = 0; i < types.Count; i++)
|
||||||
|
{
|
||||||
|
Type type = types[i];
|
||||||
|
if (_cacheIgnoreRuleTypes.ContainsKey(type.Name) == false)
|
||||||
|
_cacheIgnoreRuleTypes.Add(type.Name, type);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static AssetBundleCollectorSetting _setting = null;
|
private static AssetBundleCollectorSetting _setting = null;
|
||||||
@@ -165,6 +191,7 @@ namespace YooAsset.Editor
|
|||||||
if (isFixed)
|
if (isFixed)
|
||||||
{
|
{
|
||||||
IsDirty = true;
|
IsDirty = true;
|
||||||
|
Debug.Log("Fix package config error done !");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,6 +252,18 @@ namespace YooAsset.Editor
|
|||||||
}
|
}
|
||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
|
public static List<RuleDisplayName> GetIgnoreRuleNames()
|
||||||
|
{
|
||||||
|
List<RuleDisplayName> names = new List<RuleDisplayName>();
|
||||||
|
foreach (var pair in _cacheIgnoreRuleTypes)
|
||||||
|
{
|
||||||
|
RuleDisplayName ruleName = new RuleDisplayName();
|
||||||
|
ruleName.ClassName = pair.Key;
|
||||||
|
ruleName.DisplayName = GetRuleDisplayName(pair.Key, pair.Value);
|
||||||
|
names.Add(ruleName);
|
||||||
|
}
|
||||||
|
return names;
|
||||||
|
}
|
||||||
private static string GetRuleDisplayName(string name, Type type)
|
private static string GetRuleDisplayName(string name, Type type)
|
||||||
{
|
{
|
||||||
var attribute = DisplayNameAttributeHelper.GetAttribute<DisplayNameAttribute>(type);
|
var attribute = DisplayNameAttributeHelper.GetAttribute<DisplayNameAttribute>(type);
|
||||||
@@ -250,6 +289,10 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
return _cacheFilterRuleTypes.Keys.Contains(ruleName);
|
return _cacheFilterRuleTypes.Keys.Contains(ruleName);
|
||||||
}
|
}
|
||||||
|
public static bool HasIgnoreRuleName(string ruleName)
|
||||||
|
{
|
||||||
|
return _cacheIgnoreRuleTypes.Keys.Contains(ruleName);
|
||||||
|
}
|
||||||
|
|
||||||
public static IActiveRule GetActiveRuleInstance(string ruleName)
|
public static IActiveRule GetActiveRuleInstance(string ruleName)
|
||||||
{
|
{
|
||||||
@@ -319,6 +362,23 @@ namespace YooAsset.Editor
|
|||||||
throw new Exception($"{nameof(IFilterRule)} is invalid:{ruleName}");
|
throw new Exception($"{nameof(IFilterRule)} is invalid:{ruleName}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public static IIgnoreRule GetIgnoreRuleInstance(string ruleName)
|
||||||
|
{
|
||||||
|
if (_cacheIgnoreRuleInstance.TryGetValue(ruleName, out IIgnoreRule instance))
|
||||||
|
return instance;
|
||||||
|
|
||||||
|
// 如果不存在创建类的实例
|
||||||
|
if (_cacheIgnoreRuleTypes.TryGetValue(ruleName, out Type type))
|
||||||
|
{
|
||||||
|
instance = (IIgnoreRule)Activator.CreateInstance(type);
|
||||||
|
_cacheIgnoreRuleInstance.Add(ruleName, instance);
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new Exception($"{nameof(IIgnoreRule)} is invalid:{ruleName}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 公共参数编辑相关
|
// 公共参数编辑相关
|
||||||
public static void ModifyShowPackageView(bool showPackageView)
|
public static void ModifyShowPackageView(bool showPackageView)
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ namespace YooAsset.Editor
|
|||||||
private List<RuleDisplayName> _addressRuleList;
|
private List<RuleDisplayName> _addressRuleList;
|
||||||
private List<RuleDisplayName> _packRuleList;
|
private List<RuleDisplayName> _packRuleList;
|
||||||
private List<RuleDisplayName> _filterRuleList;
|
private List<RuleDisplayName> _filterRuleList;
|
||||||
|
private List<RuleDisplayName> _ignoreRuleList;
|
||||||
|
|
||||||
private VisualElement _helpBoxContainer;
|
private VisualElement _helpBoxContainer;
|
||||||
|
|
||||||
@@ -39,8 +40,8 @@ namespace YooAsset.Editor
|
|||||||
private Toggle _enableAddressableToogle;
|
private Toggle _enableAddressableToogle;
|
||||||
private Toggle _locationToLowerToogle;
|
private Toggle _locationToLowerToogle;
|
||||||
private Toggle _includeAssetGUIDToogle;
|
private Toggle _includeAssetGUIDToogle;
|
||||||
private Toggle _ignoreDefaultTypeToogle;
|
|
||||||
private Toggle _autoCollectShadersToogle;
|
private Toggle _autoCollectShadersToogle;
|
||||||
|
private PopupField<RuleDisplayName> _ignoreRulePopupField;
|
||||||
|
|
||||||
private VisualElement _packageContainer;
|
private VisualElement _packageContainer;
|
||||||
private ListView _packageListView;
|
private ListView _packageListView;
|
||||||
@@ -77,6 +78,7 @@ namespace YooAsset.Editor
|
|||||||
_addressRuleList = AssetBundleCollectorSettingData.GetAddressRuleNames();
|
_addressRuleList = AssetBundleCollectorSettingData.GetAddressRuleNames();
|
||||||
_packRuleList = AssetBundleCollectorSettingData.GetPackRuleNames();
|
_packRuleList = AssetBundleCollectorSettingData.GetPackRuleNames();
|
||||||
_filterRuleList = AssetBundleCollectorSettingData.GetFilterRuleNames();
|
_filterRuleList = AssetBundleCollectorSettingData.GetFilterRuleNames();
|
||||||
|
_ignoreRuleList = AssetBundleCollectorSettingData.GetIgnoreRuleNames();
|
||||||
|
|
||||||
VisualElement root = this.rootVisualElement;
|
VisualElement root = this.rootVisualElement;
|
||||||
|
|
||||||
@@ -151,17 +153,6 @@ namespace YooAsset.Editor
|
|||||||
RefreshWindow();
|
RefreshWindow();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
_ignoreDefaultTypeToogle = root.Q<Toggle>("IgnoreDefaultType");
|
|
||||||
_ignoreDefaultTypeToogle.RegisterValueChangedCallback(evt =>
|
|
||||||
{
|
|
||||||
var selectPackage = _packageListView.selectedItem as AssetBundleCollectorPackage;
|
|
||||||
if (selectPackage != null)
|
|
||||||
{
|
|
||||||
selectPackage.IgnoreDefaultType = evt.newValue;
|
|
||||||
AssetBundleCollectorSettingData.ModifyPackage(selectPackage);
|
|
||||||
RefreshWindow();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
_autoCollectShadersToogle = root.Q<Toggle>("AutoCollectShaders");
|
_autoCollectShadersToogle = root.Q<Toggle>("AutoCollectShaders");
|
||||||
_autoCollectShadersToogle.RegisterValueChangedCallback(evt =>
|
_autoCollectShadersToogle.RegisterValueChangedCallback(evt =>
|
||||||
{
|
{
|
||||||
@@ -173,6 +164,25 @@ namespace YooAsset.Editor
|
|||||||
RefreshWindow();
|
RefreshWindow();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
{
|
||||||
|
_ignoreRulePopupField = new PopupField<RuleDisplayName>(_ignoreRuleList, 0);
|
||||||
|
_ignoreRulePopupField.label = "File Ignore Rule";
|
||||||
|
_ignoreRulePopupField.name = "IgnoreRulePopupField";
|
||||||
|
_ignoreRulePopupField.style.unityTextAlign = TextAnchor.MiddleLeft;
|
||||||
|
_ignoreRulePopupField.style.width = 300;
|
||||||
|
_ignoreRulePopupField.formatListItemCallback = FormatListItemCallback;
|
||||||
|
_ignoreRulePopupField.formatSelectedValueCallback = FormatSelectedValueCallback;
|
||||||
|
_ignoreRulePopupField.RegisterValueChangedCallback(evt =>
|
||||||
|
{
|
||||||
|
var selectPackage = _packageListView.selectedItem as AssetBundleCollectorPackage;
|
||||||
|
if(selectPackage != null)
|
||||||
|
{
|
||||||
|
selectPackage.IgnoreRuleName = evt.newValue.ClassName;
|
||||||
|
AssetBundleCollectorSettingData.ModifyPackage(selectPackage);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
_setting2Container.Add(_ignoreRulePopupField);
|
||||||
|
}
|
||||||
|
|
||||||
// 配置修复按钮
|
// 配置修复按钮
|
||||||
var fixBtn = root.Q<Button>("FixButton");
|
var fixBtn = root.Q<Button>("FixButton");
|
||||||
@@ -475,7 +485,8 @@ namespace YooAsset.Editor
|
|||||||
_enableAddressableToogle.SetValueWithoutNotify(selectPackage.EnableAddressable);
|
_enableAddressableToogle.SetValueWithoutNotify(selectPackage.EnableAddressable);
|
||||||
_locationToLowerToogle.SetValueWithoutNotify(selectPackage.LocationToLower);
|
_locationToLowerToogle.SetValueWithoutNotify(selectPackage.LocationToLower);
|
||||||
_includeAssetGUIDToogle.SetValueWithoutNotify(selectPackage.IncludeAssetGUID);
|
_includeAssetGUIDToogle.SetValueWithoutNotify(selectPackage.IncludeAssetGUID);
|
||||||
_ignoreDefaultTypeToogle.SetValueWithoutNotify(selectPackage.IgnoreDefaultType);
|
_autoCollectShadersToogle.SetValueWithoutNotify(selectPackage.AutoCollectShaders);
|
||||||
|
_ignoreRulePopupField.SetValueWithoutNotify(GetIgnoreRuleIndex(selectPackage.IgnoreRuleName));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -969,7 +980,7 @@ namespace YooAsset.Editor
|
|||||||
|
|
||||||
if (collector.IsValid() == false)
|
if (collector.IsValid() == false)
|
||||||
{
|
{
|
||||||
Debug.LogWarning($"The collector is invalid : {collector.CollectPath} in group : {group.GroupName}");
|
collector.CheckConfigError();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -979,14 +990,15 @@ namespace YooAsset.Editor
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
IIgnoreRule ignoreRule = AssetBundleCollectorSettingData.GetIgnoreRuleInstance(_ignoreRulePopupField.value.ClassName);
|
||||||
CollectCommand command = new CollectCommand(EBuildMode.SimulateBuild,
|
CollectCommand command = new CollectCommand(EBuildMode.SimulateBuild,
|
||||||
_packageNameTxt.value,
|
_packageNameTxt.value,
|
||||||
_enableAddressableToogle.value,
|
_enableAddressableToogle.value,
|
||||||
_locationToLowerToogle.value,
|
_locationToLowerToogle.value,
|
||||||
_includeAssetGUIDToogle.value,
|
_includeAssetGUIDToogle.value,
|
||||||
_ignoreDefaultTypeToogle.value,
|
|
||||||
_autoCollectShadersToogle.value,
|
_autoCollectShadersToogle.value,
|
||||||
_uniqueBundleNameToogle.value);
|
_uniqueBundleNameToogle.value,
|
||||||
|
ignoreRule);
|
||||||
collector.CheckConfigError();
|
collector.CheckConfigError();
|
||||||
collectAssetInfos = collector.GetAllCollectAssets(command, group);
|
collectAssetInfos = collector.GetAllCollectAssets(command, group);
|
||||||
}
|
}
|
||||||
@@ -1077,6 +1089,15 @@ namespace YooAsset.Editor
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
private RuleDisplayName GetIgnoreRuleIndex(string ruleName)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _ignoreRuleList.Count; i++)
|
||||||
|
{
|
||||||
|
if (_ignoreRuleList[i].ClassName == ruleName)
|
||||||
|
return _ignoreRuleList[i];
|
||||||
|
}
|
||||||
|
return _ignoreRuleList[0];
|
||||||
|
}
|
||||||
private RuleDisplayName GetActiveRuleIndex(string ruleName)
|
private RuleDisplayName GetActiveRuleIndex(string ruleName)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _activeRuleList.Count; i++)
|
for (int i = 0; i < _activeRuleList.Count; i++)
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
<ui:Toggle label="Enable Addressable" name="EnableAddressable" style="width: 196px; -unity-text-align: middle-left;" />
|
<ui:Toggle label="Enable Addressable" name="EnableAddressable" style="width: 196px; -unity-text-align: middle-left;" />
|
||||||
<ui:Toggle label="Location To Lower" name="LocationToLower" style="width: 196px; -unity-text-align: middle-left;" />
|
<ui:Toggle label="Location To Lower" name="LocationToLower" style="width: 196px; -unity-text-align: middle-left;" />
|
||||||
<ui:Toggle label="Include Asset GUID" name="IncludeAssetGUID" style="width: 196px; -unity-text-align: middle-left;" />
|
<ui:Toggle label="Include Asset GUID" name="IncludeAssetGUID" style="width: 196px; -unity-text-align: middle-left;" />
|
||||||
<ui:Toggle label="Ignore Default Type" name="IgnoreDefaultType" style="width: 196px; -unity-text-align: middle-left;" />
|
|
||||||
<ui:Toggle label="Auto Collect Shaders" name="AutoCollectShaders" value="true" style="width: 196px; -unity-text-align: middle-left;" />
|
<ui:Toggle label="Auto Collect Shaders" name="AutoCollectShaders" value="true" style="width: 196px; -unity-text-align: middle-left;" />
|
||||||
</ui:VisualElement>
|
</ui:VisualElement>
|
||||||
</ui:VisualElement>
|
</ui:VisualElement>
|
||||||
|
|||||||
@@ -13,11 +13,6 @@ namespace YooAsset.Editor
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string PackageName { private set; get; }
|
public string PackageName { private set; get; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 忽略Unity引擎无法识别的文件
|
|
||||||
/// </summary>
|
|
||||||
public bool IgnoreDefaultType { private set; get; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 启用可寻址资源定位
|
/// 启用可寻址资源定位
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -48,17 +43,24 @@ namespace YooAsset.Editor
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string ShadersBundleName { private set; get; }
|
public string ShadersBundleName { private set; get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 忽略规则实例
|
||||||
|
/// </summary>
|
||||||
|
public IIgnoreRule IgnoreRule { private set; get; }
|
||||||
|
|
||||||
public CollectCommand(EBuildMode buildMode, string packageName, bool enableAddressable, bool locationToLower, bool includeAssetGUID, bool ignoreDefaultType, bool autoCollectShaders, bool uniqueBundleName)
|
|
||||||
|
public CollectCommand(EBuildMode buildMode, string packageName,
|
||||||
|
bool enableAddressable, bool locationToLower, bool includeAssetGUID,
|
||||||
|
bool autoCollectShaders, bool uniqueBundleName, IIgnoreRule ignoreRule)
|
||||||
{
|
{
|
||||||
BuildMode = buildMode;
|
BuildMode = buildMode;
|
||||||
PackageName = packageName;
|
PackageName = packageName;
|
||||||
EnableAddressable = enableAddressable;
|
EnableAddressable = enableAddressable;
|
||||||
LocationToLower = locationToLower;
|
LocationToLower = locationToLower;
|
||||||
IncludeAssetGUID = includeAssetGUID;
|
IncludeAssetGUID = includeAssetGUID;
|
||||||
IgnoreDefaultType = ignoreDefaultType;
|
|
||||||
AutoCollectShaders = autoCollectShaders;
|
AutoCollectShaders = autoCollectShaders;
|
||||||
UniqueBundleName = uniqueBundleName;
|
UniqueBundleName = uniqueBundleName;
|
||||||
|
IgnoreRule = ignoreRule;
|
||||||
|
|
||||||
// 着色器统一全名称
|
// 着色器统一全名称
|
||||||
var packRuleResult = DefaultPackRule.CreateShadersPackRuleResult();
|
var packRuleResult = DefaultPackRule.CreateShadersPackRuleResult();
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
namespace YooAsset.Editor
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 资源忽略规则接口
|
||||||
|
/// </summary>
|
||||||
|
public interface IIgnoreRule
|
||||||
|
{
|
||||||
|
bool IsIgnore(AssetInfo assetInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: bd55753dbb880fa449bf4e37b33d8ba7
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -42,7 +42,7 @@ namespace YooAsset.Editor
|
|||||||
public string GetBundleName(string packageName, bool uniqueBundleName)
|
public string GetBundleName(string packageName, bool uniqueBundleName)
|
||||||
{
|
{
|
||||||
string fullName;
|
string fullName;
|
||||||
string bundleName = EditorTools.GetRegularPath(_bundleName).Replace('/', '_').Replace('.', '_').ToLower();
|
string bundleName = EditorTools.GetRegularPath(_bundleName).Replace('/', '_').Replace('.', '_').Replace(" ", "_").ToLower();
|
||||||
if (uniqueBundleName)
|
if (uniqueBundleName)
|
||||||
fullName = $"{packageName}_{bundleName}.{_bundleExtension}";
|
fullName = $"{packageName}_{bundleName}.{_bundleExtension}";
|
||||||
else
|
else
|
||||||
@@ -56,7 +56,7 @@ namespace YooAsset.Editor
|
|||||||
public string GetShareBundleName(string packageName, bool uniqueBundleName)
|
public string GetShareBundleName(string packageName, bool uniqueBundleName)
|
||||||
{
|
{
|
||||||
string fullName;
|
string fullName;
|
||||||
string bundleName = EditorTools.GetRegularPath(_bundleName).Replace('/', '_').Replace('.', '_').ToLower();
|
string bundleName = EditorTools.GetRegularPath(_bundleName).Replace('/', '_').Replace('.', '_').Replace(" ", "_").ToLower();
|
||||||
if (uniqueBundleName)
|
if (uniqueBundleName)
|
||||||
fullName = $"{packageName}_share_{bundleName}.{_bundleExtension}";
|
fullName = $"{packageName}_share_{bundleName}.{_bundleExtension}";
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -6,22 +6,6 @@ using UnityEditor;
|
|||||||
|
|
||||||
namespace YooAsset.Editor
|
namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
public class DefaultFilterRule
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 忽略的文件类型
|
|
||||||
/// </summary>
|
|
||||||
private readonly static HashSet<string> _ignoreFileExtensions = new HashSet<string>() { "", ".so", ".dll", ".cs", ".js", ".boo", ".meta", ".cginc", ".hlsl" };
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查询是否为忽略文件
|
|
||||||
/// </summary>
|
|
||||||
public static bool IsIgnoreFile(string fileExtension)
|
|
||||||
{
|
|
||||||
return _ignoreFileExtensions.Contains(fileExtension);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[DisplayName("收集所有资源")]
|
[DisplayName("收集所有资源")]
|
||||||
public class CollectAll : IFilterRule
|
public class CollectAll : IFilterRule
|
||||||
{
|
{
|
||||||
@@ -70,6 +54,15 @@ namespace YooAsset.Editor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[DisplayName("收集着色器")]
|
||||||
|
public class CollectShader : IFilterRule
|
||||||
|
{
|
||||||
|
public bool IsCollectAsset(FilterRuleData data)
|
||||||
|
{
|
||||||
|
return Path.GetExtension(data.AssetPath) == ".shader";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[DisplayName("收集着色器变种集合")]
|
[DisplayName("收集着色器变种集合")]
|
||||||
public class CollectShaderVariants : IFilterRule
|
public class CollectShaderVariants : IFilterRule
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,82 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEditor;
|
||||||
|
|
||||||
|
namespace YooAsset.Editor
|
||||||
|
{
|
||||||
|
public class DefaultIgnoreRule
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 忽略的文件类型
|
||||||
|
/// </summary>
|
||||||
|
public readonly static HashSet<string> IgnoreFileExtensions = new HashSet<string>() { "", ".so", ".dll", ".cs", ".js", ".boo", ".meta", ".cginc", ".hlsl" };
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 适配常规的资源构建管线
|
||||||
|
/// </summary>
|
||||||
|
public class NormalIgnoreRule : IIgnoreRule
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 查询是否为忽略文件
|
||||||
|
/// </summary>
|
||||||
|
public bool IsIgnore(AssetInfo assetInfo)
|
||||||
|
{
|
||||||
|
if (assetInfo.AssetPath.StartsWith("Assets/") == false && assetInfo.AssetPath.StartsWith("Packages/") == false)
|
||||||
|
{
|
||||||
|
UnityEngine.Debug.LogError($"Invalid asset path : {assetInfo.AssetPath}");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 忽略文件夹
|
||||||
|
if (AssetDatabase.IsValidFolder(assetInfo.AssetPath))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// 忽略编辑器下的类型资源
|
||||||
|
if (assetInfo.AssetType == typeof(LightingDataAsset))
|
||||||
|
return true;
|
||||||
|
if (assetInfo.AssetType == typeof(LightmapParameters))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// 忽略Unity引擎无法识别的文件
|
||||||
|
if (assetInfo.AssetType == typeof(UnityEditor.DefaultAsset))
|
||||||
|
{
|
||||||
|
UnityEngine.Debug.LogWarning($"Cannot pack default asset : {assetInfo.AssetPath}");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return DefaultIgnoreRule.IgnoreFileExtensions.Contains(assetInfo.FileExtension);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 适配原生文件构建管线
|
||||||
|
/// </summary>
|
||||||
|
public class RawFileIgnoreRule : IIgnoreRule
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 查询是否为忽略文件
|
||||||
|
/// </summary>
|
||||||
|
public bool IsIgnore(AssetInfo assetInfo)
|
||||||
|
{
|
||||||
|
if (assetInfo.AssetPath.StartsWith("Assets/") == false && assetInfo.AssetPath.StartsWith("Packages/") == false)
|
||||||
|
{
|
||||||
|
UnityEngine.Debug.LogError($"Invalid asset path : {assetInfo.AssetPath}");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 忽略文件夹
|
||||||
|
if (AssetDatabase.IsValidFolder(assetInfo.AssetPath))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// 忽略编辑器下的类型资源
|
||||||
|
if (assetInfo.AssetType == typeof(LightingDataAsset))
|
||||||
|
return true;
|
||||||
|
if (assetInfo.AssetType == typeof(LightmapParameters))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return DefaultIgnoreRule.IgnoreFileExtensions.Contains(assetInfo.FileExtension);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b9c1900577194bb4ab49ce4332ccc4bc
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -147,6 +147,18 @@ namespace YooAsset.Editor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 打包着色器
|
||||||
|
/// </summary>
|
||||||
|
[DisplayName("打包着色器文件")]
|
||||||
|
public class PackShader : IPackRule
|
||||||
|
{
|
||||||
|
public PackRuleResult GetPackRuleResult(PackRuleData data)
|
||||||
|
{
|
||||||
|
return DefaultPackRule.CreateShadersPackRuleResult();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 打包着色器变种集合
|
/// 打包着色器变种集合
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -58,8 +58,8 @@ namespace YooAsset.Editor
|
|||||||
public bool EnableAddressable;
|
public bool EnableAddressable;
|
||||||
public bool LocationToLower;
|
public bool LocationToLower;
|
||||||
public bool IncludeAssetGUID;
|
public bool IncludeAssetGUID;
|
||||||
public bool IgnoreDefaultType;
|
|
||||||
public bool AutoCollectShaders;
|
public bool AutoCollectShaders;
|
||||||
|
public string IgnoreRuleName;
|
||||||
|
|
||||||
// 构建参数
|
// 构建参数
|
||||||
public bool EnableSharePackRule;
|
public bool EnableSharePackRule;
|
||||||
|
|||||||
@@ -72,8 +72,8 @@ namespace YooAsset.Editor
|
|||||||
_items.Add(new ItemWrapper("Enable Addressable", $"{buildReport.Summary.EnableAddressable}"));
|
_items.Add(new ItemWrapper("Enable Addressable", $"{buildReport.Summary.EnableAddressable}"));
|
||||||
_items.Add(new ItemWrapper("Location To Lower", $"{buildReport.Summary.LocationToLower}"));
|
_items.Add(new ItemWrapper("Location To Lower", $"{buildReport.Summary.LocationToLower}"));
|
||||||
_items.Add(new ItemWrapper("Include Asset GUID", $"{buildReport.Summary.IncludeAssetGUID}"));
|
_items.Add(new ItemWrapper("Include Asset GUID", $"{buildReport.Summary.IncludeAssetGUID}"));
|
||||||
_items.Add(new ItemWrapper("Ignore Default Type", $"{buildReport.Summary.IgnoreDefaultType}"));
|
|
||||||
_items.Add(new ItemWrapper("Auto Collect Shaders", $"{buildReport.Summary.AutoCollectShaders}"));
|
_items.Add(new ItemWrapper("Auto Collect Shaders", $"{buildReport.Summary.AutoCollectShaders}"));
|
||||||
|
_items.Add(new ItemWrapper("Ignore Rule Name", $"{buildReport.Summary.IgnoreRuleName}"));
|
||||||
|
|
||||||
_items.Add(new ItemWrapper(string.Empty, string.Empty));
|
_items.Add(new ItemWrapper(string.Empty, string.Empty));
|
||||||
_items.Add(new ItemWrapper("Build Params", string.Empty));
|
_items.Add(new ItemWrapper("Build Params", string.Empty));
|
||||||
|
|||||||
@@ -496,14 +496,6 @@ namespace YooAsset.Editor
|
|||||||
return fileInfo.Length;
|
return fileInfo.Length;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 获取文件的哈希值
|
|
||||||
/// </summary>
|
|
||||||
public static string GetFileCRC32(string filePath)
|
|
||||||
{
|
|
||||||
return HashUtility.FileCRC32(filePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 读取文件的所有文本内容
|
/// 读取文件的所有文本内容
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -1,36 +1,19 @@
|
|||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
|
|
||||||
namespace YooAsset
|
namespace YooAsset
|
||||||
{
|
{
|
||||||
internal class CacheFileInfo
|
public class CacheFileInfo
|
||||||
{
|
{
|
||||||
private static readonly BufferWriter SharedBuffer = new BufferWriter(1024);
|
public string RemoteFileName { private set; get; }
|
||||||
|
public string FilePath { private set; get; }
|
||||||
|
public string FileCRC { private set; get; }
|
||||||
|
public long FileSize { private set; get; }
|
||||||
|
|
||||||
/// <summary>
|
public CacheFileInfo(string remoteFileName, string filePath, string fileCRC, long fileSize)
|
||||||
/// 写入资源包信息
|
|
||||||
/// </summary>
|
|
||||||
public static void WriteInfoToFile(string filePath, string dataFileCRC, long dataFileSize)
|
|
||||||
{
|
{
|
||||||
using (FileStream fs = new FileStream(filePath, FileMode.Create, FileAccess.Write, FileShare.Read))
|
RemoteFileName = remoteFileName;
|
||||||
{
|
FilePath = filePath;
|
||||||
SharedBuffer.Clear();
|
FileCRC = fileCRC;
|
||||||
SharedBuffer.WriteUTF8(dataFileCRC);
|
FileSize = fileSize;
|
||||||
SharedBuffer.WriteInt64(dataFileSize);
|
|
||||||
SharedBuffer.WriteToStream(fs);
|
|
||||||
fs.Flush();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 读取资源包信息
|
|
||||||
/// </summary>
|
|
||||||
public static void ReadInfoFromFile(string filePath, out string dataFileCRC, out long dataFileSize)
|
|
||||||
{
|
|
||||||
byte[] binaryData = FileUtility.ReadAllBytes(filePath);
|
|
||||||
BufferReader buffer = new BufferReader(binaryData);
|
|
||||||
dataFileCRC = buffer.ReadUTF8();
|
|
||||||
dataFileSize = buffer.ReadInt64();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Diagnostics;
|
|
||||||
|
|
||||||
namespace YooAsset
|
namespace YooAsset
|
||||||
{
|
{
|
||||||
@@ -13,6 +10,37 @@ namespace YooAsset
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static bool DisableUnityCacheOnWebGL = false;
|
public static bool DisableUnityCacheOnWebGL = false;
|
||||||
|
|
||||||
|
#region 资源信息文件相关
|
||||||
|
private static readonly BufferWriter SharedBuffer = new BufferWriter(1024);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 写入资源包信息
|
||||||
|
/// </summary>
|
||||||
|
public static void WriteInfoToFile(string filePath, string dataFileCRC, long dataFileSize)
|
||||||
|
{
|
||||||
|
using (FileStream fs = new FileStream(filePath, FileMode.Create, FileAccess.Write, FileShare.Read))
|
||||||
|
{
|
||||||
|
SharedBuffer.Clear();
|
||||||
|
SharedBuffer.WriteUTF8(dataFileCRC);
|
||||||
|
SharedBuffer.WriteInt64(dataFileSize);
|
||||||
|
SharedBuffer.WriteToStream(fs);
|
||||||
|
fs.Flush();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 读取资源包信息
|
||||||
|
/// </summary>
|
||||||
|
public static void ReadInfoFromFile(string filePath, out string dataFileCRC, out long dataFileSize)
|
||||||
|
{
|
||||||
|
byte[] binaryData = FileUtility.ReadAllBytes(filePath);
|
||||||
|
BufferReader buffer = new BufferReader(binaryData);
|
||||||
|
dataFileCRC = buffer.ReadUTF8();
|
||||||
|
dataFileSize = buffer.ReadInt64();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 资源文件验证相关
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 验证缓存文件(子线程内操作)
|
/// 验证缓存文件(子线程内操作)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -34,7 +62,7 @@ namespace YooAsset
|
|||||||
return EVerifyResult.InfoFileNotExisted;
|
return EVerifyResult.InfoFileNotExisted;
|
||||||
|
|
||||||
// 解析信息文件获取验证数据
|
// 解析信息文件获取验证数据
|
||||||
CacheFileInfo.ReadInfoFromFile(element.InfoFilePath, out element.DataFileCRC, out element.DataFileSize);
|
CacheHelper.ReadInfoFromFile(element.InfoFilePath, out element.DataFileCRC, out element.DataFileSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
@@ -83,7 +111,7 @@ namespace YooAsset
|
|||||||
// 再验证文件CRC
|
// 再验证文件CRC
|
||||||
if (verifyLevel == EVerifyLevel.High)
|
if (verifyLevel == EVerifyLevel.High)
|
||||||
{
|
{
|
||||||
string crc = HashUtility.FileCRC32(filePath);
|
string crc = HashUtility.FileCRC32Safely(filePath);
|
||||||
if (crc == fileCRC)
|
if (crc == fileCRC)
|
||||||
return EVerifyResult.Succeed;
|
return EVerifyResult.Succeed;
|
||||||
else
|
else
|
||||||
@@ -99,5 +127,6 @@ namespace YooAsset
|
|||||||
return EVerifyResult.Exception;
|
return EVerifyResult.Exception;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,99 @@
|
|||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace YooAsset
|
||||||
|
{
|
||||||
|
public class GetAllCacheFileInfosOperation : AsyncOperationBase
|
||||||
|
{
|
||||||
|
private enum ESteps
|
||||||
|
{
|
||||||
|
None,
|
||||||
|
TryLoadCacheManifest,
|
||||||
|
GetCacheFileInfos,
|
||||||
|
Done,
|
||||||
|
}
|
||||||
|
|
||||||
|
private readonly PersistentManager _persistent;
|
||||||
|
private readonly CacheManager _cache;
|
||||||
|
private readonly string _packageVersion;
|
||||||
|
private LoadCacheManifestOperation _tryLoadCacheManifestOp;
|
||||||
|
private PackageManifest _manifest;
|
||||||
|
private ESteps _steps = ESteps.None;
|
||||||
|
|
||||||
|
private List<CacheFileInfo> _cacheFileInfos;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 搜索结果
|
||||||
|
/// </summary>
|
||||||
|
public List<CacheFileInfo> Result
|
||||||
|
{
|
||||||
|
get { return _cacheFileInfos; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
internal GetAllCacheFileInfosOperation(PersistentManager persistent, CacheManager cache, string packageVersion)
|
||||||
|
{
|
||||||
|
_persistent = persistent;
|
||||||
|
_cache = cache;
|
||||||
|
_packageVersion = packageVersion;
|
||||||
|
}
|
||||||
|
internal override void InternalOnStart()
|
||||||
|
{
|
||||||
|
_steps = ESteps.TryLoadCacheManifest;
|
||||||
|
}
|
||||||
|
internal override void InternalOnUpdate()
|
||||||
|
{
|
||||||
|
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (_steps == ESteps.TryLoadCacheManifest)
|
||||||
|
{
|
||||||
|
if (_tryLoadCacheManifestOp == null)
|
||||||
|
{
|
||||||
|
_tryLoadCacheManifestOp = new LoadCacheManifestOperation(_persistent, _packageVersion);
|
||||||
|
OperationSystem.StartOperation(_cache.PackageName, _tryLoadCacheManifestOp);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_tryLoadCacheManifestOp.IsDone == false)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (_tryLoadCacheManifestOp.Status == EOperationStatus.Succeed)
|
||||||
|
{
|
||||||
|
_manifest = _tryLoadCacheManifestOp.Manifest;
|
||||||
|
_steps = ESteps.GetCacheFileInfos;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_steps = ESteps.Done;
|
||||||
|
Status = EOperationStatus.Failed;
|
||||||
|
Error = _tryLoadCacheManifestOp.Error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_steps == ESteps.GetCacheFileInfos)
|
||||||
|
{
|
||||||
|
var allCachedGUIDs = _cache.GetAllCachedGUIDs();
|
||||||
|
_cacheFileInfos = new List<CacheFileInfo>(allCachedGUIDs.Count);
|
||||||
|
for (int i = 0; i < allCachedGUIDs.Count; i++)
|
||||||
|
{
|
||||||
|
var cachedGUID = allCachedGUIDs[i];
|
||||||
|
var wrapper = _cache.TryGetWrapper(cachedGUID);
|
||||||
|
if (wrapper != null)
|
||||||
|
{
|
||||||
|
if (_manifest.TryGetPackageBundleByCacheGUID(cachedGUID, out var packageBundle))
|
||||||
|
{
|
||||||
|
var cacheFileInfo = new CacheFileInfo(packageBundle.FileName, wrapper.DataFilePath, wrapper.DataFileCRC, wrapper.DataFileSize);
|
||||||
|
_cacheFileInfos.Add(cacheFileInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 注意:总是返回成功
|
||||||
|
_steps = ESteps.Done;
|
||||||
|
Status = EOperationStatus.Succeed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d37e37f5d78ddf8468adcf2dff1edfbb
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -15,11 +15,16 @@ namespace YooAsset
|
|||||||
#elif UNITY_IPHONE
|
#elif UNITY_IPHONE
|
||||||
return StringUtility.Format("file://{0}", path);
|
return StringUtility.Format("file://{0}", path);
|
||||||
#elif UNITY_ANDROID
|
#elif UNITY_ANDROID
|
||||||
return path;
|
if (path.StartsWith("jar:file://"))
|
||||||
|
return path;
|
||||||
|
else
|
||||||
|
return StringUtility.Format("jar:file://{0}", path);
|
||||||
#elif UNITY_STANDALONE_OSX
|
#elif UNITY_STANDALONE_OSX
|
||||||
return new System.Uri(path).ToString();
|
return new System.Uri(path).ToString();
|
||||||
#elif UNITY_STANDALONE
|
#elif UNITY_STANDALONE
|
||||||
return StringUtility.Format("file:///{0}", path);
|
return StringUtility.Format("file:///{0}", path);
|
||||||
|
#elif UNITY_OPENHARMONY
|
||||||
|
return path;
|
||||||
#else
|
#else
|
||||||
return path;
|
return path;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -58,7 +58,12 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
private static string CreateDefaultBuildinRoot()
|
private static string CreateDefaultBuildinRoot()
|
||||||
{
|
{
|
||||||
return PathUtility.Combine(UnityEngine.Application.streamingAssetsPath, YooAssetSettingsData.Setting.DefaultYooFolderName);
|
string path = PathUtility.Combine(UnityEngine.Application.streamingAssetsPath, YooAssetSettingsData.Setting.DefaultYooFolderName);
|
||||||
|
#if UNITY_OPENHARMONY
|
||||||
|
return $"file://{path}";
|
||||||
|
#else
|
||||||
|
return path;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
private static string CreateDefaultSandboxRoot()
|
private static string CreateDefaultSandboxRoot()
|
||||||
{
|
{
|
||||||
@@ -176,6 +181,7 @@ namespace YooAsset
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void SaveSandboxPackageVersionFile(string version)
|
public void SaveSandboxPackageVersionFile(string version)
|
||||||
{
|
{
|
||||||
|
YooLogger.Log($"Save package version : {version}");
|
||||||
string filePath = GetSandboxPackageVersionFilePath();
|
string filePath = GetSandboxPackageVersionFilePath();
|
||||||
FileUtility.WriteAllText(filePath, version);
|
FileUtility.WriteAllText(filePath, version);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ namespace YooAsset
|
|||||||
fileInfo.MoveTo(dataFilePath);
|
fileInfo.MoveTo(dataFilePath);
|
||||||
|
|
||||||
// 写入信息文件记录验证数据
|
// 写入信息文件记录验证数据
|
||||||
CacheFileInfo.WriteInfoToFile(infoFilePath, dataFileCRC, dataFileSize);
|
CacheHelper.WriteInfoToFile(infoFilePath, dataFileCRC, dataFileSize);
|
||||||
|
|
||||||
// 记录缓存文件
|
// 记录缓存文件
|
||||||
_bundleInfo.CacheRecord();
|
_bundleInfo.CacheRecord();
|
||||||
|
|||||||
@@ -99,7 +99,8 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
if (_webRequest != null)
|
if (_webRequest != null)
|
||||||
{
|
{
|
||||||
_webRequest.Dispose(); //注意:引擎底层会自动调用Abort方法
|
//注意:引擎底层会自动调用Abort方法
|
||||||
|
_webRequest.Dispose();
|
||||||
_webRequest = null;
|
_webRequest = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -142,6 +142,7 @@ namespace YooAsset
|
|||||||
|
|
||||||
if (_webRequest != null)
|
if (_webRequest != null)
|
||||||
{
|
{
|
||||||
|
//注意:引擎底层会自动调用Abort方法
|
||||||
_webRequest.Dispose();
|
_webRequest.Dispose();
|
||||||
_webRequest = null;
|
_webRequest = null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,52 +14,52 @@ namespace YooAsset
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 任务状态
|
/// 任务状态
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ERequestStatus Status { get; }
|
ERequestStatus Status { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 下载进度(0f~1f)
|
/// 下载进度(0f~1f)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float DownloadProgress { get; }
|
float DownloadProgress { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 已经下载的总字节数
|
/// 已经下载的总字节数
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ulong DownloadedBytes { get; }
|
ulong DownloadedBytes { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 返回的网络错误
|
/// 返回的网络错误
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string RequestNetError { get; }
|
string RequestNetError { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 返回的HTTP CODE
|
/// 返回的HTTP CODE
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public long RequestHttpCode { get; }
|
long RequestHttpCode { get; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 创建任务
|
/// 创建任务
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Create(string url, BundleInfo bundleInfo, params object[] args);
|
void Create(string url, BundleInfo bundleInfo, params object[] args);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 更新任务
|
/// 更新任务
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Update();
|
void Update();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 终止任务
|
/// 终止任务
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Abort();
|
void Abort();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否已经完成(无论成功或失败)
|
/// 是否已经完成(无论成功或失败)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsDone();
|
bool IsDone();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取请求的对象
|
/// 获取请求的对象
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public object GetRequestObject();
|
object GetRequestObject();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -150,5 +150,10 @@ namespace YooAsset
|
|||||||
/// 内置资源查询服务接口
|
/// 内置资源查询服务接口
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IBuildinQueryServices BuildinQueryServices = null;
|
public IBuildinQueryServices BuildinQueryServices = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 微信缓存查询服务接口
|
||||||
|
/// </summary>
|
||||||
|
public IWechatQueryServices WechatQueryServices = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -37,6 +37,16 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 等待异步执行完毕
|
||||||
|
/// </summary>
|
||||||
|
internal void WaitForAsyncComplete()
|
||||||
|
{
|
||||||
|
if (IsValidWithWarning == false)
|
||||||
|
return;
|
||||||
|
Provider.WaitForAsyncComplete();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 场景名称
|
/// 场景名称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -90,28 +100,21 @@ namespace YooAsset
|
|||||||
if (IsValidWithWarning == false)
|
if (IsValidWithWarning == false)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (SceneObject.IsValid())
|
if (Provider is DatabaseSceneProvider)
|
||||||
{
|
{
|
||||||
if (Provider is DatabaseSceneProvider)
|
var provider = Provider as DatabaseSceneProvider;
|
||||||
{
|
provider.UnSuspendLoad();
|
||||||
var temp = Provider as DatabaseSceneProvider;
|
}
|
||||||
return temp.UnSuspendLoad();
|
else if (Provider is BundledSceneProvider)
|
||||||
}
|
{
|
||||||
else if (Provider is BundledSceneProvider)
|
var provider = Provider as BundledSceneProvider;
|
||||||
{
|
provider.UnSuspendLoad();
|
||||||
var temp = Provider as BundledSceneProvider;
|
|
||||||
return temp.UnSuspendLoad();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new System.NotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
YooLogger.Warning($"Scene is invalid : {SceneObject.name}");
|
throw new System.NotImplementedException();
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -171,5 +174,7 @@ namespace YooAsset
|
|||||||
return operation;
|
return operation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -208,22 +208,47 @@ namespace YooAsset
|
|||||||
// Check error
|
// Check error
|
||||||
if (CacheBundle == null)
|
if (CacheBundle == null)
|
||||||
{
|
{
|
||||||
_steps = ESteps.Done;
|
|
||||||
Status = EStatus.Failed;
|
|
||||||
LastError = $"Failed to load assetBundle : {MainBundleInfo.Bundle.BundleName}";
|
|
||||||
YooLogger.Error(LastError);
|
|
||||||
|
|
||||||
// 注意:当缓存文件的校验等级为Low的时候,并不能保证缓存文件的完整性。
|
// 注意:当缓存文件的校验等级为Low的时候,并不能保证缓存文件的完整性。
|
||||||
// 在AssetBundle文件加载失败的情况下,我们需要重新验证文件的完整性!
|
// 在AssetBundle文件加载失败的情况下,我们需要重新验证文件的完整性!
|
||||||
if (MainBundleInfo.LoadMode == BundleInfo.ELoadMode.LoadFromCache)
|
if (MainBundleInfo.LoadMode == BundleInfo.ELoadMode.LoadFromCache)
|
||||||
{
|
{
|
||||||
var result = MainBundleInfo.VerifySelf();
|
var result = MainBundleInfo.VerifySelf();
|
||||||
if (result != EVerifyResult.Succeed)
|
if (result == EVerifyResult.Succeed)
|
||||||
{
|
{
|
||||||
YooLogger.Error($"Found possibly corrupt file ! {MainBundleInfo.Bundle.CacheGUID} Verify result : {result}");
|
// 说明:在安卓移动平台,华为和三星真机上有极小概率加载资源包失败。
|
||||||
|
// 大多数情况在首次安装下载资源到沙盒内,游戏过程中切换到后台再回到游戏内有很大概率触发!
|
||||||
|
byte[] fileData = FileUtility.ReadAllBytes(FileLoadPath);
|
||||||
|
if (fileData != null && fileData.Length > 0)
|
||||||
|
CacheBundle = AssetBundle.LoadFromMemory(fileData);
|
||||||
|
if (CacheBundle == null)
|
||||||
|
{
|
||||||
|
_steps = ESteps.Done;
|
||||||
|
Status = EStatus.Failed;
|
||||||
|
LastError = $"Failed to load assetBundle from memory : {MainBundleInfo.Bundle.BundleName}";
|
||||||
|
YooLogger.Error(LastError);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_steps = ESteps.Done;
|
||||||
|
Status = EStatus.Succeed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_steps = ESteps.Done;
|
||||||
|
Status = EStatus.Failed;
|
||||||
|
LastError = $"Found possibly corrupt file ! {MainBundleInfo.Bundle.CacheGUID} Verify result : {result}";
|
||||||
|
YooLogger.Error(LastError);
|
||||||
MainBundleInfo.CacheDiscard();
|
MainBundleInfo.CacheDiscard();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_steps = ESteps.Done;
|
||||||
|
Status = EStatus.Failed;
|
||||||
|
LastError = $"Failed to load assetBundle : {MainBundleInfo.Bundle.BundleName}";
|
||||||
|
YooLogger.Error(LastError);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -31,6 +31,22 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
_error = null;
|
_error = null;
|
||||||
_provider = provider;
|
_provider = provider;
|
||||||
|
|
||||||
|
// 注意:卸载场景前必须先解除挂起操作
|
||||||
|
if (provider is DatabaseSceneProvider)
|
||||||
|
{
|
||||||
|
var temp = provider as DatabaseSceneProvider;
|
||||||
|
temp.UnSuspendLoad();
|
||||||
|
}
|
||||||
|
else if (provider is BundledSceneProvider)
|
||||||
|
{
|
||||||
|
var temp = provider as BundledSceneProvider;
|
||||||
|
temp.UnSuspendLoad();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new System.NotImplementedException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
internal override void InternalOnStart()
|
internal override void InternalOnStart()
|
||||||
{
|
{
|
||||||
@@ -82,7 +98,6 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
_asyncOp = SceneManager.UnloadSceneAsync(_provider.SceneObject);
|
_asyncOp = SceneManager.UnloadSceneAsync(_provider.SceneObject);
|
||||||
_provider.ResourceMgr.UnloadSubScene(_provider.SceneName);
|
_provider.ResourceMgr.UnloadSubScene(_provider.SceneName);
|
||||||
_provider.ResourceMgr.TryUnloadUnusedAsset(_provider.MainAssetInfo);
|
|
||||||
_steps = ESteps.Checking;
|
_steps = ESteps.Checking;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,7 +106,7 @@ namespace YooAsset
|
|||||||
Progress = _asyncOp.progress;
|
Progress = _asyncOp.progress;
|
||||||
if (_asyncOp.isDone == false)
|
if (_asyncOp.isDone == false)
|
||||||
return;
|
return;
|
||||||
|
_provider.ResourceMgr.TryUnloadUnusedAsset(_provider.MainAssetInfo);
|
||||||
_steps = ESteps.Done;
|
_steps = ESteps.Done;
|
||||||
Status = EOperationStatus.Succeed;
|
Status = EOperationStatus.Succeed;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,14 +9,14 @@ namespace YooAsset
|
|||||||
internal sealed class BundledSceneProvider : ProviderBase
|
internal sealed class BundledSceneProvider : ProviderBase
|
||||||
{
|
{
|
||||||
public readonly LoadSceneMode SceneMode;
|
public readonly LoadSceneMode SceneMode;
|
||||||
private readonly bool _suspendLoad;
|
|
||||||
private AsyncOperation _asyncOperation;
|
private AsyncOperation _asyncOperation;
|
||||||
|
private bool _suspendLoadMode;
|
||||||
|
|
||||||
public BundledSceneProvider(ResourceManager manager, string providerGUID, AssetInfo assetInfo, LoadSceneMode sceneMode, bool suspendLoad) : base(manager, providerGUID, assetInfo)
|
public BundledSceneProvider(ResourceManager manager, string providerGUID, AssetInfo assetInfo, LoadSceneMode sceneMode, bool suspendLoad) : base(manager, providerGUID, assetInfo)
|
||||||
{
|
{
|
||||||
SceneMode = sceneMode;
|
SceneMode = sceneMode;
|
||||||
SceneName = Path.GetFileNameWithoutExtension(assetInfo.AssetPath);
|
SceneName = Path.GetFileNameWithoutExtension(assetInfo.AssetPath);
|
||||||
_suspendLoad = suspendLoad;
|
_suspendLoadMode = suspendLoad;
|
||||||
}
|
}
|
||||||
internal override void InternalOnStart()
|
internal override void InternalOnStart()
|
||||||
{
|
{
|
||||||
@@ -35,6 +35,12 @@ namespace YooAsset
|
|||||||
// 1. 检测资源包
|
// 1. 检测资源包
|
||||||
if (_steps == ESteps.CheckBundle)
|
if (_steps == ESteps.CheckBundle)
|
||||||
{
|
{
|
||||||
|
if (IsWaitForAsyncComplete)
|
||||||
|
{
|
||||||
|
DependBundles.WaitForAsyncComplete();
|
||||||
|
OwnerBundle.WaitForAsyncComplete();
|
||||||
|
}
|
||||||
|
|
||||||
if (DependBundles.IsDone() == false)
|
if (DependBundles.IsDone() == false)
|
||||||
return;
|
return;
|
||||||
if (OwnerBundle.IsDone() == false)
|
if (OwnerBundle.IsDone() == false)
|
||||||
@@ -60,53 +66,81 @@ namespace YooAsset
|
|||||||
// 2. 加载场景
|
// 2. 加载场景
|
||||||
if (_steps == ESteps.Loading)
|
if (_steps == ESteps.Loading)
|
||||||
{
|
{
|
||||||
// 注意:如果场景不存在则返回NULL
|
if (IsWaitForAsyncComplete || IsForceDestroyComplete)
|
||||||
_asyncOperation = SceneManager.LoadSceneAsync(MainAssetInfo.AssetPath, SceneMode);
|
|
||||||
if (_asyncOperation != null)
|
|
||||||
{
|
{
|
||||||
_asyncOperation.allowSceneActivation = !_suspendLoad;
|
// 注意:场景同步加载方法不会立即加载场景,而是在下一帧加载。
|
||||||
_asyncOperation.priority = 100;
|
LoadSceneParameters parameters = new LoadSceneParameters(SceneMode);
|
||||||
SceneObject = SceneManager.GetSceneAt(SceneManager.sceneCount - 1);
|
SceneObject = SceneManager.LoadScene(MainAssetInfo.AssetPath, parameters);
|
||||||
_steps = ESteps.Checking;
|
_steps = ESteps.Checking;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string error = $"Failed to load scene : {MainAssetInfo.AssetPath}";
|
// 注意:如果场景不存在异步加载方法返回NULL
|
||||||
YooLogger.Error(error);
|
// 注意:即使是异步加载也要在当帧获取到场景对象
|
||||||
InvokeCompletion(error, EOperationStatus.Failed);
|
_asyncOperation = SceneManager.LoadSceneAsync(MainAssetInfo.AssetPath, SceneMode);
|
||||||
|
if (_asyncOperation != null)
|
||||||
|
{
|
||||||
|
_asyncOperation.allowSceneActivation = !_suspendLoadMode;
|
||||||
|
_asyncOperation.priority = 100;
|
||||||
|
SceneObject = SceneManager.GetSceneAt(SceneManager.sceneCount - 1);
|
||||||
|
_steps = ESteps.Checking;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string error = $"Failed to load scene : {MainAssetInfo.AssetPath}";
|
||||||
|
YooLogger.Error(error);
|
||||||
|
InvokeCompletion(error, EOperationStatus.Failed);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. 检测加载结果
|
// 3. 检测加载结果
|
||||||
if (_steps == ESteps.Checking)
|
if (_steps == ESteps.Checking)
|
||||||
{
|
{
|
||||||
Progress = _asyncOperation.progress;
|
if (_asyncOperation != null)
|
||||||
if (_asyncOperation.isDone)
|
|
||||||
{
|
{
|
||||||
if (SceneObject.IsValid())
|
if (IsWaitForAsyncComplete || IsForceDestroyComplete)
|
||||||
{
|
{
|
||||||
InvokeCompletion(string.Empty, EOperationStatus.Succeed);
|
// 场景加载无法强制异步转同步
|
||||||
|
YooLogger.Error("The scene is loading asyn !");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string error = $"The load scene is invalid : {MainAssetInfo.AssetPath}";
|
// 注意:在业务层中途可以取消挂起
|
||||||
YooLogger.Error(error);
|
if (_asyncOperation.allowSceneActivation == false)
|
||||||
InvokeCompletion(error, EOperationStatus.Failed);
|
{
|
||||||
|
if (_suspendLoadMode == false)
|
||||||
|
_asyncOperation.allowSceneActivation = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Progress = _asyncOperation.progress;
|
||||||
|
if (_asyncOperation.isDone == false)
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (SceneObject.IsValid())
|
||||||
|
{
|
||||||
|
InvokeCompletion(string.Empty, EOperationStatus.Succeed);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string error = $"The loaded scene is invalid : {MainAssetInfo.AssetPath}";
|
||||||
|
YooLogger.Error(error);
|
||||||
|
InvokeCompletion(error, EOperationStatus.Failed);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 解除场景加载挂起操作
|
/// 解除场景加载挂起操作
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool UnSuspendLoad()
|
public void UnSuspendLoad()
|
||||||
{
|
{
|
||||||
if (_asyncOperation == null)
|
if (IsDone == false)
|
||||||
return false;
|
{
|
||||||
|
_suspendLoadMode = false;
|
||||||
_asyncOperation.allowSceneActivation = true;
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9,14 +9,14 @@ namespace YooAsset
|
|||||||
internal sealed class DatabaseSceneProvider : ProviderBase
|
internal sealed class DatabaseSceneProvider : ProviderBase
|
||||||
{
|
{
|
||||||
public readonly LoadSceneMode SceneMode;
|
public readonly LoadSceneMode SceneMode;
|
||||||
private readonly bool _suspendLoad;
|
private bool _suspendLoadMode;
|
||||||
private AsyncOperation _asyncOperation;
|
private AsyncOperation _asyncOperation;
|
||||||
|
|
||||||
public DatabaseSceneProvider(ResourceManager manager, string providerGUID, AssetInfo assetInfo, LoadSceneMode sceneMode, bool suspendLoad) : base(manager, providerGUID, assetInfo)
|
public DatabaseSceneProvider(ResourceManager manager, string providerGUID, AssetInfo assetInfo, LoadSceneMode sceneMode, bool suspendLoad) : base(manager, providerGUID, assetInfo)
|
||||||
{
|
{
|
||||||
SceneMode = sceneMode;
|
SceneMode = sceneMode;
|
||||||
SceneName = Path.GetFileNameWithoutExtension(assetInfo.AssetPath);
|
SceneName = Path.GetFileNameWithoutExtension(assetInfo.AssetPath);
|
||||||
_suspendLoad = suspendLoad;
|
_suspendLoadMode = suspendLoad;
|
||||||
}
|
}
|
||||||
internal override void InternalOnStart()
|
internal override void InternalOnStart()
|
||||||
{
|
{
|
||||||
@@ -57,41 +57,67 @@ namespace YooAsset
|
|||||||
// 2. 加载资源对象
|
// 2. 加载资源对象
|
||||||
if (_steps == ESteps.Loading)
|
if (_steps == ESteps.Loading)
|
||||||
{
|
{
|
||||||
LoadSceneParameters loadSceneParameters = new LoadSceneParameters();
|
if (IsWaitForAsyncComplete || IsForceDestroyComplete)
|
||||||
loadSceneParameters.loadSceneMode = SceneMode;
|
|
||||||
_asyncOperation = UnityEditor.SceneManagement.EditorSceneManager.LoadSceneAsyncInPlayMode(MainAssetInfo.AssetPath, loadSceneParameters);
|
|
||||||
if (_asyncOperation != null)
|
|
||||||
{
|
{
|
||||||
_asyncOperation.allowSceneActivation = !_suspendLoad;
|
LoadSceneParameters loadSceneParameters = new LoadSceneParameters(SceneMode);
|
||||||
_asyncOperation.priority = 100;
|
SceneObject = UnityEditor.SceneManagement.EditorSceneManager.LoadSceneInPlayMode(MainAssetInfo.AssetPath, loadSceneParameters);
|
||||||
SceneObject = SceneManager.GetSceneAt(SceneManager.sceneCount - 1);
|
|
||||||
_steps = ESteps.Checking;
|
_steps = ESteps.Checking;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string error = $"Failed to load scene : {MainAssetInfo.AssetPath}";
|
LoadSceneParameters loadSceneParameters = new LoadSceneParameters(SceneMode);
|
||||||
YooLogger.Error(error);
|
_asyncOperation = UnityEditor.SceneManagement.EditorSceneManager.LoadSceneAsyncInPlayMode(MainAssetInfo.AssetPath, loadSceneParameters);
|
||||||
InvokeCompletion(error, EOperationStatus.Failed);
|
if (_asyncOperation != null)
|
||||||
|
{
|
||||||
|
_asyncOperation.allowSceneActivation = !_suspendLoadMode;
|
||||||
|
_asyncOperation.priority = 100;
|
||||||
|
SceneObject = SceneManager.GetSceneAt(SceneManager.sceneCount - 1);
|
||||||
|
_steps = ESteps.Checking;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string error = $"Failed to load scene : {MainAssetInfo.AssetPath}";
|
||||||
|
YooLogger.Error(error);
|
||||||
|
InvokeCompletion(error, EOperationStatus.Failed);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. 检测加载结果
|
// 3. 检测加载结果
|
||||||
if (_steps == ESteps.Checking)
|
if (_steps == ESteps.Checking)
|
||||||
{
|
{
|
||||||
Progress = _asyncOperation.progress;
|
if (_asyncOperation != null)
|
||||||
if (_asyncOperation.isDone)
|
|
||||||
{
|
{
|
||||||
if (SceneObject.IsValid())
|
if (IsWaitForAsyncComplete || IsForceDestroyComplete)
|
||||||
{
|
{
|
||||||
InvokeCompletion(string.Empty, EOperationStatus.Succeed);
|
// 场景加载无法强制异步转同步
|
||||||
|
YooLogger.Error("The scene is loading asyn !");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string error = $"The loaded scene is invalid : {MainAssetInfo.AssetPath}";
|
// 注意:在业务层中途可以取消挂起
|
||||||
YooLogger.Error(error);
|
if (_asyncOperation.allowSceneActivation == false)
|
||||||
InvokeCompletion(error, EOperationStatus.Failed);
|
{
|
||||||
|
if (_suspendLoadMode == false)
|
||||||
|
_asyncOperation.allowSceneActivation = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Progress = _asyncOperation.progress;
|
||||||
|
if (_asyncOperation.isDone == false)
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (SceneObject.IsValid())
|
||||||
|
{
|
||||||
|
InvokeCompletion(string.Empty, EOperationStatus.Succeed);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string error = $"The loaded scene is invalid : {MainAssetInfo.AssetPath}";
|
||||||
|
YooLogger.Error(error);
|
||||||
|
InvokeCompletion(error, EOperationStatus.Failed);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -99,13 +125,12 @@ namespace YooAsset
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 解除场景加载挂起操作
|
/// 解除场景加载挂起操作
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool UnSuspendLoad()
|
public void UnSuspendLoad()
|
||||||
{
|
{
|
||||||
if (_asyncOperation == null)
|
if (IsDone == false)
|
||||||
return false;
|
{
|
||||||
|
_suspendLoadMode = false;
|
||||||
_asyncOperation.allowSceneActivation = true;
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -332,6 +332,7 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
PackageVersion = _loadBuildinManifestOp.Manifest.PackageVersion;
|
PackageVersion = _loadBuildinManifestOp.Manifest.PackageVersion;
|
||||||
_impl.ActiveManifest = _loadBuildinManifestOp.Manifest;
|
_impl.ActiveManifest = _loadBuildinManifestOp.Manifest;
|
||||||
|
_impl.FlushManifestVersionFile(); //注意:解压内置清单并加载成功后保存该清单版本。
|
||||||
_steps = ESteps.PackageCaching;
|
_steps = ESteps.PackageCaching;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -142,9 +142,9 @@ namespace YooAsset
|
|||||||
Manifest.AssetPathMapping1.Add(location, packageAsset.AssetPath);
|
Manifest.AssetPathMapping1.Add(location, packageAsset.AssetPath);
|
||||||
|
|
||||||
// 添加无后缀名路径的映射
|
// 添加无后缀名路径的映射
|
||||||
if (Path.HasExtension(location))
|
string locationWithoutExtension = Path.ChangeExtension(location, null);
|
||||||
|
if (ReferenceEquals(location, locationWithoutExtension) == false)
|
||||||
{
|
{
|
||||||
string locationWithoutExtension = PathUtility.RemoveExtension(location);
|
|
||||||
if (Manifest.AssetPathMapping1.ContainsKey(locationWithoutExtension))
|
if (Manifest.AssetPathMapping1.ContainsKey(locationWithoutExtension))
|
||||||
YooLogger.Warning($"Location have existed : {locationWithoutExtension}");
|
YooLogger.Warning($"Location have existed : {locationWithoutExtension}");
|
||||||
else
|
else
|
||||||
@@ -190,6 +190,7 @@ namespace YooAsset
|
|||||||
Manifest.BundleList = new List<PackageBundle>(_packageBundleCount);
|
Manifest.BundleList = new List<PackageBundle>(_packageBundleCount);
|
||||||
Manifest.BundleDic1 = new Dictionary<string, PackageBundle>(_packageBundleCount);
|
Manifest.BundleDic1 = new Dictionary<string, PackageBundle>(_packageBundleCount);
|
||||||
Manifest.BundleDic2 = new Dictionary<string, PackageBundle>(_packageBundleCount);
|
Manifest.BundleDic2 = new Dictionary<string, PackageBundle>(_packageBundleCount);
|
||||||
|
Manifest.BundleDic3 = new Dictionary<string, PackageBundle>(_packageBundleCount);
|
||||||
_progressTotalValue = _packageBundleCount;
|
_progressTotalValue = _packageBundleCount;
|
||||||
_steps = ESteps.DeserializeBundleList;
|
_steps = ESteps.DeserializeBundleList;
|
||||||
}
|
}
|
||||||
@@ -212,8 +213,8 @@ namespace YooAsset
|
|||||||
Manifest.BundleDic2.Add(packageBundle.FileName, packageBundle);
|
Manifest.BundleDic2.Add(packageBundle.FileName, packageBundle);
|
||||||
|
|
||||||
// 注意:原始文件可能存在相同的CacheGUID
|
// 注意:原始文件可能存在相同的CacheGUID
|
||||||
if (Manifest.CacheGUIDs.Contains(packageBundle.CacheGUID) == false)
|
if (Manifest.BundleDic3.ContainsKey(packageBundle.CacheGUID) == false)
|
||||||
Manifest.CacheGUIDs.Add(packageBundle.CacheGUID);
|
Manifest.BundleDic3.Add(packageBundle.CacheGUID, packageBundle);
|
||||||
|
|
||||||
_packageBundleCount--;
|
_packageBundleCount--;
|
||||||
Progress = 1f - _packageBundleCount / _progressTotalValue;
|
Progress = 1f - _packageBundleCount / _progressTotalValue;
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ namespace YooAsset
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
string fileHash = HashUtility.FileMD5(_manifestFilePath);
|
string fileHash = HashUtility.FileMD5Safely(_manifestFilePath);
|
||||||
if (fileHash != _queryCachePackageHashOp.PackageHash)
|
if (fileHash != _queryCachePackageHashOp.PackageHash)
|
||||||
{
|
{
|
||||||
_steps = ESteps.Done;
|
_steps = ESteps.Done;
|
||||||
|
|||||||
@@ -134,7 +134,6 @@ namespace YooAsset
|
|||||||
TryLoadCacheManifest,
|
TryLoadCacheManifest,
|
||||||
DownloadManifest,
|
DownloadManifest,
|
||||||
LoadCacheManifest,
|
LoadCacheManifest,
|
||||||
CheckDeserializeManifest,
|
|
||||||
Done,
|
Done,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,6 @@ namespace YooAsset
|
|||||||
TryLoadCacheManifest,
|
TryLoadCacheManifest,
|
||||||
DownloadManifest,
|
DownloadManifest,
|
||||||
LoadCacheManifest,
|
LoadCacheManifest,
|
||||||
CheckDeserializeManifest,
|
|
||||||
Done,
|
Done,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -75,6 +75,12 @@ namespace YooAsset
|
|||||||
[NonSerialized]
|
[NonSerialized]
|
||||||
public Dictionary<string, PackageBundle> BundleDic2;
|
public Dictionary<string, PackageBundle> BundleDic2;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 资源包集合(提供CacheGUID获取PackageBundle)
|
||||||
|
/// </summary>
|
||||||
|
[NonSerialized]
|
||||||
|
public Dictionary<string, PackageBundle> BundleDic3;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 资源映射集合(提供AssetPath获取PackageAsset)
|
/// 资源映射集合(提供AssetPath获取PackageAsset)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -93,12 +99,6 @@ namespace YooAsset
|
|||||||
[NonSerialized]
|
[NonSerialized]
|
||||||
public Dictionary<string, string> AssetPathMapping2;
|
public Dictionary<string, string> AssetPathMapping2;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 该资源清单所有文件的缓存GUID集合
|
|
||||||
/// </summary>
|
|
||||||
[NonSerialized]
|
|
||||||
public HashSet<string> CacheGUIDs = new HashSet<string>();
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 尝试映射为资源路径
|
/// 尝试映射为资源路径
|
||||||
@@ -189,12 +189,20 @@ namespace YooAsset
|
|||||||
return BundleDic2.TryGetValue(fileName, out result);
|
return BundleDic2.TryGetValue(fileName, out result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 尝试获取包裹的资源包
|
||||||
|
/// </summary>
|
||||||
|
public bool TryGetPackageBundleByCacheGUID(string cacheGUID, out PackageBundle result)
|
||||||
|
{
|
||||||
|
return BundleDic3.TryGetValue(cacheGUID, out result);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否包含资源文件
|
/// 是否包含资源文件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsIncludeBundleFile(string cacheGUID)
|
public bool IsIncludeBundleFile(string cacheGUID)
|
||||||
{
|
{
|
||||||
return CacheGUIDs.Contains(cacheGUID);
|
return BundleDic3.ContainsKey(cacheGUID);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ namespace YooAsset
|
|||||||
private ResourceAssist _assist;
|
private ResourceAssist _assist;
|
||||||
private IBuildinQueryServices _buildinQueryServices;
|
private IBuildinQueryServices _buildinQueryServices;
|
||||||
private IRemoteServices _remoteServices;
|
private IRemoteServices _remoteServices;
|
||||||
|
private IWechatQueryServices _wechatQueryServices;
|
||||||
|
|
||||||
public readonly string PackageName;
|
public readonly string PackageName;
|
||||||
public DownloadManager Download
|
public DownloadManager Download
|
||||||
@@ -34,11 +35,12 @@ namespace YooAsset
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 异步初始化
|
/// 异步初始化
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public InitializationOperation InitializeAsync(ResourceAssist assist, IBuildinQueryServices buildinQueryServices, IRemoteServices remoteServices)
|
public InitializationOperation InitializeAsync(ResourceAssist assist, IBuildinQueryServices buildinQueryServices, IRemoteServices remoteServices, IWechatQueryServices wechatQueryServices)
|
||||||
{
|
{
|
||||||
_assist = assist;
|
_assist = assist;
|
||||||
_buildinQueryServices = buildinQueryServices;
|
_buildinQueryServices = buildinQueryServices;
|
||||||
_remoteServices = remoteServices;
|
_remoteServices = remoteServices;
|
||||||
|
_wechatQueryServices = wechatQueryServices;
|
||||||
|
|
||||||
var operation = new WebPlayModeInitializationOperation(this);
|
var operation = new WebPlayModeInitializationOperation(this);
|
||||||
OperationSystem.StartOperation(PackageName, operation);
|
OperationSystem.StartOperation(PackageName, operation);
|
||||||
@@ -65,23 +67,13 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 查询相关
|
// 查询相关
|
||||||
#if UNITY_WECHAT_GAME
|
|
||||||
private WeChatWASM.WXFileSystemManager _wxFileSystemMgr;
|
|
||||||
private bool IsCachedPackageBundle(PackageBundle packageBundle)
|
private bool IsCachedPackageBundle(PackageBundle packageBundle)
|
||||||
{
|
{
|
||||||
if (_wxFileSystemMgr == null)
|
if (_wechatQueryServices != null)
|
||||||
_wxFileSystemMgr = WeChatWASM.WX.GetFileSystemManager();
|
return _wechatQueryServices.Query(PackageName, packageBundle.FileName, packageBundle.FileCRC);
|
||||||
string filePath = WeChatWASM.WX.env.USER_DATA_PATH + packageBundle.FileName;
|
else
|
||||||
string result = _wxFileSystemMgr.AccessSync(filePath);
|
return false;
|
||||||
return result.Equals("access:ok");
|
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
private bool IsCachedPackageBundle(PackageBundle packageBundle)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private bool IsBuildinPackageBundle(PackageBundle packageBundle)
|
private bool IsBuildinPackageBundle(PackageBundle packageBundle)
|
||||||
{
|
{
|
||||||
return _buildinQueryServices.Query(PackageName, packageBundle.FileName, packageBundle.FileCRC);
|
return _buildinQueryServices.Query(PackageName, packageBundle.FileName, packageBundle.FileCRC);
|
||||||
|
|||||||
@@ -184,7 +184,8 @@ namespace YooAsset
|
|||||||
var initializeParameters = parameters as WebPlayModeParameters;
|
var initializeParameters = parameters as WebPlayModeParameters;
|
||||||
initializeOperation = webPlayModeImpl.InitializeAsync(assist,
|
initializeOperation = webPlayModeImpl.InitializeAsync(assist,
|
||||||
initializeParameters.BuildinQueryServices,
|
initializeParameters.BuildinQueryServices,
|
||||||
initializeParameters.RemoteServices);
|
initializeParameters.RemoteServices,
|
||||||
|
initializeParameters.WechatQueryServices);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -314,28 +315,6 @@ namespace YooAsset
|
|||||||
return _playModeImpl.PreDownloadContentAsync(packageVersion, timeout);
|
return _playModeImpl.PreDownloadContentAsync(packageVersion, timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 清理包裹未使用的缓存文件
|
|
||||||
/// </summary>
|
|
||||||
public ClearUnusedCacheFilesOperation ClearUnusedCacheFilesAsync()
|
|
||||||
{
|
|
||||||
DebugCheckInitialize();
|
|
||||||
var operation = new ClearUnusedCacheFilesOperation(this, _cacheMgr);
|
|
||||||
OperationSystem.StartOperation(PackageName, operation);
|
|
||||||
return operation;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 清理包裹本地所有的缓存文件
|
|
||||||
/// </summary>
|
|
||||||
public ClearAllCacheFilesOperation ClearAllCacheFilesAsync()
|
|
||||||
{
|
|
||||||
DebugCheckInitialize();
|
|
||||||
var operation = new ClearAllCacheFilesOperation(_cacheMgr);
|
|
||||||
OperationSystem.StartOperation(PackageName, operation);
|
|
||||||
return operation;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取本地包裹的版本信息
|
/// 获取本地包裹的版本信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -412,6 +391,40 @@ namespace YooAsset
|
|||||||
_persistentMgr.DeleteSandboxPackageFolder();
|
_persistentMgr.DeleteSandboxPackageFolder();
|
||||||
_cacheMgr.ClearAll();
|
_cacheMgr.ClearAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 清理包裹未使用的缓存文件
|
||||||
|
/// </summary>
|
||||||
|
public ClearUnusedCacheFilesOperation ClearUnusedCacheFilesAsync()
|
||||||
|
{
|
||||||
|
DebugCheckInitialize();
|
||||||
|
var operation = new ClearUnusedCacheFilesOperation(this, _cacheMgr);
|
||||||
|
OperationSystem.StartOperation(PackageName, operation);
|
||||||
|
return operation;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 清理包裹本地所有的缓存文件
|
||||||
|
/// </summary>
|
||||||
|
public ClearAllCacheFilesOperation ClearAllCacheFilesAsync()
|
||||||
|
{
|
||||||
|
DebugCheckInitialize();
|
||||||
|
var operation = new ClearAllCacheFilesOperation(_cacheMgr);
|
||||||
|
OperationSystem.StartOperation(PackageName, operation);
|
||||||
|
return operation;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取指定版本的缓存信息
|
||||||
|
/// </summary>
|
||||||
|
public GetAllCacheFileInfosOperation GetAllCacheFileInfosAsync(string packageVersion)
|
||||||
|
{
|
||||||
|
DebugCheckInitialize();
|
||||||
|
|
||||||
|
var operation = new GetAllCacheFileInfosOperation(_persistentMgr, _cacheMgr, packageVersion);
|
||||||
|
OperationSystem.StartOperation(PackageName, operation);
|
||||||
|
return operation;
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 资源信息
|
#region 资源信息
|
||||||
@@ -590,6 +603,29 @@ namespace YooAsset
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 场景加载
|
#region 场景加载
|
||||||
|
/// <summary>
|
||||||
|
/// 同步加载场景
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="location">场景的定位地址</param>
|
||||||
|
/// <param name="sceneMode">场景加载模式</param>
|
||||||
|
public SceneHandle LoadSceneSync(string location, LoadSceneMode sceneMode = LoadSceneMode.Single)
|
||||||
|
{
|
||||||
|
DebugCheckInitialize();
|
||||||
|
AssetInfo assetInfo = ConvertLocationToAssetInfo(location, null);
|
||||||
|
return LoadSceneInternal(assetInfo, true, sceneMode, false, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 同步加载场景
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="assetInfo">场景的资源信息</param>
|
||||||
|
/// <param name="sceneMode">场景加载模式</param>
|
||||||
|
public SceneHandle LoadSceneSync(AssetInfo assetInfo, LoadSceneMode sceneMode = LoadSceneMode.Single)
|
||||||
|
{
|
||||||
|
DebugCheckInitialize();
|
||||||
|
return LoadSceneInternal(assetInfo, true, sceneMode, false, 0);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 异步加载场景
|
/// 异步加载场景
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -601,8 +637,7 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
DebugCheckInitialize();
|
DebugCheckInitialize();
|
||||||
AssetInfo assetInfo = ConvertLocationToAssetInfo(location, null);
|
AssetInfo assetInfo = ConvertLocationToAssetInfo(location, null);
|
||||||
var handle = _resourceMgr.LoadSceneAsync(assetInfo, sceneMode, suspendLoad, priority);
|
return LoadSceneInternal(assetInfo, false, sceneMode, suspendLoad, priority);
|
||||||
return handle;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -615,7 +650,16 @@ namespace YooAsset
|
|||||||
public SceneHandle LoadSceneAsync(AssetInfo assetInfo, LoadSceneMode sceneMode = LoadSceneMode.Single, bool suspendLoad = false, uint priority = 0)
|
public SceneHandle LoadSceneAsync(AssetInfo assetInfo, LoadSceneMode sceneMode = LoadSceneMode.Single, bool suspendLoad = false, uint priority = 0)
|
||||||
{
|
{
|
||||||
DebugCheckInitialize();
|
DebugCheckInitialize();
|
||||||
|
return LoadSceneInternal(assetInfo, false, sceneMode, suspendLoad, priority);
|
||||||
|
}
|
||||||
|
|
||||||
|
private SceneHandle LoadSceneInternal(AssetInfo assetInfo, bool waitForAsyncComplete, LoadSceneMode sceneMode, bool suspendLoad, uint priority)
|
||||||
|
{
|
||||||
|
DebugCheckAssetLoadMethod(nameof(LoadAssetAsync));
|
||||||
|
DebugCheckAssetLoadType(assetInfo.AssetType);
|
||||||
var handle = _resourceMgr.LoadSceneAsync(assetInfo, sceneMode, suspendLoad, priority);
|
var handle = _resourceMgr.LoadSceneAsync(assetInfo, sceneMode, suspendLoad, priority);
|
||||||
|
if (waitForAsyncComplete)
|
||||||
|
handle.WaitForAsyncComplete();
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
15
Assets/YooAsset/Runtime/Services/IWechatQueryServices.cs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
namespace YooAsset
|
||||||
|
{
|
||||||
|
public interface IWechatQueryServices
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 查询是否为微信缓存的资源文件
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="packageName">包裹名称</param>
|
||||||
|
/// <param name="fileName">文件名称(包含文件的后缀格式)</param>
|
||||||
|
/// <param name="fileCRC">文件哈希值</param>
|
||||||
|
/// <returns>返回查询结果</returns>
|
||||||
|
bool Query(string packageName, string fileName, string fileCRC);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e6b28ce9425f5eb4f972dcda9fd864f3
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -191,7 +191,7 @@ namespace YooAsset
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 哈希工具类
|
/// 哈希工具类
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static class HashUtility
|
public static class HashUtility
|
||||||
{
|
{
|
||||||
private static string ToString(byte[] hashBytes)
|
private static string ToString(byte[] hashBytes)
|
||||||
{
|
{
|
||||||
@@ -214,13 +214,21 @@ namespace YooAsset
|
|||||||
/// 获取文件的Hash值
|
/// 获取文件的Hash值
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string FileSHA1(string filePath)
|
public static string FileSHA1(string filePath)
|
||||||
|
{
|
||||||
|
using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||||
|
{
|
||||||
|
return StreamSHA1(fs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取文件的Hash值
|
||||||
|
/// </summary>
|
||||||
|
public static string FileSHA1Safely(string filePath)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read))
|
return FileSHA1(filePath);
|
||||||
{
|
|
||||||
return StreamSHA1(fs);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@@ -266,13 +274,21 @@ namespace YooAsset
|
|||||||
/// 获取文件的MD5
|
/// 获取文件的MD5
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string FileMD5(string filePath)
|
public static string FileMD5(string filePath)
|
||||||
|
{
|
||||||
|
using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||||
|
{
|
||||||
|
return StreamMD5(fs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取文件的MD5
|
||||||
|
/// </summary>
|
||||||
|
public static string FileMD5Safely(string filePath)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read))
|
return FileMD5(filePath);
|
||||||
{
|
|
||||||
return StreamMD5(fs);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@@ -316,13 +332,21 @@ namespace YooAsset
|
|||||||
/// 获取文件的CRC32
|
/// 获取文件的CRC32
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string FileCRC32(string filePath)
|
public static string FileCRC32(string filePath)
|
||||||
|
{
|
||||||
|
using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||||
|
{
|
||||||
|
return StreamCRC32(fs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取文件的CRC32
|
||||||
|
/// </summary>
|
||||||
|
public static string FileCRC32Safely(string filePath)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read))
|
return FileCRC32(filePath);
|
||||||
{
|
|
||||||
return StreamCRC32(fs);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -156,6 +156,28 @@ namespace YooAsset
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 场景加载
|
#region 场景加载
|
||||||
|
/// <summary>
|
||||||
|
/// 同步加载场景
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="location">场景的定位地址</param>
|
||||||
|
/// <param name="sceneMode">场景加载模式</param>
|
||||||
|
public static SceneHandle LoadSceneSync(string location, LoadSceneMode sceneMode = LoadSceneMode.Single)
|
||||||
|
{
|
||||||
|
DebugCheckDefaultPackageValid();
|
||||||
|
return _defaultPackage.LoadSceneSync(location, sceneMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 同步加载场景
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="assetInfo">场景的资源信息</param>
|
||||||
|
/// <param name="sceneMode">场景加载模式</param>
|
||||||
|
public static SceneHandle LoadSceneSync(AssetInfo assetInfo, LoadSceneMode sceneMode = LoadSceneMode.Single)
|
||||||
|
{
|
||||||
|
DebugCheckDefaultPackageValid();
|
||||||
|
return _defaultPackage.LoadSceneSync(assetInfo, sceneMode);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 异步加载场景
|
/// 异步加载场景
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class ShaderVariantCollectionManifest
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class ShaderVariantInfo
|
public class ShaderVariantInfo : IComparable<ShaderVariantInfo>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 着色器资源路径.
|
/// 着色器资源路径.
|
||||||
@@ -46,6 +46,13 @@ public class ShaderVariantCollectionManifest
|
|||||||
/// 着色器变种列表
|
/// 着色器变种列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<ShaderVariantElement> ShaderVariantElements = new List<ShaderVariantElement>(1000);
|
public List<ShaderVariantElement> ShaderVariantElements = new List<ShaderVariantElement>(1000);
|
||||||
|
|
||||||
|
public int CompareTo(ShaderVariantInfo other)
|
||||||
|
{
|
||||||
|
string thisStr = AssetPath + "+" +ShaderName;
|
||||||
|
string otherStr = other.AssetPath + "+" + other.ShaderName;
|
||||||
|
return thisStr.CompareTo(otherStr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -141,6 +148,8 @@ public class ShaderVariantCollectionManifest
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 重新排序
|
||||||
|
manifest.ShaderVariantInfos.Sort();
|
||||||
return manifest;
|
return manifest;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -22,7 +22,7 @@ public static class ShaderVariantCollector
|
|||||||
}
|
}
|
||||||
|
|
||||||
private const float WaitMilliseconds = 1000f;
|
private const float WaitMilliseconds = 1000f;
|
||||||
private const float SleepMilliseconds = 100f;
|
private const float SleepMilliseconds = 2000f;
|
||||||
private static string _savePath;
|
private static string _savePath;
|
||||||
private static string _packageName;
|
private static string _packageName;
|
||||||
private static int _processMaxNum;
|
private static int _processMaxNum;
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 01865ad6f7c806147b6cb37f2d83bc96
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 96761de9252a2be45b984c64f3307bd0
|
|
||||||
folderAsset: yes
|
|
||||||
timeCreated: 1438091524
|
|
||||||
licenseType: Store
|
|
||||||
DefaultImporter:
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 5ef7e8cb2b1939e4fbaa2f4fb83fae34
|
|
||||||
folderAsset: yes
|
|
||||||
timeCreated: 1438091524
|
|
||||||
licenseType: Store
|
|
||||||
DefaultImporter:
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 7916cd3fc7621524ab888d9cae92c327
|
|
||||||
folderAsset: yes
|
|
||||||
timeCreated: 1438091524
|
|
||||||
licenseType: Store
|
|
||||||
DefaultImporter:
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 856900e36ea72f24a9896ec2db21a71e
|
|
||||||
folderAsset: yes
|
|
||||||
timeCreated: 1438091524
|
|
||||||
licenseType: Store
|
|
||||||
DefaultImporter:
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 5338a5ade0415264b976d834237aa226
|
guid: eabfe0b853c6b024f9ebe6ed4eaf9291
|
||||||
folderAsset: yes
|
folderAsset: yes
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
|
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 35 KiB |
@@ -112,6 +112,18 @@ TextureImporter:
|
|||||||
overridden: 0
|
overridden: 0
|
||||||
androidETC2FallbackOverride: 0
|
androidETC2FallbackOverride: 0
|
||||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: WebGL
|
||||||
|
maxTextureSize: 1024
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
spriteSheet:
|
spriteSheet:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
sprites: []
|
sprites: []
|
||||||
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
@@ -112,6 +112,18 @@ TextureImporter:
|
|||||||
overridden: 0
|
overridden: 0
|
||||||
androidETC2FallbackOverride: 0
|
androidETC2FallbackOverride: 0
|
||||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: WebGL
|
||||||
|
maxTextureSize: 1024
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
spriteSheet:
|
spriteSheet:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
sprites: []
|
sprites: []
|
||||||
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
@@ -112,6 +112,18 @@ TextureImporter:
|
|||||||
overridden: 0
|
overridden: 0
|
||||||
androidETC2FallbackOverride: 0
|
androidETC2FallbackOverride: 0
|
||||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: WebGL
|
||||||
|
maxTextureSize: 1024
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
spriteSheet:
|
spriteSheet:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
sprites: []
|
sprites: []
|
||||||
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
@@ -112,6 +112,18 @@ TextureImporter:
|
|||||||
overridden: 0
|
overridden: 0
|
||||||
androidETC2FallbackOverride: 0
|
androidETC2FallbackOverride: 0
|
||||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: WebGL
|
||||||
|
maxTextureSize: 1024
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
spriteSheet:
|
spriteSheet:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
sprites: []
|
sprites: []
|
||||||
|
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 43 KiB |
@@ -112,6 +112,18 @@ TextureImporter:
|
|||||||
overridden: 0
|
overridden: 0
|
||||||
androidETC2FallbackOverride: 0
|
androidETC2FallbackOverride: 0
|
||||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: WebGL
|
||||||
|
maxTextureSize: 1024
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
spriteSheet:
|
spriteSheet:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
sprites: []
|
sprites: []
|
||||||
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
@@ -112,6 +112,18 @@ TextureImporter:
|
|||||||
overridden: 0
|
overridden: 0
|
||||||
androidETC2FallbackOverride: 0
|
androidETC2FallbackOverride: 0
|
||||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: WebGL
|
||||||
|
maxTextureSize: 1024
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
spriteSheet:
|
spriteSheet:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
sprites: []
|
sprites: []
|
||||||
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
@@ -112,6 +112,18 @@ TextureImporter:
|
|||||||
overridden: 0
|
overridden: 0
|
||||||
androidETC2FallbackOverride: 0
|
androidETC2FallbackOverride: 0
|
||||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: WebGL
|
||||||
|
maxTextureSize: 1024
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
spriteSheet:
|
spriteSheet:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
sprites: []
|
sprites: []
|
||||||
|
Before Width: | Height: | Size: 111 KiB After Width: | Height: | Size: 111 KiB |
@@ -112,6 +112,18 @@ TextureImporter:
|
|||||||
overridden: 0
|
overridden: 0
|
||||||
androidETC2FallbackOverride: 0
|
androidETC2FallbackOverride: 0
|
||||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: WebGL
|
||||||
|
maxTextureSize: 1024
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
spriteSheet:
|
spriteSheet:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
sprites: []
|
sprites: []
|
||||||
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
@@ -112,6 +112,18 @@ TextureImporter:
|
|||||||
overridden: 0
|
overridden: 0
|
||||||
androidETC2FallbackOverride: 0
|
androidETC2FallbackOverride: 0
|
||||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: WebGL
|
||||||
|
maxTextureSize: 1024
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
spriteSheet:
|
spriteSheet:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
sprites: []
|
sprites: []
|
||||||
|
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 33 KiB |
@@ -112,6 +112,18 @@ TextureImporter:
|
|||||||
overridden: 0
|
overridden: 0
|
||||||
androidETC2FallbackOverride: 0
|
androidETC2FallbackOverride: 0
|
||||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: WebGL
|
||||||
|
maxTextureSize: 1024
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
spriteSheet:
|
spriteSheet:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
sprites: []
|
sprites: []
|
||||||
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
@@ -112,6 +112,18 @@ TextureImporter:
|
|||||||
overridden: 0
|
overridden: 0
|
||||||
androidETC2FallbackOverride: 0
|
androidETC2FallbackOverride: 0
|
||||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: WebGL
|
||||||
|
maxTextureSize: 1024
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
spriteSheet:
|
spriteSheet:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
sprites: []
|
sprites: []
|
||||||
@@ -31,7 +31,7 @@ SpriteAtlas:
|
|||||||
secondaryTextureSettings: {}
|
secondaryTextureSettings: {}
|
||||||
variantMultiplier: 1
|
variantMultiplier: 1
|
||||||
packables:
|
packables:
|
||||||
- {fileID: 102900000, guid: 5338a5ade0415264b976d834237aa226, type: 3}
|
- {fileID: 102900000, guid: eabfe0b853c6b024f9ebe6ed4eaf9291, type: 3}
|
||||||
bindAsDefault: 1
|
bindAsDefault: 1
|
||||||
isAtlasV2: 0
|
isAtlasV2: 0
|
||||||
cachedData: {fileID: 0}
|
cachedData: {fileID: 0}
|
||||||
|
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
@@ -112,6 +112,18 @@ TextureImporter:
|
|||||||
overridden: 0
|
overridden: 0
|
||||||
androidETC2FallbackOverride: 0
|
androidETC2FallbackOverride: 0
|
||||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: WebGL
|
||||||
|
maxTextureSize: 1024
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
spriteSheet:
|
spriteSheet:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
sprites: []
|
sprites: []
|
||||||
|
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
@@ -112,6 +112,18 @@ TextureImporter:
|
|||||||
overridden: 0
|
overridden: 0
|
||||||
androidETC2FallbackOverride: 0
|
androidETC2FallbackOverride: 0
|
||||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: WebGL
|
||||||
|
maxTextureSize: 1024
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
spriteSheet:
|
spriteSheet:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
sprites: []
|
sprites: []
|
||||||
|
Before Width: | Height: | Size: 104 KiB After Width: | Height: | Size: 104 KiB |
@@ -112,6 +112,18 @@ TextureImporter:
|
|||||||
overridden: 0
|
overridden: 0
|
||||||
androidETC2FallbackOverride: 0
|
androidETC2FallbackOverride: 0
|
||||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: WebGL
|
||||||
|
maxTextureSize: 1024
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
spriteSheet:
|
spriteSheet:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
sprites: []
|
sprites: []
|
||||||
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
@@ -112,6 +112,18 @@ TextureImporter:
|
|||||||
overridden: 0
|
overridden: 0
|
||||||
androidETC2FallbackOverride: 0
|
androidETC2FallbackOverride: 0
|
||||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: WebGL
|
||||||
|
maxTextureSize: 1024
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
spriteSheet:
|
spriteSheet:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
sprites: []
|
sprites: []
|
||||||
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
@@ -112,6 +112,18 @@ TextureImporter:
|
|||||||
overridden: 0
|
overridden: 0
|
||||||
androidETC2FallbackOverride: 0
|
androidETC2FallbackOverride: 0
|
||||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: WebGL
|
||||||
|
maxTextureSize: 1024
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
spriteSheet:
|
spriteSheet:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
sprites: []
|
sprites: []
|
||||||
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
@@ -112,6 +112,18 @@ TextureImporter:
|
|||||||
overridden: 0
|
overridden: 0
|
||||||
androidETC2FallbackOverride: 0
|
androidETC2FallbackOverride: 0
|
||||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: WebGL
|
||||||
|
maxTextureSize: 1024
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
spriteSheet:
|
spriteSheet:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
sprites: []
|
sprites: []
|
||||||