Compare commits

..

23 Commits
1.3.3 ... 1.3.4

Author SHA1 Message Date
hevinci
03aa9780eb Update CHANGELOG.md 2022-11-04 13:38:26 +08:00
hevinci
d3a9005964 Update package.json 2022-11-04 13:38:22 +08:00
hevinci
48bcf4a848 Update document 2022-11-04 13:22:31 +08:00
hevinci
72f0426531 Update PatchSystem
移除了WeaklyUpdatePatchManifestAsync()方法
新增了CheckPackageContentsAsync()方法
2022-11-04 13:10:08 +08:00
hevinci
44ec5b3de3 Update document 2022-11-04 11:39:16 +08:00
hevinci
292fdb1288 Update document 2022-11-03 20:47:40 +08:00
hevinci
76e65286fd Update basic sample 2022-11-03 20:18:05 +08:00
hevinci
9397a0ebae Update ShaderVariantCollector 2022-11-03 20:17:07 +08:00
hevinci
c37b5e52ac Update basic sample 2022-11-03 15:21:03 +08:00
hevinci
ecfced7195 Fix #38 2022-11-03 12:02:10 +08:00
hevinci
1c7a79f7d7 Fix #37 2022-11-03 11:51:17 +08:00
hevinci
1149906786 Fix #29 2022-11-03 11:38:26 +08:00
hevinci
9db111c08a Update runtime code 2022-11-03 10:37:34 +08:00
hevinci
0844447b46 Update AssetBundleBuilder
界面增加构建版本选项
2022-11-03 10:15:27 +08:00
hevinci
c7116ad165 Update basic sample 2022-11-02 22:04:11 +08:00
hevinci
a805e0639e Update editor code 2022-11-02 21:57:08 +08:00
hevinci
e8e69a2e86 Update runtime code
重写了文件解密流程。
2022-11-02 21:54:44 +08:00
hevinci
3e4761a60f Update basic sample 2022-11-01 23:13:45 +08:00
hevinci
3413157c67 Update editor code
调整加密文件的生成规则
2022-11-01 23:13:18 +08:00
hevinci
b5f2174ed0 Update runtime code 2022-11-01 23:02:20 +08:00
hevinci
bdc8285255 Update basic sample 2022-10-31 16:46:05 +08:00
hevinci
cd79f0e434 Update runtime code
AssetsPackage.WeaklyUpdateManifestAsync(string packageVersion)移除了packageVersion参数。
优化了HostPlayMode的初始化逻辑,优先读取沙盒内的清单,如果不存在则读取内置清单。
2022-10-31 16:45:21 +08:00
hevinci
171f40551e Update document 2022-10-28 10:46:35 +08:00
92 changed files with 2031 additions and 1519 deletions

View File

@@ -2,6 +2,62 @@
All notable changes to this package will be documented in this file.
## [1.3.4] - 2022-11-04
### Fixed
- (#29)修复了EditorHelper中根据guid找uxml有时候会出错的问题。
- (#37)修复了在修改GroupName和GroupDesc时左侧Group栏显示没刷新的问题。
- (#38)修复了工程里没有shader的话SBP构建会报异常的问题。
### Added
- 新增了AssetsPackage.CheckPackageContentsAsync()方法
```c#
/// <summary>
/// 检查本地包裹内容的完整性
/// </summary>
public CheckPackageContentsOperation CheckPackageContentsAsync()
```
### Changed
- 优化了HostPlayMode的初始化逻辑优先读取沙盒内的清单如果不存在则读取内置清单。
- 重写了文件的加密和解密逻辑。
```c#
public interface IDecryptionServices
{
/// <summary>
/// 文件偏移解密方法
/// </summary>
ulong LoadFromFileOffset(DecryptFileInfo fileInfo);
/// <summary>
/// 文件内存解密方法
/// </summary>
byte[] LoadFromMemory(DecryptFileInfo fileInfo);
/// <summary>
/// 文件流解密方法
/// </summary>
System.IO.FileStream LoadFromStream(DecryptFileInfo fileInfo);
/// <summary>
/// 文件流解密的托管缓存大小
/// </summary>
uint GetManagedReadBufferSize();
}
```
- AssetBundleBuilder界面增加了构建版本选项。
### Removed
- 移除了AssetsPackage.WeaklyUpdateManifestAsync()方法。
## [1.3.3] - 2022-10-27
### Fixed

View File

@@ -56,6 +56,7 @@ namespace YooAsset.Editor
new TaskBuilding(), //开始执行构建
new TaskVerifyBuildResult(), //验证构建结果
new TaskEncryption(), //加密资源文件
new TaskUpdateBuildInfo(), //更新构建信息
new TaskCreatePatchManifest(), //创建清单文件
new TaskCreateReport(), //创建报告文件
new TaskCreatePatchPackage(), //制作补丁包
@@ -71,6 +72,7 @@ namespace YooAsset.Editor
new TaskBuilding_SBP(), //开始执行构建
new TaskVerifyBuildResult_SBP(), //验证构建结果
new TaskEncryption(), //加密资源文件
new TaskUpdateBuildInfo(), //更新构建信息
new TaskCreatePatchManifest(), //创建清单文件
new TaskCreateReport(), //创建报告文件
new TaskCreatePatchPackage(), //制作补丁包

View File

@@ -64,27 +64,8 @@ namespace YooAsset.Editor
/// </summary>
public static string MakePipelineOutputDirectory(string outputRoot, string buildPackage, BuildTarget buildTarget, EBuildMode buildMode)
{
string result = $"{outputRoot}/{buildPackage}/{buildTarget}/{YooAssetSettings.OutputFolderName}";
if (buildMode == EBuildMode.DryRunBuild)
result += $"_{EBuildMode.DryRunBuild}";
else if (buildMode == EBuildMode.SimulateBuild)
result += $"_{EBuildMode.SimulateBuild}";
return result;
}
/// <summary>
/// 加载补丁清单文件
/// </summary>
internal static PatchManifest LoadPatchManifestFile(string fileDirectory, string packageName, string packageVersion)
{
string filePath = $"{fileDirectory}/{YooAssetSettingsData.GetPatchManifestFileName(packageName, packageVersion)}";
if (File.Exists(filePath) == false)
{
throw new System.Exception($"Not found patch manifest file : {filePath}");
}
string jsonData = FileUtility.ReadFile(filePath);
return PatchManifest.Deserialize(jsonData);
string outputDirectory = $"{outputRoot}/{buildPackage}/{buildTarget}/{YooAssetSettings.OutputFolderName}";
return outputDirectory;
}
}
}

View File

@@ -27,6 +27,7 @@ namespace YooAsset.Editor
private TextField _buildOutputField;
private EnumField _buildPipelineField;
private EnumField _buildModeField;
private TextField _buildVersionField;
private PopupField<string> _buildPackageField;
private PopupField<string> _encryptionField;
private EnumField _compressionField;
@@ -91,6 +92,10 @@ namespace YooAsset.Editor
RefreshWindow();
});
// 构建版本
_buildVersionField = root.Q<TextField>("BuildVersion");
_buildVersionField.SetValueWithoutNotify(GetBuildPackageVersion());
// 构建包裹
var buildPackageContainer = root.Q("BuildPackageContainer");
if (_buildPackageNames.Count > 0)
@@ -256,7 +261,7 @@ namespace YooAsset.Editor
buildParameters.BuildPipeline = AssetBundleBuilderSettingData.Setting.BuildPipeline;
buildParameters.BuildMode = AssetBundleBuilderSettingData.Setting.BuildMode;
buildParameters.PackageName = AssetBundleBuilderSettingData.Setting.BuildPackage;
buildParameters.PackageVersion = GetDefaultPackageVersion();
buildParameters.PackageVersion = _buildVersionField.value;
buildParameters.VerifyBuildingResult = true;
buildParameters.EncryptionServices = CreateEncryptionServicesInstance();
buildParameters.CompressOption = AssetBundleBuilderSettingData.Setting.CompressOption;
@@ -277,7 +282,9 @@ namespace YooAsset.Editor
EditorUtility.RevealInFinder(buildResult.OutputPackageDirectory);
}
}
private string GetDefaultPackageVersion()
// 构建版本相关
private string GetBuildPackageVersion()
{
int totalMinutes = DateTime.Now.Hour * 60 + DateTime.Now.Minute;
return DateTime.Now.ToString("yyyy-MM-dd") + "-" + totalMinutes;

View File

@@ -6,6 +6,7 @@
<ui:TextField picking-mode="Ignore" label="Build Output" name="BuildOutput" />
<uie:EnumField label="Build Pipeline" name="BuildPipeline" />
<uie:EnumField label="Build Mode" name="BuildMode" />
<ui:TextField picking-mode="Ignore" label="Build Version" name="BuildVersion" style="width: 350px;" />
<ui:VisualElement name="BuildPackageContainer" style="height: 24px;" />
<ui:VisualElement name="EncryptionContainer" style="height: 24px;" />
<uie:EnumField label="Compression" value="Center" name="Compression" />

View File

@@ -21,9 +21,8 @@ namespace YooAsset.Editor
var buildResult = builder.Run(buildParameters);
if (buildResult.Success)
{
string pipelineOutputDirectory = AssetBundleBuilderHelper.MakePipelineOutputDirectory(buildParameters.OutputRoot, buildParameters.PackageName, buildParameters.BuildTarget, buildParameters.BuildMode);
string manifestFileName = YooAssetSettingsData.GetPatchManifestFileName(buildParameters.PackageName, buildParameters.PackageVersion);
string manifestFilePath = $"{pipelineOutputDirectory}/{manifestFileName}";
string manifestFilePath = $"{buildResult.OutputPackageDirectory}/{manifestFileName}";
return manifestFilePath;
}
else

View File

@@ -8,6 +8,40 @@ namespace YooAsset.Editor
{
public class BuildBundleInfo
{
public class BuildPatchInfo
{
/// <summary>
/// 构建内容的哈希值
/// </summary>
public string ContentHash { set; get; }
/// <summary>
/// 文件哈希值
/// </summary>
public string PatchFileHash { set; get; }
/// <summary>
/// 文件哈希值
/// </summary>
public string PatchFileCRC { set; get; }
/// <summary>
/// 文件哈希值
/// </summary>
public long PatchFileSize { set; get; }
/// <summary>
/// 构建输出的文件路径
/// </summary>
public string BuildOutputFilePath { set; get; }
/// <summary>
/// 补丁包输出文件路径
/// </summary>
public string PatchOutputFilePath { set; get; }
}
/// <summary>
/// 资源包名称
/// </summary>
@@ -19,6 +53,22 @@ namespace YooAsset.Editor
/// </summary>
public readonly List<BuildAssetInfo> BuildinAssets = new List<BuildAssetInfo>();
/// <summary>
/// 补丁文件信息
/// </summary>
public readonly BuildPatchInfo PatchInfo = new BuildPatchInfo();
/// <summary>
/// Bundle文件的加载方法
/// </summary>
public EBundleLoadMethod LoadMethod { set; get; }
/// <summary>
/// 加密生成文件的路径
/// 注意:如果未加密该路径为空
/// </summary>
public string EncryptedFilePath { set; get; }
/// <summary>
/// 是否为原生文件
/// </summary>
@@ -36,9 +86,18 @@ namespace YooAsset.Editor
}
/// <summary>
/// 构建内容哈希值
/// 是否为加密文件
/// </summary>
public string ContentHash { set; get; } = "00000000000000000000000000000000"; //32位
public bool IsEncryptedFile
{
get
{
if (string.IsNullOrEmpty(EncryptedFilePath))
return false;
else
return true;
}
}
public BuildBundleInfo(string bundleName)
@@ -117,5 +176,20 @@ namespace YooAsset.Editor
build.assetNames = GetBuildinAssetPaths();
return build;
}
/// <summary>
/// 创建PatchBundle类
/// </summary>
internal PatchBundle CreatePatchBundle()
{
string fileHash = PatchInfo.PatchFileHash;
string fileCRC = PatchInfo.PatchFileCRC;
long fileSize = PatchInfo.PatchFileSize;
bool isRawFile = IsRawFile;
byte loadMethod = (byte)LoadMethod;
string[] tags = GetBundleTags();
PatchBundle patchBundle = new PatchBundle(BundleName, fileHash, fileCRC, fileSize, isRawFile, loadMethod, tags);
return patchBundle;
}
}
}

View File

@@ -64,18 +64,6 @@ namespace YooAsset.Editor
return result;
}
/// <summary>
/// 获取资源包的分类标签列表
/// </summary>
public string[] GetBundleTags(string bundleName)
{
if (TryGetBundleInfo(bundleName, out BuildBundleInfo bundleInfo))
{
return bundleInfo.GetBundleTags();
}
throw new Exception($"Not found {nameof(BuildBundleInfo)} : {bundleName}");
}
/// <summary>
/// 获取AssetBundle内构建的资源路径列表
/// </summary>

View File

@@ -8,21 +8,6 @@ namespace YooAsset.Editor
[Serializable]
public class ReportBundleInfo
{
public class FlagsData
{
public bool IsEncrypted { private set; get; }
public bool IsBuildin { private set; get; }
public bool IsRawFile { private set; get; }
public FlagsData(bool isEncrypted, bool isBuildin, bool isRawFile)
{
IsEncrypted = isEncrypted;
IsBuildin = isBuildin;
IsRawFile = isRawFile;
}
}
private FlagsData _flagData;
/// <summary>
/// 资源包名称
/// </summary>
@@ -48,33 +33,21 @@ namespace YooAsset.Editor
/// </summary>
public long FileSize;
/// <summary>
/// 是否为原生文件
/// </summary>
public bool IsRawFile;
/// <summary>
/// 加载方法
/// </summary>
public EBundleLoadMethod LoadMethod;
/// <summary>
/// Tags
/// </summary>
public string[] Tags;
/// <summary>
/// Flags
/// </summary>
public int Flags;
/// <summary>
/// 获取标志位的解析数据
/// </summary>
public FlagsData GetFlagData()
{
if (_flagData == null)
{
BitMask32 value = Flags;
bool isEncrypted = value.Test(0);
bool isBuildin = value.Test(1);
bool isRawFile = value.Test(2);
_flagData = new FlagsData(isEncrypted, isBuildin, isRawFile);
}
return _flagData;
}
/// <summary>
/// 获取资源分类标签的字符串
/// </summary>
@@ -85,16 +58,5 @@ namespace YooAsset.Editor
else
return string.Empty;
}
/// <summary>
/// 是否为原生文件
/// </summary>
public bool IsRawFile()
{
if (System.IO.Path.GetExtension(BundleName) == $".{YooAssetSettingsData.Setting.RawFileVariant}")
return true;
else
return false;
}
}
}

View File

@@ -25,16 +25,19 @@ namespace YooAsset.Editor
if (buildMode == EBuildMode.SimulateBuild)
return;
// 开始构建
string pipelineOutputDirectory = buildParametersContext.GetPipelineOutputDirectory();
BuildAssetBundleOptions buildOptions = buildParametersContext.GetPipelineBuildOptions();
AssetBundleManifest buildResults = BuildPipeline.BuildAssetBundles(pipelineOutputDirectory, buildMapContext.GetPipelineBuilds(), buildOptions, buildParametersContext.Parameters.BuildTarget);
if (buildResults == null)
{
throw new Exception("构建过程中发生错误!");
}
if (buildMode == EBuildMode.ForceRebuild || buildMode == EBuildMode.IncrementalBuild)
{
string unityOutputManifestFilePath = $"{buildParametersContext.GetPipelineOutputDirectory()}/{YooAssetSettings.OutputFolderName}";
if(System.IO.File.Exists(unityOutputManifestFilePath) == false)
string unityOutputManifestFilePath = $"{pipelineOutputDirectory}/{YooAssetSettings.OutputFolderName}";
if (System.IO.File.Exists(unityOutputManifestFilePath) == false)
throw new Exception("构建过程中发生严重错误!请查阅上下文日志!");
}
@@ -43,10 +46,10 @@ namespace YooAsset.Editor
buildResultContext.UnityManifest = buildResults;
context.SetContextObject(buildResultContext);
// 拷贝原生文件
if (buildMode == EBuildMode.ForceRebuild || buildMode == EBuildMode.IncrementalBuild)
{
CopyRawBundle(buildMapContext, buildParametersContext);
UpdateBuildBundleInfo(buildMapContext, buildParametersContext, buildResultContext);
}
}
@@ -69,29 +72,5 @@ namespace YooAsset.Editor
}
}
}
/// <summary>
/// 更新构建结果
/// </summary>
private void UpdateBuildBundleInfo(BuildMapContext buildMapContext, BuildParametersContext buildParametersContext, BuildResultContext buildResult)
{
string pipelineOutputDirectory = buildParametersContext.GetPipelineOutputDirectory();
foreach (var bundleInfo in buildMapContext.BundleInfos)
{
if (bundleInfo.IsRawFile)
{
string filePath = $"{pipelineOutputDirectory}/{bundleInfo.BundleName}";
bundleInfo.ContentHash = HashUtility.FileMD5(filePath);
}
else
{
var hash = buildResult.UnityManifest.GetAssetBundleHash(bundleInfo.BundleName);
if (hash.isValid)
bundleInfo.ContentHash = hash.ToString();
else
throw new Exception($"Not found bundle in build result : {bundleInfo.BundleName}");
}
}
}
}
}

View File

@@ -46,10 +46,10 @@ namespace YooAsset.Editor
buildResultContext.Results = buildResults;
context.SetContextObject(buildResultContext);
// 拷贝原生文件
if (buildMode == EBuildMode.ForceRebuild || buildMode == EBuildMode.IncrementalBuild)
{
CopyRawBundle(buildMapContext, buildParametersContext);
UpdateBuildBundleInfo(buildMapContext, buildParametersContext, buildResultContext);
}
}
@@ -72,29 +72,5 @@ namespace YooAsset.Editor
}
}
}
/// <summary>
/// 更新构建结果
/// </summary>
private void UpdateBuildBundleInfo(BuildMapContext buildMapContext, BuildParametersContext buildParametersContext, BuildResultContext buildResult)
{
string pipelineOutputDirectory = buildParametersContext.GetPipelineOutputDirectory();
foreach (var bundleInfo in buildMapContext.BundleInfos)
{
if (bundleInfo.IsRawFile)
{
string filePath = $"{pipelineOutputDirectory}/{bundleInfo.BundleName}";
bundleInfo.ContentHash = HashUtility.FileMD5(filePath);
}
else
{
// 注意当资源包的依赖列表发生变化的时候ContentHash也会发生变化
if (buildResult.Results.BundleInfos.TryGetValue(bundleInfo.BundleName, out var value))
bundleInfo.ContentHash = value.Hash.ToString();
else
throw new Exception($"Not found bundle in build result : {bundleInfo.BundleName}");
}
}
}
}
}

View File

