mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-26 18:50:10 +00:00
Compare commits
20 Commits
053b4a00d7
...
2.3.13
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f49143d4f7 | ||
|
|
fd760b12a3 | ||
|
|
14cf8e9ca3 | ||
|
|
3595219a71 | ||
|
|
a4c7d4b8f5 | ||
|
|
43c5c7fb53 | ||
|
|
48d2b36d4e | ||
|
|
2fd87f4d4b | ||
|
|
0fd75b835a | ||
|
|
4489ca570b | ||
|
|
268792b576 | ||
|
|
33907ea967 | ||
|
|
5d7afff3e4 | ||
|
|
fa15f83d85 | ||
|
|
1801974c8a | ||
|
|
bfd476d59c | ||
|
|
7dd08e9634 | ||
|
|
b2776b933a | ||
|
|
9f09b6c526 | ||
|
|
01f6103b48 |
@@ -2,6 +2,60 @@
|
||||
|
||||
All notable changes to this package will be documented in this file.
|
||||
|
||||
## [2.3.13] - 2025-07-23
|
||||
|
||||
**重要**:**所有下载相关的超时参数(timeout)已更新判定逻辑**
|
||||
|
||||
超时不再以‘指定时间内未接收到任何数据’为判定条件,而是以‘指定时间内未完成整个下载任务’为判定条件。
|
||||
|
||||
### Improvements
|
||||
|
||||
- 重构了核心代码的下载逻辑,解决了同步加载触发的下载任务没有完成的问题。
|
||||
- 扩展工程里新增了PreprocessBuildCatalog类,用于处理在构建应用程序前自动生成内置资源目录文件。
|
||||
- (#592) 优化了资源清单逻辑里不必要产生的GC逻辑。
|
||||
|
||||
### Fixed
|
||||
|
||||
- (#590) 修复了TryUnloadUnusedAsset方法,在依赖嵌套层数过深导致没有卸载的问题。
|
||||
|
||||
### Added
|
||||
|
||||
- 新增了支持Google Play的文件系统扩展示例。
|
||||
|
||||
- 新增了支持DefaultCacheFileSystem的单元测试用例。
|
||||
|
||||
- 新增了文件系统配置参数:DISABLE_ONDEMAND_DOWNLOAD
|
||||
|
||||
```csharp
|
||||
public class FileSystemParametersDefine
|
||||
{
|
||||
// 禁用边玩边下机制
|
||||
public const string DISABLE_ONDEMAND_DOWNLOAD = "DISABLE_ONDEMAND_DOWNLO";
|
||||
}
|
||||
```
|
||||
|
||||
### Changed
|
||||
|
||||
- IManifestServices接口拆分为了IManifestProcessServices和IManifestRestoreServices
|
||||
|
||||
```csharp
|
||||
public interface IManifestProcessServices
|
||||
{
|
||||
/// <summary>
|
||||
/// 处理资源清单(压缩或加密)
|
||||
/// </summary>
|
||||
byte[] ProcessManifest(byte[] fileData);
|
||||
}
|
||||
|
||||
public interface IManifestRestoreServices
|
||||
{
|
||||
/// <summary>
|
||||
/// 还原资源清单(解压或解密)
|
||||
/// </summary>
|
||||
byte[] RestoreManifest(byte[] fileData);
|
||||
}
|
||||
```
|
||||
|
||||
## [2.3.12] - 2025-07-01
|
||||
|
||||
### Improvements
|
||||
|
||||
@@ -79,15 +79,27 @@ namespace YooAsset.Editor
|
||||
EditorPrefs.SetString(key, encyptionClassName);
|
||||
}
|
||||
|
||||
// ManifestServicesClassName
|
||||
public static string GetPackageManifestServicesClassName(string packageName, string buildPipeline)
|
||||
// ManifestProcessServicesClassName
|
||||
public static string GetPackageManifestProcessServicesClassName(string packageName, string buildPipeline)
|
||||
{
|
||||
string key = $"{Application.productName}_{packageName}_{buildPipeline}_ManifestServicesClassName";
|
||||
return EditorPrefs.GetString(key, $"{typeof(ManifestNone).FullName}");
|
||||
string key = $"{Application.productName}_{packageName}_{buildPipeline}_ManifestProcessServicesClassName";
|
||||
return EditorPrefs.GetString(key, $"{typeof(ManifestProcessNone).FullName}");
|
||||
}
|
||||
public static void SetPackageManifestServicesClassName(string packageName, string buildPipeline, string encyptionClassName)
|
||||
public static void SetPackageManifestProcessServicesClassName(string packageName, string buildPipeline, string encyptionClassName)
|
||||
{
|
||||
string key = $"{Application.productName}_{packageName}_{buildPipeline}_ManifestServicesClassName";
|
||||
string key = $"{Application.productName}_{packageName}_{buildPipeline}_ManifestProcessServicesClassName";
|
||||
EditorPrefs.SetString(key, encyptionClassName);
|
||||
}
|
||||
|
||||
// ManifestRestoreServicesClassName
|
||||
public static string GetPackageManifestRestoreServicesClassName(string packageName, string buildPipeline)
|
||||
{
|
||||
string key = $"{Application.productName}_{packageName}_{buildPipeline}_ManifestRestoreServicesClassName";
|
||||
return EditorPrefs.GetString(key, $"{typeof(ManifestRestoreNone).FullName}");
|
||||
}
|
||||
public static void SetPackageManifestRestoreServicesClassName(string packageName, string buildPipeline, string encyptionClassName)
|
||||
{
|
||||
string key = $"{Application.productName}_{packageName}_{buildPipeline}_ManifestRestoreServicesClassName";
|
||||
EditorPrefs.SetString(key, encyptionClassName);
|
||||
}
|
||||
|
||||
|
||||
@@ -99,10 +99,14 @@ namespace YooAsset.Editor
|
||||
public IEncryptionServices EncryptionServices;
|
||||
|
||||
/// <summary>
|
||||
/// 资源清单服务类
|
||||
/// 资源清单加密服务类
|
||||
/// </summary>
|
||||
public IManifestServices ManifestServices;
|
||||
public IManifestProcessServices ManifestProcessServices;
|
||||
|
||||
/// <summary>
|
||||
/// 资源清单解密服务类
|
||||
/// </summary>
|
||||
public IManifestRestoreServices ManifestRestoreServices;
|
||||
|
||||
private string _pipelineOutputDirectory = string.Empty;
|
||||
private string _packageOutputDirectory = string.Empty;
|
||||
|
||||
@@ -14,8 +14,8 @@ namespace YooAsset.Editor
|
||||
{
|
||||
string buildinRootDirectory = buildParametersContext.GetBuildinRootDirectory();
|
||||
string buildPackageName = buildParametersContext.Parameters.PackageName;
|
||||
var manifestServices = buildParametersContext.Parameters.ManifestServices;
|
||||
DefaultBuildinFileSystemBuild.CreateBuildinCatalogFile(manifestServices, buildPackageName, buildinRootDirectory);
|
||||
var manifestServices = buildParametersContext.Parameters.ManifestRestoreServices;
|
||||
CatalogTools.CreateCatalogFile(manifestServices, buildPackageName, buildinRootDirectory);
|
||||
|
||||
// 刷新目录
|
||||
AssetDatabase.Refresh();
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace YooAsset.Editor
|
||||
{
|
||||
string fileName = YooAssetSettingsData.GetManifestBinaryFileName(buildParameters.PackageName, buildParameters.PackageVersion);
|
||||
packagePath = $"{packageOutputDirectory}/{fileName}";
|
||||
ManifestTools.SerializeToBinary(packagePath, manifest, buildParameters.ManifestServices);
|
||||
ManifestTools.SerializeToBinary(packagePath, manifest, buildParameters.ManifestProcessServices);
|
||||
packageHash = HashUtility.FileCRC32(packagePath);
|
||||
BuildLogger.Log($"Create package manifest file: {packagePath}");
|
||||
}
|
||||
@@ -97,7 +97,7 @@ namespace YooAsset.Editor
|
||||
{
|
||||
ManifestContext manifestContext = new ManifestContext();
|
||||
byte[] bytesData = FileUtility.ReadAllBytes(packagePath);
|
||||
manifestContext.Manifest = ManifestTools.DeserializeFromBinary(bytesData, buildParameters.ManifestServices);
|
||||
manifestContext.Manifest = ManifestTools.DeserializeFromBinary(bytesData, buildParameters.ManifestRestoreServices);
|
||||
context.SetContextObject(manifestContext);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,9 @@ namespace YooAsset.Editor
|
||||
buildReport.Summary.SingleReferencedPackAlone = buildParameters.SingleReferencedPackAlone;
|
||||
buildReport.Summary.FileNameStyle = buildParameters.FileNameStyle;
|
||||
buildReport.Summary.EncryptionServicesClassName = buildParameters.EncryptionServices == null ? "null" : buildParameters.EncryptionServices.GetType().FullName;
|
||||
buildReport.Summary.ManifestServicesClassName = buildParameters.ManifestServices == null ? "null" : buildParameters.ManifestServices.GetType().FullName;
|
||||
buildReport.Summary.ManifestProcessServicesClassName = buildParameters.ManifestProcessServices == null ? "null" : buildParameters.ManifestProcessServices.GetType().FullName;
|
||||
buildReport.Summary.ManifestRestoreServicesClassName = buildParameters.ManifestRestoreServices == null ? "null" : buildParameters.ManifestRestoreServices.GetType().FullName;
|
||||
|
||||
if (buildParameters is BuiltinBuildParameters)
|
||||
{
|
||||
var builtinBuildParameters = buildParameters as BuiltinBuildParameters;
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
|
||||
namespace YooAsset.Editor
|
||||
{
|
||||
public class ManifestNone : IManifestServices
|
||||
public class ManifestProcessNone : IManifestProcessServices
|
||||
{
|
||||
public byte[] ProcessManifest(byte[] fileData)
|
||||
byte[] IManifestProcessServices.ProcessManifest(byte[] fileData)
|
||||
{
|
||||
return fileData;
|
||||
}
|
||||
public byte[] RestoreManifest(byte[] fileData)
|
||||
}
|
||||
|
||||
public class ManifestRestoreNone : IManifestRestoreServices
|
||||
{
|
||||
byte[] IManifestRestoreServices.RestoreManifest(byte[] fileData)
|
||||
{
|
||||
return fileData;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace YooAsset.Editor
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建资源加密服务类实例
|
||||
/// 创建资源包加密服务类实例
|
||||
/// </summary>
|
||||
protected IEncryptionServices CreateEncryptionServicesInstance()
|
||||
{
|
||||
@@ -58,15 +58,29 @@ namespace YooAsset.Editor
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建资源清单服务类实例
|
||||
/// 创建资源清单加密服务类实例
|
||||
/// </summary>
|
||||
protected IManifestServices CreateManifestServicesInstance()
|
||||
protected IManifestProcessServices CreateManifestProcessServicesInstance()
|
||||
{
|
||||
var className = AssetBundleBuilderSetting.GetPackageManifestServicesClassName(PackageName, PipelineName);
|
||||
var classTypes = EditorTools.GetAssignableTypes(typeof(IManifestServices));
|
||||
var className = AssetBundleBuilderSetting.GetPackageManifestProcessServicesClassName(PackageName, PipelineName);
|
||||
var classTypes = EditorTools.GetAssignableTypes(typeof(IManifestProcessServices));
|
||||
var classType = classTypes.Find(x => x.FullName.Equals(className));
|
||||
if (classType != null)
|
||||
return (IManifestServices)Activator.CreateInstance(classType);
|
||||
return (IManifestProcessServices)Activator.CreateInstance(classType);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建资源清单解密服务类实例
|
||||
/// </summary>
|
||||
protected IManifestRestoreServices CreateManifestRestoreServicesInstance()
|
||||
{
|
||||
var className = AssetBundleBuilderSetting.GetPackageManifestRestoreServicesClassName(PackageName, PipelineName);
|
||||
var classTypes = EditorTools.GetAssignableTypes(typeof(IManifestRestoreServices));
|
||||
var classType = classTypes.Find(x => x.FullName.Equals(className));
|
||||
if (classType != null)
|
||||
return (IManifestRestoreServices)Activator.CreateInstance(classType);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
@@ -169,7 +183,7 @@ namespace YooAsset.Editor
|
||||
}
|
||||
protected PopupField<Type> CreateEncryptionServicesField(VisualElement container)
|
||||
{
|
||||
// 加密服务类
|
||||
// 资源包加密服务类
|
||||
var classTypes = EditorTools.GetAssignableTypes(typeof(IEncryptionServices));
|
||||
if (classTypes.Count > 0)
|
||||
{
|
||||
@@ -198,22 +212,22 @@ namespace YooAsset.Editor
|
||||
return popupField;
|
||||
}
|
||||
}
|
||||
protected PopupField<Type> CreateManifestServicesField(VisualElement container)
|
||||
protected PopupField<Type> CreateManifestProcessServicesField(VisualElement container)
|
||||
{
|
||||
// 清单服务类
|
||||
var classTypes = EditorTools.GetAssignableTypes(typeof(IManifestServices));
|
||||
// 资源清单加密服务类
|
||||
var classTypes = EditorTools.GetAssignableTypes(typeof(IManifestProcessServices));
|
||||
if (classTypes.Count > 0)
|
||||
{
|
||||
var className = AssetBundleBuilderSetting.GetPackageManifestServicesClassName(PackageName, PipelineName);
|
||||
var className = AssetBundleBuilderSetting.GetPackageManifestProcessServicesClassName(PackageName, PipelineName);
|
||||
int defaultIndex = classTypes.FindIndex(x => x.FullName.Equals(className));
|
||||
if (defaultIndex < 0)
|
||||
defaultIndex = 0;
|
||||
var popupField = new PopupField<Type>(classTypes, defaultIndex);
|
||||
popupField.label = "Manifest Services";
|
||||
popupField.label = "Manifest Process Services";
|
||||
popupField.style.width = StyleWidth;
|
||||
popupField.RegisterValueChangedCallback(evt =>
|
||||
{
|
||||
AssetBundleBuilderSetting.SetPackageManifestServicesClassName(PackageName, PipelineName, popupField.value.FullName);
|
||||
AssetBundleBuilderSetting.SetPackageManifestProcessServicesClassName(PackageName, PipelineName, popupField.value.FullName);
|
||||
});
|
||||
container.Add(popupField);
|
||||
UIElementsTools.SetElementLabelMinWidth(popupField, LabelMinWidth);
|
||||
@@ -222,7 +236,38 @@ namespace YooAsset.Editor
|
||||
else
|
||||
{
|
||||
var popupField = new PopupField<Type>();
|
||||
popupField.label = "Manifest Services";
|
||||
popupField.label = "Manifest Process Services";
|
||||
popupField.style.width = StyleWidth;
|
||||
container.Add(popupField);
|
||||
UIElementsTools.SetElementLabelMinWidth(popupField, LabelMinWidth);
|
||||
return popupField;
|
||||
}
|
||||
}
|
||||
protected PopupField<Type> CreateManifestRestoreServicesField(VisualElement container)
|
||||
{
|
||||
// 资源清单加密服务类
|
||||
var classTypes = EditorTools.GetAssignableTypes(typeof(IManifestRestoreServices));
|
||||
if (classTypes.Count > 0)
|
||||
{
|
||||
var className = AssetBundleBuilderSetting.GetPackageManifestRestoreServicesClassName(PackageName, PipelineName);
|
||||
int defaultIndex = classTypes.FindIndex(x => x.FullName.Equals(className));
|
||||
if (defaultIndex < 0)
|
||||
defaultIndex = 0;
|
||||
var popupField = new PopupField<Type>(classTypes, defaultIndex);
|
||||
popupField.label = "Manifest Restore Services";
|
||||
popupField.style.width = StyleWidth;
|
||||
popupField.RegisterValueChangedCallback(evt =>
|
||||
{
|
||||
AssetBundleBuilderSetting.SetPackageManifestRestoreServicesClassName(PackageName, PipelineName, popupField.value.FullName);
|
||||
});
|
||||
container.Add(popupField);
|
||||
UIElementsTools.SetElementLabelMinWidth(popupField, LabelMinWidth);
|
||||
return popupField;
|
||||
}
|
||||
else
|
||||
{
|
||||
var popupField = new PopupField<Type>();
|
||||
popupField.label = "Manifest Restore Services";
|
||||
popupField.style.width = StyleWidth;
|
||||
container.Add(popupField);
|
||||
UIElementsTools.SetElementLabelMinWidth(popupField, LabelMinWidth);
|
||||
|
||||
@@ -17,7 +17,8 @@ namespace YooAsset.Editor
|
||||
protected TextField _buildOutputField;
|
||||
protected TextField _buildVersionField;
|
||||
protected PopupField<Type> _encryptionServicesField;
|
||||
protected PopupField<Type> _manifestServicesField;
|
||||
protected PopupField<Type> _manifestProcessServicesField;
|
||||
protected PopupField<Type> _manifestRestoreServicesField;
|
||||
protected EnumField _compressionField;
|
||||
protected EnumField _outputNameStyleField;
|
||||
protected EnumField _copyBuildinFileOptionField;
|
||||
@@ -47,7 +48,8 @@ namespace YooAsset.Editor
|
||||
// 服务类
|
||||
var popupContainer = Root.Q("PopupContainer");
|
||||
_encryptionServicesField = CreateEncryptionServicesField(popupContainer);
|
||||
_manifestServicesField = CreateManifestServicesField(popupContainer);
|
||||
_manifestProcessServicesField = CreateManifestProcessServicesField(popupContainer);
|
||||
_manifestRestoreServicesField = CreateManifestRestoreServicesField(popupContainer);
|
||||
|
||||
// 压缩方式选项
|
||||
_compressionField = Root.Q<EnumField>("Compression");
|
||||
@@ -120,7 +122,8 @@ namespace YooAsset.Editor
|
||||
buildParameters.ClearBuildCacheFiles = clearBuildCache;
|
||||
buildParameters.UseAssetDependencyDB = useAssetDependencyDB;
|
||||
buildParameters.EncryptionServices = CreateEncryptionServicesInstance();
|
||||
buildParameters.ManifestServices = CreateManifestServicesInstance();
|
||||
buildParameters.ManifestProcessServices = CreateManifestProcessServicesInstance();
|
||||
buildParameters.ManifestRestoreServices = CreateManifestRestoreServicesInstance();
|
||||
|
||||
BuiltinBuildPipeline pipeline = new BuiltinBuildPipeline();
|
||||
var buildResult = pipeline.Run(buildParameters, true);
|
||||
|
||||
@@ -17,7 +17,8 @@ namespace YooAsset.Editor
|
||||
protected TextField _buildOutputField;
|
||||
protected TextField _buildVersionField;
|
||||
protected PopupField<Type> _encryptionServicesField;
|
||||
protected PopupField<Type> _manifestServicesField;
|
||||
protected PopupField<Type> _manifestProcessServicesField;
|
||||
protected PopupField<Type> _manifestRestoreServicesField;
|
||||
protected EnumField _outputNameStyleField;
|
||||
protected EnumField _copyBuildinFileOptionField;
|
||||
protected TextField _copyBuildinFileTagsField;
|
||||
@@ -46,7 +47,8 @@ namespace YooAsset.Editor
|
||||
// 加密方法
|
||||
var popupContainer = Root.Q("PopupContainer");
|
||||
_encryptionServicesField = CreateEncryptionServicesField(popupContainer);
|
||||
_manifestServicesField = CreateManifestServicesField(popupContainer);
|
||||
_manifestProcessServicesField = CreateManifestProcessServicesField(popupContainer);
|
||||
_manifestRestoreServicesField = CreateManifestRestoreServicesField(popupContainer);
|
||||
|
||||
// 输出文件名称样式
|
||||
_outputNameStyleField = Root.Q<EnumField>("FileNameStyle");
|
||||
@@ -112,7 +114,8 @@ namespace YooAsset.Editor
|
||||
buildParameters.ClearBuildCacheFiles = clearBuildCache;
|
||||
buildParameters.UseAssetDependencyDB = useAssetDependencyDB;
|
||||
buildParameters.EncryptionServices = CreateEncryptionServicesInstance();
|
||||
buildParameters.ManifestServices = CreateManifestServicesInstance();
|
||||
buildParameters.ManifestProcessServices = CreateManifestProcessServicesInstance();
|
||||
buildParameters.ManifestRestoreServices = CreateManifestRestoreServicesInstance();
|
||||
|
||||
RawFileBuildPipeline pipeline = new RawFileBuildPipeline();
|
||||
var buildResult = pipeline.Run(buildParameters, true);
|
||||
|
||||
@@ -17,7 +17,8 @@ namespace YooAsset.Editor
|
||||
protected TextField _buildOutputField;
|
||||
protected TextField _buildVersionField;
|
||||
protected PopupField<Type> _encryptionServicesField;
|
||||
protected PopupField<Type> _manifestServicesField;
|
||||
protected PopupField<Type> _manifestProcessServicesField;
|
||||
protected PopupField<Type> _manifestRestoreServicesField;
|
||||
protected EnumField _compressionField;
|
||||
protected EnumField _outputNameStyleField;
|
||||
protected EnumField _copyBuildinFileOptionField;
|
||||
@@ -47,7 +48,8 @@ namespace YooAsset.Editor
|
||||
// 加密方法
|
||||
var popupContainer = Root.Q("PopupContainer");
|
||||
_encryptionServicesField = CreateEncryptionServicesField(popupContainer);
|
||||
_manifestServicesField = CreateManifestServicesField(popupContainer);
|
||||
_manifestProcessServicesField = CreateManifestProcessServicesField(popupContainer);
|
||||
_manifestRestoreServicesField = CreateManifestRestoreServicesField(popupContainer);
|
||||
|
||||
// 压缩方式选项
|
||||
_compressionField = Root.Q<EnumField>("Compression");
|
||||
@@ -122,7 +124,8 @@ namespace YooAsset.Editor
|
||||
buildParameters.UseAssetDependencyDB = useAssetDependencyDB;
|
||||
buildParameters.BuiltinShadersBundleName = builtinShaderBundleName;
|
||||
buildParameters.EncryptionServices = CreateEncryptionServicesInstance();
|
||||
buildParameters.ManifestServices = CreateManifestServicesInstance();
|
||||
buildParameters.ManifestProcessServices = CreateManifestProcessServicesInstance();
|
||||
buildParameters.ManifestRestoreServices = CreateManifestRestoreServicesInstance();
|
||||
|
||||
ScriptableBuildPipeline pipeline = new ScriptableBuildPipeline();
|
||||
var buildResult = pipeline.Run(buildParameters, true);
|
||||
|
||||
@@ -72,7 +72,8 @@ namespace YooAsset.Editor
|
||||
public bool EnableSharePackRule;
|
||||
public bool SingleReferencedPackAlone;
|
||||
public string EncryptionServicesClassName;
|
||||
public string ManifestServicesClassName;
|
||||
public string ManifestProcessServicesClassName;
|
||||
public string ManifestRestoreServicesClassName;
|
||||
public EFileNameStyle FileNameStyle;
|
||||
|
||||
// 引擎参数
|
||||
|
||||
@@ -67,7 +67,8 @@ namespace YooAsset.Editor
|
||||
BindListViewItem("Enable Share Pack Rule", $"{buildReport.Summary.EnableSharePackRule}");
|
||||
BindListViewItem("Single Referenced Pack Alone", $"{buildReport.Summary.SingleReferencedPackAlone}");
|
||||
BindListViewItem("Encryption Services", buildReport.Summary.EncryptionServicesClassName);
|
||||
BindListViewItem("Manifest Services", buildReport.Summary.ManifestServicesClassName);
|
||||
BindListViewItem("Manifest Process Services", buildReport.Summary.ManifestProcessServicesClassName);
|
||||
BindListViewItem("Manifest Restore Services", buildReport.Summary.ManifestRestoreServicesClassName);
|
||||
BindListViewItem("FileNameStyle", $"{buildReport.Summary.FileNameStyle}");
|
||||
BindListViewItem("CompressOption", $"{buildReport.Summary.CompressOption}");
|
||||
BindListViewItem("DisableWriteTypeTree", $"{buildReport.Summary.DisableWriteTypeTree}");
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
// 内部友元
|
||||
[assembly: InternalsVisibleTo("YooAsset.Editor")]
|
||||
[assembly: InternalsVisibleTo("YooAsset.Test")]
|
||||
[assembly: InternalsVisibleTo("YooAsset.Test.Editor")]
|
||||
|
||||
// 外部友元
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using UnityEngine.Networking;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine.Networking;
|
||||
using UnityEngine;
|
||||
|
||||
namespace YooAsset
|
||||
@@ -14,6 +16,7 @@ namespace YooAsset
|
||||
}
|
||||
|
||||
private UnityWebRequestAsyncOperation _requestOperation;
|
||||
private readonly Dictionary<string, string> _headers = new Dictionary<string, string>();
|
||||
private ESteps _steps = ESteps.None;
|
||||
|
||||
|
||||
@@ -64,13 +67,22 @@ namespace YooAsset
|
||||
/// </summary>
|
||||
public void SetRequestHeader(string name, string value)
|
||||
{
|
||||
_webRequest.SetRequestHeader(name, value);
|
||||
_headers.Add(name, value);
|
||||
}
|
||||
|
||||
private void CreateWebRequest()
|
||||
{
|
||||
_webRequest = DownloadSystemHelper.NewUnityWebRequestGet(_requestURL);
|
||||
_webRequest.disposeDownloadHandlerOnDispose = true;
|
||||
|
||||
// 设置消息头
|
||||
foreach (var keyValuePair in _headers)
|
||||
{
|
||||
string name = keyValuePair.Key;
|
||||
string value = keyValuePair.Value;
|
||||
_webRequest.SetRequestHeader(name, value);
|
||||
}
|
||||
|
||||
_requestOperation = _webRequest.SendWebRequest();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,114 @@ namespace YooAsset
|
||||
{
|
||||
internal static class CatalogTools
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
/// <summary>
|
||||
/// 生成包裹的内置资源目录文件
|
||||
/// 说明:根据指定目录下的文件生成清单文件。
|
||||
/// </summary>
|
||||
public static bool CreateCatalogFile(IManifestRestoreServices services, string packageName, string packageDirectory)
|
||||
{
|
||||
// 获取资源清单版本
|
||||
string packageVersion;
|
||||
{
|
||||
string versionFileName = YooAssetSettingsData.GetPackageVersionFileName(packageName);
|
||||
string versionFilePath = $"{packageDirectory}/{versionFileName}";
|
||||
if (File.Exists(versionFilePath) == false)
|
||||
{
|
||||
Debug.LogError($"Can not found package version file : {versionFilePath}");
|
||||
return false;
|
||||
}
|
||||
|
||||
packageVersion = FileUtility.ReadAllText(versionFilePath);
|
||||
}
|
||||
|
||||
// 加载资源清单文件
|
||||
PackageManifest packageManifest;
|
||||
{
|
||||
string manifestFileName = YooAssetSettingsData.GetManifestBinaryFileName(packageName, packageVersion);
|
||||
string manifestFilePath = $"{packageDirectory}/{manifestFileName}";
|
||||
if (File.Exists(manifestFilePath) == false)
|
||||
{
|
||||
Debug.LogError($"Can not found package manifest file : {manifestFilePath}");
|
||||
return false;
|
||||
}
|
||||
|
||||
var binaryData = FileUtility.ReadAllBytes(manifestFilePath);
|
||||
packageManifest = ManifestTools.DeserializeFromBinary(binaryData, services);
|
||||
}
|
||||
|
||||
// 获取文件名映射关系
|
||||
Dictionary<string, string> fileMapping = new Dictionary<string, string>();
|
||||
{
|
||||
foreach (var packageBundle in packageManifest.BundleList)
|
||||
{
|
||||
fileMapping.Add(packageBundle.FileName, packageBundle.BundleGUID);
|
||||
}
|
||||
}
|
||||
|
||||
// 创建内置清单实例
|
||||
var buildinFileCatalog = new DefaultBuildinFileCatalog();
|
||||
buildinFileCatalog.FileVersion = CatalogDefine.FileVersion;
|
||||
buildinFileCatalog.PackageName = packageName;
|
||||
buildinFileCatalog.PackageVersion = packageVersion;
|
||||
|
||||
// 创建白名单查询集合
|
||||
HashSet<string> whiteFileList = new HashSet<string>
|
||||
{
|
||||
"link.xml",
|
||||
"buildlogtep.json",
|
||||
$"{packageName}.version",
|
||||
$"{packageName}_{packageVersion}.bytes",
|
||||
$"{packageName}_{packageVersion}.hash",
|
||||
$"{packageName}_{packageVersion}.json",
|
||||
$"{packageName}_{packageVersion}.report",
|
||||
DefaultBuildinFileSystemDefine.BuildinCatalogJsonFileName,
|
||||
DefaultBuildinFileSystemDefine.BuildinCatalogBinaryFileName
|
||||
};
|
||||
|
||||
// 记录所有内置资源文件
|
||||
DirectoryInfo rootDirectory = new DirectoryInfo(packageDirectory);
|
||||
FileInfo[] fileInfos = rootDirectory.GetFiles();
|
||||
foreach (var fileInfo in fileInfos)
|
||||
{
|
||||
if (fileInfo.Extension == ".meta")
|
||||
continue;
|
||||
|
||||
if (whiteFileList.Contains(fileInfo.Name))
|
||||
continue;
|
||||
|
||||
string fileName = fileInfo.Name;
|
||||
if (fileMapping.TryGetValue(fileName, out string bundleGUID))
|
||||
{
|
||||
var wrapper = new DefaultBuildinFileCatalog.FileWrapper();
|
||||
wrapper.BundleGUID = bundleGUID;
|
||||
wrapper.FileName = fileName;
|
||||
buildinFileCatalog.Wrappers.Add(wrapper);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning($"Failed mapping file : {fileName}");
|
||||
}
|
||||
}
|
||||
|
||||
// 创建输出文件
|
||||
string jsonFilePath = $"{packageDirectory}/{DefaultBuildinFileSystemDefine.BuildinCatalogJsonFileName}";
|
||||
if (File.Exists(jsonFilePath))
|
||||
File.Delete(jsonFilePath);
|
||||
SerializeToJson(jsonFilePath, buildinFileCatalog);
|
||||
|
||||
// 创建输出文件
|
||||
string binaryFilePath = $"{packageDirectory}/{DefaultBuildinFileSystemDefine.BuildinCatalogBinaryFileName}";
|
||||
if (File.Exists(binaryFilePath))
|
||||
File.Delete(binaryFilePath);
|
||||
SerializeToBinary(binaryFilePath, buildinFileCatalog);
|
||||
|
||||
UnityEditor.AssetDatabase.Refresh();
|
||||
Debug.Log($"Succeed to save catalog file : {binaryFilePath}");
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// 序列化(JSON文件)
|
||||
/// </summary>
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace YooAsset
|
||||
/// <summary>
|
||||
/// 自定义参数:资源清单服务类
|
||||
/// </summary>
|
||||
public IManifestServices ManifestServices { private set; get; }
|
||||
public IManifestRestoreServices ManifestServices { private set; get; }
|
||||
|
||||
/// <summary>
|
||||
/// 自定义参数:拷贝内置文件服务类
|
||||
@@ -186,7 +186,7 @@ namespace YooAsset
|
||||
}
|
||||
else if (name == FileSystemParametersDefine.MANIFEST_SERVICES)
|
||||
{
|
||||
ManifestServices = (IManifestServices)value;
|
||||
ManifestServices = (IManifestRestoreServices)value;
|
||||
}
|
||||
else if (name == FileSystemParametersDefine.COPY_LOCAL_FILE_SERVICES)
|
||||
{
|
||||
|
||||
@@ -1,155 +0,0 @@
|
||||
#if UNITY_EDITOR
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
public class DefaultBuildinFileSystemBuild : UnityEditor.Build.IPreprocessBuildWithReport
|
||||
{
|
||||
public int callbackOrder { get { return 0; } }
|
||||
|
||||
/// <summary>
|
||||
/// 在构建应用程序前自动生成内置资源目录文件。
|
||||
/// 原理:搜索StreamingAssets目录下的所有资源文件,将这些文件信息写入文件,然后在运行时做查询用途。
|
||||
/// </summary>
|
||||
public void OnPreprocessBuild(UnityEditor.Build.Reporting.BuildReport report)
|
||||
{
|
||||
YooLogger.Log("Begin to create catalog file !");
|
||||
|
||||
string rootPath = YooAssetSettingsData.GetYooDefaultBuildinRoot();
|
||||
DirectoryInfo rootDirectory = new DirectoryInfo(rootPath);
|
||||
if (rootDirectory.Exists == false)
|
||||
{
|
||||
Debug.LogWarning($"Can not found StreamingAssets root directory : {rootPath}");
|
||||
return;
|
||||
}
|
||||
|
||||
// 搜索所有Package目录
|
||||
DirectoryInfo[] subDirectories = rootDirectory.GetDirectories();
|
||||
foreach (var subDirectory in subDirectories)
|
||||
{
|
||||
string packageName = subDirectory.Name;
|
||||
string pacakgeDirectory = subDirectory.FullName;
|
||||
try
|
||||
{
|
||||
bool result = CreateBuildinCatalogFile(null, packageName, pacakgeDirectory);
|
||||
if (result == false)
|
||||
{
|
||||
Debug.LogError($"Create package {packageName} catalog file failed ! See the detail error in console !");
|
||||
}
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
Debug.LogError($"Create package {packageName} catalog file failed ! {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 生成包裹的内置资源目录文件
|
||||
/// </summary>
|
||||
public static bool CreateBuildinCatalogFile(IManifestServices services, string packageName, string packageDirectory)
|
||||
{
|
||||
// 获取资源清单版本
|
||||
string packageVersion;
|
||||
{
|
||||
string versionFileName = YooAssetSettingsData.GetPackageVersionFileName(packageName);
|
||||
string versionFilePath = $"{packageDirectory}/{versionFileName}";
|
||||
if (File.Exists(versionFilePath) == false)
|
||||
{
|
||||
Debug.LogError($"Can not found package version file : {versionFilePath}");
|
||||
return false;
|
||||
}
|
||||
|
||||
packageVersion = FileUtility.ReadAllText(versionFilePath);
|
||||
}
|
||||
|
||||
// 加载资源清单文件
|
||||
PackageManifest packageManifest;
|
||||
{
|
||||
string manifestFileName = YooAssetSettingsData.GetManifestBinaryFileName(packageName, packageVersion);
|
||||
string manifestFilePath = $"{packageDirectory}/{manifestFileName}";
|
||||
if (File.Exists(manifestFilePath) == false)
|
||||
{
|
||||
Debug.LogError($"Can not found package manifest file : {manifestFilePath}");
|
||||
return false;
|
||||
}
|
||||
|
||||
var binaryData = FileUtility.ReadAllBytes(manifestFilePath);
|
||||
packageManifest = ManifestTools.DeserializeFromBinary(binaryData, services);
|
||||
}
|
||||
|
||||
// 获取文件名映射关系
|
||||
Dictionary<string, string> fileMapping = new Dictionary<string, string>();
|
||||
{
|
||||
foreach (var packageBundle in packageManifest.BundleList)
|
||||
{
|
||||
fileMapping.Add(packageBundle.FileName, packageBundle.BundleGUID);
|
||||
}
|
||||
}
|
||||
|
||||
// 创建内置清单实例
|
||||
var buildinFileCatalog = new DefaultBuildinFileCatalog();
|
||||
buildinFileCatalog.FileVersion = CatalogDefine.FileVersion;
|
||||
buildinFileCatalog.PackageName = packageName;
|
||||
buildinFileCatalog.PackageVersion = packageVersion;
|
||||
|
||||
// 创建白名单查询集合
|
||||
HashSet<string> whiteFileList = new HashSet<string>
|
||||
{
|
||||
"link.xml",
|
||||
"buildlogtep.json",
|
||||
$"{packageName}.version",
|
||||
$"{packageName}_{packageVersion}.bytes",
|
||||
$"{packageName}_{packageVersion}.hash",
|
||||
$"{packageName}_{packageVersion}.json",
|
||||
$"{packageName}_{packageVersion}.report",
|
||||
DefaultBuildinFileSystemDefine.BuildinCatalogJsonFileName,
|
||||
DefaultBuildinFileSystemDefine.BuildinCatalogBinaryFileName
|
||||
};
|
||||
|
||||
// 记录所有内置资源文件
|
||||
DirectoryInfo rootDirectory = new DirectoryInfo(packageDirectory);
|
||||
FileInfo[] fileInfos = rootDirectory.GetFiles();
|
||||
foreach (var fileInfo in fileInfos)
|
||||
{
|
||||
if (fileInfo.Extension == ".meta")
|
||||
continue;
|
||||
|
||||
if (whiteFileList.Contains(fileInfo.Name))
|
||||
continue;
|
||||
|
||||
string fileName = fileInfo.Name;
|
||||
if (fileMapping.TryGetValue(fileName, out string bundleGUID))
|
||||
{
|
||||
var wrapper = new DefaultBuildinFileCatalog.FileWrapper();
|
||||
wrapper.BundleGUID = bundleGUID;
|
||||
wrapper.FileName = fileName;
|
||||
buildinFileCatalog.Wrappers.Add(wrapper);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning($"Failed mapping file : {fileName}");
|
||||
}
|
||||
}
|
||||
|
||||
// 创建输出文件
|
||||
string jsonFilePath = $"{packageDirectory}/{DefaultBuildinFileSystemDefine.BuildinCatalogJsonFileName}";
|
||||
if (File.Exists(jsonFilePath))
|
||||
File.Delete(jsonFilePath);
|
||||
CatalogTools.SerializeToJson(jsonFilePath, buildinFileCatalog);
|
||||
|
||||
// 创建输出文件
|
||||
string binaryFilePath = $"{packageDirectory}/{DefaultBuildinFileSystemDefine.BuildinCatalogBinaryFileName}";
|
||||
if (File.Exists(binaryFilePath))
|
||||
File.Delete(binaryFilePath);
|
||||
CatalogTools.SerializeToBinary(binaryFilePath, buildinFileCatalog);
|
||||
|
||||
UnityEditor.AssetDatabase.Refresh();
|
||||
Debug.Log($"Succeed to save buildin file catalog : {binaryFilePath}");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -17,7 +17,7 @@ namespace YooAsset
|
||||
private readonly DefaultBuildinFileSystem _fileSystem;
|
||||
private CopyBuildinPackageManifestOperation _copyBuildinPackageManifestOp;
|
||||
private FSInitializeFileSystemOperation _initUnpackFIleSystemOp;
|
||||
private LoadBuildinCatalogFileOperation _loadCatalogFileOp;
|
||||
private LoadBuildinCatalogFileOperation _loadBuildinCatalogFileOp;
|
||||
private ESteps _steps = ESteps.None;
|
||||
|
||||
internal DBFSInitializeOperation(DefaultBuildinFileSystem fileSystem)
|
||||
@@ -103,34 +103,18 @@ namespace YooAsset
|
||||
|
||||
if (_steps == ESteps.LoadCatalogFile)
|
||||
{
|
||||
if (_loadCatalogFileOp == null)
|
||||
if (_loadBuildinCatalogFileOp == null)
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
/*
|
||||
// 兼容性初始化
|
||||
// 说明:内置文件系统在编辑器下运行时需要动态生成
|
||||
string packageRoot = _fileSystem.FileRoot;
|
||||
bool result = DefaultBuildinFileSystemBuild.CreateBuildinCatalogFile(_fileSystem.ManifestServices, _fileSystem.PackageName, packageRoot);
|
||||
if (result == false)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = $"Create package catalog file failed ! See the detail error in console !";
|
||||
return;
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
|
||||
_loadCatalogFileOp = new LoadBuildinCatalogFileOperation(_fileSystem);
|
||||
_loadCatalogFileOp.StartOperation();
|
||||
AddChildOperation(_loadCatalogFileOp);
|
||||
_loadBuildinCatalogFileOp = new LoadBuildinCatalogFileOperation(_fileSystem);
|
||||
_loadBuildinCatalogFileOp.StartOperation();
|
||||
AddChildOperation(_loadBuildinCatalogFileOp);
|
||||
}
|
||||
|
||||
_loadCatalogFileOp.UpdateOperation();
|
||||
if (_loadCatalogFileOp.IsDone == false)
|
||||
_loadBuildinCatalogFileOp.UpdateOperation();
|
||||
if (_loadBuildinCatalogFileOp.IsDone == false)
|
||||
return;
|
||||
|
||||
if (_loadCatalogFileOp.Status == EOperationStatus.Succeed)
|
||||
if (_loadBuildinCatalogFileOp.Status == EOperationStatus.Succeed)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Succeed;
|
||||
@@ -139,7 +123,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = _loadCatalogFileOp.Error;
|
||||
Error = _loadBuildinCatalogFileOp.Error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,27 +104,28 @@ namespace YooAsset
|
||||
}
|
||||
}
|
||||
|
||||
if (_assetBundle != null)
|
||||
if (_assetBundle == null)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Result = new AssetBundleResult(_fileSystem, _bundle, _assetBundle, _managedStream);
|
||||
Status = EOperationStatus.Succeed;
|
||||
return;
|
||||
}
|
||||
|
||||
if (_bundle.Encrypted)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = $"Failed to load encrypted buildin asset bundle file : {_bundle.BundleName}";
|
||||
YooLogger.Error(Error);
|
||||
if (_bundle.Encrypted)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = $"Failed to load encrypted buildin asset bundle file : {_bundle.BundleName}";
|
||||
YooLogger.Error(Error);
|
||||
}
|
||||
else
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = $"Failed to load buildin asset bundle file : {_bundle.BundleName}";
|
||||
YooLogger.Error(Error);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = $"Failed to load buildin asset bundle file : {_bundle.BundleName}";
|
||||
YooLogger.Error(Error);
|
||||
Result = new AssetBundleResult(_fileSystem, _bundle, _assetBundle, _managedStream);
|
||||
Status = EOperationStatus.Succeed;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -176,13 +177,15 @@ namespace YooAsset
|
||||
|
||||
if (_steps == ESteps.LoadBuildinRawBundle)
|
||||
{
|
||||
string filePath = _fileSystem.GetBuildinFileLoadPath(_bundle);
|
||||
|
||||
#if UNITY_ANDROID
|
||||
//TODO : 安卓平台内置文件属于APK压缩包内的文件。
|
||||
_steps = ESteps.Done;
|
||||
Result = new RawBundleResult(_fileSystem, _bundle);
|
||||
Status = EOperationStatus.Succeed;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = $"Can not load android buildin raw bundle file : {filePath}";
|
||||
YooLogger.Error(Error);
|
||||
#else
|
||||
string filePath = _fileSystem.GetBuildinFileLoadPath(_bundle);
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
|
||||
@@ -20,8 +20,8 @@ namespace YooAsset
|
||||
|
||||
private readonly DefaultBuildinFileSystem _fileSystem;
|
||||
private RequestBuildinPackageVersionOperation _requestBuildinPackageVersionOp;
|
||||
private UnityWebFileRequestOperation _hashFileRequestOp;
|
||||
private UnityWebFileRequestOperation _manifestFileRequestOp;
|
||||
private UnityWebFileRequestOperation _hashWebFileRequestOp;
|
||||
private UnityWebFileRequestOperation _manifestWebFileRequestOp;
|
||||
private string _buildinPackageVersion;
|
||||
private ESteps _steps = ESteps.None;
|
||||
|
||||
@@ -78,21 +78,21 @@ namespace YooAsset
|
||||
|
||||
if (_steps == ESteps.UnpackHashFile)
|
||||
{
|
||||
if (_hashFileRequestOp == null)
|
||||
if (_hashWebFileRequestOp == null)
|
||||
{
|
||||
string sourcePath = _fileSystem.GetBuildinPackageHashFilePath(_buildinPackageVersion);
|
||||
string destPath = GetCopyPackageHashDestPath(_buildinPackageVersion);
|
||||
string url = DownloadSystemHelper.ConvertToWWWPath(sourcePath);
|
||||
_hashFileRequestOp = new UnityWebFileRequestOperation(url, destPath, 60);
|
||||
_hashFileRequestOp.StartOperation();
|
||||
AddChildOperation(_hashFileRequestOp);
|
||||
_hashWebFileRequestOp = new UnityWebFileRequestOperation(url, destPath, 60);
|
||||
_hashWebFileRequestOp.StartOperation();
|
||||
AddChildOperation(_hashWebFileRequestOp);
|
||||
}
|
||||
|
||||
_hashFileRequestOp.UpdateOperation();
|
||||
if (_hashFileRequestOp.IsDone == false)
|
||||
_hashWebFileRequestOp.UpdateOperation();
|
||||
if (_hashWebFileRequestOp.IsDone == false)
|
||||
return;
|
||||
|
||||
if (_hashFileRequestOp.Status == EOperationStatus.Succeed)
|
||||
if (_hashWebFileRequestOp.Status == EOperationStatus.Succeed)
|
||||
{
|
||||
_steps = ESteps.CheckManifestFile;
|
||||
}
|
||||
@@ -100,7 +100,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = _hashFileRequestOp.Error;
|
||||
Error = _hashWebFileRequestOp.Error;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,21 +119,21 @@ namespace YooAsset
|
||||
|
||||
if (_steps == ESteps.UnpackManifestFile)
|
||||
{
|
||||
if (_manifestFileRequestOp == null)
|
||||
if (_manifestWebFileRequestOp == null)
|
||||
{
|
||||
string sourcePath = _fileSystem.GetBuildinPackageManifestFilePath(_buildinPackageVersion);
|
||||
string destPath = GetCopyPackageManifestDestPath(_buildinPackageVersion);
|
||||
string url = DownloadSystemHelper.ConvertToWWWPath(sourcePath);
|
||||
_manifestFileRequestOp = new UnityWebFileRequestOperation(url, destPath, 60);
|
||||
_manifestFileRequestOp.StartOperation();
|
||||
AddChildOperation(_manifestFileRequestOp);
|
||||
_manifestWebFileRequestOp = new UnityWebFileRequestOperation(url, destPath, 60);
|
||||
_manifestWebFileRequestOp.StartOperation();
|
||||
AddChildOperation(_manifestWebFileRequestOp);
|
||||
}
|
||||
|
||||
_manifestFileRequestOp.UpdateOperation();
|
||||
if (_manifestFileRequestOp.IsDone == false)
|
||||
_manifestWebFileRequestOp.UpdateOperation();
|
||||
if (_manifestWebFileRequestOp.IsDone == false)
|
||||
return;
|
||||
|
||||
if (_manifestFileRequestOp.Status == EOperationStatus.Succeed)
|
||||
if (_manifestWebFileRequestOp.Status == EOperationStatus.Succeed)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Succeed;
|
||||
@@ -142,7 +142,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = _manifestFileRequestOp.Error;
|
||||
Error = _manifestWebFileRequestOp.Error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,6 +75,11 @@ namespace YooAsset
|
||||
/// </summary>
|
||||
public bool AppendFileExtension { private set; get; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// 自定义参数:禁用边玩边下机制
|
||||
/// </summary>
|
||||
public bool DisableOnDemandDownload { private set; get; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// 自定义参数:最大并发连接数
|
||||
/// </summary>
|
||||
@@ -103,7 +108,7 @@ namespace YooAsset
|
||||
/// <summary>
|
||||
/// 自定义参数:资源清单服务类
|
||||
/// </summary>
|
||||
public IManifestServices ManifestServices { private set; get; }
|
||||
public IManifestRestoreServices ManifestServices { private set; get; }
|
||||
|
||||
/// <summary>
|
||||
/// 自定义参数:拷贝内置文件服务类
|
||||
@@ -222,6 +227,10 @@ namespace YooAsset
|
||||
{
|
||||
AppendFileExtension = Convert.ToBoolean(value);
|
||||
}
|
||||
else if (name == FileSystemParametersDefine.DISABLE_ONDEMAND_DOWNLOAD)
|
||||
{
|
||||
DisableOnDemandDownload = Convert.ToBoolean(value);
|
||||
}
|
||||
else if (name == FileSystemParametersDefine.DOWNLOAD_MAX_CONCURRENCY)
|
||||
{
|
||||
DownloadMaxConcurrency = Convert.ToInt32(value);
|
||||
@@ -244,7 +253,7 @@ namespace YooAsset
|
||||
}
|
||||
else if (name == FileSystemParametersDefine.MANIFEST_SERVICES)
|
||||
{
|
||||
ManifestServices = (IManifestServices)value;
|
||||
ManifestServices = (IManifestRestoreServices)value;
|
||||
}
|
||||
else if (name == FileSystemParametersDefine.COPY_LOCAL_FILE_SERVICES)
|
||||
{
|
||||
|
||||
@@ -111,7 +111,7 @@ namespace YooAsset
|
||||
if (_verifyCacheFilesOp.Status == EOperationStatus.Succeed)
|
||||
{
|
||||
_steps = ESteps.CreateDownloadCenter;
|
||||
YooLogger.Log($"Package '{_fileSystem.PackageName}' cached files count : {_fileSystem.FileCount}");
|
||||
YooLogger.Log($"Package '{_fileSystem.PackageName}' '{_fileSystem.GetType().Name}' cached files count : {_fileSystem.FileCount}");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -49,7 +49,17 @@ namespace YooAsset
|
||||
}
|
||||
else
|
||||
{
|
||||
_steps = ESteps.DownloadFile;
|
||||
if (_fileSystem.DisableOnDemandDownload)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = $"The bundle not cached : {_bundle.BundleName}";
|
||||
YooLogger.Warning(Error);
|
||||
}
|
||||
else
|
||||
{
|
||||
_steps = ESteps.DownloadFile;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,22 +3,11 @@ using System.Collections.Generic;
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
/// <summary>
|
||||
/// 下载器单元测试
|
||||
/// 1. 下载失败重试机制
|
||||
/// 2. 下载引用计数机制
|
||||
/// 3. 最大下载并发机制
|
||||
/// 4. 异步下载远端资源
|
||||
/// 5. 同步下载远端资源
|
||||
/// 6. 异步拷贝本地资源
|
||||
/// 7. 同步拷贝本地资源
|
||||
/// 9. 断点续传下载器
|
||||
/// </summary>
|
||||
internal class DownloadCenterOperation : AsyncOperationBase
|
||||
{
|
||||
private readonly DefaultCacheFileSystem _fileSystem;
|
||||
protected readonly Dictionary<string, UnityDownloadFileOperation> _downloaders = new Dictionary<string, UnityDownloadFileOperation>(1000);
|
||||
protected readonly List<string> _removeDownloadList = new List<string>(1000);
|
||||
protected readonly List<string> _removeList = new List<string>(1000);
|
||||
|
||||
public DownloadCenterOperation(DefaultCacheFileSystem fileSystem)
|
||||
{
|
||||
@@ -30,31 +19,34 @@ namespace YooAsset
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
// 获取可移除的下载器集合
|
||||
_removeDownloadList.Clear();
|
||||
_removeList.Clear();
|
||||
foreach (var valuePair in _downloaders)
|
||||
{
|
||||
var downloader = valuePair.Value;
|
||||
downloader.UpdateOperation();
|
||||
if (downloader.IsDone)
|
||||
{
|
||||
_removeList.Add(valuePair.Key);
|
||||
continue;
|
||||
}
|
||||
|
||||
// 注意:主动终止引用计数为零的下载任务
|
||||
if (downloader.RefCount <= 0)
|
||||
{
|
||||
_removeDownloadList.Add(valuePair.Key);
|
||||
_removeList.Add(valuePair.Key);
|
||||
downloader.AbortOperation();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (downloader.IsDone)
|
||||
{
|
||||
_removeDownloadList.Add(valuePair.Key);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// 移除下载器
|
||||
foreach (var key in _removeDownloadList)
|
||||
foreach (var key in _removeList)
|
||||
{
|
||||
_downloaders.Remove(key);
|
||||
if (_downloaders.TryGetValue(key, out var downloader))
|
||||
{
|
||||
Childs.Remove(downloader);
|
||||
_downloaders.Remove(key);
|
||||
}
|
||||
}
|
||||
|
||||
// 最大并发数检测
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace YooAsset
|
||||
/// <summary>
|
||||
/// 自定义参数:资源清单服务类
|
||||
/// </summary>
|
||||
public IManifestServices ManifestServices { private set; get; }
|
||||
public IManifestRestoreServices ManifestServices { private set; get; }
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ namespace YooAsset
|
||||
}
|
||||
else if (name == FileSystemParametersDefine.MANIFEST_SERVICES)
|
||||
{
|
||||
ManifestServices = (IManifestServices)value;
|
||||
ManifestServices = (IManifestRestoreServices)value;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = $"{nameof(LoadWebAssetBundleOperation)} loaded asset bundle is null !";
|
||||
Error = $"{nameof(DWRFSLoadAssetBundleOperation)} loaded asset bundle is null !";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace YooAsset
|
||||
/// <summary>
|
||||
/// 自定义参数:资源清单服务类
|
||||
/// </summary>
|
||||
public IManifestServices ManifestServices { private set; get; }
|
||||
public IManifestRestoreServices ManifestServices { private set; get; }
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ namespace YooAsset
|
||||
}
|
||||
else if (name == FileSystemParametersDefine.MANIFEST_SERVICES)
|
||||
{
|
||||
ManifestServices = (IManifestServices)value;
|
||||
ManifestServices = (IManifestRestoreServices)value;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -32,22 +32,6 @@ namespace YooAsset
|
||||
{
|
||||
if (_loadCatalogFileOp == null)
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
/*
|
||||
// 兼容性初始化
|
||||
// 说明:内置文件系统在编辑器下运行时需要动态生成
|
||||
string packageRoot = _fileSystem.FileRoot;
|
||||
bool result = DefaultBuildinFileSystemBuild.CreateBuildinCatalogFile(_fileSystem.ManifestServices, _fileSystem.PackageName, packageRoot);
|
||||
if (result == false)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = $"Create package catalog file failed ! See the detail error in console !";
|
||||
return;
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
|
||||
_loadCatalogFileOp = new LoadWebServerCatalogFileOperation(_fileSystem, 60);
|
||||
_loadCatalogFileOp.StartOperation();
|
||||
AddChildOperation(_loadCatalogFileOp);
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = $"{nameof(LoadWebAssetBundleOperation)} loaded asset bundle is null !";
|
||||
Error = $"{nameof(DWSFSLoadAssetBundleOperation)} loaded asset bundle is null !";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace YooAsset
|
||||
public const string APPEND_FILE_EXTENSION = "APPEND_FILE_EXTENSION";
|
||||
public const string DISABLE_CATALOG_FILE = "DISABLE_CATALOG_FILE";
|
||||
public const string DISABLE_UNITY_WEB_CACHE = "DISABLE_UNITY_WEB_CACHE";
|
||||
public const string DISABLE_ONDEMAND_DOWNLOAD = "DISABLE_ONDEMAND_DOWNLOAD";
|
||||
public const string DOWNLOAD_MAX_CONCURRENCY = "DOWNLOAD_MAX_CONCURRENCY";
|
||||
public const string DOWNLOAD_MAX_REQUEST_PER_FRAME = "DOWNLOAD_MAX_REQUEST_PER_FRAME";
|
||||
public const string RESUME_DOWNLOAD_MINMUM_SIZE = "RESUME_DOWNLOAD_MINMUM_SIZE";
|
||||
|
||||
@@ -13,10 +13,10 @@ namespace YooAsset
|
||||
Done,
|
||||
}
|
||||
|
||||
private UnityWebDataRequestOperation _unityWebDataRequestOp;
|
||||
private readonly PackageBundle _bundle;
|
||||
private readonly DownloadFileOptions _options;
|
||||
private readonly IWebDecryptionServices _decryptionServices;
|
||||
private UnityWebDataRequestOperation _unityWebDataRequestOp;
|
||||
|
||||
protected int _requestCount = 0;
|
||||
protected float _tryAgainTimer;
|
||||
@@ -53,6 +53,7 @@ namespace YooAsset
|
||||
string url = GetRequestURL();
|
||||
_unityWebDataRequestOp = new UnityWebDataRequestOperation(url, 0);
|
||||
_unityWebDataRequestOp.StartOperation();
|
||||
AddChildOperation(_unityWebDataRequestOp);
|
||||
_steps = ESteps.CheckRequest;
|
||||
}
|
||||
|
||||
@@ -115,12 +116,6 @@ namespace YooAsset
|
||||
}
|
||||
}
|
||||
}
|
||||
internal override void InternalAbort()
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
if (_unityWebDataRequestOp != null)
|
||||
_unityWebDataRequestOp.AbortOperation();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载加密资源文件
|
||||
|
||||
@@ -45,6 +45,7 @@ namespace YooAsset
|
||||
string url = GetRequestURL();
|
||||
_unityAssetBundleRequestOp = new UnityAssetBundleRequestOperation(_bundle, _disableUnityWebCache, url);
|
||||
_unityAssetBundleRequestOp.StartOperation();
|
||||
AddChildOperation(_unityAssetBundleRequestOp);
|
||||
_steps = ESteps.CheckRequest;
|
||||
}
|
||||
|
||||
@@ -96,12 +97,6 @@ namespace YooAsset
|
||||
}
|
||||
}
|
||||
}
|
||||
internal override void InternalAbort()
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
if (_unityAssetBundleRequestOp != null)
|
||||
_unityAssetBundleRequestOp.AbortOperation();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取网络请求地址
|
||||
|
||||
@@ -62,6 +62,11 @@ namespace YooAsset
|
||||
/// </summary>
|
||||
public void TryUnloadUnusedAsset(AssetInfo assetInfo, int loopCount)
|
||||
{
|
||||
if (assetInfo == null)
|
||||
{
|
||||
YooLogger.Error($"{nameof(AssetInfo)} is null !");
|
||||
return;
|
||||
}
|
||||
if (assetInfo.IsInvalid)
|
||||
{
|
||||
YooLogger.Error($"Failed to unload asset ! {assetInfo.Error}");
|
||||
@@ -73,31 +78,29 @@ namespace YooAsset
|
||||
loopCount--;
|
||||
|
||||
// 卸载主资源包加载器
|
||||
string mainBundleName = _bundleQuery.GetMainBundleName(assetInfo);
|
||||
string mainBundleName = _bundleQuery.GetMainBundleName(assetInfo.Asset.BundleID);
|
||||
var mainLoader = TryGetBundleFileLoader(mainBundleName);
|
||||
if (mainLoader != null)
|
||||
{
|
||||
mainLoader.TryDestroyProviders();
|
||||
if (mainLoader.CanDestroyLoader())
|
||||
{
|
||||
string bundleName = mainLoader.LoadBundleInfo.Bundle.BundleName;
|
||||
mainLoader.DestroyLoader();
|
||||
LoaderDic.Remove(bundleName);
|
||||
LoaderDic.Remove(mainBundleName);
|
||||
}
|
||||
}
|
||||
|
||||
// 卸载依赖资源包加载器
|
||||
string[] dependBundleNames = _bundleQuery.GetDependBundleNames(assetInfo);
|
||||
foreach (var dependBundleName in dependBundleNames)
|
||||
foreach (var dependID in assetInfo.Asset.DependBundleIDs)
|
||||
{
|
||||
string dependBundleName = _bundleQuery.GetMainBundleName(dependID);
|
||||
var dependLoader = TryGetBundleFileLoader(dependBundleName);
|
||||
if (dependLoader != null)
|
||||
{
|
||||
if (dependLoader.CanDestroyLoader())
|
||||
{
|
||||
string bundleName = dependLoader.LoadBundleInfo.Bundle.BundleName;
|
||||
dependLoader.DestroyLoader();
|
||||
LoaderDic.Remove(bundleName);
|
||||
LoaderDic.Remove(dependBundleName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -296,8 +299,8 @@ namespace YooAsset
|
||||
}
|
||||
internal List<LoadBundleFileOperation> CreateDependBundleFileLoaders(AssetInfo assetInfo)
|
||||
{
|
||||
BundleInfo[] bundleInfos = _bundleQuery.GetDependBundleInfos(assetInfo);
|
||||
List<LoadBundleFileOperation> result = new List<LoadBundleFileOperation>(bundleInfos.Length);
|
||||
List<BundleInfo> bundleInfos = _bundleQuery.GetDependBundleInfos(assetInfo);
|
||||
List<LoadBundleFileOperation> result = new List<LoadBundleFileOperation>(bundleInfos.Count);
|
||||
foreach (var bundleInfo in bundleInfos)
|
||||
{
|
||||
var bundleLoader = CreateBundleFileLoaderInternal(bundleInfo);
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
internal interface IBundleQuery
|
||||
@@ -11,21 +13,11 @@ namespace YooAsset
|
||||
/// <summary>
|
||||
/// 获取依赖的资源包信息集合
|
||||
/// </summary>
|
||||
BundleInfo[] GetDependBundleInfos(AssetInfo assetPath);
|
||||
List<BundleInfo> GetDependBundleInfos(AssetInfo assetPath);
|
||||
|
||||
/// <summary>
|
||||
/// 获取主资源包名称
|
||||
/// </summary>
|
||||
string GetMainBundleName(int bundleID);
|
||||
|
||||
/// <summary>
|
||||
/// 获取主资源包名称
|
||||
/// </summary>
|
||||
string GetMainBundleName(AssetInfo assetInfo);
|
||||
|
||||
/// <summary>
|
||||
/// 获取依赖的资源包名称集合
|
||||
/// </summary>
|
||||
string[] GetDependBundleNames(AssetInfo assetInfo);
|
||||
}
|
||||
}
|
||||
@@ -44,7 +44,7 @@ namespace YooAsset
|
||||
/// <summary>
|
||||
/// 序列化(二进制文件)
|
||||
/// </summary>
|
||||
public static void SerializeToBinary(string savePath, PackageManifest manifest, IManifestServices services)
|
||||
public static void SerializeToBinary(string savePath, PackageManifest manifest, IManifestProcessServices services)
|
||||
{
|
||||
using (FileStream fs = new FileStream(savePath, FileMode.Create))
|
||||
{
|
||||
@@ -124,7 +124,7 @@ namespace YooAsset
|
||||
/// <summary>
|
||||
/// 反序列化(二进制文件)
|
||||
/// </summary>
|
||||
public static PackageManifest DeserializeFromBinary(byte[] binaryData, IManifestServices services)
|
||||
public static PackageManifest DeserializeFromBinary(byte[] binaryData, IManifestRestoreServices services)
|
||||
{
|
||||
// 创建缓存器
|
||||
BufferReader buffer;
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace YooAsset
|
||||
Done,
|
||||
}
|
||||
|
||||
private readonly IManifestServices _services;
|
||||
private readonly IManifestRestoreServices _services;
|
||||
private byte[] _sourceData;
|
||||
private BufferReader _buffer;
|
||||
private int _packageAssetCount;
|
||||
@@ -33,7 +33,7 @@ namespace YooAsset
|
||||
/// </summary>
|
||||
public PackageManifest Manifest { private set; get; }
|
||||
|
||||
public DeserializeManifestOperation(IManifestServices services, byte[] binaryData)
|
||||
public DeserializeManifestOperation(IManifestRestoreServices services, byte[] binaryData)
|
||||
{
|
||||
_services = services;
|
||||
_sourceData = binaryData;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
@@ -171,10 +170,10 @@ namespace YooAsset
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取依赖列表
|
||||
/// 获取资源对象的依赖列表(框架层查询结果)
|
||||
/// 注意:传入的资源对象一定合法有效!
|
||||
/// </summary>
|
||||
public PackageBundle[] GetAllDependencies(PackageAsset packageAsset)
|
||||
public List<PackageBundle> GetAssetAllDependencies(PackageAsset packageAsset)
|
||||
{
|
||||
List<PackageBundle> result = new List<PackageBundle>(packageAsset.DependBundleIDs.Length);
|
||||
foreach (var dependID in packageAsset.DependBundleIDs)
|
||||
@@ -182,14 +181,14 @@ namespace YooAsset
|
||||
var dependBundle = GetMainPackageBundle(dependID);
|
||||
result.Add(dependBundle);
|
||||
}
|
||||
return result.ToArray();
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取依赖列表
|
||||
/// 获取资源包的依赖列表(引擎层查询结果)
|
||||
/// 注意:传入的资源包对象一定合法有效!
|
||||
/// </summary>
|
||||
public PackageBundle[] GetAllDependencies(PackageBundle packageBundle)
|
||||
public List<PackageBundle> GetBundleAllDependencies(PackageBundle packageBundle)
|
||||
{
|
||||
List<PackageBundle> result = new List<PackageBundle>(packageBundle.DependBundleIDs.Length);
|
||||
foreach (var dependID in packageBundle.DependBundleIDs)
|
||||
@@ -197,7 +196,7 @@ namespace YooAsset
|
||||
var dependBundle = GetMainPackageBundle(dependID);
|
||||
result.Add(dependBundle);
|
||||
}
|
||||
return result.ToArray();
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -211,17 +210,17 @@ namespace YooAsset
|
||||
/// <summary>
|
||||
/// 尝试获取包裹的资源包
|
||||
/// </summary>
|
||||
public bool TryGetPackageBundleByBundleName(string bundleName, out PackageBundle result)
|
||||
public bool TryGetPackageBundleByFileName(string fileName, out PackageBundle result)
|
||||
{
|
||||
return BundleDic1.TryGetValue(bundleName, out result);
|
||||
return BundleDic2.TryGetValue(fileName, out result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 尝试获取包裹的资源包
|
||||
/// </summary>
|
||||
public bool TryGetPackageBundleByFileName(string fileName, out PackageBundle result)
|
||||
public bool TryGetPackageBundleByBundleName(string bundleName, out PackageBundle result)
|
||||
{
|
||||
return BundleDic2.TryGetValue(fileName, out result);
|
||||
return BundleDic1.TryGetValue(bundleName, out result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -245,13 +244,14 @@ namespace YooAsset
|
||||
/// </summary>
|
||||
public AssetInfo[] GetAllAssetInfos()
|
||||
{
|
||||
List<AssetInfo> result = new List<AssetInfo>(AssetList.Count);
|
||||
foreach (var packageAsset in AssetList)
|
||||
AssetInfo[] result = new AssetInfo[AssetList.Count];
|
||||
for (int i = 0; i < AssetList.Count; i++)
|
||||
{
|
||||
var packageAsset = AssetList[i];
|
||||
AssetInfo assetInfo = new AssetInfo(PackageName, packageAsset, null);
|
||||
result.Add(assetInfo);
|
||||
result[i] = assetInfo;
|
||||
}
|
||||
return result.ToArray();
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -259,7 +259,7 @@ namespace YooAsset
|
||||
/// </summary>
|
||||
public AssetInfo[] GetAssetInfosByTags(string[] tags)
|
||||
{
|
||||
List<AssetInfo> result = new List<AssetInfo>(100);
|
||||
List<AssetInfo> result = new List<AssetInfo>(AssetList.Count);
|
||||
foreach (var packageAsset in AssetList)
|
||||
{
|
||||
if (packageAsset.HasTag(tags))
|
||||
|
||||
@@ -176,30 +176,30 @@ namespace YooAsset
|
||||
var packageBundle = ActiveManifest.GetMainPackageBundle(assetInfo.Asset);
|
||||
return CreateBundleInfo(packageBundle);
|
||||
}
|
||||
BundleInfo[] IBundleQuery.GetDependBundleInfos(AssetInfo assetInfo)
|
||||
List<BundleInfo> IBundleQuery.GetDependBundleInfos(AssetInfo assetInfo)
|
||||
{
|
||||
if (assetInfo == null || assetInfo.IsInvalid)
|
||||
throw new Exception("Should never get here !");
|
||||
|
||||
// 注意:如果清单里未找到资源包会抛出异常!
|
||||
PackageBundle[] depends;
|
||||
List<PackageBundle> depends;
|
||||
if (assetInfo.LoadMethod == AssetInfo.ELoadMethod.LoadAllAssets)
|
||||
{
|
||||
var mainBundle = ActiveManifest.GetMainPackageBundle(assetInfo.Asset);
|
||||
depends = ActiveManifest.GetAllDependencies(mainBundle);
|
||||
depends = ActiveManifest.GetBundleAllDependencies(mainBundle);
|
||||
}
|
||||
else
|
||||
{
|
||||
depends = ActiveManifest.GetAllDependencies(assetInfo.Asset);
|
||||
depends = ActiveManifest.GetAssetAllDependencies(assetInfo.Asset);
|
||||
}
|
||||
|
||||
List<BundleInfo> result = new List<BundleInfo>(depends.Length);
|
||||
List<BundleInfo> result = new List<BundleInfo>(depends.Count);
|
||||
foreach (var packageBundle in depends)
|
||||
{
|
||||
BundleInfo bundleInfo = CreateBundleInfo(packageBundle);
|
||||
result.Add(bundleInfo);
|
||||
}
|
||||
return result.ToArray();
|
||||
return result;
|
||||
}
|
||||
string IBundleQuery.GetMainBundleName(int bundleID)
|
||||
{
|
||||
@@ -207,29 +207,6 @@ namespace YooAsset
|
||||
var packageBundle = ActiveManifest.GetMainPackageBundle(bundleID);
|
||||
return packageBundle.BundleName;
|
||||
}
|
||||
string IBundleQuery.GetMainBundleName(AssetInfo assetInfo)
|
||||
{
|
||||
if (assetInfo == null || assetInfo.IsInvalid)
|
||||
throw new Exception("Should never get here !");
|
||||
|
||||
// 注意:如果清单里未找到资源包会抛出异常!
|
||||
var packageBundle = ActiveManifest.GetMainPackageBundle(assetInfo.Asset);
|
||||
return packageBundle.BundleName;
|
||||
}
|
||||
string[] IBundleQuery.GetDependBundleNames(AssetInfo assetInfo)
|
||||
{
|
||||
if (assetInfo == null || assetInfo.IsInvalid)
|
||||
throw new Exception("Should never get here !");
|
||||
|
||||
// 注意:如果清单里未找到资源包会抛出异常!
|
||||
var depends = ActiveManifest.GetAllDependencies(assetInfo.Asset);
|
||||
List<string> result = new List<string>(depends.Length);
|
||||
foreach (var packageBundle in depends)
|
||||
{
|
||||
result.Add(packageBundle.BundleName);
|
||||
}
|
||||
return result.ToArray();
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
@@ -336,7 +313,7 @@ namespace YooAsset
|
||||
checkList.Add(mainBundle);
|
||||
|
||||
// 注意:如果清单里未找到资源包会抛出异常!
|
||||
PackageBundle[] mainDependBundles = manifest.GetAllDependencies(assetInfo.Asset);
|
||||
List<PackageBundle> mainDependBundles = manifest.GetAssetAllDependencies(assetInfo.Asset);
|
||||
foreach (var dependBundle in mainDependBundles)
|
||||
{
|
||||
if (checkList.Contains(dependBundle) == false)
|
||||
@@ -352,7 +329,7 @@ namespace YooAsset
|
||||
if (checkList.Contains(otherMainBundle) == false)
|
||||
checkList.Add(otherMainBundle);
|
||||
|
||||
PackageBundle[] otherDependBundles = manifest.GetAllDependencies(otherMainAsset);
|
||||
List<PackageBundle> otherDependBundles = manifest.GetAssetAllDependencies(otherMainAsset);
|
||||
foreach (var dependBundle in otherDependBundles)
|
||||
{
|
||||
if (checkList.Contains(dependBundle) == false)
|
||||
|
||||
@@ -496,7 +496,7 @@ namespace YooAsset
|
||||
if (bundleInfo.IsNeedDownloadFromRemote())
|
||||
return true;
|
||||
|
||||
BundleInfo[] depends = _bundleQuery.GetDependBundleInfos(assetInfo);
|
||||
List<BundleInfo> depends = _bundleQuery.GetDependBundleInfos(assetInfo);
|
||||
foreach (var depend in depends)
|
||||
{
|
||||
if (depend.IsNeedDownloadFromRemote())
|
||||
@@ -555,6 +555,7 @@ namespace YooAsset
|
||||
|
||||
private RawFileHandle LoadRawFileInternal(AssetInfo assetInfo, bool waitForAsyncComplete, uint priority)
|
||||
{
|
||||
assetInfo.LoadMethod = AssetInfo.ELoadMethod.LoadRawFile;
|
||||
var handle = _resourceManager.LoadRawFileAsync(assetInfo, priority);
|
||||
if (waitForAsyncComplete)
|
||||
handle.WaitForAsyncComplete();
|
||||
|
||||
14
Assets/YooAsset/Runtime/Services/IManifestProcessServices.cs
Normal file
14
Assets/YooAsset/Runtime/Services/IManifestProcessServices.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
/// <summary>
|
||||
/// 资源清单文件处理服务接口
|
||||
/// </summary>
|
||||
public interface IManifestProcessServices
|
||||
{
|
||||
/// <summary>
|
||||
/// 处理资源清单(压缩或加密)
|
||||
/// </summary>
|
||||
byte[] ProcessManifest(byte[] fileData);
|
||||
}
|
||||
}
|
||||
14
Assets/YooAsset/Runtime/Services/IManifestRestoreServices.cs
Normal file
14
Assets/YooAsset/Runtime/Services/IManifestRestoreServices.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
/// <summary>
|
||||
/// 资源清单文件处理服务接口
|
||||
/// </summary>
|
||||
public interface IManifestRestoreServices
|
||||
{
|
||||
/// <summary>
|
||||
/// 还原资源清单(解压或解密)
|
||||
/// </summary>
|
||||
byte[] RestoreManifest(byte[] fileData);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b17060f9f11771e4cbcb0201fce446e6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,19 +0,0 @@
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
/// <summary>
|
||||
/// 资源清单文件处理服务接口
|
||||
/// </summary>
|
||||
public interface IManifestServices
|
||||
{
|
||||
/// <summary>
|
||||
/// 处理资源清单(压缩和加密)
|
||||
/// </summary>
|
||||
byte[] ProcessManifest(byte[] fileData);
|
||||
|
||||
/// <summary>
|
||||
/// 还原资源清单(解压和解密)
|
||||
/// </summary>
|
||||
byte[] RestoreManifest(byte[] fileData);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8c5a1726d94498e4cbe30f5f510cc796
|
||||
guid: 36626e333f5e25c4581bc91db0189714
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
@@ -0,0 +1,48 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
public class PreprocessBuildCatalog : UnityEditor.Build.IPreprocessBuildWithReport
|
||||
{
|
||||
public int callbackOrder { get { return 0; } }
|
||||
|
||||
/// <summary>
|
||||
/// 在构建应用程序前自动生成内置资源目录文件。
|
||||
/// 原理:搜索StreamingAssets目录下的所有资源文件,将这些文件信息写入文件,然后在运行时做查询用途。
|
||||
/// </summary>
|
||||
public void OnPreprocessBuild(UnityEditor.Build.Reporting.BuildReport report)
|
||||
{
|
||||
YooLogger.Log("Begin to create catalog file !");
|
||||
|
||||
string rootPath = YooAssetSettingsData.GetYooDefaultBuildinRoot();
|
||||
DirectoryInfo rootDirectory = new DirectoryInfo(rootPath);
|
||||
if (rootDirectory.Exists == false)
|
||||
{
|
||||
Debug.LogWarning($"Can not found StreamingAssets root directory : {rootPath}");
|
||||
return;
|
||||
}
|
||||
|
||||
// 搜索所有Package目录
|
||||
DirectoryInfo[] subDirectories = rootDirectory.GetDirectories();
|
||||
foreach (var subDirectory in subDirectories)
|
||||
{
|
||||
string packageName = subDirectory.Name;
|
||||
string pacakgeDirectory = subDirectory.FullName;
|
||||
try
|
||||
{
|
||||
bool result = CatalogTools.CreateCatalogFile(null, packageName, pacakgeDirectory); //TODO 自行处理解密
|
||||
if (result == false)
|
||||
{
|
||||
Debug.LogError($"Create package {packageName} catalog file failed ! See the detail error in console !");
|
||||
}
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
Debug.LogError($"Create package {packageName} catalog file failed ! {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bcc739bb54706c347b7ee54cbe51b69c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,98 @@
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
internal class FileSystemTester
|
||||
{
|
||||
public IEnumerator RunTester(IFileSystem fileSystem, string testLocation)
|
||||
{
|
||||
string packageName = fileSystem.PackageName;
|
||||
|
||||
// 初始化小游戏文件系统
|
||||
Debug.Log("初始化小游戏文件系统!");
|
||||
var initializeFileSystemOp = fileSystem.InitializeFileSystemAsync();
|
||||
OperationSystem.StartOperation(packageName, initializeFileSystemOp);
|
||||
yield return initializeFileSystemOp;
|
||||
if (initializeFileSystemOp.Status != EOperationStatus.Succeed)
|
||||
{
|
||||
Debug.LogError($"初始化小游戏文件系统失败!{initializeFileSystemOp.Error}");
|
||||
yield break;
|
||||
}
|
||||
|
||||
// 请求资源版本
|
||||
Debug.Log("请求资源版本信息!");
|
||||
var requestPackageVersionOp = fileSystem.RequestPackageVersionAsync(true, 60);
|
||||
OperationSystem.StartOperation(packageName, requestPackageVersionOp);
|
||||
yield return requestPackageVersionOp;
|
||||
if (requestPackageVersionOp.Status != EOperationStatus.Succeed)
|
||||
{
|
||||
Debug.LogError($"请求资源版本信息失败!{requestPackageVersionOp.Error}");
|
||||
yield break;
|
||||
}
|
||||
|
||||
// 请求资源清单
|
||||
string packageVersion = requestPackageVersionOp.PackageVersion;
|
||||
Debug.Log($"加载资源清单文件!{packageVersion}");
|
||||
var loadPackageManifestOp = fileSystem.LoadPackageManifestAsync(packageVersion, 60);
|
||||
OperationSystem.StartOperation(packageName, loadPackageManifestOp);
|
||||
yield return loadPackageManifestOp;
|
||||
if (loadPackageManifestOp.Status != EOperationStatus.Succeed)
|
||||
{
|
||||
Debug.LogError($"加载资源清单文件失败!{loadPackageManifestOp.Error}");
|
||||
yield break;
|
||||
}
|
||||
|
||||
// 预下载资源包
|
||||
Debug.Log("预下载资源包!");
|
||||
{
|
||||
var manifest = loadPackageManifestOp.Manifest;
|
||||
var packageBundle = GetPackageBundle(manifest, testLocation);
|
||||
var options = new DownloadFileOptions(1);
|
||||
var downloadFileOp = fileSystem.DownloadFileAsync(packageBundle, options);
|
||||
OperationSystem.StartOperation(packageName, downloadFileOp);
|
||||
yield return downloadFileOp;
|
||||
if (downloadFileOp.Status != EOperationStatus.Succeed)
|
||||
{
|
||||
Debug.LogError($"预下载资源包失败!{downloadFileOp.Error}");
|
||||
yield break;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("预下载资源包成功!");
|
||||
}
|
||||
}
|
||||
|
||||
// 加载资源包
|
||||
Debug.Log("加载资源包!");
|
||||
{
|
||||
var manifest = loadPackageManifestOp.Manifest;
|
||||
var packageBundle = GetPackageBundle(manifest, testLocation);
|
||||
var loadBundleFileOp = fileSystem.LoadBundleFile(packageBundle);
|
||||
OperationSystem.StartOperation(packageName, loadBundleFileOp);
|
||||
yield return loadBundleFileOp;
|
||||
if (loadBundleFileOp.Status != EOperationStatus.Succeed)
|
||||
{
|
||||
Debug.LogError($"加载资源包失败!{loadBundleFileOp.Error}");
|
||||
yield break;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("加载资源包成功!");
|
||||
}
|
||||
|
||||
// 卸载资源包
|
||||
loadBundleFileOp.Result.UnloadBundleFile();
|
||||
}
|
||||
|
||||
Debug.Log("完整测试成功!");
|
||||
}
|
||||
|
||||
private PackageBundle GetPackageBundle(PackageManifest manifest, string location)
|
||||
{
|
||||
var assetInfo = manifest.ConvertLocationToAssetInfo(location, typeof(GameObject));
|
||||
var packageBundle = manifest.GetMainPackageBundle(assetInfo.Asset);
|
||||
return packageBundle;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 19ed2b81fece5b84fa771a5eeb108572
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,49 @@
|
||||
#if UNITY_WEBGL && DOUYINMINIGAME
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
internal class TiktokFileSystemTest : MonoBehaviour
|
||||
{
|
||||
private void Awake()
|
||||
{
|
||||
YooAssets.Initialize();
|
||||
}
|
||||
|
||||
private IEnumerator Start()
|
||||
{
|
||||
string packageName = "DefaultPackage";
|
||||
string testLocation = "asteroid01";
|
||||
string hostServer = "http://127.0.0.1/CDN/WebGL/yoo";
|
||||
string packageRoot = $"{StarkSDKSpace.StarkFileSystemManager.USER_DATA_PATH}/__GAME_FILE_CACHE";
|
||||
|
||||
IRemoteServices remoteServices = new RemoteServices(hostServer);
|
||||
TiktokFileSystem fileSystem = new TiktokFileSystem();
|
||||
fileSystem.SetParameter(FileSystemParametersDefine.REMOTE_SERVICES, remoteServices);
|
||||
fileSystem.OnCreate(packageName, packageRoot);
|
||||
|
||||
FileSystemTester tester = new FileSystemTester();
|
||||
yield return tester.RunTester(fileSystem, testLocation);
|
||||
}
|
||||
|
||||
private class RemoteServices : IRemoteServices
|
||||
{
|
||||
private readonly string _hostServer;
|
||||
|
||||
public RemoteServices(string hostServer)
|
||||
{
|
||||
_hostServer = hostServer;
|
||||
}
|
||||
string IRemoteServices.GetRemoteMainURL(string fileName)
|
||||
{
|
||||
return $"{_hostServer}/{fileName}";
|
||||
}
|
||||
string IRemoteServices.GetRemoteFallbackURL(string fileName)
|
||||
{
|
||||
return $"{_hostServer}/{fileName}";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ec9d17e765ccd4642aa3aa9ca0580799
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,49 @@
|
||||
#if UNITY_WEBGL && WEIXINMINIGAME
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
internal class WechatFileSystemTest : MonoBehaviour
|
||||
{
|
||||
private void Awake()
|
||||
{
|
||||
YooAssets.Initialize();
|
||||
}
|
||||
|
||||
private IEnumerator Start()
|
||||
{
|
||||
string packageName = "DefaultPackage";
|
||||
string testLocation = "asteroid01";
|
||||
string hostServer = "http://127.0.0.1/CDN/WebGL/yoo";
|
||||
string packageRoot = $"{WeChatWASM.WX.env.USER_DATA_PATH}/__GAME_FILE_CACHE";
|
||||
|
||||
IRemoteServices remoteServices = new RemoteServices(hostServer);
|
||||
WechatFileSystem fileSystem = new WechatFileSystem();
|
||||
fileSystem.SetParameter(FileSystemParametersDefine.REMOTE_SERVICES, remoteServices);
|
||||
fileSystem.OnCreate(packageName, packageRoot);
|
||||
|
||||
FileSystemTester tester = new FileSystemTester();
|
||||
yield return tester.RunTester(fileSystem, testLocation);
|
||||
}
|
||||
|
||||
private class RemoteServices : IRemoteServices
|
||||
{
|
||||
private readonly string _hostServer;
|
||||
|
||||
public RemoteServices(string hostServer)
|
||||
{
|
||||
_hostServer = hostServer;
|
||||
}
|
||||
string IRemoteServices.GetRemoteMainURL(string fileName)
|
||||
{
|
||||
return $"{_hostServer}/{fileName}";
|
||||
}
|
||||
string IRemoteServices.GetRemoteFallbackURL(string fileName)
|
||||
{
|
||||
return $"{_hostServer}/{fileName}";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3036392c24e1a3b49b7628fbf6cc24d8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -15,7 +15,7 @@ internal class TTFSDownloadFileOperation : FSDownloadFileOperation
|
||||
|
||||
private readonly TiktokFileSystem _fileSystem;
|
||||
private readonly DownloadFileOptions _options;
|
||||
private UnityWebCacheRequestOperation _unityWebCacheRequestOp;
|
||||
private UnityWebCacheRequestOperation _webCacheRequestOp;
|
||||
private int _requestCount = 0;
|
||||
private float _tryAgainTimer;
|
||||
private int _failedTryAgain;
|
||||
@@ -36,21 +36,23 @@ internal class TTFSDownloadFileOperation : FSDownloadFileOperation
|
||||
if (_steps == ESteps.CreateRequest)
|
||||
{
|
||||
string url = GetRequestURL();
|
||||
_unityWebCacheRequestOp = new UnityWebCacheRequestOperation(url);
|
||||
_unityWebCacheRequestOp.StartOperation();
|
||||
_webCacheRequestOp = new UnityWebCacheRequestOperation(url);
|
||||
_webCacheRequestOp.StartOperation();
|
||||
AddChildOperation(_webCacheRequestOp);
|
||||
_steps = ESteps.CheckRequest;
|
||||
}
|
||||
|
||||
// 检测下载结果
|
||||
if (_steps == ESteps.CheckRequest)
|
||||
{
|
||||
Progress = _unityWebCacheRequestOp.Progress;
|
||||
DownloadProgress = _unityWebCacheRequestOp.DownloadProgress;
|
||||
DownloadedBytes = (long)_unityWebCacheRequestOp.DownloadedBytes;
|
||||
if (_unityWebCacheRequestOp.IsDone == false)
|
||||
_webCacheRequestOp.UpdateOperation();
|
||||
Progress = _webCacheRequestOp.Progress;
|
||||
DownloadProgress = _webCacheRequestOp.DownloadProgress;
|
||||
DownloadedBytes = (long)_webCacheRequestOp.DownloadedBytes;
|
||||
if (_webCacheRequestOp.IsDone == false)
|
||||
return;
|
||||
|
||||
if (_unityWebCacheRequestOp.Status == EOperationStatus.Succeed)
|
||||
if (_webCacheRequestOp.Status == EOperationStatus.Succeed)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Succeed;
|
||||
@@ -65,13 +67,13 @@ internal class TTFSDownloadFileOperation : FSDownloadFileOperation
|
||||
if (_failedTryAgain > 0)
|
||||
{
|
||||
_steps = ESteps.TryAgain;
|
||||
YooLogger.Warning($"Failed download : {_unityWebCacheRequestOp.URL} Try again !");
|
||||
YooLogger.Warning($"Failed download : {_webCacheRequestOp.URL} Try again !");
|
||||
}
|
||||
else
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = _unityWebCacheRequestOp.Error;
|
||||
Error = _webCacheRequestOp.Error;
|
||||
YooLogger.Error(Error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,9 +54,9 @@ internal class TTFSLoadBundleOperation : FSLoadBundleOperation
|
||||
}
|
||||
|
||||
_loadWebAssetBundleOp.UpdateOperation();
|
||||
Progress = _loadWebAssetBundleOp.Progress;
|
||||
DownloadProgress = _loadWebAssetBundleOp.DownloadProgress;
|
||||
DownloadedBytes = (long)_loadWebAssetBundleOp.DownloadedBytes;
|
||||
Progress = DownloadProgress;
|
||||
if (_loadWebAssetBundleOp.IsDone == false)
|
||||
return;
|
||||
|
||||
|
||||
@@ -176,10 +176,10 @@ internal class TiktokFileSystem : IFileSystem
|
||||
YooLogger.Warning($"Invalid parameter : {name}");
|
||||
}
|
||||
}
|
||||
public virtual void OnCreate(string packageName, string rootDirectory)
|
||||
public virtual void OnCreate(string packageName, string packageRoot)
|
||||
{
|
||||
PackageName = packageName;
|
||||
_ttCacheRoot = rootDirectory;
|
||||
_ttCacheRoot = packageRoot;
|
||||
|
||||
if (string.IsNullOrEmpty(_ttCacheRoot))
|
||||
{
|
||||
|
||||
@@ -15,7 +15,7 @@ internal class WXFSDownloadFileOperation : FSDownloadFileOperation
|
||||
|
||||
private readonly WechatFileSystem _fileSystem;
|
||||
private readonly DownloadFileOptions _options;
|
||||
private UnityWebCacheRequestOperation _unityWebCacheRequestOp;
|
||||
private UnityWebCacheRequestOperation _webCacheRequestOp;
|
||||
private int _requestCount = 0;
|
||||
private float _tryAgainTimer;
|
||||
private int _failedTryAgain;
|
||||
@@ -36,24 +36,24 @@ internal class WXFSDownloadFileOperation : FSDownloadFileOperation
|
||||
if (_steps == ESteps.CreateRequest)
|
||||
{
|
||||
string url = GetRequestURL();
|
||||
_unityWebCacheRequestOp = new UnityWebCacheRequestOperation(url);
|
||||
_unityWebCacheRequestOp.SetRequestHeader("wechatminigame-preload", "1");
|
||||
_unityWebCacheRequestOp.StartOperation();
|
||||
AddChildOperation(_unityWebCacheRequestOp);
|
||||
_webCacheRequestOp = new UnityWebCacheRequestOperation(url);
|
||||
_webCacheRequestOp.SetRequestHeader("wechatminigame-preload", "1");
|
||||
_webCacheRequestOp.StartOperation();
|
||||
AddChildOperation(_webCacheRequestOp);
|
||||
_steps = ESteps.CheckRequest;
|
||||
}
|
||||
|
||||
// 检测下载结果
|
||||
if (_steps == ESteps.CheckRequest)
|
||||
{
|
||||
_unityWebCacheRequestOp.UpdateOperation();
|
||||
Progress = _unityWebCacheRequestOp.Progress;
|
||||
DownloadProgress = _unityWebCacheRequestOp.DownloadProgress;
|
||||
DownloadedBytes = (long)_unityWebCacheRequestOp.DownloadedBytes;
|
||||
if (_unityWebCacheRequestOp.IsDone == false)
|
||||
_webCacheRequestOp.UpdateOperation();
|
||||
Progress = _webCacheRequestOp.Progress;
|
||||
DownloadProgress = _webCacheRequestOp.DownloadProgress;
|
||||
DownloadedBytes = (long)_webCacheRequestOp.DownloadedBytes;
|
||||
if (_webCacheRequestOp.IsDone == false)
|
||||
return;
|
||||
|
||||
if (_unityWebCacheRequestOp.Status == EOperationStatus.Succeed)
|
||||
if (_webCacheRequestOp.Status == EOperationStatus.Succeed)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Succeed;
|
||||
@@ -69,13 +69,13 @@ internal class WXFSDownloadFileOperation : FSDownloadFileOperation
|
||||
if (_failedTryAgain > 0)
|
||||
{
|
||||
_steps = ESteps.TryAgain;
|
||||
YooLogger.Warning($"Failed download : {_unityWebCacheRequestOp.URL} Try again !");
|
||||
YooLogger.Warning($"Failed download : {_webCacheRequestOp.URL} Try again !");
|
||||
}
|
||||
else
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = _unityWebCacheRequestOp.Error;
|
||||
Error = _webCacheRequestOp.Error;
|
||||
YooLogger.Error(Error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,9 +53,9 @@ internal class WXFSLoadBundleOperation : FSLoadBundleOperation
|
||||
}
|
||||
|
||||
_loadWebAssetBundleOp.UpdateOperation();
|
||||
Progress = _loadWebAssetBundleOp.Progress;
|
||||
DownloadProgress = _loadWebAssetBundleOp.DownloadProgress;
|
||||
DownloadedBytes = (long)_loadWebAssetBundleOp.DownloadedBytes;
|
||||
Progress = DownloadProgress;
|
||||
if (_loadWebAssetBundleOp.IsDone == false)
|
||||
return;
|
||||
|
||||
|
||||
@@ -96,12 +96,6 @@ namespace YooAsset
|
||||
}
|
||||
}
|
||||
}
|
||||
internal override void InternalAbort()
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
if (_unityWechatAssetBundleRequestOp != null)
|
||||
_unityWechatAssetBundleRequestOp.AbortOperation();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取网络请求地址
|
||||
|
||||
8
Assets/YooAsset/Samples~/Mini Game/Scenes.meta
Normal file
8
Assets/YooAsset/Samples~/Mini Game/Scenes.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0f79d08cddb5196408cff10f6750ae69
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,449 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!29 &1
|
||||
OcclusionCullingSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_OcclusionBakeSettings:
|
||||
smallestOccluder: 5
|
||||
smallestHole: 0.25
|
||||
backfaceThreshold: 100
|
||||
m_SceneGUID: 00000000000000000000000000000000
|
||||
m_OcclusionCullingData: {fileID: 0}
|
||||
--- !u!104 &2
|
||||
RenderSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 9
|
||||
m_Fog: 0
|
||||
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
|
||||
m_FogMode: 3
|
||||
m_FogDensity: 0.01
|
||||
m_LinearFogStart: 0
|
||||
m_LinearFogEnd: 300
|
||||
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
|
||||
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
|
||||
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
|
||||
m_AmbientIntensity: 1
|
||||
m_AmbientMode: 0
|
||||
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
|
||||
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_HaloStrength: 0.5
|
||||
m_FlareStrength: 1
|
||||
m_FlareFadeSpeed: 3
|
||||
m_HaloTexture: {fileID: 0}
|
||||
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_DefaultReflectionMode: 0
|
||||
m_DefaultReflectionResolution: 128
|
||||
m_ReflectionBounces: 1
|
||||
m_ReflectionIntensity: 1
|
||||
m_CustomReflection: {fileID: 0}
|
||||
m_Sun: {fileID: 0}
|
||||
m_IndirectSpecularColor: {r: 0.3730807, g: 0.380755, b: 0.35876408, a: 1}
|
||||
m_UseRadianceAmbientProbe: 0
|
||||
--- !u!157 &3
|
||||
LightmapSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 12
|
||||
m_GIWorkflowMode: 1
|
||||
m_GISettings:
|
||||
serializedVersion: 2
|
||||
m_BounceScale: 1
|
||||
m_IndirectOutputScale: 1
|
||||
m_AlbedoBoost: 1
|
||||
m_EnvironmentLightingMode: 0
|
||||
m_EnableBakedLightmaps: 1
|
||||
m_EnableRealtimeLightmaps: 0
|
||||
m_LightmapEditorSettings:
|
||||
serializedVersion: 12
|
||||
m_Resolution: 2
|
||||
m_BakeResolution: 40
|
||||
m_AtlasSize: 1024
|
||||
m_AO: 0
|
||||
m_AOMaxDistance: 1
|
||||
m_CompAOExponent: 1
|
||||
m_CompAOExponentDirect: 0
|
||||
m_ExtractAmbientOcclusion: 0
|
||||
m_Padding: 2
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_LightmapsBakeMode: 1
|
||||
m_TextureCompression: 1
|
||||
m_FinalGather: 0
|
||||
m_FinalGatherFiltering: 1
|
||||
m_FinalGatherRayCount: 256
|
||||
m_ReflectionCompression: 2
|
||||
m_MixedBakeMode: 2
|
||||
m_BakeBackend: 1
|
||||
m_PVRSampling: 1
|
||||
m_PVRDirectSampleCount: 32
|
||||
m_PVRSampleCount: 512
|
||||
m_PVRBounces: 2
|
||||
m_PVREnvironmentSampleCount: 256
|
||||
m_PVREnvironmentReferencePointCount: 2048
|
||||
m_PVRFilteringMode: 1
|
||||
m_PVRDenoiserTypeDirect: 1
|
||||
m_PVRDenoiserTypeIndirect: 1
|
||||
m_PVRDenoiserTypeAO: 1
|
||||
m_PVRFilterTypeDirect: 0
|
||||
m_PVRFilterTypeIndirect: 0
|
||||
m_PVRFilterTypeAO: 0
|
||||
m_PVREnvironmentMIS: 1
|
||||
m_PVRCulling: 1
|
||||
m_PVRFilteringGaussRadiusDirect: 1
|
||||
m_PVRFilteringGaussRadiusIndirect: 5
|
||||
m_PVRFilteringGaussRadiusAO: 2
|
||||
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
|
||||
m_PVRFilteringAtrousPositionSigmaIndirect: 2
|
||||
m_PVRFilteringAtrousPositionSigmaAO: 1
|
||||
m_ExportTrainingData: 0
|
||||
m_TrainingDataDestination: TrainingData
|
||||
m_LightProbeSampleCountMultiplier: 4
|
||||
m_LightingDataAsset: {fileID: 0}
|
||||
m_LightingSettings: {fileID: 0}
|
||||
--- !u!196 &4
|
||||
NavMeshSettings:
|
||||
serializedVersion: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_BuildSettings:
|
||||
serializedVersion: 3
|
||||
agentTypeID: 0
|
||||
agentRadius: 0.5
|
||||
agentHeight: 2
|
||||
agentSlope: 45
|
||||
agentClimb: 0.4
|
||||
ledgeDropHeight: 0
|
||||
maxJumpAcrossDistance: 0
|
||||
minRegionArea: 2
|
||||
manualCellSize: 0
|
||||
cellSize: 0.16666667
|
||||
manualTileSize: 0
|
||||
tileSize: 256
|
||||
buildHeightMesh: 0
|
||||
maxJobWorkers: 0
|
||||
preserveTilesOutsideBounds: 0
|
||||
debug:
|
||||
m_Flags: 0
|
||||
m_NavMeshData: {fileID: 0}
|
||||
--- !u!1 &749215248
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 749215251}
|
||||
- component: {fileID: 749215250}
|
||||
- component: {fileID: 749215249}
|
||||
m_Layer: 0
|
||||
m_Name: Main Camera
|
||||
m_TagString: MainCamera
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!81 &749215249
|
||||
AudioListener:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 749215248}
|
||||
m_Enabled: 1
|
||||
--- !u!20 &749215250
|
||||
Camera:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 749215248}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_ClearFlags: 2
|
||||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
|
||||
m_projectionMatrixMode: 1
|
||||
m_GateFitMode: 2
|
||||
m_FOVAxisMode: 0
|
||||
m_Iso: 200
|
||||
m_ShutterSpeed: 0.005
|
||||
m_Aperture: 16
|
||||
m_FocusDistance: 10
|
||||
m_FocalLength: 50
|
||||
m_BladeCount: 5
|
||||
m_Curvature: {x: 2, y: 11}
|
||||
m_BarrelClipping: 0.25
|
||||
m_Anamorphism: 0
|
||||
m_SensorSize: {x: 36, y: 24}
|
||||
m_LensShift: {x: 0, y: 0}
|
||||
m_NormalizedViewPortRect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 1
|
||||
height: 1
|
||||
near clip plane: 0.3
|
||||
far clip plane: 1000
|
||||
field of view: 60
|
||||
orthographic: 0
|
||||
orthographic size: 5
|
||||
m_Depth: -1
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_RenderingPath: -1
|
||||
m_TargetTexture: {fileID: 0}
|
||||
m_TargetDisplay: 0
|
||||
m_TargetEye: 3
|
||||
m_HDR: 1
|
||||
m_AllowMSAA: 1
|
||||
m_AllowDynamicResolution: 0
|
||||
m_ForceIntoRT: 0
|
||||
m_OcclusionCulling: 1
|
||||
m_StereoConvergence: 10
|
||||
m_StereoSeparation: 0.022
|
||||
--- !u!4 &749215251
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 749215248}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 1, z: -10}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &821591607
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 821591609}
|
||||
- component: {fileID: 821591610}
|
||||
m_Layer: 0
|
||||
m_Name: Test
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &821591609
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 821591607}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &821591610
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 821591607}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: ec9d17e765ccd4642aa3aa9ca0580799, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &941113990
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 941113991}
|
||||
- component: {fileID: 941113993}
|
||||
- component: {fileID: 941113992}
|
||||
m_Layer: 5
|
||||
m_Name: Text
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &941113991
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 941113990}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1861717922}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &941113992
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 941113990}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_FontData:
|
||||
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_FontSize: 60
|
||||
m_FontStyle: 1
|
||||
m_BestFit: 0
|
||||
m_MinSize: 6
|
||||
m_MaxSize: 60
|
||||
m_Alignment: 4
|
||||
m_AlignByGeometry: 0
|
||||
m_RichText: 1
|
||||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: "\u5C0F\u6E38\u620F\u6D4B\u8BD5\u7528\u4F8B\uFF0C\u65E5\u5FD7\u8BF7\u67E5\u770B\u5C0F\u6E38\u620F\u5F00\u53D1\u8005\u5DE5\u5177\uFF01"
|
||||
--- !u!222 &941113993
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 941113990}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1 &1861717918
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1861717922}
|
||||
- component: {fileID: 1861717921}
|
||||
- component: {fileID: 1861717920}
|
||||
- component: {fileID: 1861717919}
|
||||
m_Layer: 5
|
||||
m_Name: Canvas
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &1861717919
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1861717918}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_IgnoreReversedGraphics: 1
|
||||
m_BlockingObjects: 0
|
||||
m_BlockingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
--- !u!114 &1861717920
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1861717918}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_UiScaleMode: 0
|
||||
m_ReferencePixelsPerUnit: 100
|
||||
m_ScaleFactor: 1
|
||||
m_ReferenceResolution: {x: 800, y: 600}
|
||||
m_ScreenMatchMode: 0
|
||||
m_MatchWidthOrHeight: 0
|
||||
m_PhysicalUnit: 3
|
||||
m_FallbackScreenDPI: 96
|
||||
m_DefaultSpriteDPI: 96
|
||||
m_DynamicPixelsPerUnit: 1
|
||||
m_PresetInfoIsWorld: 0
|
||||
--- !u!223 &1861717921
|
||||
Canvas:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1861717918}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_RenderMode: 0
|
||||
m_Camera: {fileID: 0}
|
||||
m_PlaneDistance: 100
|
||||
m_PixelPerfect: 0
|
||||
m_ReceivesEvents: 1
|
||||
m_OverrideSorting: 0
|
||||
m_OverridePixelPerfect: 0
|
||||
m_SortingBucketNormalizedSize: 0
|
||||
m_VertexColorAlwaysGammaSpace: 0
|
||||
m_AdditionalShaderChannelsFlag: 0
|
||||
m_UpdateRectTransformForStandalone: 0
|
||||
m_SortingLayerID: 0
|
||||
m_SortingOrder: 0
|
||||
m_TargetDisplay: 0
|
||||
--- !u!224 &1861717922
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1861717918}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 0, y: 0, z: 0}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 941113991}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0, y: 0}
|
||||
--- !u!1660057539 &9223372036854775807
|
||||
SceneRoots:
|
||||
m_ObjectHideFlags: 0
|
||||
m_Roots:
|
||||
- {fileID: 749215251}
|
||||
- {fileID: 821591609}
|
||||
- {fileID: 1861717922}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4fdc3ec5aeab28849a55f4ec8619e04c
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,449 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!29 &1
|
||||
OcclusionCullingSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_OcclusionBakeSettings:
|
||||
smallestOccluder: 5
|
||||
smallestHole: 0.25
|
||||
backfaceThreshold: 100
|
||||
m_SceneGUID: 00000000000000000000000000000000
|
||||
m_OcclusionCullingData: {fileID: 0}
|
||||
--- !u!104 &2
|
||||
RenderSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 9
|
||||
m_Fog: 0
|
||||
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
|
||||
m_FogMode: 3
|
||||
m_FogDensity: 0.01
|
||||
m_LinearFogStart: 0
|
||||
m_LinearFogEnd: 300
|
||||
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
|
||||
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
|
||||
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
|
||||
m_AmbientIntensity: 1
|
||||
m_AmbientMode: 0
|
||||
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
|
||||
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_HaloStrength: 0.5
|
||||
m_FlareStrength: 1
|
||||
m_FlareFadeSpeed: 3
|
||||
m_HaloTexture: {fileID: 0}
|
||||
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_DefaultReflectionMode: 0
|
||||
m_DefaultReflectionResolution: 128
|
||||
m_ReflectionBounces: 1
|
||||
m_ReflectionIntensity: 1
|
||||
m_CustomReflection: {fileID: 0}
|
||||
m_Sun: {fileID: 0}
|
||||
m_IndirectSpecularColor: {r: 0.3730807, g: 0.380755, b: 0.35876408, a: 1}
|
||||
m_UseRadianceAmbientProbe: 0
|
||||
--- !u!157 &3
|
||||
LightmapSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 12
|
||||
m_GIWorkflowMode: 1
|
||||
m_GISettings:
|
||||
serializedVersion: 2
|
||||
m_BounceScale: 1
|
||||
m_IndirectOutputScale: 1
|
||||
m_AlbedoBoost: 1
|
||||
m_EnvironmentLightingMode: 0
|
||||
m_EnableBakedLightmaps: 1
|
||||
m_EnableRealtimeLightmaps: 0
|
||||
m_LightmapEditorSettings:
|
||||
serializedVersion: 12
|
||||
m_Resolution: 2
|
||||
m_BakeResolution: 40
|
||||
m_AtlasSize: 1024
|
||||
m_AO: 0
|
||||
m_AOMaxDistance: 1
|
||||
m_CompAOExponent: 1
|
||||
m_CompAOExponentDirect: 0
|
||||
m_ExtractAmbientOcclusion: 0
|
||||
m_Padding: 2
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_LightmapsBakeMode: 1
|
||||
m_TextureCompression: 1
|
||||
m_FinalGather: 0
|
||||
m_FinalGatherFiltering: 1
|
||||
m_FinalGatherRayCount: 256
|
||||
m_ReflectionCompression: 2
|
||||
m_MixedBakeMode: 2
|
||||
m_BakeBackend: 1
|
||||
m_PVRSampling: 1
|
||||
m_PVRDirectSampleCount: 32
|
||||
m_PVRSampleCount: 512
|
||||
m_PVRBounces: 2
|
||||
m_PVREnvironmentSampleCount: 256
|
||||
m_PVREnvironmentReferencePointCount: 2048
|
||||
m_PVRFilteringMode: 1
|
||||
m_PVRDenoiserTypeDirect: 1
|
||||
m_PVRDenoiserTypeIndirect: 1
|
||||
m_PVRDenoiserTypeAO: 1
|
||||
m_PVRFilterTypeDirect: 0
|
||||
m_PVRFilterTypeIndirect: 0
|
||||
m_PVRFilterTypeAO: 0
|
||||
m_PVREnvironmentMIS: 1
|
||||
m_PVRCulling: 1
|
||||
m_PVRFilteringGaussRadiusDirect: 1
|
||||
m_PVRFilteringGaussRadiusIndirect: 5
|
||||
m_PVRFilteringGaussRadiusAO: 2
|
||||
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
|
||||
m_PVRFilteringAtrousPositionSigmaIndirect: 2
|
||||
m_PVRFilteringAtrousPositionSigmaAO: 1
|
||||
m_ExportTrainingData: 0
|
||||
m_TrainingDataDestination: TrainingData
|
||||
m_LightProbeSampleCountMultiplier: 4
|
||||
m_LightingDataAsset: {fileID: 0}
|
||||
m_LightingSettings: {fileID: 0}
|
||||
--- !u!196 &4
|
||||
NavMeshSettings:
|
||||
serializedVersion: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_BuildSettings:
|
||||
serializedVersion: 3
|
||||
agentTypeID: 0
|
||||
agentRadius: 0.5
|
||||
agentHeight: 2
|
||||
agentSlope: 45
|
||||
agentClimb: 0.4
|
||||
ledgeDropHeight: 0
|
||||
maxJumpAcrossDistance: 0
|
||||
minRegionArea: 2
|
||||
manualCellSize: 0
|
||||
cellSize: 0.16666667
|
||||
manualTileSize: 0
|
||||
tileSize: 256
|
||||
buildHeightMesh: 0
|
||||
maxJobWorkers: 0
|
||||
preserveTilesOutsideBounds: 0
|
||||
debug:
|
||||
m_Flags: 0
|
||||
m_NavMeshData: {fileID: 0}
|
||||
--- !u!1 &749215248
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 749215251}
|
||||
- component: {fileID: 749215250}
|
||||
- component: {fileID: 749215249}
|
||||
m_Layer: 0
|
||||
m_Name: Main Camera
|
||||
m_TagString: MainCamera
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!81 &749215249
|
||||
AudioListener:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 749215248}
|
||||
m_Enabled: 1
|
||||
--- !u!20 &749215250
|
||||
Camera:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 749215248}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_ClearFlags: 2
|
||||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
|
||||
m_projectionMatrixMode: 1
|
||||
m_GateFitMode: 2
|
||||
m_FOVAxisMode: 0
|
||||
m_Iso: 200
|
||||
m_ShutterSpeed: 0.005
|
||||
m_Aperture: 16
|
||||
m_FocusDistance: 10
|
||||
m_FocalLength: 50
|
||||
m_BladeCount: 5
|
||||
m_Curvature: {x: 2, y: 11}
|
||||
m_BarrelClipping: 0.25
|
||||
m_Anamorphism: 0
|
||||
m_SensorSize: {x: 36, y: 24}
|
||||
m_LensShift: {x: 0, y: 0}
|
||||
m_NormalizedViewPortRect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 1
|
||||
height: 1
|
||||
near clip plane: 0.3
|
||||
far clip plane: 1000
|
||||
field of view: 60
|
||||
orthographic: 0
|
||||
orthographic size: 5
|
||||
m_Depth: -1
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_RenderingPath: -1
|
||||
m_TargetTexture: {fileID: 0}
|
||||
m_TargetDisplay: 0
|
||||
m_TargetEye: 3
|
||||
m_HDR: 1
|
||||
m_AllowMSAA: 1
|
||||
m_AllowDynamicResolution: 0
|
||||
m_ForceIntoRT: 0
|
||||
m_OcclusionCulling: 1
|
||||
m_StereoConvergence: 10
|
||||
m_StereoSeparation: 0.022
|
||||
--- !u!4 &749215251
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 749215248}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 1, z: -10}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &821591607
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 821591609}
|
||||
- component: {fileID: 821591610}
|
||||
m_Layer: 0
|
||||
m_Name: Test
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &821591609
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 821591607}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &821591610
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 821591607}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 3036392c24e1a3b49b7628fbf6cc24d8, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &941113990
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 941113991}
|
||||
- component: {fileID: 941113993}
|
||||
- component: {fileID: 941113992}
|
||||
m_Layer: 5
|
||||
m_Name: Text
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &941113991
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 941113990}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1861717922}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &941113992
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 941113990}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_FontData:
|
||||
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_FontSize: 60
|
||||
m_FontStyle: 1
|
||||
m_BestFit: 0
|
||||
m_MinSize: 6
|
||||
m_MaxSize: 60
|
||||
m_Alignment: 4
|
||||
m_AlignByGeometry: 0
|
||||
m_RichText: 1
|
||||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: "\u5C0F\u6E38\u620F\u6D4B\u8BD5\u7528\u4F8B\uFF0C\u65E5\u5FD7\u8BF7\u67E5\u770B\u5C0F\u6E38\u620F\u5F00\u53D1\u8005\u5DE5\u5177\uFF01"
|
||||
--- !u!222 &941113993
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 941113990}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1 &1861717918
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1861717922}
|
||||
- component: {fileID: 1861717921}
|
||||
- component: {fileID: 1861717920}
|
||||
- component: {fileID: 1861717919}
|
||||
m_Layer: 5
|
||||
m_Name: Canvas
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &1861717919
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1861717918}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_IgnoreReversedGraphics: 1
|
||||
m_BlockingObjects: 0
|
||||
m_BlockingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
--- !u!114 &1861717920
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1861717918}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_UiScaleMode: 0
|
||||
m_ReferencePixelsPerUnit: 100
|
||||
m_ScaleFactor: 1
|
||||
m_ReferenceResolution: {x: 800, y: 600}
|
||||
m_ScreenMatchMode: 0
|
||||
m_MatchWidthOrHeight: 0
|
||||
m_PhysicalUnit: 3
|
||||
m_FallbackScreenDPI: 96
|
||||
m_DefaultSpriteDPI: 96
|
||||
m_DynamicPixelsPerUnit: 1
|
||||
m_PresetInfoIsWorld: 0
|
||||
--- !u!223 &1861717921
|
||||
Canvas:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1861717918}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_RenderMode: 0
|
||||
m_Camera: {fileID: 0}
|
||||
m_PlaneDistance: 100
|
||||
m_PixelPerfect: 0
|
||||
m_ReceivesEvents: 1
|
||||
m_OverrideSorting: 0
|
||||
m_OverridePixelPerfect: 0
|
||||
m_SortingBucketNormalizedSize: 0
|
||||
m_VertexColorAlwaysGammaSpace: 0
|
||||
m_AdditionalShaderChannelsFlag: 0
|
||||
m_UpdateRectTransformForStandalone: 0
|
||||
m_SortingLayerID: 0
|
||||
m_SortingOrder: 0
|
||||
m_TargetDisplay: 0
|
||||
--- !u!224 &1861717922
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1861717918}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 0, y: 0, z: 0}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 941113991}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0, y: 0}
|
||||
--- !u!1660057539 &9223372036854775807
|
||||
SceneRoots:
|
||||
m_ObjectHideFlags: 0
|
||||
m_Roots:
|
||||
- {fileID: 749215251}
|
||||
- {fileID: 821591609}
|
||||
- {fileID: 1861717922}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2aba4dc1069712d4da0976a70c62e040
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
84
Assets/YooAsset/Samples~/Space Shooter/link.xml
Normal file
84
Assets/YooAsset/Samples~/Space Shooter/link.xml
Normal file
@@ -0,0 +1,84 @@
|
||||
<linker>
|
||||
<assembly fullname="Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
||||
<type fullname="BackgroundScroller" preserve="all" />
|
||||
<type fullname="EntityAsteroid" preserve="all" />
|
||||
<type fullname="EntityBullet" preserve="all" />
|
||||
<type fullname="EntityEffect" preserve="all" />
|
||||
<type fullname="EntityEnemy" preserve="all" />
|
||||
<type fullname="EntityPlayer" preserve="all" />
|
||||
<type fullname="SceneBattle" preserve="all" />
|
||||
<type fullname="SceneHome" preserve="all" />
|
||||
<type fullname="UIBattleWindow" preserve="all" />
|
||||
<type fullname="UIHomeWindow" preserve="all" />
|
||||
<type fullname="UILoadingWindow" preserve="all" />
|
||||
<type fullname="RoomBoundary" preserve="nothing" serialized="true" />
|
||||
</assembly>
|
||||
<assembly fullname="UnityEngine.AnimationModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
||||
<type fullname="UnityEngine.AnimationClip" preserve="all" />
|
||||
<type fullname="UnityEngine.Animator" preserve="all" />
|
||||
<type fullname="UnityEngine.RuntimeAnimatorController" preserve="all" />
|
||||
</assembly>
|
||||
<assembly fullname="UnityEngine.AudioModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
||||
<type fullname="UnityEngine.AudioClip" preserve="all" />
|
||||
<type fullname="UnityEngine.AudioListener" preserve="all" />
|
||||
<type fullname="UnityEngine.AudioSource" preserve="all" />
|
||||
</assembly>
|
||||
<assembly fullname="UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
||||
<type fullname="UnityEngine.Camera" preserve="all" />
|
||||
<type fullname="UnityEngine.Cubemap" preserve="all" />
|
||||
<type fullname="UnityEngine.GameObject" preserve="all" />
|
||||
<type fullname="UnityEngine.Light" preserve="all" />
|
||||
<type fullname="UnityEngine.LightingSettings" preserve="all" />
|
||||
<type fullname="UnityEngine.LightmapSettings" preserve="all" />
|
||||
<type fullname="UnityEngine.LightProbes" preserve="all" />
|
||||
<type fullname="UnityEngine.Material" preserve="all" />
|
||||
<type fullname="UnityEngine.Mesh" preserve="all" />
|
||||
<type fullname="UnityEngine.MeshFilter" preserve="all" />
|
||||
<type fullname="UnityEngine.MeshRenderer" preserve="all" />
|
||||
<type fullname="UnityEngine.Object" preserve="all" />
|
||||
<type fullname="UnityEngine.RectTransform" preserve="all" />
|
||||
<type fullname="UnityEngine.RenderSettings" preserve="all" />
|
||||
<type fullname="UnityEngine.Shader" preserve="all" />
|
||||
<type fullname="UnityEngine.ShaderVariantCollection" preserve="all" />
|
||||
<type fullname="UnityEngine.Sprite" preserve="all" />
|
||||
<type fullname="UnityEngine.TextAsset" preserve="all" />
|
||||
<type fullname="UnityEngine.Texture2D" preserve="all" />
|
||||
<type fullname="UnityEngine.Transform" preserve="all" />
|
||||
<type fullname="UnityEngine.U2D.SpriteAtlas" preserve="all" />
|
||||
<type fullname="UnityEngine.Events.PersistentCallGroup" preserve="nothing" serialized="true" />
|
||||
</assembly>
|
||||
<assembly fullname="UnityEngine.ParticleSystemModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
||||
<type fullname="UnityEngine.ParticleSystem" preserve="all" />
|
||||
<type fullname="UnityEngine.ParticleSystemRenderer" preserve="all" />
|
||||
</assembly>
|
||||
<assembly fullname="UnityEngine.PhysicsModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
||||
<type fullname="UnityEngine.BoxCollider" preserve="all" />
|
||||
<type fullname="UnityEngine.CapsuleCollider" preserve="all" />
|
||||
<type fullname="UnityEngine.MeshCollider" preserve="all" />
|
||||
<type fullname="UnityEngine.Rigidbody" preserve="all" />
|
||||
<type fullname="UnityEngine.SphereCollider" preserve="all" />
|
||||
</assembly>
|
||||
<assembly fullname="UnityEngine.TextRenderingModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
||||
<type fullname="UnityEngine.Font" preserve="all" />
|
||||
</assembly>
|
||||
<assembly fullname="UnityEngine.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
|
||||
<type fullname="UnityEngine.EventSystems.EventSystem" preserve="all" />
|
||||
<type fullname="UnityEngine.EventSystems.StandaloneInputModule" preserve="all" />
|
||||
<type fullname="UnityEngine.UI.Button" preserve="all" />
|
||||
<type fullname="UnityEngine.UI.CanvasScaler" preserve="all" />
|
||||
<type fullname="UnityEngine.UI.GraphicRaycaster" preserve="all" />
|
||||
<type fullname="UnityEngine.UI.Image" preserve="all" />
|
||||
<type fullname="UnityEngine.UI.Text" preserve="all" />
|
||||
<type fullname="UnityEngine.UI.AnimationTriggers" preserve="nothing" serialized="true" />
|
||||
<type fullname="UnityEngine.UI.Button/ButtonClickedEvent" preserve="nothing" serialized="true" />
|
||||
<type fullname="UnityEngine.UI.ColorBlock" preserve="nothing" serialized="true" />
|
||||
<type fullname="UnityEngine.UI.FontData" preserve="nothing" serialized="true" />
|
||||
<type fullname="UnityEngine.UI.MaskableGraphic/CullStateChangedEvent" preserve="nothing" serialized="true" />
|
||||
<type fullname="UnityEngine.UI.Navigation" preserve="nothing" serialized="true" />
|
||||
<type fullname="UnityEngine.UI.SpriteState" preserve="nothing" serialized="true" />
|
||||
</assembly>
|
||||
<assembly fullname="UnityEngine.UIModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
||||
<type fullname="UnityEngine.Canvas" preserve="all" />
|
||||
<type fullname="UnityEngine.CanvasRenderer" preserve="all" />
|
||||
</assembly>
|
||||
</linker>
|
||||
7
Assets/YooAsset/Samples~/Space Shooter/link.xml.meta
Normal file
7
Assets/YooAsset/Samples~/Space Shooter/link.xml.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c143f0e9e54b3fd438250e53ea8268a5
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -72,7 +72,8 @@ public static class TestPackageBuilder
|
||||
buildParameters.UseAssetDependencyDB = true;
|
||||
buildParameters.BuiltinShadersBundleName = builtinShaderBundleName;
|
||||
buildParameters.EncryptionServices = new TestFileStreamEncryption();
|
||||
buildParameters.ManifestServices = new TestProcessManifest();
|
||||
buildParameters.ManifestProcessServices = new TestProcessManifest();
|
||||
buildParameters.ManifestRestoreServices = new TestRestoreManifest();
|
||||
|
||||
var pipeline = new ScriptableBuildPipeline();
|
||||
BuildResult buildResult = pipeline.Run(buildParameters, false);
|
||||
@@ -110,7 +111,8 @@ public static class TestPackageBuilder
|
||||
buildParameters.ClearBuildCacheFiles = true;
|
||||
buildParameters.UseAssetDependencyDB = true;
|
||||
buildParameters.EncryptionServices = new TestFileStreamEncryption();
|
||||
buildParameters.ManifestServices = new TestProcessManifest();
|
||||
buildParameters.ManifestProcessServices = new TestProcessManifest();
|
||||
buildParameters.ManifestRestoreServices = new TestRestoreManifest();
|
||||
|
||||
var pipeline = new BuiltinBuildPipeline();
|
||||
BuildResult buildResult = pipeline.Run(buildParameters, false);
|
||||
|
||||
@@ -6,24 +6,31 @@ using UnityEngine;
|
||||
using NUnit.Framework;
|
||||
using YooAsset;
|
||||
|
||||
public class TestProcessManifest : IManifestServices
|
||||
public class TestProcessManifest : IManifestProcessServices
|
||||
{
|
||||
public byte[] ProcessManifest(byte[] fileData)
|
||||
byte[] IManifestProcessServices.ProcessManifest(byte[] fileData)
|
||||
{
|
||||
return XorProcess(fileData, "YOO");
|
||||
}
|
||||
public byte[] RestoreManifest(byte[] fileData)
|
||||
{
|
||||
return XorProcess(fileData, "YOO");
|
||||
return XorCrypto.Crypto(fileData, "YOO");
|
||||
}
|
||||
}
|
||||
|
||||
public class TestRestoreManifest : IManifestRestoreServices
|
||||
{
|
||||
byte[] IManifestRestoreServices.RestoreManifest(byte[] fileData)
|
||||
{
|
||||
return XorCrypto.Crypto(fileData, "YOO");
|
||||
}
|
||||
}
|
||||
|
||||
public class XorCrypto
|
||||
{
|
||||
/// <summary>
|
||||
/// 使用异或加密/解密字节数组
|
||||
/// </summary>
|
||||
/// <param name="data">输入数据</param>
|
||||
/// <param name="key">加密密钥</param>
|
||||
/// <returns>处理后的字节数组</returns>
|
||||
public static byte[] XorProcess(byte[] data, byte[] key)
|
||||
public static byte[] Crypto(byte[] data, byte[] key)
|
||||
{
|
||||
if (data == null)
|
||||
throw new ArgumentNullException(nameof(data));
|
||||
@@ -47,9 +54,9 @@ public class TestProcessManifest : IManifestServices
|
||||
/// <param name="data">输入数据</param>
|
||||
/// <param name="key">字符串密钥</param>
|
||||
/// <returns>处理后的字节数组</returns>
|
||||
public static byte[] XorProcess(byte[] data, string key)
|
||||
public static byte[] Crypto(byte[] data, string key)
|
||||
{
|
||||
byte[] keyBytes = System.Text.Encoding.UTF8.GetBytes(key);
|
||||
return XorProcess(data, keyBytes);
|
||||
return Crypto(data, keyBytes);
|
||||
}
|
||||
}
|
||||
@@ -89,7 +89,7 @@ public class T0_InitYooAssets : IPrebuildSetup, IPostBuildCleanup
|
||||
YooAsset.Editor.AssetBundleCollectorSettingData.CreateCollector(panelGroup, collector1);
|
||||
}
|
||||
|
||||
// 预制体(构建到一个AB)
|
||||
// 预制体
|
||||
var prefabGroup = YooAsset.Editor.AssetBundleCollectorSettingData.CreateGroup(testPackage, "PrefabGroup");
|
||||
{
|
||||
var collector1 = new YooAsset.Editor.AssetBundleCollector();
|
||||
@@ -166,15 +166,16 @@ public class T0_InitYooAssets : IPrebuildSetup, IPostBuildCleanup
|
||||
{
|
||||
var collector1 = new YooAsset.Editor.AssetBundleCollector();
|
||||
collector1.CollectPath = "";
|
||||
collector1.CollectorGUID = "e082d492b9da65e499cee3495be3645d"; //TestRes3/music目录
|
||||
collector1.CollectorGUID = "e082d492b9da65e499cee3495be3645d"; //TestRes3/encrypt目录
|
||||
collector1.CollectorType = YooAsset.Editor.ECollectorType.MainAssetCollector;
|
||||
collector1.PackRuleName = nameof(YooAsset.Editor.PackSeparately);
|
||||
YooAsset.Editor.AssetBundleCollectorSettingData.CreateCollector(encryptGroup, collector1);
|
||||
|
||||
var collector2 = new YooAsset.Editor.AssetBundleCollector();
|
||||
collector2.CollectPath = "";
|
||||
collector2.CollectorGUID = "8c5a1726d94498e4cbe30f5f510cc796"; //TestRes3/prefab目录
|
||||
collector2.CollectorGUID = "35f454fb80a715047bcf0ce30c7c4f18"; //TestRes3/import目录
|
||||
collector2.CollectorType = YooAsset.Editor.ECollectorType.MainAssetCollector;
|
||||
collector2.AssetTags = "import";
|
||||
collector2.PackRuleName = nameof(YooAsset.Editor.PackSeparately);
|
||||
YooAsset.Editor.AssetBundleCollectorSettingData.CreateCollector(encryptGroup, collector2);
|
||||
|
||||
@@ -185,14 +186,31 @@ public class T0_InitYooAssets : IPrebuildSetup, IPostBuildCleanup
|
||||
collector3.AssetTags = "unpack";
|
||||
collector3.PackRuleName = nameof(YooAsset.Editor.PackSeparately);
|
||||
YooAsset.Editor.AssetBundleCollectorSettingData.CreateCollector(encryptGroup, collector3);
|
||||
}
|
||||
|
||||
var collector4 = new YooAsset.Editor.AssetBundleCollector();
|
||||
collector4.CollectPath = "";
|
||||
collector4.CollectorGUID = "35f454fb80a715047bcf0ce30c7c4f18"; //TestRes3/import目录
|
||||
collector4.CollectorType = YooAsset.Editor.ECollectorType.MainAssetCollector;
|
||||
collector4.AssetTags = "import";
|
||||
collector4.PackRuleName = nameof(YooAsset.Editor.PackSeparately);
|
||||
YooAsset.Editor.AssetBundleCollectorSettingData.CreateCollector(encryptGroup, collector4);
|
||||
// 卸载测试文件
|
||||
var unloadGroup = YooAsset.Editor.AssetBundleCollectorSettingData.CreateGroup(testPackage, "UnloadGroup");
|
||||
{
|
||||
var collector1 = new YooAsset.Editor.AssetBundleCollector();
|
||||
collector1.CollectPath = "";
|
||||
collector1.CollectorGUID = "c8cebdb7cd80a4044b15a1522363bb86"; //TestRes4/Enemy目录
|
||||
collector1.CollectorType = YooAsset.Editor.ECollectorType.MainAssetCollector;
|
||||
collector1.PackRuleName = nameof(YooAsset.Editor.PackDirectory);
|
||||
YooAsset.Editor.AssetBundleCollectorSettingData.CreateCollector(unloadGroup, collector1);
|
||||
|
||||
var collector2 = new YooAsset.Editor.AssetBundleCollector();
|
||||
collector2.CollectPath = "";
|
||||
collector2.CollectorGUID = "3ba9252bc0a278145a7bde0cf876cbcb"; //TestRes4/EnemyImage目录
|
||||
collector2.CollectorType = YooAsset.Editor.ECollectorType.DependAssetCollector;
|
||||
collector2.PackRuleName = nameof(YooAsset.Editor.PackDirectory);
|
||||
YooAsset.Editor.AssetBundleCollectorSettingData.CreateCollector(unloadGroup, collector2);
|
||||
|
||||
var collector3 = new YooAsset.Editor.AssetBundleCollector();
|
||||
collector3.CollectPath = "";
|
||||
collector3.CollectorGUID = "65cc88e038c61ec488be24b82c4e2937"; //TestRes4/EnemyMat目录
|
||||
collector3.CollectorType = YooAsset.Editor.ECollectorType.DependAssetCollector;
|
||||
collector3.PackRuleName = nameof(YooAsset.Editor.PackDirectory);
|
||||
YooAsset.Editor.AssetBundleCollectorSettingData.CreateCollector(unloadGroup, collector3);
|
||||
}
|
||||
}
|
||||
private static void CreateRawBundlePackageCollector()
|
||||
|
||||
@@ -47,7 +47,7 @@ public class T1_TestEditorFileSystem : IPrebuildSetup, IPostBuildCleanup
|
||||
[UnityTest]
|
||||
public IEnumerator A_InitializePackage()
|
||||
{
|
||||
// 初始化资源包
|
||||
// 初始化资源包 ASSET_BUNDLE
|
||||
{
|
||||
string packageRoot = string.Empty;
|
||||
#if UNITY_EDITOR
|
||||
@@ -82,7 +82,7 @@ public class T1_TestEditorFileSystem : IPrebuildSetup, IPostBuildCleanup
|
||||
Assert.AreEqual(EOperationStatus.Succeed, updateManifestOp.Status);
|
||||
}
|
||||
|
||||
// 初始化资源包
|
||||
// 初始化资源包 RAW_BUNDLE
|
||||
{
|
||||
string packageRoot = string.Empty;
|
||||
#if UNITY_EDITOR
|
||||
@@ -119,30 +119,30 @@ public class T1_TestEditorFileSystem : IPrebuildSetup, IPostBuildCleanup
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator B1_TestLoadAsyncTask()
|
||||
public IEnumerator B1_TestAsyncTask()
|
||||
{
|
||||
var tester = new TestLoadPanel();
|
||||
var tester = new TestAsyncTask();
|
||||
yield return tester.RuntimeTester();
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator B2_TestLoadAudio()
|
||||
public IEnumerator B2_TestLoadAsset()
|
||||
{
|
||||
var tester = new TestLoadAudio();
|
||||
var tester = new TestLoadAsset();
|
||||
yield return tester.RuntimeTester();
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator B3_TestLoadImage()
|
||||
public IEnumerator B3_TestLoadSubAssets()
|
||||
{
|
||||
var tester = new TestLoadImage();
|
||||
var tester = new TestLoadSubAssets();
|
||||
yield return tester.RuntimeTester();
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator B4_TestLoadPrefab()
|
||||
public IEnumerator B4_TestLoadAllAssets()
|
||||
{
|
||||
var tester = new TestLoadPrefab();
|
||||
var tester = new TestLoadAllAssets();
|
||||
yield return tester.RuntimeTester();
|
||||
}
|
||||
|
||||
@@ -182,32 +182,9 @@ public class T1_TestEditorFileSystem : IPrebuildSetup, IPostBuildCleanup
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator C_DestroyPackage()
|
||||
public IEnumerator D_DestroyPackage()
|
||||
{
|
||||
// 销毁旧资源包
|
||||
{
|
||||
var package = YooAssets.GetPackage(TestDefine.AssetBundlePackageName);
|
||||
var destroyOp = package.DestroyAsync();
|
||||
yield return destroyOp;
|
||||
if (destroyOp.Status != EOperationStatus.Succeed)
|
||||
Debug.LogError(destroyOp.Error);
|
||||
Assert.AreEqual(EOperationStatus.Succeed, destroyOp.Status);
|
||||
|
||||
bool result = YooAssets.RemovePackage(TestDefine.AssetBundlePackageName);
|
||||
Assert.IsTrue(result);
|
||||
}
|
||||
|
||||
// 销毁旧资源包
|
||||
{
|
||||
var package = YooAssets.GetPackage(TestDefine.RawBundlePackageName);
|
||||
var destroyOp = package.DestroyAsync();
|
||||
yield return destroyOp;
|
||||
if (destroyOp.Status != EOperationStatus.Succeed)
|
||||
Debug.LogError(destroyOp.Error);
|
||||
Assert.AreEqual(EOperationStatus.Succeed, destroyOp.Status);
|
||||
|
||||
bool result = YooAssets.RemovePackage(TestDefine.RawBundlePackageName);
|
||||
Assert.IsTrue(result);
|
||||
}
|
||||
var tester = new TestDestroyPackage();
|
||||
yield return tester.RuntimeTester(true);
|
||||
}
|
||||
}
|
||||
@@ -61,10 +61,10 @@ public class T2_TestBuldinFileSystem : IPrebuildSetup, IPostBuildCleanup
|
||||
// 初始化资源包
|
||||
var initParams = new OfflinePlayModeParameters();
|
||||
var fileDecryption = new TestFileStreamDecryption();
|
||||
var manifestProcess = new TestProcessManifest();
|
||||
var manifestServices = new TestRestoreManifest();
|
||||
initParams.BuildinFileSystemParameters = FileSystemParameters.CreateDefaultBuildinFileSystemParameters(fileDecryption, packageRoot);
|
||||
initParams.BuildinFileSystemParameters.AddParameter(FileSystemParametersDefine.DISABLE_CATALOG_FILE, true);
|
||||
initParams.BuildinFileSystemParameters.AddParameter(FileSystemParametersDefine.MANIFEST_SERVICES, manifestProcess);
|
||||
initParams.BuildinFileSystemParameters.AddParameter(FileSystemParametersDefine.MANIFEST_SERVICES, manifestServices);
|
||||
var initializeOp = package.InitializeAsync(initParams);
|
||||
yield return initializeOp;
|
||||
if (initializeOp.Status != EOperationStatus.Succeed)
|
||||
@@ -125,30 +125,30 @@ public class T2_TestBuldinFileSystem : IPrebuildSetup, IPostBuildCleanup
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator B1_TestLoadAsyncTask()
|
||||
public IEnumerator B1_TestAsyncTask()
|
||||
{
|
||||
var tester = new TestLoadPanel();
|
||||
var tester = new TestAsyncTask();
|
||||
yield return tester.RuntimeTester();
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator B2_TestLoadAudio()
|
||||
public IEnumerator B2_TestLoadAsset()
|
||||
{
|
||||
var tester = new TestLoadAudio();
|
||||
var tester = new TestLoadAsset();
|
||||
yield return tester.RuntimeTester();
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator B3_TestLoadImage()
|
||||
public IEnumerator B3_TestLoadSubAssets()
|
||||
{
|
||||
var tester = new TestLoadImage();
|
||||
var tester = new TestLoadSubAssets();
|
||||
yield return tester.RuntimeTester();
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator B4_TestLoadPrefab()
|
||||
public IEnumerator B4_TestLoadAllAssets()
|
||||
{
|
||||
var tester = new TestLoadPrefab();
|
||||
var tester = new TestLoadAllAssets();
|
||||
yield return tester.RuntimeTester();
|
||||
}
|
||||
|
||||
@@ -186,11 +186,11 @@ public class T2_TestBuldinFileSystem : IPrebuildSetup, IPostBuildCleanup
|
||||
var tester = new TestLoadVideo();
|
||||
yield return tester.RuntimeTester();
|
||||
}
|
||||
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator C1_TestBundleReference()
|
||||
public IEnumerator C1_TestGetAssetInfos()
|
||||
{
|
||||
var tester = new TestBundleReference();
|
||||
var tester = new TestGetAssetInfos();
|
||||
yield return tester.RuntimeTester();
|
||||
}
|
||||
|
||||
@@ -201,33 +201,31 @@ public class T2_TestBuldinFileSystem : IPrebuildSetup, IPostBuildCleanup
|
||||
yield return tester.RuntimeTester();
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator C3_TestBundleUnpacker()
|
||||
{
|
||||
var tester = new TestBundleUnpacker();
|
||||
yield return tester.RuntimeTester();
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator C4_TestBundleReference()
|
||||
{
|
||||
var tester = new TestBundleReference();
|
||||
yield return tester.RuntimeTester();
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator C4_TestBundleUnload()
|
||||
{
|
||||
var tester = new TestBundleUnload();
|
||||
yield return tester.RuntimeTester();
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator D_DestroyPackage()
|
||||
{
|
||||
// 销毁旧资源包
|
||||
{
|
||||
var package = YooAssets.GetPackage(TestDefine.AssetBundlePackageName);
|
||||
var destroyOp = package.DestroyAsync();
|
||||
yield return destroyOp;
|
||||
if (destroyOp.Status != EOperationStatus.Succeed)
|
||||
Debug.LogError(destroyOp.Error);
|
||||
Assert.AreEqual(EOperationStatus.Succeed, destroyOp.Status);
|
||||
|
||||
bool result = YooAssets.RemovePackage(TestDefine.AssetBundlePackageName);
|
||||
Assert.IsTrue(result);
|
||||
}
|
||||
|
||||
// 销毁旧资源包
|
||||
{
|
||||
var package = YooAssets.GetPackage(TestDefine.RawBundlePackageName);
|
||||
var destroyOp = package.DestroyAsync();
|
||||
yield return destroyOp;
|
||||
if (destroyOp.Status != EOperationStatus.Succeed)
|
||||
Debug.LogError(destroyOp.Error);
|
||||
Assert.AreEqual(EOperationStatus.Succeed, destroyOp.Status);
|
||||
|
||||
bool result = YooAssets.RemovePackage(TestDefine.RawBundlePackageName);
|
||||
Assert.IsTrue(result);
|
||||
}
|
||||
var tester = new TestDestroyPackage();
|
||||
yield return tester.RuntimeTester(true);
|
||||
}
|
||||
}
|
||||
@@ -16,53 +16,61 @@ public class TestBundleEncryption
|
||||
ResourcePackage package = YooAssets.GetPackage(TestDefine.AssetBundlePackageName);
|
||||
Assert.IsNotNull(package);
|
||||
|
||||
// 异步加载音乐播放预制体
|
||||
// 异步加载加密的预制体
|
||||
// 说明:测试内置文件解压
|
||||
{
|
||||
var assetHandle = package.LoadAssetAsync<GameObject>("prefab_audioA");
|
||||
var assetHandle = package.LoadAssetAsync<GameObject>("prefab_encryptA");
|
||||
yield return assetHandle;
|
||||
Assert.AreEqual(EOperationStatus.Succeed, assetHandle.Status);
|
||||
|
||||
var go = assetHandle.InstantiateSync(Vector3.zero, Quaternion.identity);
|
||||
Assert.IsNotNull(go);
|
||||
|
||||
var audioSource = go.GetComponent<AudioSource>();
|
||||
Assert.IsNotNull(audioSource.clip);
|
||||
}
|
||||
|
||||
// 同步加载音乐播放预制体
|
||||
// 同步加载加密的预制体
|
||||
// 说明:测试内置文件解压
|
||||
{
|
||||
var assetHandle = package.LoadAssetSync<GameObject>("prefab_audioB");
|
||||
yield return assetHandle;
|
||||
var assetHandle = package.LoadAssetSync<GameObject>("prefab_encryptB");
|
||||
Assert.AreEqual(EOperationStatus.Succeed, assetHandle.Status);
|
||||
|
||||
var go = assetHandle.InstantiateSync(Vector3.zero, Quaternion.identity);
|
||||
Assert.IsNotNull(go);
|
||||
|
||||
var audioSource = go.GetComponent<AudioSource>();
|
||||
Assert.IsNotNull(audioSource.clip);
|
||||
}
|
||||
|
||||
yield return new WaitForSeconds(1f);
|
||||
}
|
||||
}
|
||||
|
||||
/* 资源代码流程
|
||||
* 内置文件解压(加载器)
|
||||
* 内置文件解压(加载器触发)
|
||||
BuildinFileSystem::LoadBundleFile()
|
||||
{
|
||||
_unpackFileSystem.LoadBundleFile(bundle);
|
||||
if (IsUnpackBundleFile(bundle))
|
||||
{
|
||||
_unpackFileSystem.LoadBundleFile(bundle);
|
||||
}
|
||||
}
|
||||
UnpackFileSystem::LoadAssetBundleOperation()
|
||||
UnpackFileSystem::LoadBundleFile()
|
||||
{
|
||||
DownloadFileOptions options = new DownloadFileOptions(int.MaxValue, 60);
|
||||
_unpackFileSystem.DownloadFileAsync(_bundle, options);
|
||||
var operation = new DCFSLoadAssetBundleOperation(this, bundle);
|
||||
return operation;
|
||||
}
|
||||
DCFSLoadAssetBundleOperation::InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.DownloadFile)
|
||||
{
|
||||
DownloadFileOptions options = new DownloadFileOptions(int.MaxValue);
|
||||
_unpackFileSystem.DownloadFileAsync(_bundle, options);
|
||||
}
|
||||
}
|
||||
UnpackFileSystem::DownloadFileAsync()
|
||||
{
|
||||
//RemoteServices返回内置文件路径
|
||||
string mainURL = RemoteServices.GetRemoteMainURL(bundle.FileName);
|
||||
string fallbackURL = RemoteServices.GetRemoteFallbackURL(bundle.FileName);
|
||||
options.SetURL(mainURL, fallbackURL);
|
||||
return new DownloadPackageBundleOperation(bundle, options);
|
||||
if (string.IsNullOrEmpty(options.ImportFilePath))
|
||||
{
|
||||
//RemoteServices返回内置文件路径
|
||||
string mainURL = RemoteServices.GetRemoteMainURL(bundle.FileName);
|
||||
string fallbackURL = RemoteServices.GetRemoteFallbackURL(bundle.FileName);
|
||||
options.SetURL(mainURL, fallbackURL);
|
||||
var downloader = new DownloadPackageBundleOperation(bundle, options);
|
||||
return downloader;
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.U2D;
|
||||
using UnityEngine.TestTools;
|
||||
using NUnit.Framework;
|
||||
using YooAsset;
|
||||
using System.Linq;
|
||||
|
||||
public class TestBundleUnload
|
||||
{
|
||||
public IEnumerator RuntimeTester()
|
||||
{
|
||||
ResourcePackage package = YooAssets.GetPackage(TestDefine.AssetBundlePackageName);
|
||||
Assert.IsNotNull(package);
|
||||
|
||||
string targetBundleName = "assets_samples_test_sample_testres4_enemy.bundle";
|
||||
|
||||
// 加载Enemy
|
||||
AssetHandle assetHandle;
|
||||
{
|
||||
assetHandle = package.LoadAssetAsync<GameObject>("enemy");
|
||||
yield return assetHandle;
|
||||
Assert.AreEqual(EOperationStatus.Succeed, assetHandle.Status);
|
||||
|
||||
DebugPackageData debugData = package.GetDebugPackageData();
|
||||
var findItem = debugData.BundleInfos.Where(x => x.BundleName == targetBundleName);
|
||||
Assert.AreEqual(findItem.Count(), 1);
|
||||
}
|
||||
|
||||
// 卸载Enemy
|
||||
{
|
||||
assetHandle.Release();
|
||||
package.TryUnloadUnusedAsset("enemy");
|
||||
|
||||
DebugPackageData debugData = package.GetDebugPackageData();
|
||||
var findItem = debugData.BundleInfos.Where(x => x.BundleName == targetBundleName);
|
||||
Assert.AreEqual(findItem.Count(), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c9cf81becc940b94b98926a171bca520
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -19,29 +19,31 @@ public class TestBundleUnpacker
|
||||
var resourceUnpacker = package.CreateResourceUnpacker("unpack", 10, 1);
|
||||
Assert.AreEqual(resourceUnpacker.TotalDownloadCount, 2);
|
||||
|
||||
resourceUnpacker.BeginDownload();
|
||||
yield return resourceUnpacker;
|
||||
Assert.AreEqual(EOperationStatus.Succeed, resourceUnpacker.Status);
|
||||
|
||||
// 等待一秒
|
||||
yield return new WaitForSeconds(1f);
|
||||
}
|
||||
}
|
||||
|
||||
/* 资源代码流程
|
||||
* 内置文件解压(解压器)
|
||||
* 内置文件解压(解压器触发)
|
||||
BundleInfo::CreateDownloader()
|
||||
{
|
||||
return _buildFileSystem.DownloadFileAsync(Bundle, options);
|
||||
}
|
||||
BuildinFileSystem::DownloadFileAsync()
|
||||
{
|
||||
options.ImportFilePath = xxxxxx;
|
||||
_unpackFileSystem.DownloadFileAsync(bundle, options);
|
||||
options.ImportFilePath = GetBuildinFileLoadPath(bundle);
|
||||
return _unpackFileSystem.DownloadFileAsync(bundle, options);
|
||||
}
|
||||
UnpackFileSystem::DownloadFileAsync()
|
||||
{
|
||||
string mainURL = ConvertToWWWPath(options.ImportFilePath);
|
||||
options.SetURL(mainURL, mainURL);
|
||||
return new DownloadPackageBundleOperation(bundle, options);
|
||||
if (string.IsNullOrEmpty(options.ImportFilePath) == false)
|
||||
{
|
||||
string mainURL = ConvertToWWWPath(options.ImportFilePath);
|
||||
options.SetURL(mainURL, mainURL);
|
||||
var downloader = new DownloadPackageBundleOperation(bundle, options);
|
||||
return downloader;
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.U2D;
|
||||
using UnityEngine.TestTools;
|
||||
using NUnit.Framework;
|
||||
using YooAsset;
|
||||
|
||||
public class TestGetAssetInfos
|
||||
{
|
||||
public IEnumerator RuntimeTester()
|
||||
{
|
||||
ResourcePackage package = YooAssets.GetPackage(TestDefine.AssetBundlePackageName);
|
||||
Assert.IsNotNull(package);
|
||||
|
||||
// 获取所有资源对象信息
|
||||
var allAssetInfos = package.GetAllAssetInfos();
|
||||
Assert.AreEqual(allAssetInfos.Length, 28);
|
||||
|
||||
// 获取指定资源对象信息
|
||||
var assetInfos = package.GetAssetInfos("import");
|
||||
Assert.AreEqual(assetInfos.Length, 2);
|
||||
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ed2ce0f1d01df854da3622e757694128
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -46,13 +46,13 @@ public class T3_TestCacheFileSystem : IPrebuildSetup, IPostBuildCleanup
|
||||
// 初始化资源包
|
||||
var initParams = new HostPlayModeParameters();
|
||||
var fileDecryption = new TestFileStreamDecryption();
|
||||
var manifestProcess = new TestProcessManifest();
|
||||
var manifestServices = new TestRestoreManifest();
|
||||
|
||||
string hostServerIP = "http://127.0.0.1/CDN/Android/Test/";
|
||||
var remoteServices = new TestRemoteServices(hostServerIP);
|
||||
initParams.BuildinFileSystemParameters = null;
|
||||
initParams.CacheFileSystemParameters = FileSystemParameters.CreateDefaultCacheFileSystemParameters(remoteServices, fileDecryption);
|
||||
initParams.CacheFileSystemParameters.AddParameter(FileSystemParametersDefine.MANIFEST_SERVICES, manifestProcess);
|
||||
initParams.CacheFileSystemParameters.AddParameter(FileSystemParametersDefine.MANIFEST_SERVICES, manifestServices);
|
||||
var initializeOp = package.InitializeAsync(initParams);
|
||||
yield return initializeOp;
|
||||
if (initializeOp.Status != EOperationStatus.Succeed)
|
||||
@@ -92,29 +92,34 @@ public class T3_TestCacheFileSystem : IPrebuildSetup, IPostBuildCleanup
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator B1_TestBundlePlaying()
|
||||
public IEnumerator C1_TestBundlePlaying()
|
||||
{
|
||||
var tester = new TestBundlePlaying();
|
||||
yield return tester.RuntimeTester();
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator B2_TestBundleImporter()
|
||||
public IEnumerator C2_TestBundleImporter()
|
||||
{
|
||||
var tester = new TestBundleImporter();
|
||||
yield return tester.RuntimeTester();
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator B3_TestBundleDownloader()
|
||||
public IEnumerator C3_TestBundleDownloader()
|
||||
{
|
||||
var tester = new TestBundleDownloader();
|
||||
yield return tester.RuntimeTester();
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator D_DestroyPackage()
|
||||
{
|
||||
var tester = new TestDestroyPackage();
|
||||
yield return tester.RuntimeTester(false);
|
||||
}
|
||||
|
||||
private static void CopyDirectory(string sourceDir, string targetDir)
|
||||
{
|
||||
// 检查源目录是否存在
|
||||
|
||||
@@ -17,31 +17,30 @@ public class TestBundleDownloader
|
||||
Assert.IsNotNull(package);
|
||||
|
||||
var downloader = package.CreateResourceDownloader(10, 1);
|
||||
if (downloader.TotalDownloadCount == 0)
|
||||
{
|
||||
Assert.Fail($"Test downloader not found any file !");
|
||||
}
|
||||
Assert.AreNotEqual(downloader.TotalDownloadCount, 0);
|
||||
|
||||
downloader.BeginDownload();
|
||||
downloader.DownloadFinishCallback = (DownloaderFinishData data) =>
|
||||
{
|
||||
if (data.Succeed == false)
|
||||
Assert.Fail($"Test downloader failed ! {downloader.Error}");
|
||||
};
|
||||
|
||||
// 等待一秒
|
||||
yield return new WaitForSeconds(1f);
|
||||
yield return downloader;
|
||||
Assert.AreEqual(EOperationStatus.Succeed, downloader.Status);
|
||||
}
|
||||
}
|
||||
|
||||
/* 资源代码流程
|
||||
* 远端文件下载(下载器)
|
||||
* 远端文件下载(下载器触发)
|
||||
BundleInfo::CreateDownloader()
|
||||
{
|
||||
return _buildFileSystem.DownloadFileAsync(Bundle, options);
|
||||
}
|
||||
CacheFileSystem::DownloadFileAsync()
|
||||
{
|
||||
//RemoteServices返回CDN文件路径
|
||||
string mainURL = RemoteServices.GetRemoteMainURL(bundle.FileName);
|
||||
string fallbackURL = RemoteServices.GetRemoteFallbackURL(bundle.FileName);
|
||||
options.SetURL(mainURL, fallbackURL);
|
||||
return new DownloadPackageBundleOperation(bundle, options);
|
||||
if (string.IsNullOrEmpty(options.ImportFilePath))
|
||||
{
|
||||
//RemoteServices返回CDN文件路径
|
||||
string mainURL = RemoteServices.GetRemoteMainURL(bundle.FileName);
|
||||
string fallbackURL = RemoteServices.GetRemoteFallbackURL(bundle.FileName);
|
||||
options.SetURL(mainURL, fallbackURL);
|
||||
var downloader = new DownloadPackageBundleOperation(bundle, options);
|
||||
return downloader;
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -35,14 +35,11 @@ public class TestBundleImporter
|
||||
unpacker.BeginDownload();
|
||||
yield return unpacker;
|
||||
Assert.AreEqual(EOperationStatus.Succeed, unpacker.Status);
|
||||
|
||||
// 等待一秒
|
||||
yield return new WaitForSeconds(1f);
|
||||
}
|
||||
}
|
||||
|
||||
/* 资源代码流程
|
||||
* 本地文件导入(导入器)
|
||||
* 本地文件导入(导入器触发)
|
||||
BundleInfo::CreateDownloader()
|
||||
{
|
||||
options.ImportFilePath = _importFilePath;
|
||||
@@ -50,8 +47,12 @@ BundleInfo::CreateDownloader()
|
||||
}
|
||||
CacheFileSystem::DownloadFileAsync()
|
||||
{
|
||||
string mainURL = ConvertToWWWPath(options.ImportFilePath);
|
||||
options.SetURL(mainURL, mainURL);
|
||||
return new DownloadPackageBundleOperation(bundle, options);
|
||||
if (string.IsNullOrEmpty(options.ImportFilePath) == false)
|
||||
{
|
||||
string mainURL = ConvertToWWWPath(options.ImportFilePath);
|
||||
options.SetURL(mainURL, mainURL);
|
||||
var downloader = new DownloadPackageBundleOperation(bundle, options);
|
||||
return downloader;
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -16,28 +16,27 @@ public class TestBundlePlaying
|
||||
ResourcePackage package = YooAssets.GetPackage(TestDefine.AssetBundlePackageName);
|
||||
Assert.IsNotNull(package);
|
||||
|
||||
if (package.IsNeedDownloadFromRemote("panel_a") == false)
|
||||
if (package.IsNeedDownloadFromRemote("prefab_encryptA") == false)
|
||||
{
|
||||
Assert.Fail("Load bundle is already existed !");
|
||||
}
|
||||
if (package.IsNeedDownloadFromRemote("panel_b") == false)
|
||||
if (package.IsNeedDownloadFromRemote("prefab_encryptB") == false)
|
||||
{
|
||||
Assert.Fail("Load bundle is already existed !");
|
||||
}
|
||||
|
||||
// 测试异步加载
|
||||
// 测试异步加载远端资源
|
||||
{
|
||||
var assetsHandle = package.LoadAssetAsync<GameObject>("panel_a");
|
||||
var assetsHandle = package.LoadAssetAsync<GameObject>("prefab_encryptA");
|
||||
yield return assetsHandle;
|
||||
Assert.AreEqual(EOperationStatus.Succeed, assetsHandle.Status);
|
||||
}
|
||||
|
||||
// 测试同步加载
|
||||
// 测试同步加载远端资源
|
||||
{
|
||||
// 验证失败结果
|
||||
UnityEngine.TestTools.LogAssert.ignoreFailingMessages = true;
|
||||
var assetsHandle = package.LoadAssetSync<GameObject>("panel_b");
|
||||
yield return assetsHandle;
|
||||
var assetsHandle = package.LoadAssetSync<GameObject>("prefab_encryptB");
|
||||
Assert.AreEqual(EOperationStatus.Failed, assetsHandle.Status);
|
||||
UnityEngine.TestTools.LogAssert.ignoreFailingMessages = false;
|
||||
|
||||
@@ -46,34 +45,38 @@ public class TestBundlePlaying
|
||||
package.UnloadUnusedAssetsAsync();
|
||||
|
||||
// 验证成功结果
|
||||
// 说明:同步加载也会触发远端下载任务!
|
||||
yield return new WaitForSeconds(1f);
|
||||
assetsHandle = package.LoadAssetSync<GameObject>("panel_b");
|
||||
yield return assetsHandle;
|
||||
assetsHandle = package.LoadAssetSync<GameObject>("prefab_encryptB");
|
||||
Assert.AreEqual(EOperationStatus.Succeed, assetsHandle.Status);
|
||||
}
|
||||
|
||||
// 等待一秒
|
||||
yield return new WaitForSeconds(1f);
|
||||
}
|
||||
}
|
||||
|
||||
/* 资源代码流程
|
||||
* 远端文件下载(加载器)
|
||||
* 远端文件下载(加载器触发)
|
||||
CacheFileSystem::LoadBundleFile()
|
||||
{
|
||||
_cacheFileSystem.LoadBundleFile(bundle);
|
||||
}
|
||||
CacheFileSystem::LoadAssetBundleOperation()
|
||||
DCFSLoadAssetBundleOperation::InternalUpdate()
|
||||
{
|
||||
DownloadFileOptions options = new DownloadFileOptions(int.MaxValue, 60);
|
||||
_cacheFileSystem.DownloadFileAsync(_bundle, options);
|
||||
if (_steps == ESteps.DownloadFile)
|
||||
{
|
||||
DownloadFileOptions options = new DownloadFileOptions(int.MaxValue);
|
||||
_cacheFileSystem.DownloadFileAsync(_bundle, options);
|
||||
}
|
||||
}
|
||||
CacheFileSystem::DownloadFileAsync()
|
||||
{
|
||||
//RemoteServices返回CDN文件路径
|
||||
string mainURL = RemoteServices.GetRemoteMainURL(bundle.FileName);
|
||||
string fallbackURL = RemoteServices.GetRemoteFallbackURL(bundle.FileName);
|
||||
options.SetURL(mainURL, fallbackURL);
|
||||
return new DownloadPackageBundleOperation(bundle, options);
|
||||
if (string.IsNullOrEmpty(options.ImportFilePath))
|
||||
{
|
||||
//RemoteServices返回CDN文件路径
|
||||
string mainURL = RemoteServices.GetRemoteMainURL(bundle.FileName);
|
||||
string fallbackURL = RemoteServices.GetRemoteFallbackURL(bundle.FileName);
|
||||
options.SetURL(mainURL, fallbackURL);
|
||||
var downloader = new DownloadPackageBundleOperation(bundle, options);
|
||||
return downloader;
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.U2D;
|
||||
using UnityEngine.TestTools;
|
||||
using NUnit.Framework;
|
||||
using YooAsset;
|
||||
|
||||
public class TestDestroyPackage
|
||||
{
|
||||
public IEnumerator RuntimeTester(bool destroyRawPackage)
|
||||
{
|
||||
// 销毁旧资源包 ASSET_BUNDLE
|
||||
{
|
||||
var package = YooAssets.GetPackage(TestDefine.AssetBundlePackageName);
|
||||
var destroyOp = package.DestroyAsync();
|
||||
yield return destroyOp;
|
||||
if (destroyOp.Status != EOperationStatus.Succeed)
|
||||
Debug.LogError(destroyOp.Error);
|
||||
Assert.AreEqual(EOperationStatus.Succeed, destroyOp.Status);
|
||||
|
||||
bool result = YooAssets.RemovePackage(TestDefine.AssetBundlePackageName);
|
||||
Assert.IsTrue(result);
|
||||
}
|
||||
|
||||
// 销毁旧资源包 RAW_BUNDLE
|
||||
if (destroyRawPackage)
|
||||
{
|
||||
var package = YooAssets.GetPackage(TestDefine.RawBundlePackageName);
|
||||
var destroyOp = package.DestroyAsync();
|
||||
yield return destroyOp;
|
||||
if (destroyOp.Status != EOperationStatus.Succeed)
|
||||
Debug.LogError(destroyOp.Error);
|
||||
Assert.AreEqual(EOperationStatus.Succeed, destroyOp.Status);
|
||||
|
||||
bool result = YooAssets.RemovePackage(TestDefine.RawBundlePackageName);
|
||||
Assert.IsTrue(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2772d71ea8e24f844b0ad661a3c85ee6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.U2D;
|
||||
using UnityEngine.TestTools;
|
||||
using NUnit.Framework;
|
||||
using YooAsset;
|
||||
|
||||
public class TestLoadAllAssets
|
||||
{
|
||||
public IEnumerator RuntimeTester()
|
||||
{
|
||||
ResourcePackage package = YooAssets.GetPackage(TestDefine.AssetBundlePackageName);
|
||||
Assert.IsNotNull(package);
|
||||
|
||||
// 异步加载所有资源
|
||||
{
|
||||
var allAssetsHandle = package.LoadAllAssetsAsync<GameObject>("prefab_a");
|
||||
yield return allAssetsHandle;
|
||||
Assert.AreEqual(EOperationStatus.Succeed, allAssetsHandle.Status);
|
||||
|
||||
var allAssetObjects = allAssetsHandle.AllAssetObjects;
|
||||
Assert.IsNotNull(allAssetObjects);
|
||||
|
||||
int count = allAssetObjects.Count;
|
||||
Assert.AreEqual(count, 3);
|
||||
}
|
||||
|
||||
// 同步加载所有资源
|
||||
{
|
||||
var allAssetsHandle = package.LoadAllAssetsSync<GameObject>("prefab_x");
|
||||
Assert.AreEqual(EOperationStatus.Succeed, allAssetsHandle.Status);
|
||||
|
||||
var allAssetObjects = allAssetsHandle.AllAssetObjects;
|
||||
Assert.IsNotNull(allAssetObjects);
|
||||
|
||||
int count = allAssetObjects.Count;
|
||||
Assert.AreEqual(count, 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,14 +9,14 @@ using UnityEngine.TestTools;
|
||||
using NUnit.Framework;
|
||||
using YooAsset;
|
||||
|
||||
public class TestLoadAudio
|
||||
public class TestLoadAsset
|
||||
{
|
||||
public IEnumerator RuntimeTester()
|
||||
{
|
||||
ResourcePackage package = YooAssets.GetPackage(TestDefine.AssetBundlePackageName);
|
||||
Assert.IsNotNull(package);
|
||||
|
||||
// 音乐异步加载
|
||||
// 异步加载音乐
|
||||
{
|
||||
var assetHandle = package.LoadAssetAsync<AudioClip>("music_a");
|
||||
yield return assetHandle;
|
||||
@@ -26,7 +26,7 @@ public class TestLoadAudio
|
||||
Assert.IsNotNull(audioClip);
|
||||
}
|
||||
|
||||
// 音效异步加载
|
||||
// 异步加载音效
|
||||
{
|
||||
var assetHandle = package.LoadAssetAsync<AudioClip>("sound_a");
|
||||
yield return assetHandle;
|
||||
@@ -36,10 +36,9 @@ public class TestLoadAudio
|
||||
Assert.IsNotNull(audioClip);
|
||||
}
|
||||
|
||||
// 音效同步加载
|
||||
// 同步加载音效
|
||||
{
|
||||
var assetHandle = package.LoadAssetSync<AudioClip>("sound_b");
|
||||
yield return assetHandle;
|
||||
Assert.AreEqual(EOperationStatus.Succeed, assetHandle.Status);
|
||||
|
||||
var audioClip = assetHandle.AssetObject as AudioClip;
|
||||
@@ -10,16 +10,16 @@ using UnityEngine.TestTools;
|
||||
using NUnit.Framework;
|
||||
using YooAsset;
|
||||
|
||||
public class TestLoadPanel
|
||||
public class TestAsyncTask
|
||||
{
|
||||
public IEnumerator RuntimeTester()
|
||||
{
|
||||
ResourcePackage package = YooAssets.GetPackage(TestDefine.AssetBundlePackageName);
|
||||
Assert.IsNotNull(package);
|
||||
|
||||
// 异步加载面板
|
||||
// Task异步加载面板
|
||||
{
|
||||
var assetsHandle = package.LoadAssetAsync<GameObject>("panel_canvas");
|
||||
var assetsHandle = package.LoadAssetAsync<GameObject>("canvas");
|
||||
var handleTask = assetsHandle.Task;
|
||||
while (!handleTask.IsCompleted)
|
||||
yield return null;
|
||||
@@ -28,7 +28,7 @@ public class TestLoadPanel
|
||||
|
||||
var instantiateOp = assetsHandle.InstantiateAsync();
|
||||
var operationTask = instantiateOp.Task;
|
||||
while (!handleTask.IsCompleted)
|
||||
while (!operationTask.IsCompleted)
|
||||
yield return null;
|
||||
yield return null;
|
||||
Assert.AreEqual(EOperationStatus.Succeed, instantiateOp.Status);
|
||||
@@ -1,64 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.U2D;
|
||||
using UnityEngine.TestTools;
|
||||
using NUnit.Framework;
|
||||
using YooAsset;
|
||||
|
||||
public class TestLoadPrefab
|
||||
{
|
||||
public IEnumerator RuntimeTester()
|
||||
{
|
||||
ResourcePackage package = YooAssets.GetPackage(TestDefine.AssetBundlePackageName);
|
||||
Assert.IsNotNull(package);
|
||||
|
||||
// 异步加载所有预制体
|
||||
{
|
||||
var allAssetsHandle = package.LoadAllAssetsAsync<GameObject>("prefab_a");
|
||||
yield return allAssetsHandle;
|
||||
Assert.AreEqual(EOperationStatus.Succeed, allAssetsHandle.Status);
|
||||
|
||||
var allAssetObjects = allAssetsHandle.AllAssetObjects;
|
||||
Assert.IsNotNull(allAssetObjects);
|
||||
|
||||
int count = allAssetObjects.Count;
|
||||
Assert.AreEqual(count, 3);
|
||||
}
|
||||
|
||||
// 异步加载指定预制体
|
||||
{
|
||||
var assetsHandle = package.LoadAssetAsync<GameObject>("prefab_b");
|
||||
yield return assetsHandle;
|
||||
Assert.AreEqual(EOperationStatus.Succeed, assetsHandle.Status);
|
||||
Assert.IsNotNull(assetsHandle.AssetObject);
|
||||
|
||||
var instantiateOp = assetsHandle.InstantiateAsync();
|
||||
yield return instantiateOp;
|
||||
Assert.AreEqual(EOperationStatus.Succeed, instantiateOp.Status);
|
||||
|
||||
Assert.IsNotNull(instantiateOp.Result);
|
||||
TestLogger.Log(this, instantiateOp.Result.name);
|
||||
GameObject.Destroy(instantiateOp.Result);
|
||||
}
|
||||
|
||||
// 同步加载指定预制体
|
||||
{
|
||||
var assetsHandle = package.LoadAssetSync<GameObject>("prefab_c");
|
||||
yield return assetsHandle;
|
||||
Assert.AreEqual(EOperationStatus.Succeed, assetsHandle.Status);
|
||||
Assert.IsNotNull(assetsHandle.AssetObject);
|
||||
|
||||
var instantiateOp = assetsHandle.InstantiateAsync();
|
||||
yield return instantiateOp;
|
||||
Assert.AreEqual(EOperationStatus.Succeed, instantiateOp.Status);
|
||||
|
||||
Assert.IsNotNull(instantiateOp.Result);
|
||||
TestLogger.Log(this, instantiateOp.Result.name);
|
||||
GameObject.Destroy(instantiateOp.Result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,11 +27,10 @@ public class TestLoadScene
|
||||
Assert.IsNotNull(scene);
|
||||
}
|
||||
|
||||
// 异步加载附加场景
|
||||
yield return new WaitForSeconds(1f);
|
||||
// 同步加载附加场景
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
{
|
||||
var sceneHandle = package.LoadSceneAsync("scene_b", LoadSceneMode.Additive);
|
||||
yield return sceneHandle;
|
||||
var sceneHandle = package.LoadSceneSync("scene_b", LoadSceneMode.Additive);
|
||||
Assert.AreEqual(EOperationStatus.Succeed, sceneHandle.Status);
|
||||
|
||||
var scene = sceneHandle.SceneObject;
|
||||
@@ -39,18 +38,21 @@ public class TestLoadScene
|
||||
}
|
||||
|
||||
// 异步加载附加场景
|
||||
yield return new WaitForSeconds(1f);
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
SceneHandle cachedHandle;
|
||||
{
|
||||
var sceneHandle = package.LoadSceneSync("scene_c", LoadSceneMode.Additive);
|
||||
yield return sceneHandle;
|
||||
Assert.AreEqual(EOperationStatus.Succeed, sceneHandle.Status);
|
||||
cachedHandle = package.LoadSceneSync("scene_c", LoadSceneMode.Additive);
|
||||
yield return cachedHandle;
|
||||
Assert.AreEqual(EOperationStatus.Succeed, cachedHandle.Status);
|
||||
|
||||
var scene = sceneHandle.SceneObject;
|
||||
var scene = cachedHandle.SceneObject;
|
||||
Assert.IsNotNull(scene);
|
||||
}
|
||||
|
||||
// 异步销毁附加场景
|
||||
yield return new WaitForSeconds(1f);
|
||||
var unloadSceneOp = sceneHandle.UnloadAsync();
|
||||
// 异步销毁附加场景
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
{
|
||||
var unloadSceneOp = cachedHandle.UnloadAsync();
|
||||
yield return unloadSceneOp;
|
||||
Assert.AreEqual(EOperationStatus.Succeed, unloadSceneOp.Status);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ using UnityEngine.TestTools;
|
||||
using NUnit.Framework;
|
||||
using YooAsset;
|
||||
|
||||
public class TestLoadImage
|
||||
public class TestLoadSubAssets
|
||||
{
|
||||
public IEnumerator RuntimeTester()
|
||||
{
|
||||
@@ -32,7 +32,6 @@ public class TestLoadImage
|
||||
// 同步加载子对象
|
||||
{
|
||||
var subAssetsHandle = package.LoadSubAssetsSync<Sprite>("image_b");
|
||||
yield return subAssetsHandle;
|
||||
Assert.AreEqual(EOperationStatus.Succeed, subAssetsHandle.Status);
|
||||
|
||||
var subAssetObjects = subAssetsHandle.SubAssetObjects;
|
||||
@@ -12,7 +12,7 @@ GameObject:
|
||||
- component: {fileID: 7980853937325680292}
|
||||
- component: {fileID: -2226153785594138141}
|
||||
m_Layer: 0
|
||||
m_Name: panel_canvas
|
||||
m_Name: canvas
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fb1303d9729dc8d4fb0846570e02feeb
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user