@@ -12,16 +12,21 @@ namespace YooAsset.Editor
void IBuildTask.Run(BuildContext context)
{
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
if (buildParametersContext.Parameters.CopyBuildinFileOption != ECopyBuildinFileOption.None)
var patchManifestContext = context.GetContextObject<PatchManifestContext>();
var buildMode = buildParametersContext.Parameters.BuildMode;
if (buildMode == EBuildMode.ForceRebuild || buildMode == EBuildMode.IncrementalBuild)
{
CopyBuildinFilesToStreaming(buildParametersContext);
if (buildParametersContext.Parameters.CopyBuildinFileOption != ECopyBuildinFileOption.None)
{
CopyBuildinFilesToStreaming(buildParametersContext, patchManifestContext);
}
}
}
/// <summary>
/// 拷贝首包资源文件
/// </summary>
private void CopyBuildinFilesToStreaming(BuildParametersContext buildParametersContext)
private void CopyBuildinFilesToStreaming(BuildParametersContext buildParametersContext, PatchManifestContext patchManifestContext)
{
ECopyBuildinFileOption option = buildParametersContext.Parameters.CopyBuildinFileOption;
string packageOutputDirectory = buildParametersContext.GetPackageOutputDirectory();
@@ -30,7 +35,7 @@ namespace YooAsset.Editor
string buildPackageVersion = buildParametersContext.Parameters.PackageVersion;
// 加载补丁清单
PatchManifest patchManifest = AssetBundleBuilderHelper.LoadPatchManifestFile(packageOutputDirectory, buildPackageName, buildPackageVersion);
PatchManifest patchManifest = patchManifestContext.Manifest;
// 清空流目录
if (option == ECopyBuildinFileOption.ClearAndCopyAll || option == ECopyBuildinFileOption.ClearAndCopyByTags)

View File

@@ -8,6 +8,11 @@ using UnityEditor.Build.Pipeline.Interfaces;
namespace YooAsset.Editor
{
public class PatchManifestContext : IContextObject
{
internal PatchManifest Manifest;
}
[TaskAttribute("创建补丁清单文件")]
public class TaskCreatePatchManifest : IBuildTask
{
@@ -24,7 +29,7 @@ namespace YooAsset.Editor
var buildMapContext = context.GetContextObject<BuildMapContext>();
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
var buildParameters = buildParametersContext.Parameters;
string pipelineOutputDirectory = buildParametersContext.GetPipelineOutputDirectory();
string packageOutputDirectory = buildParametersContext.GetPackageOutputDirectory();
// 创建新补丁清单
PatchManifest patchManifest = new PatchManifest();
@@ -45,21 +50,26 @@ namespace YooAsset.Editor
UpdateBuiltInBundleReference(patchManifest, buildResultContext.Results);
}
}
// 创建补丁清单文件
string packageHash = string.Empty;
string packageHash;
{
string fileName = YooAssetSettingsData.GetPatchManifestFileName(buildParameters.PackageName, buildParameters.PackageVersion);
string filePath = $"{pipelineOutputDirectory}/{fileName}";
string filePath = $"{packageOutputDirectory}/{fileName}";
PatchManifest.Serialize(filePath, patchManifest);
packageHash = HashUtility.FileMD5(filePath);
BuildRunner.Log($"创建补丁清单文件:{filePath}");
var patchManifestContext = new PatchManifestContext();
string jsonData = FileUtility.ReadFile(filePath);
patchManifestContext.Manifest = PatchManifest.Deserialize(jsonData);
context.SetContextObject(patchManifestContext);
}
// 创建补丁清单哈希文件
{
string fileName = YooAssetSettingsData.GetPatchManifestHashFileName(buildParameters.PackageName, buildParameters.PackageVersion);
string filePath = $"{pipelineOutputDirectory}/{fileName}";
string filePath = $"{packageOutputDirectory}/{fileName}";
FileUtility.CreateFile(filePath, packageHash);
BuildRunner.Log($"创建补丁清单哈希文件:{filePath}");
}
@@ -67,7 +77,7 @@ namespace YooAsset.Editor
// 创建补丁清单版本文件
{
string fileName = YooAssetSettingsData.GetPatchManifestVersionFileName(buildParameters.PackageName);
string filePath = $"{pipelineOutputDirectory}/{fileName}";
string filePath = $"{packageOutputDirectory}/{fileName}";
FileUtility.CreateFile(filePath, buildParameters.PackageVersion);
BuildRunner.Log($"创建补丁清单版本文件:{filePath}");
}
@@ -78,59 +88,17 @@ namespace YooAsset.Editor
/// </summary>
private List<PatchBundle> GetAllPatchBundle(BuildContext context)
{
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
var buildMapContext = context.GetContextObject<BuildMapContext>();
var encryptionContext = context.GetContextObject<TaskEncryption.EncryptionContext>();
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
List<PatchBundle> result = new List<PatchBundle>(1000);
foreach (var bundleInfo in buildMapContext.BundleInfos)
{
// NOTE检测路径长度不要超过260字符。
string filePath = $"{buildParametersContext.GetPipelineOutputDirectory()}/{bundleInfo.BundleName}";
if (filePath.Length >= 260)
throw new Exception($"The output bundle name is too long {filePath.Length} chars : {filePath}");
var bundleName = bundleInfo.BundleName;
string fileHash = GetBundleFileHash(bundleInfo, buildParametersContext);
string fileCRC = GetBundleFileCRC(bundleInfo, buildParametersContext);
long fileSize = GetBundleFileSize(bundleInfo, buildParametersContext);
string[] tags = buildMapContext.GetBundleTags(bundleName);
bool isEncrypted = encryptionContext.IsEncryptFile(bundleName);
bool isRawFile = bundleInfo.IsRawFile;
PatchBundle patchBundle = new PatchBundle(bundleName, fileHash, fileCRC, fileSize, tags);
patchBundle.SetFlagsValue(isRawFile, isEncrypted);
var patchBundle = bundleInfo.CreatePatchBundle();
result.Add(patchBundle);
}
return result;
}
private string GetBundleFileHash(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
{
var buildMode = buildParametersContext.Parameters.BuildMode;
if (buildMode == EBuildMode.DryRunBuild || buildMode == EBuildMode.SimulateBuild)
return "00000000000000000000000000000000"; //32位
string filePath = $"{buildParametersContext.GetPipelineOutputDirectory()}/{bundleInfo.BundleName}";
return HashUtility.FileMD5(filePath);
}
private string GetBundleFileCRC(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
{
var buildMode = buildParametersContext.Parameters.BuildMode;
if (buildMode == EBuildMode.DryRunBuild || buildMode == EBuildMode.SimulateBuild)
return "00000000"; //8位
string filePath = $"{buildParametersContext.GetPipelineOutputDirectory()}/{bundleInfo.BundleName}";
return HashUtility.FileCRC32(filePath);
}
private long GetBundleFileSize(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
{
var buildMode = buildParametersContext.Parameters.BuildMode;
if (buildMode == EBuildMode.DryRunBuild || buildMode == EBuildMode.SimulateBuild)
return 0;
string filePath = $"{buildParametersContext.GetPipelineOutputDirectory()}/{bundleInfo.BundleName}";
return FileUtility.GetFileSize(filePath);
}
/// <summary>
/// 获取资源列表
@@ -200,6 +168,10 @@ namespace YooAsset.Editor
shaderBundleReferenceList.Add(valuePair.Key);
}
// 注意:没有任何资源依赖着色器
if (shaderBundleReferenceList.Count == 0)
return;
// 获取着色器资源包索引
Predicate<PatchBundle> predicate = new Predicate<PatchBundle>(s => s.BundleName == shadersBunldeName);
int shaderBundleId = patchManifest.BundleList.FindIndex(predicate);

View File

@@ -9,55 +9,24 @@ namespace YooAsset.Editor
void IBuildTask.Run(BuildContext context)
{
var buildParameters = context.GetContextObject<BuildParametersContext>();
var buildMapContext = context.GetContextObject<BuildMapContext>();
var buildMode = buildParameters.Parameters.BuildMode;
if (buildMode == EBuildMode.ForceRebuild || buildMode == EBuildMode.IncrementalBuild)
{
CopyPatchFiles(buildParameters);
CopyPatchFiles(buildParameters, buildMapContext);
}
}
/// <summary>
/// 拷贝补丁文件到补丁包目录
/// </summary>
private void CopyPatchFiles(BuildParametersContext buildParametersContext)
private void CopyPatchFiles(BuildParametersContext buildParametersContext, BuildMapContext buildMapContext)
{
var buildParameters = buildParametersContext.Parameters;
string pipelineOutputDirectory = buildParametersContext.GetPipelineOutputDirectory();
string packageOutputDirectory = buildParametersContext.GetPackageOutputDirectory();
BuildRunner.Log($"开始拷贝补丁文件到补丁包目录:{packageOutputDirectory}");
// 拷贝Report文件
{
string fileName = YooAssetSettingsData.GetReportFileName(buildParameters.PackageName, buildParameters.PackageVersion);
string sourcePath = $"{pipelineOutputDirectory}/{fileName}";
string destPath = $"{packageOutputDirectory}/{fileName}";
EditorTools.CopyFile(sourcePath, destPath, true);
}
// 拷贝补丁清单文件
{
string fileName = YooAssetSettingsData.GetPatchManifestFileName(buildParameters.PackageName, buildParameters.PackageVersion);
string sourcePath = $"{pipelineOutputDirectory}/{fileName}";
string destPath = $"{packageOutputDirectory}/{fileName}";
EditorTools.CopyFile(sourcePath, destPath, true);
}
// 拷贝补丁清单哈希文件
{
string fileName = YooAssetSettingsData.GetPatchManifestHashFileName(buildParameters.PackageName, buildParameters.PackageVersion);
string sourcePath = $"{pipelineOutputDirectory}/{fileName}";
string destPath = $"{packageOutputDirectory}/{fileName}";
EditorTools.CopyFile(sourcePath, destPath, true);
}
// 拷贝补丁清单版本文件
{
string fileName = YooAssetSettingsData.GetPatchManifestVersionFileName(buildParameters.PackageName);
string sourcePath = $"{pipelineOutputDirectory}/{fileName}";
string destPath = $"{packageOutputDirectory}/{fileName}";
EditorTools.CopyFile(sourcePath, destPath, true);
}
if (buildParameters.BuildPipeline == EBuildPipeline.ScriptableBuildPipeline)
{
// 拷贝构建日志
@@ -75,7 +44,7 @@ namespace YooAsset.Editor
EditorTools.CopyFile(sourcePath, destPath, true);
}
}
else
else if (buildParameters.BuildPipeline == EBuildPipeline.BuiltinBuildPipeline)
{
// 拷贝UnityManifest序列化文件
{
@@ -91,16 +60,17 @@ namespace YooAsset.Editor
EditorTools.CopyFile(sourcePath, destPath, true);
}
}
else
{
throw new System.NotImplementedException();
}
// 拷贝所有补丁文件
int progressValue = 0;
PatchManifest patchManifest = AssetBundleBuilderHelper.LoadPatchManifestFile(pipelineOutputDirectory, buildParameters.PackageName, buildParameters.PackageVersion);
int patchFileTotalCount = patchManifest.BundleList.Count;
foreach (var patchBundle in patchManifest.BundleList)
int patchFileTotalCount = buildMapContext.BundleInfos.Count;
foreach (var bundleInfo in buildMapContext.BundleInfos)
{
string sourcePath = $"{pipelineOutputDirectory}/{patchBundle.BundleName}";
string destPath = $"{packageOutputDirectory}/{patchBundle.FileName}";
EditorTools.CopyFile(sourcePath, destPath, true);
EditorTools.CopyFile(bundleInfo.PatchInfo.BuildOutputFilePath, bundleInfo.PatchInfo.PatchOutputFilePath, true);
EditorTools.DisplayProgressBar("拷贝补丁文件", ++progressValue, patchFileTotalCount);
}
EditorTools.ClearProgressBar();

View File

@@ -12,24 +12,25 @@ namespace YooAsset.Editor
{
var buildParameters = context.GetContextObject<BuildParametersContext>();
var buildMapContext = context.GetContextObject<BuildMapContext>();
var patchManifestContext = context.GetContextObject<PatchManifestContext>();
buildParameters.StopWatch();
var buildMode = buildParameters.Parameters.BuildMode;
if (buildMode != EBuildMode.SimulateBuild)
{
CreateReportFile(buildParameters, buildMapContext);
CreateReportFile(buildParameters, buildMapContext, patchManifestContext);
}
float buildSeconds = buildParameters.GetBuildingSeconds();
BuildRunner.Info($"Build time consuming {buildSeconds} seconds.");
}
private void CreateReportFile(BuildParametersContext buildParametersContext, BuildMapContext buildMapContext)
private void CreateReportFile(BuildParametersContext buildParametersContext, BuildMapContext buildMapContext, PatchManifestContext patchManifestContext)
{
var buildParameters = buildParametersContext.Parameters;
string pipelineOutputDirectory = buildParametersContext.GetPipelineOutputDirectory();
PatchManifest patchManifest = AssetBundleBuilderHelper.LoadPatchManifestFile(pipelineOutputDirectory, buildParameters.PackageName, buildParameters.PackageVersion);
string packageOutputDirectory = buildParametersContext.GetPackageOutputDirectory();
PatchManifest patchManifest = patchManifestContext.Manifest;
BuildReport buildReport = new BuildReport();
// 概述信息
@@ -49,7 +50,6 @@ namespace YooAsset.Editor
buildReport.Summary.BuildPackageVersion = buildParameters.PackageVersion;
buildReport.Summary.EnableAddressable = buildMapContext.EnableAddressable;
buildReport.Summary.UniqueBundleName = buildMapContext.UniqueBundleName;
buildReport.Summary.EncryptionServicesClassName = buildParameters.EncryptionServices == null ?
"null" : buildParameters.EncryptionServices.GetType().FullName;
@@ -98,13 +98,14 @@ namespace YooAsset.Editor
reportBundleInfo.FileCRC = patchBundle.FileCRC;
reportBundleInfo.FileSize = patchBundle.FileSize;
reportBundleInfo.Tags = patchBundle.Tags;
reportBundleInfo.Flags = patchBundle.Flags;
reportBundleInfo.IsRawFile = patchBundle.IsRawFile;
reportBundleInfo.LoadMethod = (EBundleLoadMethod)patchBundle.LoadMethod;
buildReport.BundleInfos.Add(reportBundleInfo);
}
// 序列化文件
string fileName = YooAssetSettingsData.GetReportFileName(buildParameters.PackageName, buildParameters.PackageVersion);
string filePath = $"{pipelineOutputDirectory}/{fileName}";
string filePath = $"{packageOutputDirectory}/{fileName}";
BuildReport.Serialize(filePath, buildReport);
BuildRunner.Log($"资源构建报告文件创建完成:{filePath}");
}
@@ -178,7 +179,7 @@ namespace YooAsset.Editor
int fileCount = 0;
foreach (var patchBundle in patchManifest.BundleList)
{
if (patchBundle.IsEncrypted)
if (patchBundle.LoadMethod != (byte)EBundleLoadMethod.Normal)
fileCount++;
}
return fileCount;
@@ -188,7 +189,7 @@ namespace YooAsset.Editor
long fileBytes = 0;
foreach (var patchBundle in patchManifest.BundleList)
{
if (patchBundle.IsEncrypted)
if (patchBundle.LoadMethod != (byte)EBundleLoadMethod.Normal)
fileBytes += patchBundle.FileSize;
}
return fileBytes;

View File

@@ -9,19 +9,6 @@ namespace YooAsset.Editor
[TaskAttribute("资源包加密")]
public class TaskEncryption : IBuildTask
{
public class EncryptionContext : IContextObject
{
public List<string> EncryptList;
/// <summary>
/// 检测是否为加密文件
/// </summary>
public bool IsEncryptFile(string bundleName)
{
return EncryptList.Contains(bundleName);
}
}
void IBuildTask.Run(BuildContext context)
{
var buildParameters = context.GetContextObject<BuildParametersContext>();
@@ -30,65 +17,52 @@ namespace YooAsset.Editor
var buildMode = buildParameters.Parameters.BuildMode;
if (buildMode == EBuildMode.ForceRebuild || buildMode == EBuildMode.IncrementalBuild)
{
EncryptionContext encryptionContext = new EncryptionContext();
encryptionContext.EncryptList = EncryptFiles(buildParameters, buildMapContext);
context.SetContextObject(encryptionContext);
}
else
{
EncryptionContext encryptionContext = new EncryptionContext();
encryptionContext.EncryptList = new List<string>();
context.SetContextObject(encryptionContext);
EncryptingBundleFiles(buildParameters, buildMapContext);
}
}
/// <summary>
/// 加密文件
/// </summary>
private List<string> EncryptFiles(BuildParametersContext buildParametersContext, BuildMapContext buildMapContext)
private void EncryptingBundleFiles(BuildParametersContext buildParametersContext, BuildMapContext buildMapContext)
{
var encryptionServices = buildParametersContext.Parameters.EncryptionServices;
// 加密资源列表
List<string> encryptList = new List<string>();
// 如果没有设置加密类
if (encryptionServices == null)
return encryptList;
return;
int progressValue = 0;
string pipelineOutputDirectory = buildParametersContext.GetPipelineOutputDirectory();
foreach (var bundleInfo in buildMapContext.BundleInfos)
{
if (encryptionServices.Check(bundleInfo.BundleName))
bundleInfo.LoadMethod = EBundleLoadMethod.Normal;
EncryptFileInfo fileInfo = new EncryptFileInfo();
fileInfo.BundleName = bundleInfo.BundleName;
fileInfo.FilePath = $"{pipelineOutputDirectory}/{bundleInfo.BundleName}";
var encryptResult = encryptionServices.Encrypt(fileInfo);
if (encryptResult.LoadMethod != EBundleLoadMethod.Normal)
{
// 注意:原生文件不支持加密
if (bundleInfo.IsRawFile)
{
UnityEngine.Debug.LogWarning($"Encryption not support raw file : {bundleInfo.BundleName}");
continue;
}
encryptList.Add(bundleInfo.BundleName);
// 注意:通过判断文件合法性,规避重复加密一个文件
string filePath = $"{pipelineOutputDirectory}/{bundleInfo.BundleName}";
byte[] fileData = File.ReadAllBytes(filePath);
if (EditorTools.CheckBundleFileValid(fileData))
{
byte[] bytes = encryptionServices.Encrypt(fileData);
File.WriteAllBytes(filePath, bytes);
BuildRunner.Log($"文件加密完成:{filePath}");
}
string filePath = $"{pipelineOutputDirectory}/{bundleInfo.BundleName}.encrypt";
FileUtility.CreateFile(filePath, encryptResult.EncryptedData);
bundleInfo.EncryptedFilePath = filePath;
bundleInfo.LoadMethod = encryptResult.LoadMethod;
BuildRunner.Log($"Bundle文件加密完成{filePath}");
}
// 进度条
EditorTools.DisplayProgressBar("加密资源包", ++progressValue, buildMapContext.BundleInfos.Count);
}
EditorTools.ClearProgressBar();
if(encryptList.Count == 0)
UnityEngine.Debug.LogWarning($"没有发现需要加密的文件!");
return encryptList;
}
}
}

View File

@@ -0,0 +1,118 @@
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
namespace YooAsset.Editor
{
[TaskAttribute("更新构建信息")]
public class TaskUpdateBuildInfo : IBuildTask
{
void IBuildTask.Run(BuildContext context)
{
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
var buildMapContext = context.GetContextObject<BuildMapContext>();
string pipelineOutputDirectory = buildParametersContext.GetPipelineOutputDirectory();
string packageOutputDirectory = buildParametersContext.GetPackageOutputDirectory();
int outputNameStyle = (int)buildParametersContext.Parameters.OutputNameStyle;
// 1.检测路径长度
foreach (var bundleInfo in buildMapContext.BundleInfos)
{
// NOTE检测路径长度不要超过260字符。
string filePath = $"{pipelineOutputDirectory}/{bundleInfo.BundleName}";
if (filePath.Length >= 260)
throw new Exception($"The output bundle name is too long {filePath.Length} chars : {filePath}");
}
// 2.更新构建输出的文件路径
foreach (var bundleInfo in buildMapContext.BundleInfos)
{
if (bundleInfo.IsEncryptedFile)
bundleInfo.PatchInfo.BuildOutputFilePath = bundleInfo.EncryptedFilePath;
else
bundleInfo.PatchInfo.BuildOutputFilePath = $"{pipelineOutputDirectory}/{bundleInfo.BundleName}";
}
// 3.更新文件其它信息
foreach (var bundleInfo in buildMapContext.BundleInfos)
{
string buildOutputFilePath = bundleInfo.PatchInfo.BuildOutputFilePath;
bundleInfo.PatchInfo.ContentHash = GetBundleContentHash(bundleInfo, context);
bundleInfo.PatchInfo.PatchFileHash = GetBundleFileHash(buildOutputFilePath, buildParametersContext);
bundleInfo.PatchInfo.PatchFileCRC = GetBundleFileCRC(buildOutputFilePath, buildParametersContext);
bundleInfo.PatchInfo.PatchFileSize = GetBundleFileSize(buildOutputFilePath, buildParametersContext);
}
// 4.更新补丁包输出的文件路径
foreach (var bundleInfo in buildMapContext.BundleInfos)
{
string patchFileName = PatchManifest.CreateBundleFileName(outputNameStyle, bundleInfo.BundleName, bundleInfo.PatchInfo.PatchFileHash);
bundleInfo.PatchInfo.PatchOutputFilePath = $"{packageOutputDirectory}/{patchFileName}";
}
}
private string GetBundleContentHash(BuildBundleInfo bundleInfo, BuildContext context)
{
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
var parameters = buildParametersContext.Parameters;
var buildMode = parameters.BuildMode;
if (buildMode == EBuildMode.DryRunBuild || buildMode == EBuildMode.SimulateBuild)
return "00000000000000000000000000000000"; //32位
if (bundleInfo.IsRawFile)
{
string filePath = bundleInfo.PatchInfo.BuildOutputFilePath;
return HashUtility.FileMD5(filePath);
}
if (parameters.BuildPipeline == EBuildPipeline.BuiltinBuildPipeline)
{
var buildResult = context.GetContextObject<TaskBuilding.BuildResultContext>();
var hash = buildResult.UnityManifest.GetAssetBundleHash(bundleInfo.BundleName);
if (hash.isValid)
return hash.ToString();
else
throw new Exception($"Not found bundle in build result : {bundleInfo.BundleName}");
}
else if (parameters.BuildPipeline == EBuildPipeline.ScriptableBuildPipeline)
{
// 注意当资源包的依赖列表发生变化的时候ContentHash也会发生变化
var buildResult = context.GetContextObject<TaskBuilding_SBP.BuildResultContext>();
if (buildResult.Results.BundleInfos.TryGetValue(bundleInfo.BundleName, out var value))
return value.Hash.ToString();
else
throw new Exception($"Not found bundle in build result : {bundleInfo.BundleName}");
}
else
{
throw new System.NotImplementedException();
}
}
private string GetBundleFileHash(string filePath, BuildParametersContext buildParametersContext)
{
var buildMode = buildParametersContext.Parameters.BuildMode;
if (buildMode == EBuildMode.DryRunBuild || buildMode == EBuildMode.SimulateBuild)
return "00000000000000000000000000000000"; //32位
else
return HashUtility.FileMD5(filePath);
}
private string GetBundleFileCRC(string filePath, BuildParametersContext buildParametersContext)
{
var buildMode = buildParametersContext.Parameters.BuildMode;
if (buildMode == EBuildMode.DryRunBuild || buildMode == EBuildMode.SimulateBuild)
return "00000000"; //8位
else
return HashUtility.FileCRC32(filePath);
}
private long GetBundleFileSize(string filePath, BuildParametersContext buildParametersContext)
{
var buildMode = buildParametersContext.Parameters.BuildMode;
if (buildMode == EBuildMode.DryRunBuild || buildMode == EBuildMode.SimulateBuild)
return 0;
else
return FileUtility.GetFileSize(filePath);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4882f54fbf0bcb04680fb581deae4889
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,18 +0,0 @@

namespace YooAsset.Editor
{
public interface IEncryptionServices
{
/// <summary>
/// 检测是否需要加密
/// </summary>
bool Check(string bundleName);
/// <summary>
/// 加密方法
/// </summary>
/// <param name="fileData">要加密的文件数据</param>
/// <returns>返回加密后的字节数据</returns>
byte[] Encrypt(byte[] fileData);
}
}

View File

@@ -187,6 +187,7 @@ namespace YooAsset.Editor
{
selectGroup.GroupName = evt.newValue;
AssetBundleCollectorSettingData.ModifyGroup(selectPackage, selectGroup);
FillGroupViewData();
}
});
@@ -200,6 +201,7 @@ namespace YooAsset.Editor
{
selectGroup.GroupDesc = evt.newValue;
AssetBundleCollectorSettingData.ModifyGroup(selectPackage, selectGroup);
FillGroupViewData();
}
});

View File

@@ -25,7 +25,7 @@ namespace YooAsset.Editor
private ToolbarButton _topBar1;
private ToolbarButton _topBar2;
private ToolbarButton _topBar3;
private ToolbarButton _topBar4;
private ToolbarButton _topBar5;
private ToolbarButton _bottomBar1;
private ListView _bundleListView;
private ListView _includeListView;
@@ -53,11 +53,11 @@ namespace YooAsset.Editor
_topBar1 = _root.Q<ToolbarButton>("TopBar1");
_topBar2 = _root.Q<ToolbarButton>("TopBar2");
_topBar3 = _root.Q<ToolbarButton>("TopBar3");
_topBar4 = _root.Q<ToolbarButton>("TopBar4");
_topBar5 = _root.Q<ToolbarButton>("TopBar5");
_topBar1.clicked += TopBar1_clicked;
_topBar2.clicked += TopBar2_clicked;
_topBar3.clicked += TopBar3_clicked;
_topBar4.clicked += TopBar4_clicked;
_topBar5.clicked += TopBar4_clicked;
// 底部按钮栏
_bottomBar1 = _root.Q<ToolbarButton>("BottomBar1");
@@ -144,7 +144,7 @@ namespace YooAsset.Editor
_topBar1.text = $"Bundle Name ({_bundleListView.itemsSource.Count})";
_topBar2.text = "Size";
_topBar3.text = "Hash";
_topBar4.text = "Tags";
_topBar5.text = "Tags";
if (_sortMode == ESortMode.BundleName)
{
@@ -163,9 +163,9 @@ namespace YooAsset.Editor
else if (_sortMode == ESortMode.BundleTags)
{
if (_descendingSort)
_topBar4.text = "Tags ↓";
_topBar5.text = "Tags ↓";
else
_topBar4.text = "Tags ↑";
_topBar5.text = "Tags ↑";
}
else
{
@@ -231,6 +231,16 @@ namespace YooAsset.Editor
label.name = "Label5";
label.style.unityTextAlign = TextAnchor.MiddleLeft;
label.style.marginLeft = 3f;
//label.style.flexGrow = 1f;
label.style.width = 150;
element.Add(label);
}
{
var label = new Label();
label.name = "Label6";
label.style.unityTextAlign = TextAnchor.MiddleLeft;
label.style.marginLeft = 3f;
label.style.flexGrow = 1f;
label.style.width = 80;
element.Add(label);
@@ -255,9 +265,13 @@ namespace YooAsset.Editor
var label3 = element.Q<Label>("Label3");
label3.text = bundleInfo.FileHash;
// Tags
// LoadMethod
var label5 = element.Q<Label>("Label5");
label5.text = bundleInfo.GetTagsString();
label5.text = bundleInfo.LoadMethod.ToString();
// Tags
var label6 = element.Q<Label>("Label6");
label6.text = bundleInfo.GetTagsString();
}
private void BundleListView_onSelectionChange(IEnumerable<object> objs)
{
@@ -271,7 +285,7 @@ namespace YooAsset.Editor
}
private void ShowAssetBundleInspector(ReportBundleInfo bundleInfo)
{
if (bundleInfo.IsRawFile())
if (bundleInfo.IsRawFile)
return;
string rootDirectory = Path.GetDirectoryName(_reportFilePath);

View File

@@ -5,7 +5,8 @@
<uie:ToolbarButton text="Bundle Name" display-tooltip-when-elided="true" name="TopBar1" style="width: 280px; -unity-text-align: middle-left; flex-grow: 1;" />
<uie:ToolbarButton text="Size" display-tooltip-when-elided="true" name="TopBar2" style="width: 100px; -unity-text-align: middle-left; flex-grow: 0;" />
<uie:ToolbarButton text="Hash" display-tooltip-when-elided="true" name="TopBar3" style="width: 280px; -unity-text-align: middle-left;" />
<uie:ToolbarButton text="Tags" display-tooltip-when-elided="true" name="TopBar4" style="width: 80px; -unity-text-align: middle-left; flex-grow: 1;" />
<uie:ToolbarButton text="LoadMethod" display-tooltip-when-elided="true" name="TopBar4" style="width: 150px; -unity-text-align: middle-left; flex-grow: 0;" />
<uie:ToolbarButton text="Tags" display-tooltip-when-elided="true" name="TopBar5" style="width: 80px; -unity-text-align: middle-left; flex-grow: 1;" />
</uie:Toolbar>
<ui:ListView focusable="true" name="TopListView" item-height="18" virtualization-method="DynamicHeight" style="flex-grow: 1;" />
</ui:VisualElement>

View File

@@ -8,7 +8,14 @@ namespace YooAsset.Editor
/// <summary>
/// 停靠窗口类型集合
/// </summary>
public static readonly Type[] DockedWindowTypes = { typeof(AssetBundleBuilderWindow), typeof(AssetBundleCollectorWindow), typeof(AssetBundleDebuggerWindow), typeof(AssetBundleReporterWindow)};
public static readonly Type[] DockedWindowTypes =
{
typeof(AssetBundleBuilderWindow),
typeof(AssetBundleCollectorWindow),
typeof(AssetBundleDebuggerWindow),
typeof(AssetBundleReporterWindow),
typeof(ShaderVariantCollectorWindow)
};
#endif
}

View File

@@ -10,6 +10,7 @@ namespace YooAsset.Editor
#if UNITY_2019_4_OR_NEWER
private readonly static Dictionary<System.Type, string> _uxmlDic = new Dictionary<System.Type, string>();
/*
static EditorHelper()
{
// 资源包收集
@@ -51,6 +52,46 @@ namespace YooAsset.Editor
throw new System.Exception($"Invalid YooAsset window type : {windowType}");
}
}
*/
/// <summary>
/// 加载窗口的布局文件
/// </summary>
public static UnityEngine.UIElements.VisualTreeAsset LoadWindowUXML<TWindow>() where TWindow : class
{
var windowType = typeof(TWindow);
// 缓存里查询并加载
if (_uxmlDic.TryGetValue(windowType, out string uxmlGUID))
{
string assetPath = AssetDatabase.GUIDToAssetPath(uxmlGUID);
if (string.IsNullOrEmpty(assetPath))
{
_uxmlDic.Clear();
throw new System.Exception($"Invalid UXML GUID : {uxmlGUID} ! Please close the window and open it again !");
}
var treeAsset = AssetDatabase.LoadAssetAtPath<UnityEngine.UIElements.VisualTreeAsset>(assetPath);
return treeAsset;
}
// 全局搜索并加载
string[] guids = AssetDatabase.FindAssets(windowType.Name);
if (guids.Length == 0)
throw new System.Exception($"Not found any assets : {windowType.Name}");
foreach (string assetGUID in guids)
{
string assetPath = AssetDatabase.GUIDToAssetPath(assetGUID);
var assetType = AssetDatabase.GetMainAssetTypeAtPath(assetPath);
if (assetType == typeof(UnityEngine.UIElements.VisualTreeAsset))
{
_uxmlDic.Add(windowType, assetGUID);
var treeAsset = AssetDatabase.LoadAssetAtPath<UnityEngine.UIElements.VisualTreeAsset>(assetPath);
return treeAsset;
}
}
throw new System.Exception($"Not found UXML file : {windowType.Name}");
}
#endif
/// <summary>

View File

@@ -349,9 +349,9 @@ namespace YooAsset.Editor
}
/// <summary>
/// 文件移动
/// 移动文件
/// </summary>
public static void FileMoveTo(string filePath, string destPath)
public static void MoveFile(string filePath, string destPath)
{
if (File.Exists(destPath))
File.Delete(destPath);
@@ -359,7 +359,7 @@ namespace YooAsset.Editor
FileInfo fileInfo = new FileInfo(filePath);
fileInfo.MoveTo(destPath);
}
/// <summary>
/// 拷贝文件夹
/// 注意:包括所有子目录的文件

View File

@@ -9,7 +9,8 @@ using UnityEditor;
namespace YooAsset.Editor
{
public static class ShaderVariantCollectionReadme
[Serializable]
public class ShaderVariantCollectionManifest
{
[Serializable]
public class ShaderVariantElement
@@ -44,52 +45,49 @@ namespace YooAsset.Editor
public List<ShaderVariantElement> ShaderVariantElements = new List<ShaderVariantElement>(1000);
}
[Serializable]
public class ShaderVariantCollectionManifest
/// <summary>
/// Number of shaders in this collection
/// </summary>
public int ShaderTotalCount;
/// <summary>
/// Number of total varians in this collection
/// </summary>
public int VariantTotalCount;
/// <summary>
/// Shader variants info list.
/// </summary>
public List<ShaderVariantInfo> ShaderVariantInfos = new List<ShaderVariantInfo>(1000);
/// <summary>
/// 添加着色器变种信息
/// </summary>
public void AddShaderVariant(string assetPath, string shaderName, PassType passType, string[] keywords)
{
/// <summary>
/// Number of shaders in this collection
/// </summary>
public int ShaderTotalCount;
/// <summary>
/// Number of total varians in this collection
/// </summary>
public int VariantTotalCount;
/// <summary>
/// Shader variants info list.
/// </summary>
public List<ShaderVariantInfo> ShaderVariantInfos = new List<ShaderVariantInfo>(1000);
/// <summary>
/// 添加着色器变种信息
/// </summary>
public void AddShaderVariant(string assetPath, string shaderName, PassType passType, string[] keywords)
var info = GetOrCreateShaderVariantInfo(assetPath, shaderName);
ShaderVariantElement element = new ShaderVariantElement();
element.PassType = passType;
element.Keywords = keywords;
info.ShaderVariantElements.Add(element);
}
private ShaderVariantInfo GetOrCreateShaderVariantInfo(string assetPath, string shaderName)
{
var selectList = ShaderVariantInfos.Where(t => t.ShaderName == shaderName && t.AssetPath == assetPath).ToList();
if (selectList.Count == 0)
{
var info = GetOrCreateShaderVariantInfo(assetPath, shaderName);
ShaderVariantElement element = new ShaderVariantElement();
element.PassType = passType;
element.Keywords = keywords;
info.ShaderVariantElements.Add(element);
ShaderVariantInfo newInfo = new ShaderVariantInfo();
newInfo.AssetPath = assetPath;
newInfo.ShaderName = shaderName;
ShaderVariantInfos.Add(newInfo);
return newInfo;
}
private ShaderVariantInfo GetOrCreateShaderVariantInfo(string assetPath, string shaderName)
{
var selectList = ShaderVariantInfos.Where(t => t.ShaderName == shaderName && t.AssetPath == assetPath).ToList();
if (selectList.Count == 0)
{
ShaderVariantInfo newInfo = new ShaderVariantInfo();
newInfo.AssetPath = assetPath;
newInfo.ShaderName = shaderName;
ShaderVariantInfos.Add(newInfo);
return newInfo;
}
if (selectList.Count != 1)
throw new Exception("Should never get here !");
if (selectList.Count != 1)
throw new Exception("Should never get here !");
return selectList[0];
}
return selectList[0];
}

View File

@@ -30,8 +30,8 @@ namespace YooAsset.Editor
// 保存结果
ShaderVariantCollectionHelper.SaveCurrentShaderVariantCollection(_saveFilePath);
// 创建说明文件
CreateReadme();
// 创建清单
CreateManifest();
Debug.Log($"搜集SVC完毕");
_completedCallback?.Invoke();
@@ -64,7 +64,7 @@ namespace YooAsset.Editor
ShaderVariantCollectionHelper.ClearCurrentShaderVariantCollection();
// 创建临时测试场景
CreateTemperScene();
CreateTempScene();
// 收集着色器变种
var materials = GetAllMaterials();
@@ -76,9 +76,8 @@ namespace YooAsset.Editor
_elapsedTime.Start();
}
private static void CreateTemperScene()
private static void CreateTempScene()
{
// 创建临时场景
EditorSceneManager.NewScene(NewSceneSetup.DefaultGameObjects);
}
private static List<Material> GetAllMaterials()
@@ -186,17 +185,17 @@ namespace YooAsset.Editor
go.transform.position = position;
go.name = $"Sphere_{index}|{material.name}";
}
private static void CreateReadme()
private static void CreateManifest()
{
AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate);
ShaderVariantCollection svc = AssetDatabase.LoadAssetAtPath<ShaderVariantCollection>(_saveFilePath);
if (svc != null)
{
var wrapper = ShaderVariantCollectionReadme.Extract(svc);
string jsonContents = JsonUtility.ToJson(wrapper, true);
string savePath = _saveFilePath.Replace(".shadervariants", "Manifest.json");
File.WriteAllText(savePath, jsonContents);
var wrapper = ShaderVariantCollectionManifest.Extract(svc);
string jsonData = JsonUtility.ToJson(wrapper, true);
string savePath = _saveFilePath.Replace(".shadervariants", ".json");
File.WriteAllText(savePath, jsonData);
}
AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate);

View File

@@ -1,61 +1,82 @@
using UnityEngine;
#if UNITY_2019_4_OR_NEWER
using System;
using System.Linq;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using UnityEditor.UIElements;
using UnityEngine.UIElements;
namespace YooAsset.Editor
{
public class ShaderVariantCollectionWindow : EditorWindow
public class ShaderVariantCollectorWindow : EditorWindow
{
static ShaderVariantCollectionWindow _thisInstance;
[MenuItem("YooAsset/ShaderVariant Collector", false, 201)]
static void ShowWindow()
public static void ShowExample()
{
if (_thisInstance == null)
{
_thisInstance = GetWindow<ShaderVariantCollectionWindow>("着色器变种收集工具");
_thisInstance.minSize = new Vector2(800, 600);
}
_thisInstance.Show();
ShaderVariantCollectorWindow window = GetWindow<ShaderVariantCollectorWindow>("着色器变种收集工具", true, EditorDefine.DockedWindowTypes);
window.minSize = new Vector2(800, 600);
}
private ShaderVariantCollection _selectSVC;
private Button _collectButton;
private TextField _collectOutputField;
private Label _currentShaderCountField;
private Label _currentVariantCountField;
private void OnGUI()
public void CreateGUI()
{
EditorGUILayout.Space();
ShaderVariantCollectorSettingData.Setting.SavePath = EditorGUILayout.TextField("收集文件保存路径", ShaderVariantCollectorSettingData.Setting.SavePath);
int currentShaderCount = ShaderVariantCollectionHelper.GetCurrentShaderVariantCollectionShaderCount();
int currentVariantCount = ShaderVariantCollectionHelper.GetCurrentShaderVariantCollectionVariantCount();
EditorGUILayout.LabelField($"CurrentShaderCount : {currentShaderCount}");
EditorGUILayout.LabelField($"CurrentVariantCount : {currentVariantCount}");
// 搜集变种
EditorGUILayout.Space();
if (GUILayout.Button("搜集变种", GUILayout.MaxWidth(80)))
try
{
ShaderVariantCollector.Run(ShaderVariantCollectorSettingData.Setting.SavePath, null);
}
VisualElement root = this.rootVisualElement;
// 查询
EditorGUILayout.Space();
if (GUILayout.Button("查询", GUILayout.MaxWidth(80)))
{
string resultPath = EditorTools.OpenFilePath("Select File", "Assets/", "shadervariants");
if (string.IsNullOrEmpty(resultPath))
// 加载布局文件
var visualAsset = EditorHelper.LoadWindowUXML<ShaderVariantCollectorWindow>();
if (visualAsset == null)
return;
string assetPath = EditorTools.AbsolutePathToAssetPath(resultPath);
_selectSVC = AssetDatabase.LoadAssetAtPath<ShaderVariantCollection>(assetPath);
visualAsset.CloneTree(root);
// 文件输出目录
_collectOutputField = root.Q<TextField>("CollectOutput");
_collectOutputField.SetValueWithoutNotify(ShaderVariantCollectorSettingData.Setting.SavePath);
_collectOutputField.RegisterValueChangedCallback(evt =>
{
ShaderVariantCollectorSettingData.Setting.SavePath = _collectOutputField.value;
});
_currentShaderCountField = root.Q<Label>("CurrentShaderCount");
_currentVariantCountField = root.Q<Label>("CurrentVariantCount");
// 变种收集按钮
_collectButton = root.Q<Button>("CollectButton");
_collectButton.clicked += CollectButton_clicked;
//RefreshWindow();
}
if (_selectSVC != null)
catch (Exception e)
{
EditorGUILayout.LabelField($"ShaderCount : {_selectSVC.shaderCount}");
EditorGUILayout.LabelField($"VariantCount : {_selectSVC.variantCount}");
Debug.LogError(e.ToString());
}
}
private void OnDestroy()
private void Update()
{
ShaderVariantCollectorSettingData.SaveFile();
if (_currentShaderCountField != null)
{
int currentShaderCount = ShaderVariantCollectionHelper.GetCurrentShaderVariantCollectionShaderCount();
_currentShaderCountField.text = $"Current Shader Count : {currentShaderCount}";
}
if (_currentVariantCountField != null)
{
int currentVariantCount = ShaderVariantCollectionHelper.GetCurrentShaderVariantCollectionVariantCount();
_currentVariantCountField.text = $"Current Variant Count : {currentVariantCount}";
}
}
private void CollectButton_clicked()
{
ShaderVariantCollector.Run(ShaderVariantCollectorSettingData.Setting.SavePath, null);
}
}
}
}
#endif

View File

@@ -0,0 +1,9 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../UIElementsSchema/UIElements.xsd" editor-extension-mode="True">
<uie:Toolbar name="Toolbar" style="display: flex; flex-direction: row-reverse;" />
<ui:VisualElement name="BuildContainer">
<ui:TextField picking-mode="Ignore" label="文件保存路径" name="CollectOutput" />
<ui:Label text="Current Shader Count" display-tooltip-when-elided="true" name="CurrentShaderCount" />
<ui:Label text="Current Variant Count" display-tooltip-when-elided="true" name="CurrentVariantCount" />
<ui:Button text="开始搜集" display-tooltip-when-elided="true" name="CollectButton" style="height: 50px; background-color: rgb(40, 106, 42); margin-top: 10px;" />
</ui:VisualElement>
</ui:UXML>

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 9bff4878063eaf04dab8713e1e662ac5
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}

View File

@@ -13,6 +13,8 @@ namespace YooAsset
None = 0,
Download,
CheckDownload,
Unpack,
CheckUnpack,
LoadFile,
CheckLoadFile,
Done,
@@ -22,8 +24,10 @@ namespace YooAsset
private string _fileLoadPath;
private bool _isWaitForAsyncComplete = false;
private bool _isShowWaitForAsyncError = false;
private DownloaderBase _unpacker;
private DownloaderBase _downloader;
private AssetBundleCreateRequest _createRequest;
private FileStream _fileStream;
public AssetBundleFileLoader(AssetSystemImpl impl, BundleInfo bundleInfo) : base(impl, bundleInfo)
@@ -47,8 +51,22 @@ namespace YooAsset
}
else if (MainBundleInfo.LoadMode == BundleInfo.ELoadMode.LoadFromStreaming)
{
#if UNITY_ANDROID
EBundleLoadMethod loadMethod = (EBundleLoadMethod)MainBundleInfo.Bundle.LoadMethod;
if (loadMethod == EBundleLoadMethod.LoadFromMemory || loadMethod == EBundleLoadMethod.LoadFromStream)
{
_steps = ESteps.Unpack;
_fileLoadPath = MainBundleInfo.Bundle.CachedFilePath;
}
else
{
_steps = ESteps.LoadFile;
_fileLoadPath = MainBundleInfo.Bundle.StreamingFilePath;
}
#else
_steps = ESteps.LoadFile;
_fileLoadPath = MainBundleInfo.Bundle.StreamingFilePath;
#endif
}
else if (MainBundleInfo.LoadMode == BundleInfo.ELoadMode.LoadFromCache)
{
@@ -87,7 +105,34 @@ namespace YooAsset
}
}
// 3. 加载AssetBundle
// 3. 内置文件解压
if (_steps == ESteps.Unpack)
{
int failedTryAgain = 1;
var bundleInfo = HostPlayModeImpl.ConvertToUnpackInfo(MainBundleInfo.Bundle);
_unpacker = DownloadSystem.BeginDownload(bundleInfo, failedTryAgain);
_steps = ESteps.CheckUnpack;
}
// 4.检测内置文件解压结果
if (_steps == ESteps.CheckUnpack)
{
if (_unpacker.IsDone() == false)
return;
if (_unpacker.HasError())
{
_steps = ESteps.Done;
Status = EStatus.Failed;
LastError = _unpacker.GetLastError();
}
else
{
_steps = ESteps.LoadFile;
}
}
// 5. 加载AssetBundle
if (_steps == ESteps.LoadFile)
{
#if UNITY_EDITOR
@@ -103,31 +148,63 @@ namespace YooAsset
#endif
// Load assetBundle file
if (MainBundleInfo.Bundle.IsEncrypted)
{
if (Impl.DecryptionServices == null)
throw new Exception($"{nameof(AssetBundleFileLoader)} need {nameof(IDecryptionServices)} : {MainBundleInfo.Bundle.BundleName}");
DecryptionFileInfo fileInfo = new DecryptionFileInfo();
fileInfo.BundleName = MainBundleInfo.Bundle.BundleName;
fileInfo.FileHash = MainBundleInfo.Bundle.FileHash;
ulong offset = Impl.DecryptionServices.GetFileOffset(fileInfo);
if (_isWaitForAsyncComplete)
CacheBundle = AssetBundle.LoadFromFile(_fileLoadPath, 0, offset);
else
_createRequest = AssetBundle.LoadFromFileAsync(_fileLoadPath, 0, offset);
}
else
var loadMethod = (EBundleLoadMethod)MainBundleInfo.Bundle.LoadMethod;
if (loadMethod == EBundleLoadMethod.Normal)
{
if (_isWaitForAsyncComplete)
CacheBundle = AssetBundle.LoadFromFile(_fileLoadPath);
else
_createRequest = AssetBundle.LoadFromFileAsync(_fileLoadPath);
}
else
{
if (Impl.DecryptionServices == null)
{
_steps = ESteps.Done;
Status = EStatus.Failed;
LastError = $"{nameof(IDecryptionServices)} is null : {MainBundleInfo.Bundle.BundleName}";
YooLogger.Error(LastError);
return;
}
DecryptFileInfo fileInfo = new DecryptFileInfo();
fileInfo.BundleName = MainBundleInfo.Bundle.BundleName;
fileInfo.FilePath = _fileLoadPath;
if (loadMethod == EBundleLoadMethod.LoadFromFileOffset)
{
ulong offset = Impl.DecryptionServices.LoadFromFileOffset(fileInfo);
if (_isWaitForAsyncComplete)
CacheBundle = AssetBundle.LoadFromFile(_fileLoadPath, 0, offset);
else
_createRequest = AssetBundle.LoadFromFileAsync(_fileLoadPath, 0, offset);
}
else if (loadMethod == EBundleLoadMethod.LoadFromMemory)
{
byte[] fileData = Impl.DecryptionServices.LoadFromMemory(fileInfo);
if (_isWaitForAsyncComplete)
CacheBundle = AssetBundle.LoadFromMemory(fileData);
else
_createRequest = AssetBundle.LoadFromMemoryAsync(fileData);
}
else if (loadMethod == EBundleLoadMethod.LoadFromStream)
{
_fileStream = Impl.DecryptionServices.LoadFromStream(fileInfo);
uint managedReadBufferSize = Impl.DecryptionServices.GetManagedReadBufferSize();
if (_isWaitForAsyncComplete)
CacheBundle = AssetBundle.LoadFromStream(_fileStream, 0, managedReadBufferSize);
else
_createRequest = AssetBundle.LoadFromStreamAsync(_fileStream, 0, managedReadBufferSize);
}
else
{
throw new System.NotImplementedException();
}
}
_steps = ESteps.CheckLoadFile;
}
// 4. 检测AssetBundle加载结果
// 6. 检测AssetBundle加载结果
if (_steps == ESteps.CheckLoadFile)
{
if (_createRequest != null)
@@ -177,6 +254,21 @@ namespace YooAsset
}
}
/// <summary>
/// 销毁
/// </summary>
public override void Destroy(bool forceDestroy)
{
base.Destroy(forceDestroy);
if (_fileStream != null)
{
_fileStream.Close();
_fileStream.Dispose();
_fileStream = null;
}
}
/// <summary>
/// 主线程等待异步操作完毕
/// </summary>

View File

@@ -89,7 +89,7 @@ namespace YooAsset
/// <summary>
/// 销毁
/// </summary>
public void Destroy(bool forceDestroy)
public virtual void Destroy(bool forceDestroy)
{
IsDestroyed = true;

View File

@@ -17,7 +17,7 @@ namespace YooAsset
LoadCacheFile,
CheckLoadCacheFile,
LoadWebFile,
CheckLoadWebFile,
CheckLoadWebFile,
TryLoadWebFile,
Done,
}
@@ -30,7 +30,7 @@ namespace YooAsset
private UnityWebRequest _webRequest;
private AssetBundleCreateRequest _createRequest;
public AssetBundleWebLoader(AssetSystemImpl impl, BundleInfo bundleInfo) : base(impl, bundleInfo)
{
}
@@ -108,20 +108,18 @@ namespace YooAsset
#endif
// Load assetBundle file
if (MainBundleInfo.Bundle.IsEncrypted)
var loadMethod = (EBundleLoadMethod)MainBundleInfo.Bundle.LoadMethod;
if (loadMethod == EBundleLoadMethod.Normal)
{
if (Impl.DecryptionServices == null)
throw new Exception($"{nameof(AssetBundleFileLoader)} need {nameof(IDecryptionServices)} : {MainBundleInfo.Bundle.BundleName}");
DecryptionFileInfo fileInfo = new DecryptionFileInfo();
fileInfo.BundleName = MainBundleInfo.Bundle.BundleName;
fileInfo.FileHash = MainBundleInfo.Bundle.FileHash;
ulong offset = Impl.DecryptionServices.GetFileOffset(fileInfo);
_createRequest = AssetBundle.LoadFromFileAsync(_fileLoadPath, 0, offset);
_createRequest = AssetBundle.LoadFromFileAsync(_fileLoadPath);
}
else
{
_createRequest = AssetBundle.LoadFromFileAsync(_fileLoadPath);
_steps = ESteps.Done;
Status = EStatus.Failed;
LastError = $"WebGL not support encrypted bundle file : {MainBundleInfo.Bundle.BundleName}";
YooLogger.Error(LastError);
return;
}
_steps = ESteps.CheckLoadCacheFile;
}

View File

@@ -0,0 +1,29 @@

namespace YooAsset
{
/// <summary>
/// Bundle文件的加载方法
/// </summary>
public enum EBundleLoadMethod
{
/// <summary>
/// 正常加载(不需要解密)
/// </summary>
Normal = 0,
/// <summary>
/// 通过文件偏移来解密加载
/// </summary>
LoadFromFileOffset = 1,
/// <summary>
/// 通过文件内存来解密加载
/// </summary>
LoadFromMemory = 2,
/// <summary>
/// 通过文件流来解密加载
/// </summary>
LoadFromStream = 3,
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5e32c14ed62806b4189d20ad48ce7631
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -146,7 +146,7 @@ namespace YooAsset
{
_steps = ESteps.Done;
Status = EOperationStatus.Failed;
Error = e.ToString();
Error = e.Message;
}
}
}
@@ -171,14 +171,14 @@ namespace YooAsset
{
None,
Prepare,
DownloadBuildinFile,
CheckDownload,
Unpack,
CheckUnpack,
CheckAndCopyFile,
Done,
}
private ESteps _steps = ESteps.None;
private DownloaderBase _downloader;
private DownloaderBase _unpacker;
public OfflinePlayModeRawFileOperation(BundleInfo bundleInfo, string copyPath) : base(bundleInfo, copyPath)
{
@@ -203,7 +203,7 @@ namespace YooAsset
}
else if (_bundleInfo.LoadMode == BundleInfo.ELoadMode.LoadFromStreaming)
{
_steps = ESteps.DownloadBuildinFile;
_steps = ESteps.Unpack;
}
else if (_bundleInfo.LoadMode == BundleInfo.ELoadMode.LoadFromCache)
{
@@ -215,27 +215,27 @@ namespace YooAsset
}
}
// 2. 下载文件
if (_steps == ESteps.DownloadBuildinFile)
// 2. 内置文件解压
if (_steps == ESteps.Unpack)
{
int failedTryAgain = int.MaxValue;
var bundleInfo = PatchHelper.ConvertToUnpackInfo(_bundleInfo.Bundle);
_downloader = DownloadSystem.BeginDownload(bundleInfo, failedTryAgain);
_steps = ESteps.CheckDownload;
int failedTryAgain = 1;
var bundleInfo = HostPlayModeImpl.ConvertToUnpackInfo(_bundleInfo.Bundle);
_unpacker = DownloadSystem.BeginDownload(bundleInfo, failedTryAgain);
_steps = ESteps.CheckUnpack;
}
// 3. 检测下载结果
if (_steps == ESteps.CheckDownload)
// 3. 检测内置文件解压结果
if (_steps == ESteps.CheckUnpack)
{
Progress = _downloader.DownloadProgress;
if (_downloader.IsDone() == false)
Progress = _unpacker.DownloadProgress;
if (_unpacker.IsDone() == false)
return;
if (_downloader.HasError())
if (_unpacker.HasError())
{
_steps = ESteps.Done;
Status = EOperationStatus.Failed;
Error = _downloader.GetLastError();
Error = _unpacker.GetLastError();
}
else
{
@@ -281,7 +281,7 @@ namespace YooAsset
{
_steps = ESteps.Done;
Status = EOperationStatus.Failed;
Error = e.ToString();
Error = e.Message;
}
}
}
@@ -306,14 +306,16 @@ namespace YooAsset
{
None,
Prepare,
DownloadWebFile,
DownloadBuildinFile,
Download,
CheckDownload,
Unpack,
CheckUnpack,
CheckAndCopyFile,
Done,
}
private ESteps _steps = ESteps.None;
private DownloaderBase _unpacker;
private DownloaderBase _downloader;
internal HostPlayModeRawFileOperation(BundleInfo bundleInfo, string copyPath) : base(bundleInfo, copyPath)
@@ -339,11 +341,11 @@ namespace YooAsset
}
else if (_bundleInfo.LoadMode == BundleInfo.ELoadMode.LoadFromRemote)
{
_steps = ESteps.DownloadWebFile;
_steps = ESteps.Download;
}
else if (_bundleInfo.LoadMode == BundleInfo.ELoadMode.LoadFromStreaming)
{
_steps = ESteps.DownloadBuildinFile;
_steps = ESteps.Unpack;
}
else if (_bundleInfo.LoadMode == BundleInfo.ELoadMode.LoadFromCache)
{
@@ -356,23 +358,14 @@ namespace YooAsset
}
// 2. 下载远端文件
if (_steps == ESteps.DownloadWebFile)
if (_steps == ESteps.Download)
{
int failedTryAgain = int.MaxValue;
_downloader = DownloadSystem.BeginDownload(_bundleInfo, failedTryAgain);
_steps = ESteps.CheckDownload;
}
// 3. 下载内置文件
if (_steps == ESteps.DownloadBuildinFile)
{
int failedTryAgain = int.MaxValue;
var bundleInfo = PatchHelper.ConvertToUnpackInfo(_bundleInfo.Bundle);
_downloader = DownloadSystem.BeginDownload(bundleInfo, failedTryAgain);
_steps = ESteps.CheckDownload;
}
// 4. 检测下载结果
// 3. 检测下载结果
if (_steps == ESteps.CheckDownload)
{
Progress = _downloader.DownloadProgress;
@@ -391,6 +384,34 @@ namespace YooAsset
}
}
// 3. 解压内置文件
if (_steps == ESteps.Unpack)
{
int failedTryAgain = 1;
var bundleInfo = HostPlayModeImpl.ConvertToUnpackInfo(_bundleInfo.Bundle);
_unpacker = DownloadSystem.BeginDownload(bundleInfo, failedTryAgain);
_steps = ESteps.CheckUnpack;
}
// 4. 检测解压结果
if (_steps == ESteps.CheckUnpack)
{
Progress = _unpacker.DownloadProgress;
if (_unpacker.IsDone() == false)
return;
if (_unpacker.HasError())
{
_steps = ESteps.Done;
Status = EOperationStatus.Failed;
Error = _unpacker.GetLastError();
}
else
{
_steps = ESteps.CheckAndCopyFile;
}
}
// 5. 检测并拷贝原生文件
if (_steps == ESteps.CheckAndCopyFile)
{
@@ -429,7 +450,7 @@ namespace YooAsset
{
_steps = ESteps.Done;
Status = EOperationStatus.Failed;
Error = e.ToString();
Error = e.Message;
}
}
}

View File

@@ -182,7 +182,7 @@ namespace YooAsset
}
/// <summary>
/// 向网络端请求静态资源版本
/// 向网络端请求最新的资源版本
/// </summary>
/// <param name="timeout">超时时间默认值60秒</param>
public UpdateStaticVersionOperation UpdateStaticVersionAsync(int timeout = 60)
@@ -242,28 +242,26 @@ namespace YooAsset
}
/// <summary>
/// 弱联网情况下加载补丁清单
/// 注意:当指定版本内容验证失败后会返回失败。
/// 检查本地包裹内容的完整性
/// </summary>
/// <param name="packageVersion">指定的包裹版本</param>
public UpdateManifestOperation WeaklyUpdateManifestAsync(string packageVersion)
public CheckPackageContentsOperation CheckPackageContentsAsync()
{
DebugCheckInitialize();
if (_playMode == EPlayMode.EditorSimulateMode)
{
var operation = new EditorPlayModeUpdateManifestOperation();
var operation = new EditorSimulateModeCheckPackageContentsOperation();
OperationSystem.StartOperation(operation);
return operation;
}
else if (_playMode == EPlayMode.OfflinePlayMode)
{
var operation = new OfflinePlayModeUpdateManifestOperation();
var operation = new OfflinePlayModeCheckPackageContentsOperation();
OperationSystem.StartOperation(operation);
return operation;
}
else if (_playMode == EPlayMode.HostPlayMode)
{
return _hostPlayModeImpl.WeaklyUpdatePatchManifestAsync(PackageName, packageVersion);
return _hostPlayModeImpl.CheckPackageContentsAsync(PackageName);
}
else
{
@@ -945,9 +943,9 @@ namespace YooAsset
private void DebugCheckInitialize()
{
if (_initializeStatus == EOperationStatus.None)
throw new Exception("YooAssets initialize not completed !");
throw new Exception("Package initialize not completed !");
else if (_initializeStatus == EOperationStatus.Failed)
throw new Exception($"YooAssets initialize failed : {_initializeError}");
throw new Exception($"Package initialize failed ! {_initializeError}");
}
[Conditional("DEBUG")]

View File

@@ -4,7 +4,7 @@ namespace YooAsset
/// <summary>
/// 下载文件校验结果
/// </summary>
public enum EVerifyResult
internal enum EVerifyResult
{
/// <summary>
/// 文件不存在

View File

@@ -0,0 +1,134 @@
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
namespace YooAsset
{
/// <summary>
/// 检查本地包裹内容的完整性
/// </summary>
public abstract class CheckPackageContentsOperation : AsyncOperationBase
{
}
internal sealed class EditorSimulateModeCheckPackageContentsOperation : CheckPackageContentsOperation
{
internal EditorSimulateModeCheckPackageContentsOperation()
{
}
internal override void Start()
{
Status = EOperationStatus.Succeed;
}
internal override void Update()
{
}
}
internal sealed class OfflinePlayModeCheckPackageContentsOperation : CheckPackageContentsOperation
{
internal OfflinePlayModeCheckPackageContentsOperation()
{
}
internal override void Start()
{
Status = EOperationStatus.Succeed;
}
internal override void Update()
{
}
}
internal sealed class HostPlayModeCheckPackageContentsOperation : CheckPackageContentsOperation
{
private enum ESteps
{
None,
CheckLoadedManifest,
InitVerifyingCache,
UpdateVerifyingCache,
Done,
}
private readonly HostPlayModeImpl _impl;
private readonly string _packageName;
private readonly CacheVerifier _cacheVerifier;
private ESteps _steps = ESteps.None;
private float _verifyTime;
internal HostPlayModeCheckPackageContentsOperation(HostPlayModeImpl impl, string packageName)
{
_impl = impl;
_packageName = packageName;
#if UNITY_WEBGL
_cacheVerifier = new CacheVerifierWithoutThread();
#else
_cacheVerifier = new CacheVerifierWithThread();
#endif
}
internal override void Start()
{
_steps = ESteps.CheckLoadedManifest;
}
internal override void Update()
{
if (_steps == ESteps.None || _steps == ESteps.Done)
return;
if (_steps == ESteps.CheckLoadedManifest)
{
if (_impl.LocalPatchManifest == null)
{
_steps = ESteps.Done;
Status = EOperationStatus.Failed;
Error = $"Not found loaded package : {_packageName}";
}
else
{
_steps = ESteps.InitVerifyingCache;
}
}
if (_steps == ESteps.InitVerifyingCache)
{
var verifyInfos = _impl.GetVerifyInfoList(true);
_cacheVerifier.InitVerifier(verifyInfos);
_verifyTime = UnityEngine.Time.realtimeSinceStartup;
_steps = ESteps.UpdateVerifyingCache;
}
if (_steps == ESteps.UpdateVerifyingCache)
{
Progress = _cacheVerifier.GetVerifierProgress();
if (_cacheVerifier.UpdateVerifier())
{
float costTime = UnityEngine.Time.realtimeSinceStartup - _verifyTime;
YooLogger.Log($"Verify result : Success {_cacheVerifier.VerifySuccessList.Count}, Fail {_cacheVerifier.VerifyFailList.Count}, Elapsed time {costTime} seconds");
bool verifySucceed = true;
foreach (var verifyInfo in _cacheVerifier.VerifyFailList)
{
// 注意:跳过内置资源文件
if (verifyInfo.IsBuildinFile)
continue;
verifySucceed = false;
YooLogger.Warning($"Failed verify file : {verifyInfo.VerifyFilePath}");
}
if (verifySucceed)
{
_steps = ESteps.Done;
Status = EOperationStatus.Succeed;
}
else
{
_steps = ESteps.Done;
Status = EOperationStatus.Failed;
Error = $"The package resource {_packageName} content has verify failed file !";
}
}
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3d400b2548d79ca42bec7370f5d66b78
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -57,7 +57,7 @@ namespace YooAsset
}
catch (System.Exception e)
{
YooLogger.Warning($"Failed delete cache file : {filePath} Exception : {e}");
YooLogger.Warning($"Failed delete cache file : {filePath} ! {e.Message}");
}
}
_unusedCacheFilePaths.RemoveAt(i);
@@ -84,7 +84,7 @@ namespace YooAsset
/// </summary>
private List<string> GetUnusedCacheFilePaths()
{
string cacheFolderPath = SandboxHelper.GetCacheFolderPath();
string cacheFolderPath = PersistentHelper.GetCacheFolderPath();
if (Directory.Exists(cacheFolderPath) == false)
return new List<string>();

View File

@@ -10,6 +10,10 @@ namespace YooAsset
/// </summary>
public abstract class InitializationOperation : AsyncOperationBase
{
/// <summary>
/// 初始化内部加载的包裹版本
/// </summary>
public string InitializedPackageVersion;
}
/// <summary>
@@ -25,7 +29,7 @@ namespace YooAsset
}
private readonly EditorSimulateModeImpl _impl;
private string _simulatePatchManifestPath;
private readonly string _simulatePatchManifestPath;
private ESteps _steps = ESteps.None;
internal EditorSimulateModeInitializationOperation(EditorSimulateModeImpl impl, string simulatePatchManifestPath)
@@ -45,16 +49,26 @@ namespace YooAsset
{
_steps = ESteps.Done;
Status = EOperationStatus.Failed;
Error = $"Manifest file not found : {_simulatePatchManifestPath}";
Error = $"Not found simulation manifest file : {_simulatePatchManifestPath}";
return;
}
YooLogger.Log($"Load manifest file : {_simulatePatchManifestPath}");
string jsonContent = FileUtility.ReadFile(_simulatePatchManifestPath);
var simulatePatchManifest = PatchManifest.Deserialize(jsonContent);
_impl.SetSimulatePatchManifest(simulatePatchManifest);
_steps = ESteps.Done;
Status = EOperationStatus.Succeed;
try
{
YooLogger.Log($"Load simulation manifest file : {_simulatePatchManifestPath}");
string jsonContent = FileUtility.ReadFile(_simulatePatchManifestPath);
var manifest = PatchManifest.Deserialize(jsonContent);
InitializedPackageVersion = manifest.PackageVersion;
_impl.SetSimulatePatchManifest(manifest);
_steps = ESteps.Done;
Status = EOperationStatus.Succeed;
}
catch (System.Exception e)
{
_steps = ESteps.Done;
Status = EOperationStatus.Failed;
Error = e.Message;
}
}
}
}
@@ -67,7 +81,7 @@ namespace YooAsset
private enum ESteps
{
None,
QueryPackageVersion,
QueryAppPackageVersion,
LoadAppManifest,
InitVerifyingCache,
UpdateVerifyingCache,
@@ -76,7 +90,7 @@ namespace YooAsset
private readonly OfflinePlayModeImpl _impl;
private readonly string _packageName;
private readonly CacheVerifier _patchCacheVerifier;
private readonly CacheVerifier _cacheVerifier;
private readonly AppPackageVersionQuerier _appPackageVersionQuerier;
private AppManifestLoader _appManifestLoader;
private ESteps _steps = ESteps.None;
@@ -89,21 +103,21 @@ namespace YooAsset
_appPackageVersionQuerier = new AppPackageVersionQuerier(packageName);
#if UNITY_WEBGL
_patchCacheVerifier = new CacheVerifierWithoutThread();
_cacheVerifier = new CacheVerifierWithoutThread();
#else
_patchCacheVerifier = new CacheVerifierWithThread();
_cacheVerifier = new CacheVerifierWithThread();
#endif
}
internal override void Start()
{
_steps = ESteps.QueryPackageVersion;
_steps = ESteps.QueryAppPackageVersion;
}
internal override void Update()
{
if (_steps == ESteps.None || _steps == ESteps.Done)
return;
if (_steps == ESteps.QueryPackageVersion)
if (_steps == ESteps.QueryAppPackageVersion)
{
_appPackageVersionQuerier.Update();
if (_appPackageVersionQuerier.IsDone == false)
@@ -130,7 +144,8 @@ namespace YooAsset
if (_appManifestLoader.IsDone == false)
return;
if (_appManifestLoader.Manifest == null)
var manifest = _appManifestLoader.Manifest;
if (manifest == null)
{
_steps = ESteps.Done;
Status = EOperationStatus.Failed;
@@ -138,28 +153,29 @@ namespace YooAsset
}
else
{
InitializedPackageVersion = manifest.PackageVersion;
_impl.SetAppPatchManifest(manifest);
_steps = ESteps.InitVerifyingCache;
_impl.SetAppPatchManifest(_appManifestLoader.Manifest);
}
}
if (_steps == ESteps.InitVerifyingCache)
{
var verifyInfos = _impl.GetVerifyInfoList();
_patchCacheVerifier.InitVerifier(verifyInfos);
_cacheVerifier.InitVerifier(verifyInfos);
_verifyTime = UnityEngine.Time.realtimeSinceStartup;
_steps = ESteps.UpdateVerifyingCache;
}
if (_steps == ESteps.UpdateVerifyingCache)
{
Progress = _patchCacheVerifier.GetVerifierProgress();
if (_patchCacheVerifier.UpdateVerifier())
Progress = _cacheVerifier.GetVerifierProgress();
if (_cacheVerifier.UpdateVerifier())
{
_steps = ESteps.Done;
Status = EOperationStatus.Succeed;
float costTime = UnityEngine.Time.realtimeSinceStartup - _verifyTime;
YooLogger.Log($"Verify result : Success {_patchCacheVerifier.VerifySuccessList.Count}, Fail {_patchCacheVerifier.VerifyFailList.Count}, Elapsed time {costTime} seconds");
YooLogger.Log($"Verify result : Success {_cacheVerifier.VerifySuccessList.Count}, Fail {_cacheVerifier.VerifyFailList.Count}, Elapsed time {costTime} seconds");
}
}
}
@@ -167,15 +183,17 @@ namespace YooAsset
/// <summary>
/// 联机运行模式的初始化操作
/// 注意:优先从沙盒里加载清单,如果沙盒里不存在就尝试把内置清单拷贝到沙盒并加载该清单。
/// </summary>
internal sealed class HostPlayModeInitializationOperation : InitializationOperation
{
private enum ESteps
{
None,
QueryPackageVersion,
LoadAppManifest,
TryLoadCacheManifest,
QueryAppPackageVersion,
CopyAppManifest,
LoadAppManifest,
InitVerifyingCache,
UpdateVerifyingCache,
Done,
@@ -183,7 +201,7 @@ namespace YooAsset
private readonly HostPlayModeImpl _impl;
private readonly string _packageName;
private readonly CacheVerifier _patchCacheVerifier;
private readonly CacheVerifier _cacheVerifier;
private readonly AppPackageVersionQuerier _appPackageVersionQuerier;
private AppManifestCopyer _appManifestCopyer;
private AppManifestLoader _appManifestLoader;
@@ -197,21 +215,46 @@ namespace YooAsset
_appPackageVersionQuerier = new AppPackageVersionQuerier(packageName);
#if UNITY_WEBGL
_patchCacheVerifier = new CacheVerifierWithoutThread();
_cacheVerifier = new CacheVerifierWithoutThread();
#else
_patchCacheVerifier = new CacheVerifierWithThread();
_cacheVerifier = new CacheVerifierWithThread();
#endif
}
internal override void Start()
{
_steps = ESteps.QueryPackageVersion;
_steps = ESteps.TryLoadCacheManifest;
}
internal override void Update()
{
if (_steps == ESteps.None || _steps == ESteps.Done)
return;
if (_steps == ESteps.QueryPackageVersion)
if (_steps == ESteps.TryLoadCacheManifest)
{
if (PersistentHelper.CheckCacheManifestFileExists(_packageName))
{
try
{
var manifest = PersistentHelper.LoadCacheManifestFile(_packageName);
InitializedPackageVersion = manifest.PackageVersion;
_impl.SetLocalPatchManifest(manifest);
_steps = ESteps.InitVerifyingCache;
}
catch (System.Exception e)
{
// 注意:如果加载沙盒内的清单报错,为了避免流程被卡住,我们主动把损坏的文件删除。
YooLogger.Warning($"Failed to load cache manifest file : {e.Message}");
PersistentHelper.DeleteCacheManifestFile(_packageName);
_steps = ESteps.QueryAppPackageVersion;
}
}
else
{
_steps = ESteps.QueryAppPackageVersion;
}
}
if (_steps == ESteps.QueryAppPackageVersion)
{
_appPackageVersionQuerier.Update();
if (_appPackageVersionQuerier.IsDone == false)
@@ -223,6 +266,7 @@ namespace YooAsset
{
_steps = ESteps.Done;
Status = EOperationStatus.Succeed;
YooLogger.Log($"Failed to load buildin package version file : {error}");
}
else
{
@@ -240,7 +284,7 @@ namespace YooAsset
return;
string error = _appManifestCopyer.Error;
if(string.IsNullOrEmpty(error) == false)
if (string.IsNullOrEmpty(error) == false)
{
_steps = ESteps.Done;
Status = EOperationStatus.Failed;
@@ -259,7 +303,8 @@ namespace YooAsset
if (_appManifestLoader.IsDone == false)
return;
if (_appManifestLoader.Manifest == null)
var manifest = _appManifestLoader.Manifest;
if (manifest == null)
{
_steps = ESteps.Done;
Status = EOperationStatus.Failed;
@@ -267,35 +312,38 @@ namespace YooAsset
}
else
{
InitializedPackageVersion = manifest.PackageVersion;
_impl.SetLocalPatchManifest(manifest);
_steps = ESteps.InitVerifyingCache;
_impl.SetLocalPatchManifest(_appManifestLoader.Manifest);
}
}
if (_steps == ESteps.InitVerifyingCache)
{
var verifyInfos = _impl.GetVerifyInfoList(false);
_patchCacheVerifier.InitVerifier(verifyInfos);
_cacheVerifier.InitVerifier(verifyInfos);
_verifyTime = UnityEngine.Time.realtimeSinceStartup;
_steps = ESteps.UpdateVerifyingCache;
}
if (_steps == ESteps.UpdateVerifyingCache)
{
Progress = _patchCacheVerifier.GetVerifierProgress();
if (_patchCacheVerifier.UpdateVerifier())
Progress = _cacheVerifier.GetVerifierProgress();
if (_cacheVerifier.UpdateVerifier())
{
_steps = ESteps.Done;
Status = EOperationStatus.Succeed;
float costTime = UnityEngine.Time.realtimeSinceStartup - _verifyTime;
YooLogger.Log($"Verify result : Success {_patchCacheVerifier.VerifySuccessList.Count}, Fail {_patchCacheVerifier.VerifyFailList.Count}, Elapsed time {costTime} seconds");
YooLogger.Log($"Verify result : Success {_cacheVerifier.VerifySuccessList.Count}, Fail {_cacheVerifier.VerifyFailList.Count}, Elapsed time {costTime} seconds");
}
}
}
}
// 内置补丁清单版本查询器
/// <summary>
/// 内置补丁清单版本查询器
/// </summary>
internal class AppPackageVersionQuerier
{
private enum ESteps
@@ -367,7 +415,7 @@ namespace YooAsset
{
Version = _downloader.GetText();
if (string.IsNullOrEmpty(Version))
Error = $"Buildin package version is empty !";
Error = $"Buildin package version file content is empty !";
}
_steps = ESteps.Done;
_downloader.Dispose();
@@ -375,7 +423,9 @@ namespace YooAsset
}
}
// 内置补丁清单加载器
/// <summary>
/// 内置补丁清单加载器
/// </summary>
internal class AppManifestLoader
{
private enum ESteps
@@ -461,7 +511,14 @@ namespace YooAsset
else
{
// 解析APP里的补丁清单
Manifest = PatchManifest.Deserialize(_downloader.GetText());
try
{
Manifest = PatchManifest.Deserialize(_downloader.GetText());
}
catch (System.Exception e)
{
Error = e.Message;
}
}
_steps = ESteps.Done;
_downloader.Dispose();
@@ -469,7 +526,9 @@ namespace YooAsset
}
}
// 内置补丁清单复制器
/// <summary>
/// 内置补丁清单复制器
/// </summary>
internal class AppManifestCopyer
{
private enum ESteps
@@ -530,20 +589,13 @@ namespace YooAsset
if (_steps == ESteps.CopyAppManifest)
{
string savePath = PersistentHelper.GetCacheManifestFilePath(_buildinPackageName);
string fileName = YooAssetSettingsData.GetPatchManifestFileName(_buildinPackageName, _buildinPackageVersion);
string destFilePath = PathHelper.MakePersistentLoadPath(fileName);
if (File.Exists(destFilePath))
{
_steps = ESteps.Done;
}
else
{
string sourceFilePath = PathHelper.MakeStreamingLoadPath(fileName);
string url = PathHelper.ConvertToWWWPath(sourceFilePath);
_downloader = new UnityWebFileRequester();
_downloader.SendRequest(url, destFilePath);
_steps = ESteps.CheckAppManifest;
}
string filePath = PathHelper.MakeStreamingLoadPath(fileName);
string url = PathHelper.ConvertToWWWPath(filePath);
_downloader = new UnityWebFileRequester();
_downloader.SendRequest(url, savePath);
_steps = ESteps.CheckAppManifest;
}
if (_steps == ESteps.CheckAppManifest)

View File

@@ -13,7 +13,7 @@ namespace YooAsset
/// <summary>
/// 是否发现了新的补丁清单
/// </summary>
public bool FoundNewManifest { protected set; get; }
public bool FoundNewManifest { protected set; get; } = false;
}
/// <summary>
@@ -46,14 +46,17 @@ namespace YooAsset
/// <summary>
/// 联机模式的更新清单操作
/// 注意:优先比对沙盒清单哈希值,如果有变化就更新远端清单文件,并保存到本地。
/// </summary>
internal sealed class HostPlayModeUpdateManifestOperation : UpdateManifestOperation
{
private enum ESteps
{
None,
TryLoadCacheHash,
LoadWebHash,
CheckWebHash,
LoadCacheManifest,
LoadWebManifest,
CheckWebManifest,
InitVerifyingCache,
@@ -65,10 +68,12 @@ namespace YooAsset
private readonly HostPlayModeImpl _impl;
private readonly string _packageName;
private readonly string _packageVersion;
private readonly CacheVerifier _cacheVerifier;
private readonly int _timeout;
private UnityWebDataRequester _downloader1;
private UnityWebDataRequester _downloader2;
private CacheVerifier _cacheVerifier;
private string _cacheManifestHash;
private ESteps _steps = ESteps.None;
private float _verifyTime;
@@ -88,13 +93,27 @@ namespace YooAsset
internal override void Start()
{
RequestCount++;
_steps = ESteps.LoadWebHash;
_steps = ESteps.TryLoadCacheHash;
}
internal override void Update()
{
if (_steps == ESteps.None || _steps == ESteps.Done)
return;
if (_steps == ESteps.TryLoadCacheHash)
{
string filePath = PersistentHelper.GetCacheManifestFilePath(_packageName);
if (File.Exists(filePath))
{
_cacheManifestHash = HashUtility.FileMD5(filePath);
_steps = ESteps.LoadWebHash;
}
else
{
_steps = ESteps.LoadWebManifest;
}
}
if (_steps == ESteps.LoadWebHash)
{
string fileName = YooAssetSettingsData.GetPatchManifestHashFileName(_packageName, _packageVersion);
@@ -110,7 +129,6 @@ namespace YooAsset
if (_downloader1.IsDone() == false)
return;
// Check error
if (_downloader1.HasError())
{
_steps = ESteps.Done;
@@ -120,26 +138,37 @@ namespace YooAsset
else
{
string webManifestHash = _downloader1.GetText();
string cachedManifestHash = GetSandboxPatchManifestFileHash(_packageName, _packageVersion);
// 如果补丁清单文件的哈希值相同
if (cachedManifestHash == webManifestHash)
if (_cacheManifestHash == webManifestHash)
{
YooLogger.Log($"Patch manifest file hash is not change : {webManifestHash}");
LoadSandboxPatchManifest(_packageName, _packageVersion);
FoundNewManifest = false;
_steps = ESteps.InitVerifyingCache;
YooLogger.Log($"Not found new package : {_packageName}");
_steps = ESteps.LoadCacheManifest;
}
else
{
YooLogger.Log($"Patch manifest hash is change : {cachedManifestHash} -> {webManifestHash}");
FoundNewManifest = true;
YooLogger.Log($"Package {_packageName} is change : {_cacheManifestHash} -> {webManifestHash}");
_steps = ESteps.LoadWebManifest;
}
}
_downloader1.Dispose();
}
if (_steps == ESteps.LoadCacheManifest)
{
try
{
var manifest = PersistentHelper.LoadCacheManifestFile(_packageName);
_impl.SetLocalPatchManifest(manifest);
_steps = ESteps.InitVerifyingCache;
}
catch (System.Exception e)
{
// 注意:如果加载沙盒内的清单报错,为了避免流程被卡住,我们主动把损坏的文件删除。
YooLogger.Warning($"Failed to load cache manifest file : {e.Message}");
PersistentHelper.DeleteCacheManifestFile(_packageName);
_steps = ESteps.LoadWebManifest;
}
}
if (_steps == ESteps.LoadWebManifest)
{
string fileName = YooAssetSettingsData.GetPatchManifestFileName(_packageName, _packageVersion);
@@ -155,7 +184,6 @@ namespace YooAsset
if (_downloader2.IsDone() == false)
return;
// Check error
if (_downloader2.HasError())
{
_steps = ESteps.Done;
@@ -164,16 +192,19 @@ namespace YooAsset
}
else
{
// 解析补丁清单
if (ParseAndSaveRemotePatchManifest(_packageName, _packageVersion, _downloader2.GetText()))
try
{
string content = _downloader2.GetText();
var manifest = PersistentHelper.SaveCacheManifestFile(_packageName, content);
_impl.SetLocalPatchManifest(manifest);
FoundNewManifest = true;
_steps = ESteps.InitVerifyingCache;
}
else
catch (Exception e)
{
_steps = ESteps.Done;
Status = EOperationStatus.Failed;
Error = $"URL : {_downloader2.URL} Error : remote patch manifest content is invalid";
Error = e.Message;
}
}
_downloader2.Dispose();
@@ -211,164 +242,5 @@ namespace YooAsset
else
return _impl.GetPatchDownloadMainURL(fileName);
}
/// <summary>
/// 解析并保存远端请求的补丁清单
/// </summary>
private bool ParseAndSaveRemotePatchManifest(string packageName, string packageVersion, string content)
{
try
{
var remotePatchManifest = PatchManifest.Deserialize(content);
_impl.SetLocalPatchManifest(remotePatchManifest);
YooLogger.Log("Save remote patch manifest file.");
string fileName = YooAssetSettingsData.GetPatchManifestFileName(packageName, packageVersion);
string savePath = PathHelper.MakePersistentLoadPath(fileName);
PatchManifest.Serialize(savePath, remotePatchManifest);
return true;
}
catch (Exception e)
{
YooLogger.Error(e.ToString());
return false;
}
}
/// <summary>
/// 加载沙盒内的补丁清单
/// 注意:在加载本地补丁清单之前,已经验证过文件的哈希值
/// </summary>
private void LoadSandboxPatchManifest(string packageName, string packageVersion)
{
YooLogger.Log("Load sandbox patch manifest file.");
string fileName = YooAssetSettingsData.GetPatchManifestFileName(packageName, packageVersion);
string filePath = PathHelper.MakePersistentLoadPath(fileName);
string jsonData = File.ReadAllText(filePath);
var sandboxPatchManifest = PatchManifest.Deserialize(jsonData);
_impl.SetLocalPatchManifest(sandboxPatchManifest);
}
/// <summary>
/// 获取沙盒内补丁清单文件的哈希值
/// 注意:如果沙盒内补丁清单文件不存在,返回空字符串
/// </summary>
private string GetSandboxPatchManifestFileHash(string packageName, string packageVersion)
{
string fileName = YooAssetSettingsData.GetPatchManifestFileName(packageName, packageVersion);
string filePath = PathHelper.MakePersistentLoadPath(fileName);
if (File.Exists(filePath))
return HashUtility.FileMD5(filePath);
else
return string.Empty;
}
}
/// <summary>
/// 联机模式的更新清单操作(弱联网)
/// </summary>
internal sealed class HostPlayModeWeaklyUpdateManifestOperation : UpdateManifestOperation
{
private enum ESteps
{
None,
LoadSandboxManifestHash,
InitVerifyingCache,
UpdateVerifyingCache,
Done,
}
private readonly HostPlayModeImpl _impl;
private readonly string _packageName;
private readonly string _packageVersion;
private ESteps _steps = ESteps.None;
private CacheVerifier _cacheVerifier;
private float _verifyTime;
internal HostPlayModeWeaklyUpdateManifestOperation(HostPlayModeImpl impl, string packageName, string packageVersion)
{
_impl = impl;
_packageName = packageName;
_packageVersion = packageVersion;
#if UNITY_WEBGL
_cacheVerifier = new CacheVerifierWithoutThread();
#else
_cacheVerifier = new CacheVerifierWithThread();
#endif
}
internal override void Start()
{
_steps = ESteps.LoadSandboxManifestHash;
}
internal override void Update()
{
if (_steps == ESteps.None || _steps == ESteps.Done)
return;
if (_steps == ESteps.LoadSandboxManifestHash)
{
LoadSandboxPatchManifest(_packageName, _packageVersion);
_steps = ESteps.InitVerifyingCache;
}
if (_steps == ESteps.InitVerifyingCache)
{
var verifyInfos = _impl.GetVerifyInfoList(true);
_cacheVerifier.InitVerifier(verifyInfos);
_verifyTime = UnityEngine.Time.realtimeSinceStartup;
_steps = ESteps.UpdateVerifyingCache;
}
if (_steps == ESteps.UpdateVerifyingCache)
{
Progress = _cacheVerifier.GetVerifierProgress();
if (_cacheVerifier.UpdateVerifier())
{
float costTime = UnityEngine.Time.realtimeSinceStartup - _verifyTime;
YooLogger.Log($"Verify result : Success {_cacheVerifier.VerifySuccessList.Count}, Fail {_cacheVerifier.VerifyFailList.Count}, Elapsed time {costTime} seconds");
bool verifySucceed = true;
foreach (var verifyInfo in _cacheVerifier.VerifyFailList)
{
// 注意:跳过内置资源文件
if (verifyInfo.IsBuildinFile)
continue;
verifySucceed = false;
YooLogger.Warning($"Failed verify file : {verifyInfo.VerifyFilePath}");
}
if (verifySucceed)
{
_steps = ESteps.Done;
Status = EOperationStatus.Succeed;
}
else
{
_steps = ESteps.Done;
Status = EOperationStatus.Failed;
Error = $"The package resource {_packageName}_{_packageVersion} content has verify failed file !";
}
}
}
}
/// <summary>
/// 加载沙盒内的补丁清单
/// 注意:在加载本地补丁清单之前,未验证过文件的哈希值
/// </summary>
private void LoadSandboxPatchManifest(string packageName, string packageVersion)
{
string fileName = YooAssetSettingsData.GetPatchManifestFileName(packageName, packageVersion);
string filePath = PathHelper.MakePersistentLoadPath(fileName);
if (File.Exists(filePath))
{
YooLogger.Log("Load sandbox patch manifest file.");
string jsonData = File.ReadAllText(filePath);
var sandboxPatchManifest = PatchManifest.Deserialize(jsonData);
_impl.SetLocalPatchManifest(sandboxPatchManifest);
}
}
}
}

View File

@@ -128,17 +128,18 @@ namespace YooAsset
}
else
{
// 解析补丁清单
if (ParseRemotePatchManifest(_downloader.GetText()))
// 解析补丁清单
try
{
_remotePatchManifest = PatchManifest.Deserialize(_downloader.GetText());
_steps = ESteps.Done;
Status = EOperationStatus.Succeed;
}
else
catch(System.Exception e)
{
_steps = ESteps.Done;
Status = EOperationStatus.Failed;
Error = $"URL : {_downloader.URL} Error : remote patch manifest content is invalid";
Error = e.Message;
}
}
_downloader.Dispose();
@@ -176,23 +177,6 @@ namespace YooAsset
return _impl.GetPatchDownloadMainURL(fileName);
}
/// <summary>
/// 解析远端请求的补丁清单
/// </summary>
private bool ParseRemotePatchManifest(string content)
{
try
{
_remotePatchManifest = PatchManifest.Deserialize(content);
return true;
}
catch (Exception e)
{
YooLogger.Warning(e.ToString());
return false;
}
}
/// <summary>
/// 获取下载列表
/// </summary>

View File

@@ -5,7 +5,7 @@ using UnityEngine;
namespace YooAsset
{
/// <summary>
/// 更新静态版本操作
/// 获取包裹的最新版本
/// </summary>
public abstract class UpdateStaticVersionOperation : AsyncOperationBase
{
@@ -16,7 +16,7 @@ namespace YooAsset
}
/// <summary>
/// 编辑器下模拟运行的更新静态版本操作
/// 编辑器下模拟运行的获取包裹的最新版本操作
/// </summary>
internal sealed class EditorPlayModeUpdateStaticVersionOperation : UpdateStaticVersionOperation
{
@@ -30,7 +30,7 @@ namespace YooAsset
}
/// <summary>
/// 离线模式的更新静态版本操作
/// 离线模式的获取包裹的最新版本操作
/// </summary>
internal sealed class OfflinePlayModeUpdateStaticVersionOperation : UpdateStaticVersionOperation
{
@@ -44,7 +44,7 @@ namespace YooAsset
}
/// <summary>
/// 联机模式的更新静态版本操作
/// 联机模式的获取包裹的最新版本操作
/// </summary>
internal sealed class HostPlayModeUpdateStaticVersionOperation : UpdateStaticVersionOperation
{

View File

@@ -1,6 +1,5 @@
using System;
using System.Linq;
using System.IO;
namespace YooAsset
{
@@ -27,27 +26,21 @@ namespace YooAsset
/// </summary>
public long FileSize;
/// <summary>
/// 是否为原生文件
/// </summary>
public bool IsRawFile;
/// <summary>
/// 加载方法
/// </summary>
public byte LoadMethod;
/// <summary>
/// 资源包的分类标签
/// </summary>
public string[] Tags;
/// <summary>
/// Flags
/// </summary>
public int Flags;
/// <summary>
/// 是否为原生文件
/// </summary>
public bool IsRawFile { private set; get; }
/// <summary>
/// 是否为加密文件
/// </summary>
public bool IsEncrypted { private set; get; }
/// <summary>
/// 文件名称
/// </summary>
@@ -64,7 +57,7 @@ namespace YooAsset
if (string.IsNullOrEmpty(_cachedFilePath) == false)
return _cachedFilePath;
string cacheRoot = SandboxHelper.GetCacheFolderPath();
string cacheRoot = PersistentHelper.GetCacheFolderPath();
_cachedFilePath = $"{cacheRoot}/{FileName}";
return _cachedFilePath;
}
@@ -87,37 +80,15 @@ namespace YooAsset
}
public PatchBundle(string bundleName, string fileHash, string fileCRC, long fileSize, string[] tags)
public PatchBundle(string bundleName, string fileHash, string fileCRC, long fileSize, bool isRawFile, byte loadMethod, string[] tags)
{
BundleName = bundleName;
FileHash = fileHash;
FileCRC = fileCRC;
FileSize = fileSize;
Tags = tags;
}
/// <summary>
/// 设置Flags
/// </summary>
public void SetFlagsValue(bool isRawFile, bool isEncrypted)
{
IsRawFile = isRawFile;
IsEncrypted = isEncrypted;
BitMask32 mask = new BitMask32(0);
if (isRawFile) mask.Open(0);
if (isEncrypted) mask.Open(1);
Flags = mask;
}
/// <summary>
/// 解析Flags
/// </summary>
public void ParseFlagsValue()
{
BitMask32 value = Flags;
IsRawFile = value.Test(0);
IsEncrypted = value.Test(1);
LoadMethod = loadMethod;
Tags = tags;
}
/// <summary>
@@ -125,31 +96,7 @@ namespace YooAsset
/// </summary>
public void ParseFileName(int nameStype)
{
if (nameStype == 1)
{
FileName = FileHash;
}
else if (nameStype == 2)
{
string tempFileExtension = System.IO.Path.GetExtension(BundleName);
FileName = $"{FileHash}{tempFileExtension}";
}
else if (nameStype == 3)
{
string tempFileExtension = System.IO.Path.GetExtension(BundleName);
string tempBundleName = BundleName.Replace('/', '_').Replace(tempFileExtension, "");
FileName = $"{tempBundleName}_{FileHash}";
}
else if (nameStype == 4)
{
string tempFileExtension = System.IO.Path.GetExtension(BundleName);
string tempBundleName = BundleName.Replace('/', '_').Replace(tempFileExtension, "");
FileName = $"{tempBundleName}_{FileHash}{tempFileExtension}";
}
else
{
throw new NotImplementedException();
}
FileName = PatchManifest.CreateBundleFileName(nameStype, BundleName, FileHash);
}
/// <summary>

View File

@@ -247,6 +247,23 @@ namespace YooAsset
return false;
}
/// <summary>
/// 获取资源信息列表
/// </summary>
public AssetInfo[] GetAssetsInfoByTags(string[] tags)
{
List<AssetInfo> result = new List<AssetInfo>(100);
foreach (var patchAsset in AssetList)
{
if (patchAsset.HasTag(tags))
{
AssetInfo assetInfo = new AssetInfo(patchAsset);
result.Add(assetInfo);
}
}
return result.ToArray();
}
/// <summary>
/// 序列化
@@ -263,6 +280,8 @@ namespace YooAsset
public static PatchManifest Deserialize(string jsonData)
{
PatchManifest patchManifest = JsonUtility.FromJson<PatchManifest>(jsonData);
if (patchManifest == null)
throw new System.Exception($"{nameof(PatchManifest)} deserialize object is null !");
// 检测文件版本
if (patchManifest.FileVersion != YooAssetSettings.PatchManifestFileVersion)
@@ -271,7 +290,6 @@ namespace YooAsset
// BundleList
foreach (var patchBundle in patchManifest.BundleList)
{
patchBundle.ParseFlagsValue();
patchBundle.ParseFileName(patchManifest.OutputNameStyle);
patchManifest.BundleDic.Add(patchBundle.BundleName, patchBundle);
}
@@ -289,5 +307,37 @@ namespace YooAsset
return patchManifest;
}
/// <summary>
/// 生成Bundle文件的正式名称
/// </summary>
public static string CreateBundleFileName(int nameStype, string bundleName, string fileHash)
{
if (nameStype == 1)
{
return fileHash;
}
else if (nameStype == 2)
{
string tempFileExtension = System.IO.Path.GetExtension(bundleName);
return $"{fileHash}{tempFileExtension}";
}
else if (nameStype == 3)
{
string tempFileExtension = System.IO.Path.GetExtension(bundleName);
string tempBundleName = bundleName.Replace('/', '_').Replace(tempFileExtension, "");
return $"{tempBundleName}_{fileHash}";
}
else if (nameStype == 4)
{
string tempFileExtension = System.IO.Path.GetExtension(bundleName);
string tempBundleName = bundleName.Replace('/', '_').Replace(tempFileExtension, "");
return $"{tempBundleName}_{fileHash}{tempFileExtension}";
}
else
{
throw new NotImplementedException();
}
}
}
}

View File

@@ -53,7 +53,7 @@ namespace YooAsset
}
AssetInfo[] IBundleServices.GetAssetInfos(string[] tags)
{
return PatchHelper.GetAssetsInfoByTags(_simulatePatchManifest, tags);
return _simulatePatchManifest.GetAssetsInfoByTags(tags);
}
PatchAsset IBundleServices.TryGetPatchAsset(string assetPath)
{

View File

@@ -62,11 +62,11 @@ namespace YooAsset
}
/// <summary>
/// 异步更新补丁清单(弱联网)
/// 检查本地包裹内容的完整性
/// </summary>
public UpdateManifestOperation WeaklyUpdatePatchManifestAsync(string packageName, string packageVersion)
public CheckPackageContentsOperation CheckPackageContentsAsync(string packageName)
{
var operation = new HostPlayModeWeaklyUpdateManifestOperation(this, packageName, packageVersion);
var operation = new HostPlayModeCheckPackageContentsOperation(this, packageName);
OperationSystem.StartOperation(operation);
return operation;
}
@@ -229,7 +229,7 @@ namespace YooAsset
}
}
return PatchHelper.ConvertToUnpackList(downloadList);
return ConvertToUnpackList(downloadList);
}
/// <summary>
@@ -256,7 +256,7 @@ namespace YooAsset
}
}
return PatchHelper.ConvertToUnpackList(downloadList);
return ConvertToUnpackList(downloadList);
}
// WEB相关
@@ -280,7 +280,7 @@ namespace YooAsset
}
return result;
}
public BundleInfo ConvertToDownloadInfo(PatchBundle patchBundle)
private BundleInfo ConvertToDownloadInfo(PatchBundle patchBundle)
{
string remoteMainURL = GetPatchDownloadMainURL(patchBundle.FileName);
string remoteFallbackURL = GetPatchDownloadFallbackURL(patchBundle.FileName);
@@ -288,6 +288,25 @@ namespace YooAsset
return bundleInfo;
}
// 解压相关
public List<BundleInfo> ConvertToUnpackList(List<PatchBundle> unpackList)
{
List<BundleInfo> result = new List<BundleInfo>(unpackList.Count);
foreach (var patchBundle in unpackList)
{
var bundleInfo = ConvertToUnpackInfo(patchBundle);
result.Add(bundleInfo);
}
return result;
}
public static BundleInfo ConvertToUnpackInfo(PatchBundle patchBundle)
{
// 注意:我们把流加载路径指定为远端下载地址
string streamingPath = PathHelper.ConvertToWWWPath(patchBundle.StreamingFilePath);
BundleInfo bundleInfo = new BundleInfo(patchBundle, BundleInfo.ELoadMode.LoadFromStreaming, streamingPath, streamingPath);
return bundleInfo;
}
internal List<VerifyInfo> GetVerifyInfoList(bool weaklyUpdateMode)
{
List<VerifyInfo> result = new List<VerifyInfo>(LocalPatchManifest.BundleList.Count);
@@ -379,7 +398,7 @@ namespace YooAsset
}
AssetInfo[] IBundleServices.GetAssetInfos(string[] tags)
{
return PatchHelper.GetAssetsInfoByTags(LocalPatchManifest, tags);
return LocalPatchManifest.GetAssetsInfoByTags(tags);
}
PatchAsset IBundleServices.TryGetPatchAsset(string assetPath)
{

View File

@@ -104,7 +104,7 @@ namespace YooAsset
}
AssetInfo[] IBundleServices.GetAssetInfos(string[] tags)
{
return PatchHelper.GetAssetsInfoByTags(_appPatchManifest, tags);
return _appPatchManifest.GetAssetsInfoByTags(tags);
}
PatchAsset IBundleServices.TryGetPatchAsset(string assetPath)
{

View File

@@ -1,17 +1,42 @@

namespace YooAsset
{
public struct DecryptionFileInfo
public struct DecryptFileInfo
{
/// <summary>
/// 资源包名称
/// </summary>
public string BundleName;
public string FileHash;
/// <summary>
/// 文件路径
/// </summary>
public string FilePath;
}
/// <summary>
/// 解密类服务接口
/// </summary>
public interface IDecryptionServices
{
/// <summary>
/// 获取加密文件的数据偏移量
/// 文件偏移解密方法
/// </summary>
ulong GetFileOffset(DecryptionFileInfo fileInfo);
ulong LoadFromFileOffset(DecryptFileInfo fileInfo);
/// <summary>
/// 文件内存解密方法
/// </summary>
byte[] LoadFromMemory(DecryptFileInfo fileInfo);
/// <summary>
/// 文件流解密方法
/// </summary>
System.IO.FileStream LoadFromStream(DecryptFileInfo fileInfo);
/// <summary>
/// 文件流解密的托管缓存大小
/// </summary>
uint GetManagedReadBufferSize();
}
}

View File

@@ -0,0 +1,37 @@

namespace YooAsset
{
public struct EncryptResult
{
/// <summary>
/// 加密后的Bunlde文件加载方法
/// </summary>
public EBundleLoadMethod LoadMethod;
/// <summary>
/// 加密后的文件数据
/// </summary>
public byte[] EncryptedData;
}
public struct EncryptFileInfo
{
/// <summary>
/// 资源包名称
/// </summary>
public string BundleName;
/// <summary>
/// 文件路径
/// </summary>
public string FilePath;
}
/// <summary>
/// 加密服务类接口
/// </summary>
public interface IEncryptionServices
{
EncryptResult Encrypt(EncryptFileInfo fileInfo);
}
}

View File

@@ -24,7 +24,7 @@ namespace YooAsset
/// <summary>
/// 补丁清单文件格式版本
/// </summary>
public const string PatchManifestFileVersion = "1.3.3";
public const string PatchManifestFileVersion = "1.3.4";
/// <summary>
/// 构建输出文件夹名称

View File

@@ -40,6 +40,14 @@ namespace YooAsset
return $"{YooAssetSettings.ReportFileName}_{packageName}_{packageVersion}.json";
}
/// <summary>
/// 获取补丁清单文件不带版本号的名称
/// </summary>
public static string GetPatchManifestFileNameWithoutVersion(string packageName)
{
return $"{Setting.PatchManifestFileName}_{packageName}.bytes";
}
/// <summary>
/// 获取补丁清单文件完整名称
/// </summary>

View File

@@ -76,9 +76,9 @@ namespace YooAsset
}
/// <summary>
/// 沙盒帮助类
/// 持久化目录帮助类
/// </summary>
internal static class SandboxHelper
internal static class PersistentHelper
{
private const string CacheFolderName = "CacheFiles";
@@ -109,49 +109,66 @@ namespace YooAsset
{
return PathHelper.MakePersistentLoadPath(CacheFolderName);
}
}
/// <summary>
/// 补丁包帮助类
/// </summary>
internal static class PatchHelper
{
#region
/// <summary>
/// 获取资源信息列表
/// 获取沙盒内清单文件的路径
/// </summary>
public static AssetInfo[] GetAssetsInfoByTags(PatchManifest patchManifest, string[] tags)
public static string GetCacheManifestFilePath(string packageName)
{
List<AssetInfo> result = new List<AssetInfo>(100);
foreach (var patchAsset in patchManifest.AssetList)
{
if(patchAsset.HasTag(tags))
{
AssetInfo assetInfo = new AssetInfo(patchAsset);
result.Add(assetInfo);
}
}
return result.ToArray();
string fileName = YooAssetSettingsData.GetPatchManifestFileNameWithoutVersion(packageName);
return PathHelper.MakePersistentLoadPath(fileName);
}
/// <summary>
/// 资源解压相关
/// 加载沙盒内清单文件
/// </summary>
public static List<BundleInfo> ConvertToUnpackList(List<PatchBundle> unpackList)
public static PatchManifest LoadCacheManifestFile(string packageName)
{
List<BundleInfo> result = new List<BundleInfo>(unpackList.Count);
foreach (var patchBundle in unpackList)
YooLogger.Log($"Load sandbox patch manifest file : {packageName}");
string filePath = GetCacheManifestFilePath(packageName);
string jsonData = File.ReadAllText(filePath);
return PatchManifest.Deserialize(jsonData);
}
/// <summary>
/// 存储沙盒内清单文件
/// </summary>
public static PatchManifest SaveCacheManifestFile(string packageName, string fileContent)
{
YooLogger.Log($"Save sandbox patch manifest file : {packageName}");
var manifest = PatchManifest.Deserialize(fileContent);
string savePath = GetCacheManifestFilePath(packageName);
FileUtility.CreateFile(savePath, fileContent);
return manifest;
}
/// <summary>
/// 检测沙盒内清单文件是否存在
/// </summary>
public static bool CheckCacheManifestFileExists(string packageName)
{
string filePath = GetCacheManifestFilePath(packageName);
return File.Exists(filePath);
}
/// <summary>
/// 删除沙盒内清单文件
/// </summary>
public static bool DeleteCacheManifestFile(string packageName)
{
string filePath = GetCacheManifestFilePath(packageName);
if (File.Exists(filePath))
{
var bundleInfo = ConvertToUnpackInfo(patchBundle);
result.Add(bundleInfo);
YooLogger.Warning($"Invalid cache manifest file have been removed : {filePath}");
File.Delete(filePath);
return true;
}
else
{
return false;
}
return result;
}
public static BundleInfo ConvertToUnpackInfo(PatchBundle patchBundle)
{
// 注意:我们把流加载路径指定为远端下载地址
string streamingPath = PathHelper.ConvertToWWWPath(patchBundle.StreamingFilePath);
BundleInfo bundleInfo = new BundleInfo(patchBundle, BundleInfo.ELoadMode.LoadFromStreaming, streamingPath, streamingPath);
return bundleInfo;
}
#endregion
}
}

View File

@@ -148,6 +148,27 @@ namespace YooAsset
}
}
/// <summary>
/// 创建文件(如果已经存在则删除旧文件)
/// </summary>
public static void CreateFile(string filePath, byte[] data)
{
// 删除旧文件
if (File.Exists(filePath))
File.Delete(filePath);
// 创建文件夹路径
CreateFileDirectory(filePath);
// 创建新文件
using (FileStream fs = File.Create(filePath))
{
fs.Write(data, 0, data.Length);
fs.Flush();
fs.Close();
}
}
/// <summary>
/// 创建文件的文件夹路径
/// </summary>

View File

@@ -224,7 +224,7 @@ namespace YooAsset
/// </summary>
public static void ClearSandbox()
{
SandboxHelper.DeleteSandbox();
PersistentHelper.DeleteSandbox();
}
#endregion

View File

@@ -1,22 +1,36 @@
using UnityEngine;
using System.Diagnostics;
using UnityEngine;
namespace YooAsset
{
internal class YooAssetsDriver : MonoBehaviour
{
private static int LastestUpdateFrame = 0;
void Update()
{
DebugCheckDuplicateDriver();
YooAssets.Update();
}
void OnDestroy()
{
YooAssets.Destroy();
}
void OnApplicationQuit()
{
YooAssets.Destroy();
}
[Conditional("DEBUG")]
private void DebugCheckDuplicateDriver()
{
if (LastestUpdateFrame > 0)
{
if (LastestUpdateFrame == Time.frameCount)
YooLogger.Warning($"There are two {nameof(YooAssetsDriver)} in the scene. Please ensure there is always exactly one driver in the scene.");
}
LastestUpdateFrame = Time.frameCount;
}
}
}

View File

@@ -1,155 +1,194 @@
{
"ShaderCount": 0,
"VariantCount": 0,
"ShaderVariants": [
{
"AssetPath": "Resources/unity_builtin_extra",
"ShaderName": "Hidden/Internal-ScreenSpaceShadows",
"PassType": 0,
"Keywords": [
"SHADOWS_SINGLE_CASCADE",
"SHADOWS_SPLIT_SPHERES"
]
},
"ShaderTotalCount": 12,
"VariantTotalCount": 16,
"ShaderVariantInfos": [
{
"AssetPath": "Resources/unity_builtin_extra",
"ShaderName": "Hidden/BlitCopy",
"PassType": 0,
"Keywords": [
""
"ShaderVariantElements": [
{
"PassType": 0,
"Keywords": [
""
]
}
]
},
{
"AssetPath": "Resources/unity_builtin_extra",
"ShaderName": "Skybox/Procedural",
"PassType": 0,
"Keywords": [
"BILLBOARD_FACE_CAMERA_POS",
"UNITY_HDR_ON",
"_SUNDISK_SIMPLE"
]
},
{
"AssetPath": "Resources/unity_builtin_extra",
"ShaderName": "Skybox/Procedural",
"PassType": 0,
"Keywords": [
"BILLBOARD_FACE_CAMERA_POS",
"SOFTPARTICLES_ON",
"UNITY_HDR_ON",
"_SUNDISK_SIMPLE"
"ShaderVariantElements": [
{
"PassType": 0,
"Keywords": [
"BILLBOARD_FACE_CAMERA_POS",
"_SUNDISK_SIMPLE"
]
}
]
},
{
"AssetPath": "Resources/unity_builtin_extra",
"ShaderName": "Hidden/Internal-GUITextureClip",
"PassType": 0,
"Keywords": [
""
"ShaderVariantElements": [
{
"PassType": 0,
"Keywords": [
""
]
}
]
},
{
"AssetPath": "Resources/unity_builtin_extra",
"ShaderName": "Hidden/Internal-GUITextureClipText",
"PassType": 0,
"Keywords": [
""
"ShaderVariantElements": [
{
"PassType": 0,
"Keywords": [
""
]
}
]
},
{
"AssetPath": "Resources/unity_builtin_extra",
"ShaderName": "Hidden/Internal-GUITexture",
"PassType": 0,
"Keywords": [
""
"ShaderVariantElements": [
{
"PassType": 0,
"Keywords": [
""
]
}
]
},
{
"AssetPath": "Resources/unity_builtin_extra",
"ShaderName": "Hidden/Internal-GUITextureBlit",
"PassType": 0,
"Keywords": [
""
"ShaderVariantElements": [
{
"PassType": 0,
"Keywords": [
""
]
}
]
},
{
"AssetPath": "Resources/unity_builtin_extra",
"ShaderName": "Hidden/Internal-GUIRoundedRect",
"PassType": 0,
"Keywords": [
""
"ShaderVariantElements": [
{
"PassType": 0,
"Keywords": [
""
]
}
]
},
{
"AssetPath": "Resources/unity_builtin_extra",
"ShaderName": "Hidden/Internal-GUIRoundedRectWithColorPerBorder",
"PassType": 0,
"Keywords": [
""
"ShaderVariantElements": [
{
"PassType": 0,
"Keywords": [
""
]
}
]
},
{
"AssetPath": "Resources/unity_builtin_extra",
"ShaderName": "Hidden/Internal-UIRAtlasBlitCopy",
"PassType": 0,
"Keywords": [
""
"ShaderVariantElements": [
{
"PassType": 0,
"Keywords": [
""
]
}
]
},
{
"AssetPath": "Resources/unity_builtin_extra",
"ShaderName": "Hidden/UIElements/EditorUIE",
"PassType": 0,
"Keywords": [
"BILLBOARD_FACE_CAMERA_POS"
"ShaderVariantElements": [
{
"PassType": 0,
"Keywords": [
"BILLBOARD_FACE_CAMERA_POS"
]
}
]
},
{
"AssetPath": "Resources/unity_builtin_extra",
"ShaderName": "Hidden/UIElements/EditorUIE",
"PassType": 0,
"Keywords": [
"BILLBOARD_FACE_CAMERA_POS",
"SOFTPARTICLES_ON"
"ShaderName": "Mobile/Diffuse",
"ShaderVariantElements": [
{
"PassType": 4,
"Keywords": [
"BILLBOARD_FACE_CAMERA_POS",
"DIRECTIONAL",
"LIGHTPROBE_SH",
"SHADOWS_SCREEN",
"SHADOWS_SOFT",
"SHADOWS_SPLIT_SPHERES"
]
},
{
"PassType": 8,
"Keywords": [
""
]
},
{
"PassType": 8,
"Keywords": [
"SHADOWS_DEPTH",
"SHADOWS_SOFT",
"SHADOWS_SPLIT_SPHERES"
]
}
]
},
{
"AssetPath": "Assets/GameRes/Shaders/MyUnlitShader.shader",
"ShaderName": "Unlit/MyUnlitShader",
"PassType": 0,
"Keywords": [
"BILLBOARD_FACE_CAMERA_POS",
"UNITY_HDR_ON"
]
},
{
"AssetPath": "Assets/GameArt/Shaders/StandardMobile.shader",
"AssetPath": "Assets/Samples/Basic Sample/GameArt/Shaders/StandardMobile.shader",
"ShaderName": "Mobile/Standard",
"PassType": 1,
"Keywords": [
"BILLBOARD_FACE_CAMERA_POS",
"UNITY_HDR_ON",
"_EMISSION",
"_METALLICGLOSSMAP",
"_NORMALMAP"
]
},
{
"AssetPath": "Assets/GameArt/Shaders/StandardMobile.shader",
"ShaderName": "Mobile/Standard",
"PassType": 8,
"Keywords": [
"SHADOWS_DEPTH"
]
},
{
"AssetPath": "Assets/GameArt/Shaders/StandardMobile.shader",
"ShaderName": "Mobile/Standard",
"PassType": 8,
"Keywords": [
"_EMISSION",
"_METALLICGLOSSMAP",
"_NORMALMAP"
"ShaderVariantElements": [
{
"PassType": 1,
"Keywords": [
"BILLBOARD_FACE_CAMERA_POS",
"SHADOWS_SCREEN",
"SHADOWS_SOFT",
"SHADOWS_SPLIT_SPHERES",
"_EMISSION",
"_METALLICGLOSSMAP",
"_NORMALMAP"
]
},
{
"PassType": 8,
"Keywords": [
"_EMISSION",
"_METALLICGLOSSMAP",
"_NORMALMAP"
]
},
{
"PassType": 8,
"Keywords": [
"SHADOWS_DEPTH",
"SHADOWS_SOFT",
"SHADOWS_SPLIT_SPHERES",
"_EMISSION",
"_METALLICGLOSSMAP",
"_NORMALMAP"
]
}
]
}
]

View File

@@ -8,11 +8,6 @@ ShaderVariantCollection:
m_PrefabAsset: {fileID: 0}
m_Name: MyShaderVariants
m_Shaders:
- first: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0}
second:
variants:
- keywords: SHADOWS_SINGLE_CASCADE SHADOWS_SPLIT_SPHERES
passType: 0
- first: {fileID: 66, guid: 0000000000000000f000000000000000, type: 0}
second:
variants:
@@ -21,9 +16,7 @@ ShaderVariantCollection:
- first: {fileID: 106, guid: 0000000000000000f000000000000000, type: 0}
second:
variants:
- keywords: BILLBOARD_FACE_CAMERA_POS UNITY_HDR_ON _SUNDISK_SIMPLE
passType: 0
- keywords: BILLBOARD_FACE_CAMERA_POS SOFTPARTICLES_ON UNITY_HDR_ON _SUNDISK_SIMPLE
- keywords: BILLBOARD_FACE_CAMERA_POS _SUNDISK_SIMPLE
passType: 0
- first: {fileID: 9000, guid: 0000000000000000f000000000000000, type: 0}
second:
@@ -65,20 +58,24 @@ ShaderVariantCollection:
variants:
- keywords: BILLBOARD_FACE_CAMERA_POS
passType: 0
- keywords: BILLBOARD_FACE_CAMERA_POS SOFTPARTICLES_ON
passType: 0
- first: {fileID: 4800000, guid: e1f5153da774c754aa283cf23fd64d56, type: 3}
- first: {fileID: 10703, guid: 0000000000000000f000000000000000, type: 0}
second:
variants:
- keywords: BILLBOARD_FACE_CAMERA_POS UNITY_HDR_ON
passType: 0
- keywords: BILLBOARD_FACE_CAMERA_POS DIRECTIONAL LIGHTPROBE_SH SHADOWS_SCREEN
SHADOWS_SOFT SHADOWS_SPLIT_SPHERES
passType: 4
- keywords:
passType: 8
- keywords: SHADOWS_DEPTH SHADOWS_SOFT SHADOWS_SPLIT_SPHERES
passType: 8
- first: {fileID: 4800000, guid: ba67c8b1d5e59dc428ad9fc9270f8353, type: 3}
second:
variants:
- keywords: BILLBOARD_FACE_CAMERA_POS UNITY_HDR_ON _EMISSION _METALLICGLOSSMAP
_NORMALMAP
- keywords: BILLBOARD_FACE_CAMERA_POS SHADOWS_SCREEN SHADOWS_SOFT SHADOWS_SPLIT_SPHERES
_EMISSION _METALLICGLOSSMAP _NORMALMAP
passType: 1
- keywords: SHADOWS_DEPTH
passType: 8
- keywords: _EMISSION _METALLICGLOSSMAP _NORMALMAP
passType: 8
- keywords: SHADOWS_DEPTH SHADOWS_SOFT SHADOWS_SPLIT_SPHERES _EMISSION _METALLICGLOSSMAP
_NORMALMAP
passType: 8

View File

@@ -38,12 +38,12 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1}
m_IndirectSpecularColor: {r: 0.44648796, g: 0.49640262, b: 0.57479304, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 11
serializedVersion: 12
m_GIWorkflowMode: 1
m_GISettings:
serializedVersion: 2
@@ -98,7 +98,8 @@ LightmapSettings:
m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 0}
m_UseShadowmask: 1
m_LightingSettings: {fileID: 4890085278179872738, guid: 4d79db71c99efe845b8427c591250a17,
type: 2}
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
@@ -118,6 +119,8 @@ NavMeshSettings:
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
maxJobWorkers: 0
preserveTilesOutsideBounds: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
@@ -173,6 +176,7 @@ MonoBehaviour:
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:
@@ -312,6 +316,7 @@ Light:
m_UseColorTemperature: 0
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
m_UseBoundingSphereOverride: 0
m_UseViewFrustumForShadowCasterCull: 1
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!4 &22896611
@@ -417,6 +422,7 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@@ -495,6 +501,7 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@@ -569,6 +576,7 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0, b: 0, a: 0.5019608}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@@ -781,6 +789,7 @@ MonoBehaviour:
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
m_PresetInfoIsWorld: 0
--- !u!223 &421995326
Canvas:
m_ObjectHideFlags: 0
@@ -823,7 +832,7 @@ RectTransform:
- {fileID: 856012950}
- {fileID: 1722199052}
- {fileID: 851382668}
- {fileID: 1410518846}
- {fileID: 1728630126}
- {fileID: 2140485207}
m_Father: {fileID: 0}
m_RootOrder: 2
@@ -885,6 +894,7 @@ MonoBehaviour:
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:
@@ -964,6 +974,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
@@ -1008,6 +1019,7 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0.3921569, b: 0.5058824, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@@ -1084,6 +1096,7 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0.3921569, b: 0.5058824, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@@ -1159,6 +1172,7 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 0.23538622, g: 0.5377358, b: 0.5351191, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@@ -1271,6 +1285,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
@@ -1315,6 +1330,7 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0.3921569, b: 0.5058824, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@@ -1474,6 +1490,7 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0.3921569, b: 0.5058824, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@@ -1510,6 +1527,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
@@ -1592,6 +1610,7 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 0.50980395, g: 0.78039217, b: 0.99215686, a: 1}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@@ -1666,6 +1685,7 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@@ -1692,6 +1712,85 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1074710057}
m_CullTransparentMesh: 1
--- !u!1 &1113091724
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1113091725}
- component: {fileID: 1113091727}
- component: {fileID: 1113091726}
m_Layer: 5
m_Name: label
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1113091725
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1113091724}
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_Children: []
m_Father: {fileID: 1728630126}
m_RootOrder: 0
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 &1113091726
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1113091724}
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: 12800000, guid: 35204a17be9c96649b254d2bad80f4dd, type: 3}
m_FontSize: 22
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 2
m_MaxSize: 40
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: pckage version
--- !u!222 &1113091727
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1113091724}
m_CullTransparentMesh: 1
--- !u!1 &1128512455
GameObject:
m_ObjectHideFlags: 0
@@ -1744,6 +1843,7 @@ MonoBehaviour:
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:
@@ -1818,6 +1918,7 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@@ -1896,6 +1997,7 @@ MonoBehaviour:
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:
@@ -2055,6 +2157,7 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 0.9150943, g: 0.9150943, b: 0.9150943, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@@ -2074,136 +2177,6 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1391355263}
m_CullTransparentMesh: 1
--- !u!1001 &1410518845
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 421995327}
m_Modifications:
- target: {fileID: 2022112446042523657, guid: c960f31742c5ef84dadfc5324f497dc4,
type: 3}
propertyPath: m_Pivot.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 2022112446042523657, guid: c960f31742c5ef84dadfc5324f497dc4,
type: 3}
propertyPath: m_Pivot.y
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 2022112446042523657, guid: c960f31742c5ef84dadfc5324f497dc4,
type: 3}
propertyPath: m_RootOrder
value: 11
objectReference: {fileID: 0}
- target: {fileID: 2022112446042523657, guid: c960f31742c5ef84dadfc5324f497dc4,
type: 3}
propertyPath: m_AnchorMax.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2022112446042523657, guid: c960f31742c5ef84dadfc5324f497dc4,
type: 3}
propertyPath: m_AnchorMax.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2022112446042523657, guid: c960f31742c5ef84dadfc5324f497dc4,
type: 3}
propertyPath: m_AnchorMin.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2022112446042523657, guid: c960f31742c5ef84dadfc5324f497dc4,
type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2022112446042523657, guid: c960f31742c5ef84dadfc5324f497dc4,
type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2022112446042523657, guid: c960f31742c5ef84dadfc5324f497dc4,
type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2022112446042523657, guid: c960f31742c5ef84dadfc5324f497dc4,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2022112446042523657, guid: c960f31742c5ef84dadfc5324f497dc4,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2022112446042523657, guid: c960f31742c5ef84dadfc5324f497dc4,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2022112446042523657, guid: c960f31742c5ef84dadfc5324f497dc4,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2022112446042523657, guid: c960f31742c5ef84dadfc5324f497dc4,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2022112446042523657, guid: c960f31742c5ef84dadfc5324f497dc4,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2022112446042523657, guid: c960f31742c5ef84dadfc5324f497dc4,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2022112446042523657, guid: c960f31742c5ef84dadfc5324f497dc4,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2022112446042523657, guid: c960f31742c5ef84dadfc5324f497dc4,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2022112446042523657, guid: c960f31742c5ef84dadfc5324f497dc4,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2022112446042523657, guid: c960f31742c5ef84dadfc5324f497dc4,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2022112446042523657, guid: c960f31742c5ef84dadfc5324f497dc4,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3898752365573652967, guid: c960f31742c5ef84dadfc5324f497dc4,
type: 3}
propertyPath: m_Name
value: window
objectReference: {fileID: 0}
- target: {fileID: 3898752365573652967, guid: c960f31742c5ef84dadfc5324f497dc4,
type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: c960f31742c5ef84dadfc5324f497dc4, type: 3}
--- !u!224 &1410518846 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 2022112446042523657, guid: c960f31742c5ef84dadfc5324f497dc4,
type: 3}
m_PrefabInstance: {fileID: 1410518845}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1495202955
GameObject:
m_ObjectHideFlags: 0
@@ -2256,6 +2229,7 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 0.50980395, g: 0.78039217, b: 0.99215686, a: 1}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@@ -2398,6 +2372,7 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0.3921569, b: 0.5058824, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@@ -2434,6 +2409,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
@@ -2515,6 +2491,7 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@@ -2594,6 +2571,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
@@ -2638,6 +2616,7 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0.3921569, b: 0.5058824, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@@ -2660,6 +2639,82 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1722199051}
m_CullTransparentMesh: 1
--- !u!1 &1728630125
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1728630126}
- component: {fileID: 1728630128}
- component: {fileID: 1728630127}
m_Layer: 5
m_Name: package_version
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1728630126
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1728630125}
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_Children:
- {fileID: 1113091725}
m_Father: {fileID: 421995327}
m_RootOrder: 10
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: -167.48999, y: 52.580017}
m_SizeDelta: {x: 250, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1728630127
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1728630125}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.23538622, g: 0.5377358, b: 0.5351191, 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_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &1728630128
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1728630125}
m_CullTransparentMesh: 1
--- !u!1 &1905438978
GameObject:
m_ObjectHideFlags: 0
@@ -2712,6 +2767,7 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@@ -2786,6 +2842,7 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@@ -2864,6 +2921,7 @@ MonoBehaviour:
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:

View File

@@ -0,0 +1,77 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &4823021703421310622
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1081569295705771379}
- component: {fileID: 717313983029069870}
- component: {fileID: 4531530829655932529}
m_Layer: 5
m_Name: ui_image
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1081569295705771379
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4823021703421310622}
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_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &717313983029069870
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4823021703421310622}
m_CullTransparentMesh: 1
--- !u!114 &4531530829655932529
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4823021703421310622}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, 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_Sprite: {fileID: 21300000, guid: e7478af3e19f2754186cf50b9fcc82aa, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: e4f6646a8e92fec4e926ffb00efae2a6
guid: 3bbebf8c65a9a384fb40cb989ad1a43b
PrefabImporter:
externalObjects: {}
userData:

View File

@@ -9,10 +9,9 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 1379288801}
- component: {fileID: 1379288803}
- component: {fileID: 1379288802}
- component: {fileID: 1100654191310277548}
m_Layer: 5
m_Name: Image
m_Name: Spawn
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@@ -37,15 +36,7 @@ RectTransform:
m_AnchoredPosition: {x: 156.2, y: -180}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &1379288803
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1379288800}
m_CullTransparentMesh: 1
--- !u!114 &1379288802
--- !u!114 &1100654191310277548
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
@@ -54,27 +45,10 @@ MonoBehaviour:
m_GameObject: {fileID: 1379288800}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Script: {fileID: 11500000, guid: be3e0c14618d8ac4fa7687c9e5a1fe15, 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_Sprite: {fileID: 21300000, guid: e7478af3e19f2754186cf50b9fcc82aa, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
SpawnGo: {fileID: 4823021703421310622, guid: 3bbebf8c65a9a384fb40cb989ad1a43b, type: 3}
--- !u!1 &3898752365573652967
GameObject:
m_ObjectHideFlags: 0
@@ -88,7 +62,7 @@ GameObject:
- component: {fileID: 3845261542565316829}
- component: {fileID: 6765875055818979782}
m_Layer: 5
m_Name: window
m_Name: ui_window
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0

View File

@@ -1,253 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &1379288800
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1379288801}
- component: {fileID: 1379288803}
- component: {fileID: 1379288802}
m_Layer: 5
m_Name: Image
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1379288801
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1379288800}
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_Children: []
m_Father: {fileID: 2022112446042523657}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 156.2, y: -180}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &1379288803
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1379288800}
m_CullTransparentMesh: 1
--- !u!114 &1379288802
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1379288800}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, 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_Sprite: {fileID: 21300000, guid: e7478af3e19f2754186cf50b9fcc82aa, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &3898752365573652967
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2022112446042523657}
- component: {fileID: 3819679245741158711}
- component: {fileID: 3845261542565316829}
- component: {fileID: 6765875055818979782}
m_Layer: 5
m_Name: window2
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2022112446042523657
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3898752365573652967}
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_Children:
- {fileID: 1939154922710681327}
- {fileID: 1379288801}
m_Father: {fileID: 0}
m_RootOrder: 0
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!223 &3819679245741158711
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3898752365573652967}
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_AdditionalShaderChannelsFlag: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!114 &3845261542565316829
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3898752365573652967}
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!114 &6765875055818979782
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3898752365573652967}
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!1 &6270437865016065282
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1939154922710681327}
- component: {fileID: 2026527403895129010}
- component: {fileID: 3101003136597407213}
m_Layer: 5
m_Name: Image
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1939154922710681327
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6270437865016065282}
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_Children: []
m_Father: {fileID: 2022112446042523657}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: -180}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &2026527403895129010
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6270437865016065282}
m_CullTransparentMesh: 1
--- !u!114 &3101003136597407213
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6270437865016065282}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, 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_Sprite: {fileID: 21300000, guid: 145b173105dad2d44a8c243a25f27147, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1

View File

@@ -0,0 +1,65 @@
using System;
using System.IO;
using System.Text;
using YooAsset;
public class EncryptionNone : IEncryptionServices
{
public EncryptResult Encrypt(EncryptFileInfo fileInfo)
{
EncryptResult result = new EncryptResult();
result.LoadMethod = EBundleLoadMethod.Normal;
return result;
}
}
public class FileOffsetEncryption : IEncryptionServices
{
public EncryptResult Encrypt(EncryptFileInfo fileInfo)
{
if(fileInfo.BundleName.Contains("gameres_music"))
{
int offset = 32;
byte[] fileData = File.ReadAllBytes(fileInfo.FilePath);
var encryptedData = new byte[fileData.Length + offset];
Buffer.BlockCopy(fileData, 0, encryptedData, offset, fileData.Length);
EncryptResult result = new EncryptResult();
result.LoadMethod = EBundleLoadMethod.LoadFromFileOffset;
result.EncryptedData = encryptedData;
return result;
}
else
{
EncryptResult result = new EncryptResult();
result.LoadMethod = EBundleLoadMethod.Normal;
return result;
}
}
}
public class FileStreamEncryption : IEncryptionServices
{
public EncryptResult Encrypt(EncryptFileInfo fileInfo)
{
if (fileInfo.BundleName.Contains("gameres_music"))
{
var fileData = File.ReadAllBytes(fileInfo.FilePath);
for (int i = 0; i < fileData.Length; i++)
{
fileData[i] ^= BundleStream.KEY;
}
EncryptResult result = new EncryptResult();
result.LoadMethod = EBundleLoadMethod.LoadFromStream;
result.EncryptedData = fileData;
return result;
}
else
{
EncryptResult result = new EncryptResult();
result.LoadMethod = EBundleLoadMethod.Normal;
return result;
}
}
}

View File

@@ -1,37 +0,0 @@
using System;
using YooAsset.Editor;
public class EncryptionNone : IEncryptionServices
{
bool IEncryptionServices.Check(string bundleName)
{
return false;
}
byte[] IEncryptionServices.Encrypt(byte[] fileData)
{
throw new System.NotImplementedException();
}
}
public class GameEncryption : IEncryptionServices
{
/// <summary>
/// 检测资源包是否需要加密
/// </summary>
bool IEncryptionServices.Check(string bundleName)
{
// 对配置表进行加密
return bundleName.Contains("assets/gameres/config/");
}
/// <summary>
/// 对数据进行加密,并返回加密后的数据
/// </summary>
byte[] IEncryptionServices.Encrypt(byte[] fileData)
{
int offset = 32;
var temper = new byte[fileData.Length + offset];
Buffer.BlockCopy(fileData, 0, temper, offset, fileData.Length);
return temper;
}
}

View File

@@ -0,0 +1,14 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Spawner : MonoBehaviour
{
public GameObject SpawnGo;
void Start()
{
UnityEngine.Debug.Log("<22><>ʼ<EFBFBD><CABC><EFBFBD>ƹ<EFBFBD><C6B9>ص<EFBFBD>GameObject");
GameObject.Instantiate<GameObject>(SpawnGo, this.transform);
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: be3e0c14618d8ac4fa7687c9e5a1fe15
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -3,6 +3,7 @@ using System.Collections;
using UnityEngine;
using YooAsset;
using Better.StreamingAssets;
using System.IO;
public class BootScene : MonoBehaviour
{
@@ -61,6 +62,7 @@ public class BootScene : MonoBehaviour
if (PlayMode == EPlayMode.OfflinePlayMode)
{
var createParameters = new OfflinePlayModeParameters();
createParameters.DecryptionServices = new BundleDecryptionServices();
yield return defaultPackage.InitializeAsync(createParameters);
}
@@ -68,6 +70,7 @@ public class BootScene : MonoBehaviour
if (PlayMode == EPlayMode.HostPlayMode)
{
var createParameters = new HostPlayModeParameters();
createParameters.DecryptionServices = new BundleDecryptionServices();
createParameters.QueryServices = new QueryStreamingAssetsFileServices();
createParameters.DefaultHostServer = GetHostServerURL();
createParameters.FallbackHostServer = GetHostServerURL();
@@ -108,8 +111,32 @@ public class BootScene : MonoBehaviour
{
public bool QueryStreamingAssets(string fileName)
{
// 注意使用了BetterStreamingAssets插件使用前需要初始化该插件
string buildinFolderName = YooAssets.GetStreamingAssetBuildinFolderName();
return BetterStreamingAssets.FileExists($"{buildinFolderName}/{fileName}");
}
}
private class BundleDecryptionServices : IDecryptionServices
{
public ulong LoadFromFileOffset(DecryptFileInfo fileInfo)
{
return 32;
}
public byte[] LoadFromMemory(DecryptFileInfo fileInfo)
{
throw new NotImplementedException();
}
public FileStream LoadFromStream(DecryptFileInfo fileInfo)
{
BundleStream bundleStream = new BundleStream(fileInfo.FilePath, FileMode.Open);
return bundleStream;
}
public uint GetManagedReadBufferSize()
{
return 1024;
}
}
}

View File

@@ -0,0 +1,27 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
public class BundleStream : FileStream
{
public const byte KEY = 64;
public BundleStream(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, bool useAsync) : base(path, mode, access, share, bufferSize, useAsync)
{
}
public BundleStream(string path, FileMode mode) : base(path, mode)
{
}
public override int Read(byte[] array, int offset, int count)
{
var index = base.Read(array, offset, count);
for (int i = 0; i < array.Length; i++)
{
array[i] ^= KEY;
}
return index;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7da6bc93686626a4cb248691891073ac
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -56,6 +56,10 @@ public class GameScene1 : MonoBehaviour
else
throw new NotImplementedException();
var package = YooAssets.GetAssetsPackage("DefaultPackage");
var packageVersion = CanvasRoot.transform.Find("package_version/label").GetComponent<Text>();
packageVersion.text = package.GetPackageVersion();
// 通过资源标签加载资源
{
string assetTag = "sphere";
@@ -186,6 +190,12 @@ public class GameScene1 : MonoBehaviour
YooAssets.LoadSceneAsync("GameScene2");
});
}
// 加载面板
{
var handle = YooAssets.LoadAssetSync<GameObject>("ui_window");
handle.InstantiateSync(CanvasRoot.transform);
}
}
private void OnUnityAtlas_Completed(AssetOperationHandle handle)

View File

@@ -30,7 +30,6 @@ internal class FsmUpdateStaticVersion : IFsmNode
if (operation.Status == EOperationStatus.Succeed)
{
Debug.Log($"Found static version : {operation.PackageVersion}");
PatchUpdater.PackageVersion = operation.PackageVersion;
FsmManager.Transition(nameof(FsmUpdateManifest));
}

View File

@@ -13,10 +13,10 @@ MonoBehaviour:
m_Name: AssetBundleBuilderSetting
m_EditorClassIdentifier:
BuildPipeline: 0
BuildMode: 1
BuildMode: 0
BuildPackage: DefaultPackage
CompressOption: 2
OutputNameStyle: 1
CopyBuildinFileOption: 1
CopyBuildinFileTags:
EncyptionClassName: EncryptionNone
EncyptionClassName: FileStreamEncryption

View File

@@ -87,7 +87,7 @@ MonoBehaviour:
CollectorGUID: 926d3203fcefdb947881a7491496e039
CollectorType: 0
AddressRuleName: AddressByFileName
PackRuleName: PackDirectory
PackRuleName: PackSeparately
FilterRuleName: CollectAll
AssetTags:
- CollectPath: Assets/Samples/Basic Sample/GameRes/UISprite

View File

@@ -1,7 +1,7 @@
{
"name": "com.tuyoogame.yooasset",
"displayName": "YooAsset",
"version": "1.3.3",
"version": "1.3.4",
"unity": "2019.4",
"description": "unity3d resources management system.",
"author": {

View File

@@ -28,9 +28,13 @@
(4) 模拟构建模式在编辑器下配合EditorSimulateMode运行模式来模拟真实运行的环境。
- **Build Version**
构建的资源包版本。
- **Build Package**
需要构建的资源包名称。
构建的资源包名称。
- **Encryption**
@@ -70,38 +74,6 @@
点击构建按钮会开始构建流程,构建流程分为多个节点顺序执行,如果某个节点发生错误,会导致构建失败。错误信息可以在控制台查看。
### 资源包加密
编写继承IEncryptionServices接口的加密类。注意加密类文件需要放置在Editor文件夹里。
````C#
using System;
using YooAsset.Editor;
public class GameEncryption : IEncryptionServices
{
/// <summary>
/// 检测资源包是否需要加密
/// </summary>
bool IEncryptionServices.Check(string bundleName)
{
// 对配置表相关的资源包进行加密
return bundleName.Contains("assets/config/");
}
/// <summary>
/// 对数据进行加密,并返回加密后的数据
/// </summary>
byte[] IEncryptionServices.Encrypt(byte[] fileData)
{
int offset = 32;
var temper = new byte[fileData.Length + offset];
Buffer.BlockCopy(fileData, 0, temper, offset, fileData.Length);
return temper;
}
}
````
### 补丁包
构建成功后会在输出目录下找到补丁包文件夹,该文件夹名称为本次构建时指定的资源版本号。
@@ -112,7 +84,11 @@ public class GameEncryption : IEncryptionServices
### 补丁清单
补丁清单是一个Json格式的文本文件里面包含了所有资源包的信息例如名称大小CRC等
补丁清单是一个Json格式的文本文件。
AssetList组记录的是主资源对象列表。
BundleList组记录的是资源包列表。
![image](./Image/AssetBuilder-img2.png)
@@ -134,10 +110,9 @@ private static void BuildInternal(BuildTarget buildTarget)
buildParameters.BuildTarget = buildTarget;
buildParameters.BuildPipeline = EBuildPipeline.BuiltinBuildPipeline;
buildParameters.BuildMode = EBuildMode.ForceRebuild;
buildParameters.BuildPackage = "DefaultPackage";
buildParameters.HumanReadableVersion = "v1.0";
buildParameters.PackageName = "DefaultPackage";
buildParameters.PackageVersion = "1.0.0";
buildParameters.VerifyBuildingResult = true;
buildParameters.EncryptionServices = new GameEncryption();
buildParameters.CompressOption = ECompressOption.LZ4;
buildParameters.OutputNameStyle = EOutputNameStyle.HashName_Extension;
buildParameters.CopyBuildinFileOption = ECopyBuildinFileOption.None;
@@ -146,10 +121,12 @@ private static void BuildInternal(BuildTarget buildTarget)
AssetBundleBuilder builder = new AssetBundleBuilder();
var buildResult = builder.Run(buildParameters);
if (buildResult.Success)
Debug.Log($"构建成功!");
{
Debug.Log($"构建成功 : {buildResult.OutputPackageDirectory}");
}
}
// 从构建命令里获取参数
// 从构建命令里获取参数示例
private static string GetBuildPackageName()
{
foreach (string arg in System.Environment.GetCommandLineArgs())
@@ -157,7 +134,7 @@ private static string GetBuildPackageName()
if (arg.StartsWith("buildPackage"))
return arg.Split("="[0])[1];
}
return -1;
return string.Empty;
}
````
@@ -173,8 +150,8 @@ private static string GetBuildPackageName()
- **首包资源**
在构建应用程序的时候例如安卓的APK,我们希望将某些资源打进首包里,可以在构建成功后自己编写逻辑代码拷贝相关资源文件到StreamingAssets/YooAssets/目录。首包资源如果发生变化,也可以通过热更新来更新资源。
在构建应用程序的时候,我们希望将某些资源打进首包里,首包资源拷贝至StreamingAssets/BuildinFiles/目录。首包资源如果发生变化,也可以通过热更新来更新资源。
- **补丁包**
无论是通过增量构建还是强制构建,在构建完成后都会生成一个以补丁清单文件哈希值命名的文件夹我们把这个文件夹统称为补丁包。补丁包里包含了游戏运行需要的所有资源我们可以无脑的将补丁包内容覆盖到CDN目录下也可以通过编写差异分析工具来筛选出和线上最新版本之间的差异文件然后将差异文件上传到CDN目录里。
无论是通过增量构建还是强制构建,在构建完成后都会生成一个以包裹版本PackageVersion命名的文件夹我们把这个文件夹统称为补丁包。补丁包里包含了游戏运行需要的所有资源我们可以无脑的将补丁包内容覆盖到CDN目录下也可以通过编写差异分析工具来筛选出和线上最新版本之间的差异文件然后将差异文件上传到CDN目录里。

View File

@@ -62,32 +62,42 @@ private IEnumerator InitializeYooAsset()
private IEnumerator InitializeYooAsset()
{
var initParameters = new HostPlayModeParameters();
initParameters.LocationServices = new DefaultLocationServices("Assets/GameRes");
initParameters.DecryptionServices = new BundleDecryptionServices();
initParameters.QueryServices = new QueryStreamingAssetsServices();
initParameters.QueryServices = new QueryStreamingAssetsFileServices();
initParameters.DefaultHostServer = "http://127.0.0.1/CDN1/Android/v1.0";
initParameters.FallbackHostServer = "http://127.0.0.1/CDN2/Android/v1.0";
yield return defaultPackage.InitializeAsync(initParameters);
}
// 文件解密服务类
private class BundleDecryptionServices : IDecryptionServices
{
public ulong GetFileOffset(DecryptionFileInfo fileInfo)
{
return 32;
}
}
// 内置文件查询服务类
private class QueryStreamingAssetsServices : IQueryServices
private class QueryStreamingAssetsFileServices : IQueryServices
{
public bool QueryStreamingAssets(string fileName)
{
// 注意使用了BetterStreamingAssets插件
// 注意使用了BetterStreamingAssets插件,使用前需要初始化该插件!
string buildinFolderName = YooAssets.GetStreamingAssetBuildinFolderName();
return BetterStreamingAssets.FileExists($"{buildinFolderName}/{fileName}");
}
}
````
### 源代码解析
- 编辑器模拟模式
每次启动调用EditorSimulateModeHelper.SimulateBuild()方法都会在底层执行一次模拟构建Simulate Build
如果参与构建的资源对象数量级很大的话则会有卡顿现象,可以通过直接指定已有的清单路径来避免每次都重复执行模拟构建。
- 单机运行模式
在初始化的时候会直接读取内置清单文件StreamingAssets文件夹里的文件最后根据加载的清单去验证沙盒里缓存的文件。
- 联机运行模式
该模式下每个package都会在沙盒里保留一份清单当有更新的时候采用覆盖的方式存储。
在初始化的时候,会优先从沙盒里加载清单,如果沙盒里不存在,则会尝试加载内置清单并将其拷贝到沙盒里。最后根据加载的清单去验证沙盒里缓存的文件。
**注意**:如果沙盒清单和内置清单都不存在,初始化也会被判定为成功!

View File

@@ -10,14 +10,14 @@
private IEnumerator UpdateStaticVersion()
{
var package = YooAssets.GetAssetsPackage("DefaultPackage");
UpdateStaticVersionOperation operation = package.UpdateStaticVersionAsync();
var operation = package.UpdateStaticVersionAsync();
yield return operation;
if (operation.Status == EOperationStatus.Succeed)
{
//更新成功
string packageCRC = operation.PackageCRC;
Debug.Log($"Update resource Version : {packageCRC}");
string PackageVersion = operation.PackageVersion;
Debug.Log($"Updated package Version : {PackageVersion}");
}
else
{
@@ -35,7 +35,7 @@ private IEnumerator UpdateStaticVersion()
private IEnumerator UpdatePatchManifest()
{
var package = YooAssets.GetAssetsPackage("DefaultPackage");
UpdateManifestOperation operation = package.UpdateManifestAsync(packageCRC);
var operation = package.UpdateManifestAsync(packageVersion);
yield return operation;
if (operation.Status == EOperationStatus.Succeed)
@@ -76,7 +76,8 @@ IEnumerator Download()
int downloadingMaxNum = 10;
int failedTryAgain = 3;
int timeout = 60;
var downloader = YooAssets.CreatePatchDownloader(downloadingMaxNum, failedTryAgain, timeout);
var package = YooAssets.GetAssetsPackage("DefaultPackage");
var downloader = package.CreatePatchDownloader(downloadingMaxNum, failedTryAgain, timeout);
//没有需要下载的资源
if (downloader.TotalDownloadCount == 0)
@@ -110,47 +111,52 @@ IEnumerator Download()
}
````
**弱联网更新解决方案**
**弱联网环境解决方案**
对于偏单机但是也有资源热更需求的项目。当玩家本地网络不稳定或无网络的时候,我们又不希望玩家卡在资源更新步骤而不能正常游戏。所以当玩家本地网络有问题的时候,我们可以跳过资源更新的步骤。
对于偏单机但是也有资源热更需求的项目。当玩家无网络的时候,我们又不希望玩家卡在资源更新步骤而不能正常游戏。所以当玩家本地网络有问题的时候,我们可以跳过资源更新的步骤。
````c#
private IEnumerator UpdateStaticVersion()
private IEnumerator Start()
{
var package = YooAssets.GetAssetsPackage("DefaultPackage");
UpdateStaticVersionOperation operation = package.UpdateStaticVersionAsync(10);
var operation = package.UpdateStaticVersionAsync(30);
yield return operation;
if (operation.Status == EOperationStatus.Succeed)
{
// 如果获取远端资源版本成功,说明当前网络连接并无问题,可以走正常更新流程。
// 如果获取远端资源版本成功,说明当前网络连接通畅,可以走正常更新流程。
......
// 注意:在成功下载所有资源之后,我们需要记录当前最新的资源版本号
PlayerPrefs.SetString("STATIC_VERSION", packageCRC);
}
else
{
// 如果获取远端资源版本失败,我们走弱联网更新模式
// 注意如果从来没有保存过版本信息则需要从内部读取StaticVersion.bytes文件的版本信息
string packageCRC = PlayerPrefs.GetString("STATIC_VERSION", string.Empty);
if (packageCRC == string.Empty)
{
packageCRC = LoadStaticVersionFromStreamingAssets();
}
// 在弱联网情况下更新补丁清单
UpdateManifestOperation operation2 = package.WeaklyUpdateManifestAsync(packageCRC);
yield return operation2;
if (operation2.Status == EOperationStatus.Succeed)
// 如果获取远端资源版本失败,说明当前网络无连接
// 在正常开始游戏之前,需要验证本地清单内容的完整性
var operation = package.CheckPackageContentsAsync();
yield return operation;
if (operation.Status == EOperationStatus.Succeed)
{
StartGame();
}
else
{
// 指定版本的资源内容本地并不完整,需要提示玩家更新。
// 资源内容本地并不完整,需要提示玩家联网更新。
ShowMessageBox("请检查本地网络,有新的游戏内容需要更新!");
}
}
}
````
### 源代码解析
- 编辑器模拟模式
UpdateStaticVersionAsync()方法和UpdateManifestAsync()方法都不起效,但是都会返回成功!
- 单机运行模式
UpdateStaticVersionAsync()方法和UpdateManifestAsync()方法都不起效,但是都会返回成功!
- 联机运行模式
UpdateManifestAsync()为资源清单更新方法。该方法的内部实现原理如下:
![image](./Image/CodeTutorial2-img1.png)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 77 KiB

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 KiB

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 KiB

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 111 KiB

After

Width:  |  Height:  |  Size: 161 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 128 KiB

After

Width:  |  Height:  |  Size: 168 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 26 KiB