mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-21 16:00:32 +00:00
Compare commits
23 Commits
1.3.7
...
1.4.0-prev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5197d42807 | ||
|
|
7a0f4caa9b | ||
|
|
5bf1d29edc | ||
|
|
2687466ed4 | ||
|
|
14512d6470 | ||
|
|
32268f5a4a | ||
|
|
81401ca0b8 | ||
|
|
688cc271d5 | ||
|
|
a290353cfa | ||
|
|
6038e7acd6 | ||
|
|
4abec5a389 | ||
|
|
a2b51a8044 | ||
|
|
19cb239746 | ||
|
|
7aab610be5 | ||
|
|
4ec5a126ac | ||
|
|
32643caf51 | ||
|
|
114ebab6ae | ||
|
|
d1463e1fc6 | ||
|
|
aa49980231 | ||
|
|
2696da092d | ||
|
|
5415d95f36 | ||
|
|
efa71c8bb7 | ||
|
|
d59df4c561 |
@@ -2,6 +2,19 @@
|
|||||||
|
|
||||||
All notable changes to this package will be documented in this file.
|
All notable changes to this package will be documented in this file.
|
||||||
|
|
||||||
|
## [1.4.0-preview] - 2022-12-04
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- (#46)修复了资源包初始化失败之后,再次初始化发生异常的问题。
|
||||||
|
- 修复了在初始化失败的之后,销毁YooAssets会报异常的问题。
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- 优化了资源收集界面,可以选择显示中文别名。
|
||||||
|
- **优化了补丁清单序列化方式,由文本数据修改为二进制数据。**
|
||||||
|
- 资源操作句柄增加using支持。
|
||||||
|
|
||||||
## [1.3.7] - 2022-11-26
|
## [1.3.7] - 2022-11-26
|
||||||
|
|
||||||
全新的太空战机Demo !
|
全新的太空战机Demo !
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ namespace YooAsset.Editor
|
|||||||
var buildResult = builder.Run(buildParameters);
|
var buildResult = builder.Run(buildParameters);
|
||||||
if (buildResult.Success)
|
if (buildResult.Success)
|
||||||
{
|
{
|
||||||
string manifestFileName = YooAssetSettingsData.GetPatchManifestFileName(buildParameters.PackageName, buildParameters.PackageVersion);
|
string manifestFileName = YooAssetSettingsData.GetPatchManifestBinaryFileName(buildParameters.PackageName, buildParameters.PackageVersion);
|
||||||
string manifestFilePath = $"{buildResult.OutputPackageDirectory}/{manifestFileName}";
|
string manifestFilePath = $"{buildResult.OutputPackageDirectory}/{manifestFileName}";
|
||||||
return manifestFilePath;
|
return manifestFilePath;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -182,13 +182,14 @@ namespace YooAsset.Editor
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
internal PatchBundle CreatePatchBundle()
|
internal PatchBundle CreatePatchBundle()
|
||||||
{
|
{
|
||||||
string fileHash = PatchInfo.PatchFileHash;
|
PatchBundle patchBundle = new PatchBundle();
|
||||||
string fileCRC = PatchInfo.PatchFileCRC;
|
patchBundle.BundleName = BundleName;
|
||||||
long fileSize = PatchInfo.PatchFileSize;
|
patchBundle.FileHash = PatchInfo.PatchFileHash;
|
||||||
bool isRawFile = IsRawFile;
|
patchBundle.FileCRC = PatchInfo.PatchFileCRC;
|
||||||
byte loadMethod = (byte)LoadMethod;
|
patchBundle.FileSize = PatchInfo.PatchFileSize;
|
||||||
string[] tags = GetBundleTags();
|
patchBundle.IsRawFile = IsRawFile;
|
||||||
PatchBundle patchBundle = new PatchBundle(BundleName, fileHash, fileCRC, fileSize, isRawFile, loadMethod, tags);
|
patchBundle.LoadMethod = (byte)LoadMethod;
|
||||||
|
patchBundle.Tags = GetBundleTags();
|
||||||
return patchBundle;
|
return patchBundle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ namespace YooAsset.Editor
|
|||||||
|
|
||||||
// 拷贝补丁清单文件
|
// 拷贝补丁清单文件
|
||||||
{
|
{
|
||||||
string fileName = YooAssetSettingsData.GetPatchManifestFileName(buildPackageName, buildPackageVersion);
|
string fileName = YooAssetSettingsData.GetPatchManifestBinaryFileName(buildPackageName, buildPackageVersion);
|
||||||
string sourcePath = $"{packageOutputDirectory}/{fileName}";
|
string sourcePath = $"{packageOutputDirectory}/{fileName}";
|
||||||
string destPath = $"{streamingAssetsDirectory}/{fileName}";
|
string destPath = $"{streamingAssetsDirectory}/{fileName}";
|
||||||
EditorTools.CopyFile(sourcePath, destPath, true);
|
EditorTools.CopyFile(sourcePath, destPath, true);
|
||||||
|
|||||||
@@ -51,18 +51,26 @@ namespace YooAsset.Editor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建补丁清单文件
|
// 创建补丁清单文本文件
|
||||||
|
{
|
||||||
|
string fileName = YooAssetSettingsData.GetPatchManifestJsonFileName(buildParameters.PackageName, buildParameters.PackageVersion);
|
||||||
|
string filePath = $"{packageOutputDirectory}/{fileName}";
|
||||||
|
PatchManifest.SerializeToJson(filePath, patchManifest);
|
||||||
|
BuildRunner.Log($"创建补丁清单文件:{filePath}");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建补丁清单二进制文件
|
||||||
string packageHash;
|
string packageHash;
|
||||||
{
|
{
|
||||||
string fileName = YooAssetSettingsData.GetPatchManifestFileName(buildParameters.PackageName, buildParameters.PackageVersion);
|
string fileName = YooAssetSettingsData.GetPatchManifestBinaryFileName(buildParameters.PackageName, buildParameters.PackageVersion);
|
||||||
string filePath = $"{packageOutputDirectory}/{fileName}";
|
string filePath = $"{packageOutputDirectory}/{fileName}";
|
||||||
PatchManifest.Serialize(filePath, patchManifest);
|
PatchManifest.SerializeToBinary(filePath, patchManifest);
|
||||||
packageHash = HashUtility.FileMD5(filePath);
|
packageHash = HashUtility.FileMD5(filePath);
|
||||||
BuildRunner.Log($"创建补丁清单文件:{filePath}");
|
BuildRunner.Log($"创建补丁清单文件:{filePath}");
|
||||||
|
|
||||||
var patchManifestContext = new PatchManifestContext();
|
PatchManifestContext patchManifestContext = new PatchManifestContext();
|
||||||
string jsonData = FileUtility.ReadFile(filePath);
|
byte[] bytesData = FileUtility.ReadAllBytes(filePath);
|
||||||
patchManifestContext.Manifest = PatchManifest.Deserialize(jsonData);
|
patchManifestContext.Manifest = PatchManifest.DeserializeFromBinary(bytesData);
|
||||||
context.SetContextObject(patchManifestContext);
|
context.SetContextObject(patchManifestContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,13 +10,14 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
public class AssetBundleCollectorConfig
|
public class AssetBundleCollectorConfig
|
||||||
{
|
{
|
||||||
public const string ConfigVersion = "2.1";
|
public const string ConfigVersion = "2.2";
|
||||||
|
|
||||||
public const string XmlVersion = "Version";
|
public const string XmlVersion = "Version";
|
||||||
public const string XmlCommon = "Common";
|
public const string XmlCommon = "Common";
|
||||||
public const string XmlEnableAddressable = "AutoAddressable";
|
public const string XmlEnableAddressable = "AutoAddressable";
|
||||||
public const string XmlUniqueBundleName = "UniqueBundleName";
|
public const string XmlUniqueBundleName = "UniqueBundleName";
|
||||||
public const string XmlShowPackageView = "ShowPackageView";
|
public const string XmlShowPackageView = "ShowPackageView";
|
||||||
|
public const string XmlShowEditorAlias = "ShowEditorAlias";
|
||||||
|
|
||||||
public const string XmlPackage = "Package";
|
public const string XmlPackage = "Package";
|
||||||
public const string XmlPackageName = "PackageName";
|
public const string XmlPackageName = "PackageName";
|
||||||
@@ -65,6 +66,7 @@ namespace YooAsset.Editor
|
|||||||
bool enableAddressable = false;
|
bool enableAddressable = false;
|
||||||
bool uniqueBundleName = false;
|
bool uniqueBundleName = false;
|
||||||
bool showPackageView = false;
|
bool showPackageView = false;
|
||||||
|
bool showEditorAlias = false;
|
||||||
var commonNodeList = root.GetElementsByTagName(XmlCommon);
|
var commonNodeList = root.GetElementsByTagName(XmlCommon);
|
||||||
if (commonNodeList.Count > 0)
|
if (commonNodeList.Count > 0)
|
||||||
{
|
{
|
||||||
@@ -75,10 +77,13 @@ namespace YooAsset.Editor
|
|||||||
throw new Exception($"Not found attribute {XmlUniqueBundleName} in {XmlCommon}");
|
throw new Exception($"Not found attribute {XmlUniqueBundleName} in {XmlCommon}");
|
||||||
if (commonElement.HasAttribute(XmlShowPackageView) == false)
|
if (commonElement.HasAttribute(XmlShowPackageView) == false)
|
||||||
throw new Exception($"Not found attribute {XmlShowPackageView} in {XmlCommon}");
|
throw new Exception($"Not found attribute {XmlShowPackageView} in {XmlCommon}");
|
||||||
|
if (commonElement.HasAttribute(XmlShowEditorAlias) == false)
|
||||||
|
throw new Exception($"Not found attribute {XmlShowEditorAlias} in {XmlCommon}");
|
||||||
|
|
||||||
enableAddressable = commonElement.GetAttribute(XmlEnableAddressable) == "True" ? true : false;
|
enableAddressable = commonElement.GetAttribute(XmlEnableAddressable) == "True" ? true : false;
|
||||||
uniqueBundleName = commonElement.GetAttribute(XmlUniqueBundleName) == "True" ? true : false;
|
uniqueBundleName = commonElement.GetAttribute(XmlUniqueBundleName) == "True" ? true : false;
|
||||||
showPackageView = commonElement.GetAttribute(XmlShowPackageView) == "True" ? true : false;
|
showPackageView = commonElement.GetAttribute(XmlShowPackageView) == "True" ? true : false;
|
||||||
|
showEditorAlias = commonElement.GetAttribute(XmlShowEditorAlias) == "True" ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 读取包裹配置
|
// 读取包裹配置
|
||||||
@@ -153,6 +158,7 @@ namespace YooAsset.Editor
|
|||||||
AssetBundleCollectorSettingData.Setting.EnableAddressable = enableAddressable;
|
AssetBundleCollectorSettingData.Setting.EnableAddressable = enableAddressable;
|
||||||
AssetBundleCollectorSettingData.Setting.UniqueBundleName = uniqueBundleName;
|
AssetBundleCollectorSettingData.Setting.UniqueBundleName = uniqueBundleName;
|
||||||
AssetBundleCollectorSettingData.Setting.ShowPackageView = showPackageView;
|
AssetBundleCollectorSettingData.Setting.ShowPackageView = showPackageView;
|
||||||
|
AssetBundleCollectorSettingData.Setting.ShowEditorAlias = showEditorAlias;
|
||||||
AssetBundleCollectorSettingData.Setting.Packages.AddRange(packages);
|
AssetBundleCollectorSettingData.Setting.Packages.AddRange(packages);
|
||||||
AssetBundleCollectorSettingData.SaveFile();
|
AssetBundleCollectorSettingData.SaveFile();
|
||||||
Debug.Log($"导入配置完毕!");
|
Debug.Log($"导入配置完毕!");
|
||||||
@@ -183,6 +189,7 @@ namespace YooAsset.Editor
|
|||||||
commonElement.SetAttribute(XmlEnableAddressable, AssetBundleCollectorSettingData.Setting.EnableAddressable.ToString());
|
commonElement.SetAttribute(XmlEnableAddressable, AssetBundleCollectorSettingData.Setting.EnableAddressable.ToString());
|
||||||
commonElement.SetAttribute(XmlUniqueBundleName, AssetBundleCollectorSettingData.Setting.UniqueBundleName.ToString());
|
commonElement.SetAttribute(XmlUniqueBundleName, AssetBundleCollectorSettingData.Setting.UniqueBundleName.ToString());
|
||||||
commonElement.SetAttribute(XmlShowPackageView, AssetBundleCollectorSettingData.Setting.ShowPackageView.ToString());
|
commonElement.SetAttribute(XmlShowPackageView, AssetBundleCollectorSettingData.Setting.ShowPackageView.ToString());
|
||||||
|
commonElement.SetAttribute(XmlShowEditorAlias, AssetBundleCollectorSettingData.Setting.ShowEditorAlias.ToString());
|
||||||
root.AppendChild(commonElement);
|
root.AppendChild(commonElement);
|
||||||
|
|
||||||
// 设置Package配置
|
// 设置Package配置
|
||||||
@@ -296,6 +303,23 @@ namespace YooAsset.Editor
|
|||||||
return UpdateXmlConfig(xmlDoc);
|
return UpdateXmlConfig(xmlDoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 2.1 -> 2.2
|
||||||
|
if (configVersion == "2.1")
|
||||||
|
{
|
||||||
|
// 添加公共元素属性
|
||||||
|
var commonNodeList = root.GetElementsByTagName(XmlCommon);
|
||||||
|
if (commonNodeList.Count > 0)
|
||||||
|
{
|
||||||
|
XmlElement commonElement = commonNodeList[0] as XmlElement;
|
||||||
|
if (commonElement.HasAttribute(XmlShowEditorAlias) == false)
|
||||||
|
commonElement.SetAttribute(XmlShowEditorAlias, "False");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新版本
|
||||||
|
root.SetAttribute(XmlVersion, "2.2");
|
||||||
|
return UpdateXmlConfig(xmlDoc);
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,12 @@ namespace YooAsset.Editor
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool UniqueBundleName = false;
|
public bool UniqueBundleName = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否显示编辑器别名
|
||||||
|
/// </summary>
|
||||||
|
public bool ShowEditorAlias = false;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 包裹列表
|
/// 包裹列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -38,92 +38,6 @@ namespace YooAsset.Editor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<string> GetActiveRuleNames()
|
|
||||||
{
|
|
||||||
if (_setting == null)
|
|
||||||
LoadSettingData();
|
|
||||||
|
|
||||||
List<string> names = new List<string>();
|
|
||||||
foreach (var pair in _cacheActiveRuleTypes)
|
|
||||||
{
|
|
||||||
names.Add(pair.Key);
|
|
||||||
}
|
|
||||||
return names;
|
|
||||||
}
|
|
||||||
public static List<string> GetAddressRuleNames()
|
|
||||||
{
|
|
||||||
if (_setting == null)
|
|
||||||
LoadSettingData();
|
|
||||||
|
|
||||||
List<string> names = new List<string>();
|
|
||||||
foreach (var pair in _cacheAddressRuleTypes)
|
|
||||||
{
|
|
||||||
names.Add(pair.Key);
|
|
||||||
}
|
|
||||||
return names;
|
|
||||||
}
|
|
||||||
public static List<string> GetPackRuleNames()
|
|
||||||
{
|
|
||||||
if (_setting == null)
|
|
||||||
LoadSettingData();
|
|
||||||
|
|
||||||
List<string> names = new List<string>();
|
|
||||||
foreach (var pair in _cachePackRuleTypes)
|
|
||||||
{
|
|
||||||
names.Add(pair.Key);
|
|
||||||
}
|
|
||||||
return names;
|
|
||||||
}
|
|
||||||
public static List<string> GetFilterRuleNames()
|
|
||||||
{
|
|
||||||
if (_setting == null)
|
|
||||||
LoadSettingData();
|
|
||||||
|
|
||||||
List<string> names = new List<string>();
|
|
||||||
foreach (var pair in _cacheFilterRuleTypes)
|
|
||||||
{
|
|
||||||
names.Add(pair.Key);
|
|
||||||
}
|
|
||||||
return names;
|
|
||||||
}
|
|
||||||
public static bool HasActiveRuleName(string ruleName)
|
|
||||||
{
|
|
||||||
foreach (var pair in _cacheActiveRuleTypes)
|
|
||||||
{
|
|
||||||
if (pair.Key == ruleName)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
public static bool HasAddressRuleName(string ruleName)
|
|
||||||
{
|
|
||||||
foreach (var pair in _cacheAddressRuleTypes)
|
|
||||||
{
|
|
||||||
if (pair.Key == ruleName)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
public static bool HasPackRuleName(string ruleName)
|
|
||||||
{
|
|
||||||
foreach (var pair in _cachePackRuleTypes)
|
|
||||||
{
|
|
||||||
if (pair.Key == ruleName)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
public static bool HasFilterRuleName(string ruleName)
|
|
||||||
{
|
|
||||||
foreach (var pair in _cacheFilterRuleTypes)
|
|
||||||
{
|
|
||||||
if (pair.Key == ruleName)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 加载配置文件
|
/// 加载配置文件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -146,6 +60,7 @@ namespace YooAsset.Editor
|
|||||||
typeof(PackCollector),
|
typeof(PackCollector),
|
||||||
typeof(PackGroup),
|
typeof(PackGroup),
|
||||||
typeof(PackRawFile),
|
typeof(PackRawFile),
|
||||||
|
typeof(PackShaderVariants)
|
||||||
};
|
};
|
||||||
|
|
||||||
var customTypes = EditorTools.GetAssignableTypes(typeof(IPackRule));
|
var customTypes = EditorTools.GetAssignableTypes(typeof(IPackRule));
|
||||||
@@ -266,7 +181,92 @@ namespace YooAsset.Editor
|
|||||||
SaveFile();
|
SaveFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 实例类相关
|
public static List<RuleDisplayName> GetActiveRuleNames()
|
||||||
|
{
|
||||||
|
if (_setting == null)
|
||||||
|
LoadSettingData();
|
||||||
|
|
||||||
|
List<RuleDisplayName> names = new List<RuleDisplayName>();
|
||||||
|
foreach (var pair in _cacheActiveRuleTypes)
|
||||||
|
{
|
||||||
|
RuleDisplayName ruleName = new RuleDisplayName();
|
||||||
|
ruleName.ClassName = pair.Key;
|
||||||
|
ruleName.DisplayName = GetRuleDisplayName(pair.Key, pair.Value);
|
||||||
|
names.Add(ruleName);
|
||||||
|
}
|
||||||
|
return names;
|
||||||
|
}
|
||||||
|
public static List<RuleDisplayName> GetAddressRuleNames()
|
||||||
|
{
|
||||||
|
if (_setting == null)
|
||||||
|
LoadSettingData();
|
||||||
|
|
||||||
|
List<RuleDisplayName> names = new List<RuleDisplayName>();
|
||||||
|
foreach (var pair in _cacheAddressRuleTypes)
|
||||||
|
{
|
||||||
|
RuleDisplayName ruleName = new RuleDisplayName();
|
||||||
|
ruleName.ClassName = pair.Key;
|
||||||
|
ruleName.DisplayName = GetRuleDisplayName(pair.Key, pair.Value);
|
||||||
|
names.Add(ruleName);
|
||||||
|
}
|
||||||
|
return names;
|
||||||
|
}
|
||||||
|
public static List<RuleDisplayName> GetPackRuleNames()
|
||||||
|
{
|
||||||
|
if (_setting == null)
|
||||||
|
LoadSettingData();
|
||||||
|
|
||||||
|
List<RuleDisplayName> names = new List<RuleDisplayName>();
|
||||||
|
foreach (var pair in _cachePackRuleTypes)
|
||||||
|
{
|
||||||
|
RuleDisplayName ruleName = new RuleDisplayName();
|
||||||
|
ruleName.ClassName = pair.Key;
|
||||||
|
ruleName.DisplayName = GetRuleDisplayName(pair.Key, pair.Value);
|
||||||
|
names.Add(ruleName);
|
||||||
|
}
|
||||||
|
return names;
|
||||||
|
}
|
||||||
|
public static List<RuleDisplayName> GetFilterRuleNames()
|
||||||
|
{
|
||||||
|
if (_setting == null)
|
||||||
|
LoadSettingData();
|
||||||
|
|
||||||
|
List<RuleDisplayName> names = new List<RuleDisplayName>();
|
||||||
|
foreach (var pair in _cacheFilterRuleTypes)
|
||||||
|
{
|
||||||
|
RuleDisplayName ruleName = new RuleDisplayName();
|
||||||
|
ruleName.ClassName = pair.Key;
|
||||||
|
ruleName.DisplayName = GetRuleDisplayName(pair.Key, pair.Value);
|
||||||
|
names.Add(ruleName);
|
||||||
|
}
|
||||||
|
return names;
|
||||||
|
}
|
||||||
|
private static string GetRuleDisplayName(string name, Type type)
|
||||||
|
{
|
||||||
|
var attribute = EditorAttribute.GetAttribute<DisplayNameAttribute>(type);
|
||||||
|
if (attribute != null && string.IsNullOrEmpty(attribute.DisplayName) == false)
|
||||||
|
return attribute.DisplayName;
|
||||||
|
else
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool HasActiveRuleName(string ruleName)
|
||||||
|
{
|
||||||
|
return _cacheActiveRuleTypes.Keys.Contains(ruleName);
|
||||||
|
}
|
||||||
|
public static bool HasAddressRuleName(string ruleName)
|
||||||
|
{
|
||||||
|
return _cacheAddressRuleTypes.Keys.Contains(ruleName);
|
||||||
|
}
|
||||||
|
public static bool HasPackRuleName(string ruleName)
|
||||||
|
{
|
||||||
|
return _cachePackRuleTypes.Keys.Contains(ruleName);
|
||||||
|
}
|
||||||
|
public static bool HasFilterRuleName(string ruleName)
|
||||||
|
{
|
||||||
|
return _cacheFilterRuleTypes.Keys.Contains(ruleName);
|
||||||
|
}
|
||||||
|
|
||||||
public static IActiveRule GetActiveRuleInstance(string ruleName)
|
public static IActiveRule GetActiveRuleInstance(string ruleName)
|
||||||
{
|
{
|
||||||
if (_cacheActiveRuleInstance.TryGetValue(ruleName, out IActiveRule instance))
|
if (_cacheActiveRuleInstance.TryGetValue(ruleName, out IActiveRule instance))
|
||||||
@@ -352,6 +352,11 @@ namespace YooAsset.Editor
|
|||||||
Setting.UniqueBundleName = uniqueBundleName;
|
Setting.UniqueBundleName = uniqueBundleName;
|
||||||
IsDirty = true;
|
IsDirty = true;
|
||||||
}
|
}
|
||||||
|
public static void ModifyShowEditorAlias(bool showAlias)
|
||||||
|
{
|
||||||
|
Setting.ShowEditorAlias = showAlias;
|
||||||
|
IsDirty = true;
|
||||||
|
}
|
||||||
|
|
||||||
// 资源包裹编辑相关
|
// 资源包裹编辑相关
|
||||||
public static AssetBundleCollectorPackage CreatePackage(string packageName)
|
public static AssetBundleCollectorPackage CreatePackage(string packageName)
|
||||||
|
|||||||
@@ -20,14 +20,15 @@ namespace YooAsset.Editor
|
|||||||
|
|
||||||
private Button _saveButton;
|
private Button _saveButton;
|
||||||
private List<string> _collectorTypeList;
|
private List<string> _collectorTypeList;
|
||||||
private List<string> _activeRuleList;
|
private List<RuleDisplayName> _activeRuleList;
|
||||||
private List<string> _addressRuleList;
|
private List<RuleDisplayName> _addressRuleList;
|
||||||
private List<string> _packRuleList;
|
private List<RuleDisplayName> _packRuleList;
|
||||||
private List<string> _filterRuleList;
|
private List<RuleDisplayName> _filterRuleList;
|
||||||
|
|
||||||
private Toggle _showPackageToogle;
|
private Toggle _showPackageToogle;
|
||||||
private Toggle _enableAddressableToogle;
|
private Toggle _enableAddressableToogle;
|
||||||
private Toggle _uniqueBundleNameToogle;
|
private Toggle _uniqueBundleNameToogle;
|
||||||
|
private Toggle _showEditorAliasToggle;
|
||||||
|
|
||||||
private VisualElement _packageContainer;
|
private VisualElement _packageContainer;
|
||||||
private ListView _packageListView;
|
private ListView _packageListView;
|
||||||
@@ -42,7 +43,7 @@ namespace YooAsset.Editor
|
|||||||
|
|
||||||
private VisualElement _collectorContainer;
|
private VisualElement _collectorContainer;
|
||||||
private ScrollView _collectorScrollView;
|
private ScrollView _collectorScrollView;
|
||||||
private PopupField<string> _activeRulePopupField;
|
private PopupField<RuleDisplayName> _activeRulePopupField;
|
||||||
|
|
||||||
private int _lastModifyPackageIndex = 0;
|
private int _lastModifyPackageIndex = 0;
|
||||||
private int _lastModifyGroupIndex = 0;
|
private int _lastModifyGroupIndex = 0;
|
||||||
@@ -95,6 +96,13 @@ namespace YooAsset.Editor
|
|||||||
RefreshWindow();
|
RefreshWindow();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
_showEditorAliasToggle = root.Q<Toggle>("ShowEditorAlias");
|
||||||
|
_showEditorAliasToggle.RegisterValueChangedCallback(evt =>
|
||||||
|
{
|
||||||
|
AssetBundleCollectorSettingData.ModifyShowEditorAlias(evt.newValue);
|
||||||
|
RefreshWindow();
|
||||||
|
});
|
||||||
|
|
||||||
// 配置修复按钮
|
// 配置修复按钮
|
||||||
var fixBtn = root.Q<Button>("FixButton");
|
var fixBtn = root.Q<Button>("FixButton");
|
||||||
fixBtn.clicked += FixBtn_clicked;
|
fixBtn.clicked += FixBtn_clicked;
|
||||||
@@ -236,21 +244,23 @@ namespace YooAsset.Editor
|
|||||||
// 分组激活规则
|
// 分组激活规则
|
||||||
var activeRuleContainer = root.Q("ActiveRuleContainer");
|
var activeRuleContainer = root.Q("ActiveRuleContainer");
|
||||||
{
|
{
|
||||||
_activeRulePopupField = new PopupField<string>("Active Rule", _activeRuleList, 0);
|
_activeRulePopupField = new PopupField<RuleDisplayName>("Active Rule", _activeRuleList, 0);
|
||||||
_activeRulePopupField.name = "ActiveRuleMaskField";
|
_activeRulePopupField.name = "ActiveRuleMaskField";
|
||||||
_activeRulePopupField.style.unityTextAlign = TextAnchor.MiddleLeft;
|
_activeRulePopupField.style.unityTextAlign = TextAnchor.MiddleLeft;
|
||||||
activeRuleContainer.Add(_activeRulePopupField);
|
_activeRulePopupField.formatListItemCallback = FormatListItemCallback;
|
||||||
|
_activeRulePopupField.formatSelectedValueCallback = FormatSelectedValueCallback;
|
||||||
_activeRulePopupField.RegisterValueChangedCallback(evt =>
|
_activeRulePopupField.RegisterValueChangedCallback(evt =>
|
||||||
{
|
{
|
||||||
var selectPackage = _packageListView.selectedItem as AssetBundleCollectorPackage;
|
var selectPackage = _packageListView.selectedItem as AssetBundleCollectorPackage;
|
||||||
var selectGroup = _groupListView.selectedItem as AssetBundleCollectorGroup;
|
var selectGroup = _groupListView.selectedItem as AssetBundleCollectorGroup;
|
||||||
if (selectPackage != null && selectGroup != null)
|
if (selectPackage != null && selectGroup != null)
|
||||||
{
|
{
|
||||||
selectGroup.ActiveRuleName = evt.newValue;
|
selectGroup.ActiveRuleName = evt.newValue.ClassName;
|
||||||
AssetBundleCollectorSettingData.ModifyGroup(selectPackage, selectGroup);
|
AssetBundleCollectorSettingData.ModifyGroup(selectPackage, selectGroup);
|
||||||
FillGroupViewData();
|
FillGroupViewData();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
activeRuleContainer.Add(_activeRulePopupField);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 刷新窗体
|
// 刷新窗体
|
||||||
@@ -290,6 +300,9 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
_showPackageToogle.SetValueWithoutNotify(AssetBundleCollectorSettingData.Setting.ShowPackageView);
|
_showPackageToogle.SetValueWithoutNotify(AssetBundleCollectorSettingData.Setting.ShowPackageView);
|
||||||
_enableAddressableToogle.SetValueWithoutNotify(AssetBundleCollectorSettingData.Setting.EnableAddressable);
|
_enableAddressableToogle.SetValueWithoutNotify(AssetBundleCollectorSettingData.Setting.EnableAddressable);
|
||||||
|
_uniqueBundleNameToogle.SetValueWithoutNotify(AssetBundleCollectorSettingData.Setting.UniqueBundleName);
|
||||||
|
_showEditorAliasToggle.SetValueWithoutNotify(AssetBundleCollectorSettingData.Setting.ShowEditorAlias);
|
||||||
|
|
||||||
_groupContainer.visible = false;
|
_groupContainer.visible = false;
|
||||||
_collectorContainer.visible = false;
|
_collectorContainer.visible = false;
|
||||||
|
|
||||||
@@ -321,6 +334,20 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
AssetBundleCollectorSettingData.SaveFile();
|
AssetBundleCollectorSettingData.SaveFile();
|
||||||
}
|
}
|
||||||
|
private string FormatListItemCallback(RuleDisplayName ruleDisplayName)
|
||||||
|
{
|
||||||
|
if (_showEditorAliasToggle.value)
|
||||||
|
return ruleDisplayName.DisplayName;
|
||||||
|
else
|
||||||
|
return ruleDisplayName.ClassName;
|
||||||
|
}
|
||||||
|
private string FormatSelectedValueCallback(RuleDisplayName ruleDisplayName)
|
||||||
|
{
|
||||||
|
if (_showEditorAliasToggle.value)
|
||||||
|
return ruleDisplayName.DisplayName;
|
||||||
|
else
|
||||||
|
return ruleDisplayName.ClassName;
|
||||||
|
}
|
||||||
|
|
||||||
// 包裹列表相关
|
// 包裹列表相关
|
||||||
private void FillPackageViewData()
|
private void FillPackageViewData()
|
||||||
@@ -334,7 +361,7 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
_packageListView.selectedIndex = _lastModifyPackageIndex;
|
_packageListView.selectedIndex = _lastModifyPackageIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_showPackageToogle.value)
|
if (_showPackageToogle.value)
|
||||||
_packageContainer.style.display = DisplayStyle.Flex;
|
_packageContainer.style.display = DisplayStyle.Flex;
|
||||||
else
|
else
|
||||||
@@ -410,7 +437,7 @@ namespace YooAsset.Editor
|
|||||||
_groupListView.itemsSource = selectPackage.Groups;
|
_groupListView.itemsSource = selectPackage.Groups;
|
||||||
_groupListView.Rebuild();
|
_groupListView.Rebuild();
|
||||||
|
|
||||||
if(_lastModifyGroupIndex >=0 && _lastModifyGroupIndex < _groupListView.itemsSource.Count)
|
if (_lastModifyGroupIndex >= 0 && _lastModifyGroupIndex < _groupListView.itemsSource.Count)
|
||||||
{
|
{
|
||||||
_groupListView.selectedIndex = _lastModifyGroupIndex;
|
_groupListView.selectedIndex = _lastModifyGroupIndex;
|
||||||
}
|
}
|
||||||
@@ -460,7 +487,7 @@ namespace YooAsset.Editor
|
|||||||
|
|
||||||
_collectorContainer.visible = true;
|
_collectorContainer.visible = true;
|
||||||
_lastModifyGroupIndex = _groupListView.selectedIndex;
|
_lastModifyGroupIndex = _groupListView.selectedIndex;
|
||||||
_activeRulePopupField.SetValueWithoutNotify(selectGroup.ActiveRuleName);
|
_activeRulePopupField.SetValueWithoutNotify(GetActiveRuleIndex(selectGroup.ActiveRuleName));
|
||||||
_groupNameTxt.SetValueWithoutNotify(selectGroup.GroupName);
|
_groupNameTxt.SetValueWithoutNotify(selectGroup.GroupName);
|
||||||
_groupDescTxt.SetValueWithoutNotify(selectGroup.GroupDesc);
|
_groupDescTxt.SetValueWithoutNotify(selectGroup.GroupDesc);
|
||||||
_groupAssetTagsTxt.SetValueWithoutNotify(selectGroup.AssetTags);
|
_groupAssetTagsTxt.SetValueWithoutNotify(selectGroup.AssetTags);
|
||||||
@@ -564,21 +591,21 @@ namespace YooAsset.Editor
|
|||||||
}
|
}
|
||||||
if (_enableAddressableToogle.value)
|
if (_enableAddressableToogle.value)
|
||||||
{
|
{
|
||||||
var popupField = new PopupField<string>(_addressRuleList, 0);
|
var popupField = new PopupField<RuleDisplayName>(_addressRuleList, 0);
|
||||||
popupField.name = "PopupField1";
|
popupField.name = "PopupField1";
|
||||||
popupField.style.unityTextAlign = TextAnchor.MiddleLeft;
|
popupField.style.unityTextAlign = TextAnchor.MiddleLeft;
|
||||||
popupField.style.width = 200;
|
popupField.style.width = 200;
|
||||||
elementBottom.Add(popupField);
|
elementBottom.Add(popupField);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var popupField = new PopupField<string>(_packRuleList, 0);
|
var popupField = new PopupField<RuleDisplayName>(_packRuleList, 0);
|
||||||
popupField.name = "PopupField2";
|
popupField.name = "PopupField2";
|
||||||
popupField.style.unityTextAlign = TextAnchor.MiddleLeft;
|
popupField.style.unityTextAlign = TextAnchor.MiddleLeft;
|
||||||
popupField.style.width = 150;
|
popupField.style.width = 230;
|
||||||
elementBottom.Add(popupField);
|
elementBottom.Add(popupField);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var popupField = new PopupField<string>(_filterRuleList, 0);
|
var popupField = new PopupField<RuleDisplayName>(_filterRuleList, 0);
|
||||||
popupField.name = "PopupField3";
|
popupField.name = "PopupField3";
|
||||||
popupField.style.unityTextAlign = TextAnchor.MiddleLeft;
|
popupField.style.unityTextAlign = TextAnchor.MiddleLeft;
|
||||||
popupField.style.width = 150;
|
popupField.style.width = 150;
|
||||||
@@ -676,13 +703,15 @@ namespace YooAsset.Editor
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Address Rule
|
// Address Rule
|
||||||
var popupField1 = element.Q<PopupField<string>>("PopupField1");
|
var popupField1 = element.Q<PopupField<RuleDisplayName>>("PopupField1");
|
||||||
if (popupField1 != null)
|
if (popupField1 != null)
|
||||||
{
|
{
|
||||||
popupField1.index = GetAddressRuleIndex(collector.AddressRuleName);
|
popupField1.index = GetAddressRuleIndex(collector.AddressRuleName);
|
||||||
|
popupField1.formatListItemCallback = FormatListItemCallback;
|
||||||
|
popupField1.formatSelectedValueCallback = FormatSelectedValueCallback;
|
||||||
popupField1.RegisterValueChangedCallback(evt =>
|
popupField1.RegisterValueChangedCallback(evt =>
|
||||||
{
|
{
|
||||||
collector.AddressRuleName = evt.newValue;
|
collector.AddressRuleName = evt.newValue.ClassName;
|
||||||
AssetBundleCollectorSettingData.ModifyCollector(selectGroup, collector);
|
AssetBundleCollectorSettingData.ModifyCollector(selectGroup, collector);
|
||||||
if (foldout.value)
|
if (foldout.value)
|
||||||
{
|
{
|
||||||
@@ -692,11 +721,13 @@ namespace YooAsset.Editor
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Pack Rule
|
// Pack Rule
|
||||||
var popupField2 = element.Q<PopupField<string>>("PopupField2");
|
var popupField2 = element.Q<PopupField<RuleDisplayName>>("PopupField2");
|
||||||
popupField2.index = GetPackRuleIndex(collector.PackRuleName);
|
popupField2.index = GetPackRuleIndex(collector.PackRuleName);
|
||||||
|
popupField2.formatListItemCallback = FormatListItemCallback;
|
||||||
|
popupField2.formatSelectedValueCallback = FormatSelectedValueCallback;
|
||||||
popupField2.RegisterValueChangedCallback(evt =>
|
popupField2.RegisterValueChangedCallback(evt =>
|
||||||
{
|
{
|
||||||
collector.PackRuleName = evt.newValue;
|
collector.PackRuleName = evt.newValue.ClassName;
|
||||||
AssetBundleCollectorSettingData.ModifyCollector(selectGroup, collector);
|
AssetBundleCollectorSettingData.ModifyCollector(selectGroup, collector);
|
||||||
if (foldout.value)
|
if (foldout.value)
|
||||||
{
|
{
|
||||||
@@ -705,11 +736,13 @@ namespace YooAsset.Editor
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Filter Rule
|
// Filter Rule
|
||||||
var popupField3 = element.Q<PopupField<string>>("PopupField3");
|
var popupField3 = element.Q<PopupField<RuleDisplayName>>("PopupField3");
|
||||||
popupField3.index = GetFilterRuleIndex(collector.FilterRuleName);
|
popupField3.index = GetFilterRuleIndex(collector.FilterRuleName);
|
||||||
|
popupField3.formatListItemCallback = FormatListItemCallback;
|
||||||
|
popupField3.formatSelectedValueCallback = FormatSelectedValueCallback;
|
||||||
popupField3.RegisterValueChangedCallback(evt =>
|
popupField3.RegisterValueChangedCallback(evt =>
|
||||||
{
|
{
|
||||||
collector.FilterRuleName = evt.newValue;
|
collector.FilterRuleName = evt.newValue.ClassName;
|
||||||
AssetBundleCollectorSettingData.ModifyCollector(selectGroup, collector);
|
AssetBundleCollectorSettingData.ModifyCollector(selectGroup, collector);
|
||||||
if (foldout.value)
|
if (foldout.value)
|
||||||
{
|
{
|
||||||
@@ -815,7 +848,7 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < _addressRuleList.Count; i++)
|
for (int i = 0; i < _addressRuleList.Count; i++)
|
||||||
{
|
{
|
||||||
if (_addressRuleList[i] == ruleName)
|
if (_addressRuleList[i].ClassName == ruleName)
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -824,7 +857,7 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < _packRuleList.Count; i++)
|
for (int i = 0; i < _packRuleList.Count; i++)
|
||||||
{
|
{
|
||||||
if (_packRuleList[i] == ruleName)
|
if (_packRuleList[i].ClassName == ruleName)
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -833,11 +866,20 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < _filterRuleList.Count; i++)
|
for (int i = 0; i < _filterRuleList.Count; i++)
|
||||||
{
|
{
|
||||||
if (_filterRuleList[i] == ruleName)
|
if (_filterRuleList[i].ClassName == ruleName)
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
private RuleDisplayName GetActiveRuleIndex(string ruleName)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _activeRuleList.Count; i++)
|
||||||
|
{
|
||||||
|
if (_activeRuleList[i].ClassName == ruleName)
|
||||||
|
return _activeRuleList[i];
|
||||||
|
}
|
||||||
|
return _activeRuleList[0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<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">
|
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements">
|
||||||
<uie:Toolbar name="Toolbar" style="display: flex; flex-direction: row-reverse;">
|
<uie:Toolbar name="Toolbar" style="display: flex; flex-direction: row-reverse;">
|
||||||
<ui:Button text="Save" display-tooltip-when-elided="true" name="SaveButton" style="width: 50px; background-color: rgb(56, 147, 58);" />
|
<ui:Button text="Save" display-tooltip-when-elided="true" name="SaveButton" style="width: 50px; background-color: rgb(56, 147, 58);" />
|
||||||
<ui:Button text="导出" display-tooltip-when-elided="true" name="ExportButton" style="width: 50px; background-color: rgb(56, 147, 58);" />
|
<ui:Button text="导出" display-tooltip-when-elided="true" name="ExportButton" style="width: 50px; background-color: rgb(56, 147, 58);" />
|
||||||
@@ -7,6 +7,7 @@
|
|||||||
</uie:Toolbar>
|
</uie:Toolbar>
|
||||||
<ui:VisualElement name="PublicContainer" style="height: 30px; background-color: rgb(67, 67, 67); flex-direction: row; border-left-width: 5px; border-right-width: 5px; border-top-width: 5px; border-bottom-width: 5px;">
|
<ui:VisualElement name="PublicContainer" style="height: 30px; background-color: rgb(67, 67, 67); flex-direction: row; border-left-width: 5px; border-right-width: 5px; border-top-width: 5px; border-bottom-width: 5px;">
|
||||||
<ui:Toggle label="Show Packages" name="ShowPackages" style="width: 196px; -unity-text-align: middle-left;" />
|
<ui:Toggle label="Show Packages" name="ShowPackages" style="width: 196px; -unity-text-align: middle-left;" />
|
||||||
|
<ui:Toggle label="Show Editor Alias" name="ShowEditorAlias" style="width: 196px; -unity-text-align: middle-left;" />
|
||||||
<ui:Toggle label="Enable Addressable" name="EnableAddressable" style="width: 196px; -unity-text-align: middle-left;" />
|
<ui:Toggle label="Enable Addressable" name="EnableAddressable" style="width: 196px; -unity-text-align: middle-left;" />
|
||||||
<ui:Toggle label="Unique Bundle Name" name="UniqueBundleName" style="width: 196px; -unity-text-align: middle-left;" />
|
<ui:Toggle label="Unique Bundle Name" name="UniqueBundleName" style="width: 196px; -unity-text-align: middle-left;" />
|
||||||
</ui:VisualElement>
|
</ui:VisualElement>
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
|
|
||||||
namespace YooAsset.Editor
|
namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
/// <summary>
|
[DisplayName("启用分组")]
|
||||||
/// 启用分组
|
|
||||||
/// </summary>
|
|
||||||
public class EnableGroup : IActiveRule
|
public class EnableGroup : IActiveRule
|
||||||
{
|
{
|
||||||
public bool IsActiveGroup()
|
public bool IsActiveGroup()
|
||||||
@@ -12,9 +10,7 @@ namespace YooAsset.Editor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
[DisplayName("禁用分组")]
|
||||||
/// 禁用分组
|
|
||||||
/// </summary>
|
|
||||||
public class DisableGroup : IActiveRule
|
public class DisableGroup : IActiveRule
|
||||||
{
|
{
|
||||||
public bool IsActiveGroup()
|
public bool IsActiveGroup()
|
||||||
|
|||||||
@@ -2,9 +2,7 @@
|
|||||||
|
|
||||||
namespace YooAsset.Editor
|
namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
/// <summary>
|
[DisplayName("以文件名称为定位地址")]
|
||||||
/// 以文件名为定位地址
|
|
||||||
/// </summary>
|
|
||||||
public class AddressByFileName : IAddressRule
|
public class AddressByFileName : IAddressRule
|
||||||
{
|
{
|
||||||
string IAddressRule.GetAssetAddress(AddressRuleData data)
|
string IAddressRule.GetAssetAddress(AddressRuleData data)
|
||||||
@@ -13,9 +11,7 @@ namespace YooAsset.Editor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
[DisplayName("以分组名称+文件名称为定位地址")]
|
||||||
/// 以组名+文件名为定位地址
|
|
||||||
/// </summary>
|
|
||||||
public class AddressByGroupAndFileName : IAddressRule
|
public class AddressByGroupAndFileName : IAddressRule
|
||||||
{
|
{
|
||||||
string IAddressRule.GetAssetAddress(AddressRuleData data)
|
string IAddressRule.GetAssetAddress(AddressRuleData data)
|
||||||
@@ -25,9 +21,7 @@ namespace YooAsset.Editor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
[DisplayName("以收集器名称+文件名称为定位地址")]
|
||||||
/// 以收集器名+文件名为定位地址
|
|
||||||
/// </summary>
|
|
||||||
public class AddressByCollectorAndFileName : IAddressRule
|
public class AddressByCollectorAndFileName : IAddressRule
|
||||||
{
|
{
|
||||||
string IAddressRule.GetAssetAddress(AddressRuleData data)
|
string IAddressRule.GetAssetAddress(AddressRuleData data)
|
||||||
|
|||||||
@@ -4,9 +4,7 @@ using System.IO;
|
|||||||
|
|
||||||
namespace YooAsset.Editor
|
namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
/// <summary>
|
[DisplayName("收集所有资源")]
|
||||||
/// 收集所有资源
|
|
||||||
/// </summary>
|
|
||||||
public class CollectAll : IFilterRule
|
public class CollectAll : IFilterRule
|
||||||
{
|
{
|
||||||
public bool IsCollectAsset(FilterRuleData data)
|
public bool IsCollectAsset(FilterRuleData data)
|
||||||
@@ -15,9 +13,7 @@ namespace YooAsset.Editor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
[DisplayName("收集场景")]
|
||||||
/// 只收集场景
|
|
||||||
/// </summary>
|
|
||||||
public class CollectScene : IFilterRule
|
public class CollectScene : IFilterRule
|
||||||
{
|
{
|
||||||
public bool IsCollectAsset(FilterRuleData data)
|
public bool IsCollectAsset(FilterRuleData data)
|
||||||
@@ -25,10 +21,8 @@ namespace YooAsset.Editor
|
|||||||
return Path.GetExtension(data.AssetPath) == ".unity";
|
return Path.GetExtension(data.AssetPath) == ".unity";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
[DisplayName("收集预制体")]
|
||||||
/// 只收集预制体
|
|
||||||
/// </summary>
|
|
||||||
public class CollectPrefab : IFilterRule
|
public class CollectPrefab : IFilterRule
|
||||||
{
|
{
|
||||||
public bool IsCollectAsset(FilterRuleData data)
|
public bool IsCollectAsset(FilterRuleData data)
|
||||||
@@ -37,15 +31,13 @@ namespace YooAsset.Editor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
[DisplayName("收集精灵类型的纹理")]
|
||||||
/// 只收集精灵类型的资源
|
|
||||||
/// </summary>
|
|
||||||
public class CollectSprite : IFilterRule
|
public class CollectSprite : IFilterRule
|
||||||
{
|
{
|
||||||
public bool IsCollectAsset(FilterRuleData data)
|
public bool IsCollectAsset(FilterRuleData data)
|
||||||
{
|
{
|
||||||
var mainAssetType = AssetDatabase.GetMainAssetTypeAtPath(data.AssetPath);
|
var mainAssetType = AssetDatabase.GetMainAssetTypeAtPath(data.AssetPath);
|
||||||
if(mainAssetType == typeof(Texture2D))
|
if (mainAssetType == typeof(Texture2D))
|
||||||
{
|
{
|
||||||
var texImporter = AssetImporter.GetAtPath(data.AssetPath) as TextureImporter;
|
var texImporter = AssetImporter.GetAtPath(data.AssetPath) as TextureImporter;
|
||||||
if (texImporter != null && texImporter.textureType == TextureImporterType.Sprite)
|
if (texImporter != null && texImporter.textureType == TextureImporterType.Sprite)
|
||||||
@@ -60,9 +52,7 @@ namespace YooAsset.Editor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
[DisplayName("收集着色器变种集合")]
|
||||||
/// 只收集着色器变种收集文件
|
|
||||||
/// </summary>
|
|
||||||
public class CollectShaderVariants : IFilterRule
|
public class CollectShaderVariants : IFilterRule
|
||||||
{
|
{
|
||||||
public bool IsCollectAsset(FilterRuleData data)
|
public bool IsCollectAsset(FilterRuleData data)
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ namespace YooAsset.Editor
|
|||||||
/// 例如:"Assets/UIPanel/Shop/Image/backgroud.png" --> "assets_uipanel_shop_image_backgroud.bundle"
|
/// 例如:"Assets/UIPanel/Shop/Image/backgroud.png" --> "assets_uipanel_shop_image_backgroud.bundle"
|
||||||
/// 例如:"Assets/UIPanel/Shop/View/main.prefab" --> "assets_uipanel_shop_view_main.bundle"
|
/// 例如:"Assets/UIPanel/Shop/View/main.prefab" --> "assets_uipanel_shop_view_main.bundle"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[DisplayName("以文件路径作为资源包名")]
|
||||||
public class PackSeparately : IPackRule
|
public class PackSeparately : IPackRule
|
||||||
{
|
{
|
||||||
string IPackRule.GetBundleName(PackRuleData data)
|
string IPackRule.GetBundleName(PackRuleData data)
|
||||||
@@ -25,6 +26,7 @@ namespace YooAsset.Editor
|
|||||||
/// 例如:"Assets/UIPanel/Shop/Image/backgroud.png" --> "assets_uipanel_shop_image.bundle"
|
/// 例如:"Assets/UIPanel/Shop/Image/backgroud.png" --> "assets_uipanel_shop_image.bundle"
|
||||||
/// 例如:"Assets/UIPanel/Shop/View/main.prefab" --> "assets_uipanel_shop_view.bundle"
|
/// 例如:"Assets/UIPanel/Shop/View/main.prefab" --> "assets_uipanel_shop_view.bundle"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[DisplayName("以父类文件夹路径作为资源包名")]
|
||||||
public class PackDirectory : IPackRule
|
public class PackDirectory : IPackRule
|
||||||
{
|
{
|
||||||
public static PackDirectory StaticPackRule = new PackDirectory();
|
public static PackDirectory StaticPackRule = new PackDirectory();
|
||||||
@@ -43,6 +45,7 @@ namespace YooAsset.Editor
|
|||||||
/// 例如:"Assets/UIPanel/Shop/Image/backgroud.png" --> "assets_uipanel_shop.bundle"
|
/// 例如:"Assets/UIPanel/Shop/Image/backgroud.png" --> "assets_uipanel_shop.bundle"
|
||||||
/// 例如:"Assets/UIPanel/Shop/View/main.prefab" --> "assets_uipanel_shop.bundle"
|
/// 例如:"Assets/UIPanel/Shop/View/main.prefab" --> "assets_uipanel_shop.bundle"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[DisplayName("以收集器路径下顶级文件夹为资源包名")]
|
||||||
public class PackTopDirectory : IPackRule
|
public class PackTopDirectory : IPackRule
|
||||||
{
|
{
|
||||||
string IPackRule.GetBundleName(PackRuleData data)
|
string IPackRule.GetBundleName(PackRuleData data)
|
||||||
@@ -68,6 +71,7 @@ namespace YooAsset.Editor
|
|||||||
/// 以收集器路径作为资源包名
|
/// 以收集器路径作为资源包名
|
||||||
/// 注意:收集的所有文件打进一个资源包
|
/// 注意:收集的所有文件打进一个资源包
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[DisplayName("以收集器路径作为资源包名")]
|
||||||
public class PackCollector : IPackRule
|
public class PackCollector : IPackRule
|
||||||
{
|
{
|
||||||
string IPackRule.GetBundleName(PackRuleData data)
|
string IPackRule.GetBundleName(PackRuleData data)
|
||||||
@@ -90,6 +94,7 @@ namespace YooAsset.Editor
|
|||||||
/// 以分组名称作为资源包名
|
/// 以分组名称作为资源包名
|
||||||
/// 注意:收集的所有文件打进一个资源包
|
/// 注意:收集的所有文件打进一个资源包
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[DisplayName("以分组名称作为资源包名")]
|
||||||
public class PackGroup : IPackRule
|
public class PackGroup : IPackRule
|
||||||
{
|
{
|
||||||
string IPackRule.GetBundleName(PackRuleData data)
|
string IPackRule.GetBundleName(PackRuleData data)
|
||||||
@@ -99,9 +104,10 @@ namespace YooAsset.Editor
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 原生文件打包模式
|
/// 打包原生文件
|
||||||
/// 注意:原生文件打包支持:图片,音频,视频,文本
|
/// 注意:原生文件打包支持:图片,音频,视频,文本
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[DisplayName("打包原生文件")]
|
||||||
public class PackRawFile : IPackRule
|
public class PackRawFile : IPackRule
|
||||||
{
|
{
|
||||||
string IPackRule.GetBundleName(PackRuleData data)
|
string IPackRule.GetBundleName(PackRuleData data)
|
||||||
@@ -126,8 +132,9 @@ namespace YooAsset.Editor
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 着色器变种收集文件
|
/// 打包着色器变种集合
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[DisplayName("打包着色器变种集合")]
|
||||||
public class PackShaderVariants : IPackRule
|
public class PackShaderVariants : IPackRule
|
||||||
{
|
{
|
||||||
public string GetBundleName(PackRuleData data)
|
public string GetBundleName(PackRuleData data)
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
|
||||||
|
namespace YooAsset.Editor
|
||||||
|
{
|
||||||
|
public class RuleDisplayName
|
||||||
|
{
|
||||||
|
public string ClassName;
|
||||||
|
public string DisplayName;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 60c7594328ef976408edadfdf2b9aa3d
|
guid: df712711c3830af419b7ada8fee53dda
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
@@ -109,7 +109,7 @@ namespace YooAsset.Editor
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
_reportFilePath = selectFilePath;
|
_reportFilePath = selectFilePath;
|
||||||
string jsonData = FileUtility.ReadFile(_reportFilePath);
|
string jsonData = FileUtility.ReadAllText(_reportFilePath);
|
||||||
_buildReport = BuildReport.Deserialize(jsonData);
|
_buildReport = BuildReport.Deserialize(jsonData);
|
||||||
_assetListViewer.FillViewData(_buildReport, _searchKeyWord);
|
_assetListViewer.FillViewData(_buildReport, _searchKeyWord);
|
||||||
_bundleListViewer.FillViewData(_buildReport, _reportFilePath, _searchKeyWord);
|
_bundleListViewer.FillViewData(_buildReport, _reportFilePath, _searchKeyWord);
|
||||||
|
|||||||
36
Assets/YooAsset/Editor/EditorAttribute.cs
Normal file
36
Assets/YooAsset/Editor/EditorAttribute.cs
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace YooAsset.Editor
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 编辑器显示名字
|
||||||
|
/// </summary>
|
||||||
|
public class DisplayNameAttribute : Attribute
|
||||||
|
{
|
||||||
|
public string DisplayName;
|
||||||
|
|
||||||
|
public DisplayNameAttribute(string name)
|
||||||
|
{
|
||||||
|
this.DisplayName = name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class EditorAttribute
|
||||||
|
{
|
||||||
|
internal static T GetAttribute<T>(Type type) where T : Attribute
|
||||||
|
{
|
||||||
|
return (T)type.GetCustomAttribute(typeof(T), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static T GetAttribute<T>(MethodInfo methodInfo) where T : Attribute
|
||||||
|
{
|
||||||
|
return (T)methodInfo.GetCustomAttribute(typeof(T), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static T GetAttribute<T>(FieldInfo field) where T : Attribute
|
||||||
|
{
|
||||||
|
return (T)field.GetCustomAttribute(typeof(T), false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 6b03684bc5163694ab3983243512b4cc
|
guid: 92d5f73b21059af43b7f56165b7acd63
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
@@ -73,15 +73,15 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
provider.Destroy();
|
provider.Destroy();
|
||||||
}
|
}
|
||||||
|
_providers.Clear();
|
||||||
|
|
||||||
foreach (var loader in _loaders)
|
foreach (var loader in _loaders)
|
||||||
{
|
{
|
||||||
loader.Destroy(true);
|
loader.Destroy(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
_providers.Clear();
|
|
||||||
_loaders.Clear();
|
_loaders.Clear();
|
||||||
ClearSceneHandle();
|
|
||||||
|
|
||||||
|
ClearSceneHandle();
|
||||||
DecryptionServices = null;
|
DecryptionServices = null;
|
||||||
BundleServices = null;
|
BundleServices = null;
|
||||||
}
|
}
|
||||||
@@ -298,19 +298,21 @@ namespace YooAsset
|
|||||||
internal void ClearSceneHandle()
|
internal void ClearSceneHandle()
|
||||||
{
|
{
|
||||||
// 释放资源包下的所有场景
|
// 释放资源包下的所有场景
|
||||||
string packageName = BundleServices.GetPackageName();
|
if (BundleServices.IsServicesValid())
|
||||||
List<string> removeList = new List<string>();
|
|
||||||
foreach (var valuePair in _sceneHandles)
|
|
||||||
{
|
{
|
||||||
if (valuePair.Value.PackageName == packageName)
|
string packageName = BundleServices.GetPackageName();
|
||||||
|
List<string> removeList = new List<string>();
|
||||||
|
foreach (var valuePair in _sceneHandles)
|
||||||
{
|
{
|
||||||
removeList.Add(valuePair.Key);
|
if (valuePair.Value.PackageName == packageName)
|
||||||
|
{
|
||||||
|
removeList.Add(valuePair.Key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach (var key in removeList)
|
||||||
|
{
|
||||||
|
_sceneHandles.Remove(key);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var key in removeList)
|
|
||||||
{
|
|
||||||
_sceneHandles.Remove(key);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
using UnityEngine;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
namespace YooAsset
|
namespace YooAsset
|
||||||
{
|
{
|
||||||
public sealed class AssetOperationHandle : OperationHandleBase
|
public sealed class AssetOperationHandle : OperationHandleBase, IDisposable
|
||||||
{
|
{
|
||||||
private System.Action<AssetOperationHandle> _callback;
|
private System.Action<AssetOperationHandle> _callback;
|
||||||
|
|
||||||
@@ -37,6 +38,33 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 等待异步执行完毕
|
||||||
|
/// </summary>
|
||||||
|
public void WaitForAsyncComplete()
|
||||||
|
{
|
||||||
|
if (IsValidWithWarning == false)
|
||||||
|
return;
|
||||||
|
Provider.WaitForAsyncComplete();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 释放资源句柄
|
||||||
|
/// </summary>
|
||||||
|
public void Release()
|
||||||
|
{
|
||||||
|
this.ReleaseInternal();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 释放资源句柄
|
||||||
|
/// </summary>
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
this.ReleaseInternal();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 资源对象
|
/// 资源对象
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -61,25 +89,6 @@ namespace YooAsset
|
|||||||
return Provider.AssetObject as TAsset;
|
return Provider.AssetObject as TAsset;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 等待异步执行完毕
|
|
||||||
/// </summary>
|
|
||||||
public void WaitForAsyncComplete()
|
|
||||||
{
|
|
||||||
if (IsValidWithWarning == false)
|
|
||||||
return;
|
|
||||||
Provider.WaitForAsyncComplete();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 释放资源句柄
|
|
||||||
/// </summary>
|
|
||||||
public void Release()
|
|
||||||
{
|
|
||||||
this.ReleaseInternal();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 同步初始化游戏对象
|
/// 同步初始化游戏对象
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.Collections;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
|
||||||
namespace YooAsset
|
namespace YooAsset
|
||||||
{
|
{
|
||||||
@@ -14,7 +15,6 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
internal abstract void InvokeCallback();
|
internal abstract void InvokeCallback();
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取资源信息
|
/// 获取资源信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
using System.IO;
|
using System;
|
||||||
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace YooAsset
|
namespace YooAsset
|
||||||
{
|
{
|
||||||
public class RawFileOperationHandle : OperationHandleBase
|
public class RawFileOperationHandle : OperationHandleBase, IDisposable
|
||||||
{
|
{
|
||||||
private System.Action<RawFileOperationHandle> _callback;
|
private System.Action<RawFileOperationHandle> _callback;
|
||||||
|
|
||||||
@@ -54,7 +55,15 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
this.ReleaseInternal();
|
this.ReleaseInternal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 释放资源句柄
|
||||||
|
/// </summary>
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
this.ReleaseInternal();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取原生文件的二进制数据
|
/// 获取原生文件的二进制数据
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
using System.Collections.Generic;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace YooAsset
|
namespace YooAsset
|
||||||
{
|
{
|
||||||
public sealed class SubAssetsOperationHandle : OperationHandleBase
|
public sealed class SubAssetsOperationHandle : OperationHandleBase, IDisposable
|
||||||
{
|
{
|
||||||
private System.Action<SubAssetsOperationHandle> _callback;
|
private System.Action<SubAssetsOperationHandle> _callback;
|
||||||
|
|
||||||
@@ -36,19 +37,6 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 子资源对象集合
|
|
||||||
/// </summary>
|
|
||||||
public UnityEngine.Object[] AllAssetObjects
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (IsValidWithWarning == false)
|
|
||||||
return null;
|
|
||||||
return Provider.AllAssetObjects;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 等待异步执行完毕
|
/// 等待异步执行完毕
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -67,6 +55,27 @@ namespace YooAsset
|
|||||||
this.ReleaseInternal();
|
this.ReleaseInternal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 释放资源句柄
|
||||||
|
/// </summary>
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
this.ReleaseInternal();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 子资源对象集合
|
||||||
|
/// </summary>
|
||||||
|
public UnityEngine.Object[] AllAssetObjects
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (IsValidWithWarning == false)
|
||||||
|
return null;
|
||||||
|
return Provider.AllAssetObjects;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取子资源对象
|
/// 获取子资源对象
|
||||||
|
|||||||
@@ -78,6 +78,9 @@ namespace YooAsset
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public InitializationOperation InitializeAsync(InitializeParameters parameters)
|
public InitializationOperation InitializeAsync(InitializeParameters parameters)
|
||||||
{
|
{
|
||||||
|
// 注意:WebGL平台因为网络原因可能会初始化失败!
|
||||||
|
ResetInitializeAfterFailed();
|
||||||
|
|
||||||
// 检测初始化参数合法性
|
// 检测初始化参数合法性
|
||||||
CheckInitializeParameters(parameters);
|
CheckInitializeParameters(parameters);
|
||||||
|
|
||||||
@@ -127,6 +130,20 @@ namespace YooAsset
|
|||||||
initializeOperation.Completed += InitializeOperation_Completed;
|
initializeOperation.Completed += InitializeOperation_Completed;
|
||||||
return initializeOperation;
|
return initializeOperation;
|
||||||
}
|
}
|
||||||
|
private void ResetInitializeAfterFailed()
|
||||||
|
{
|
||||||
|
if (_isInitialize && _initializeStatus == EOperationStatus.Failed)
|
||||||
|
{
|
||||||
|
_isInitialize = false;
|
||||||
|
_initializeStatus = EOperationStatus.None;
|
||||||
|
_initializeError = string.Empty;
|
||||||
|
_bundleServices = null;
|
||||||
|
_assetSystemImpl = null;
|
||||||
|
_editorSimulateModeImpl = null;
|
||||||
|
_offlinePlayModeImpl = null;
|
||||||
|
_hostPlayModeImpl = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
private void CheckInitializeParameters(InitializeParameters parameters)
|
private void CheckInitializeParameters(InitializeParameters parameters)
|
||||||
{
|
{
|
||||||
if (_isInitialize)
|
if (_isInitialize)
|
||||||
@@ -185,7 +202,8 @@ namespace YooAsset
|
|||||||
/// 向网络端请求最新的资源版本
|
/// 向网络端请求最新的资源版本
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="timeout">超时时间(默认值:60秒)</param>
|
/// <param name="timeout">超时时间(默认值:60秒)</param>
|
||||||
public UpdatePackageVersionOperation UpdatePackageVersionAsync(int timeout = 60)
|
/// <param name="appendTimeTicks">在URL末尾添加时间戳</param>
|
||||||
|
public UpdatePackageVersionOperation UpdatePackageVersionAsync(int timeout = 60, bool appendTimeTicks = true)
|
||||||
{
|
{
|
||||||
DebugCheckInitialize();
|
DebugCheckInitialize();
|
||||||
if (_playMode == EPlayMode.EditorSimulateMode)
|
if (_playMode == EPlayMode.EditorSimulateMode)
|
||||||
@@ -202,7 +220,7 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
else if (_playMode == EPlayMode.HostPlayMode)
|
else if (_playMode == EPlayMode.HostPlayMode)
|
||||||
{
|
{
|
||||||
return _hostPlayModeImpl.UpdatePackageVersionAsync(PackageName, timeout);
|
return _hostPlayModeImpl.UpdatePackageVersionAsync(PackageName, timeout, appendTimeTicks);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ namespace YooAsset
|
|||||||
|
|
||||||
if (_steps == ESteps.LoadWebManifest)
|
if (_steps == ESteps.LoadWebManifest)
|
||||||
{
|
{
|
||||||
string fileName = YooAssetSettingsData.GetPatchManifestFileName(_packageName, _packageVersion);
|
string fileName = YooAssetSettingsData.GetPatchManifestBinaryFileName(_packageName, _packageVersion);
|
||||||
string webURL = GetPatchManifestRequestURL(fileName);
|
string webURL = GetPatchManifestRequestURL(fileName);
|
||||||
YooLogger.Log($"Beginning to request patch manifest : {webURL}");
|
YooLogger.Log($"Beginning to request patch manifest : {webURL}");
|
||||||
_downloader = new UnityWebDataRequester();
|
_downloader = new UnityWebDataRequester();
|
||||||
@@ -131,7 +131,8 @@ namespace YooAsset
|
|||||||
// 解析补丁清单
|
// 解析补丁清单
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_remotePatchManifest = PatchManifest.Deserialize(_downloader.GetText());
|
byte[] bytesData = _downloader.GetData();
|
||||||
|
_remotePatchManifest = PatchManifest.DeserializeFromBinary(bytesData);
|
||||||
_steps = ESteps.Done;
|
_steps = ESteps.Done;
|
||||||
Status = EOperationStatus.Succeed;
|
Status = EOperationStatus.Succeed;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,8 +56,8 @@ namespace YooAsset
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
YooLogger.Log($"Load simulation manifest file : {_simulatePatchManifestPath}");
|
YooLogger.Log($"Load simulation manifest file : {_simulatePatchManifestPath}");
|
||||||
string jsonContent = FileUtility.ReadFile(_simulatePatchManifestPath);
|
byte[] bytesData = FileUtility.ReadAllBytes(_simulatePatchManifestPath);
|
||||||
var manifest = PatchManifest.Deserialize(jsonContent);
|
var manifest = PatchManifest.DeserializeFromBinary(bytesData);
|
||||||
InitializedPackageVersion = manifest.PackageVersion;
|
InitializedPackageVersion = manifest.PackageVersion;
|
||||||
_impl.SetSimulatePatchManifest(manifest);
|
_impl.SetSimulatePatchManifest(manifest);
|
||||||
_steps = ESteps.Done;
|
_steps = ESteps.Done;
|
||||||
@@ -491,7 +491,7 @@ namespace YooAsset
|
|||||||
|
|
||||||
if (_steps == ESteps.LoadAppManifest)
|
if (_steps == ESteps.LoadAppManifest)
|
||||||
{
|
{
|
||||||
string fileName = YooAssetSettingsData.GetPatchManifestFileName(_buildinPackageName, _buildinPackageVersion);
|
string fileName = YooAssetSettingsData.GetPatchManifestBinaryFileName(_buildinPackageName, _buildinPackageVersion);
|
||||||
string filePath = PathHelper.MakeStreamingLoadPath(fileName);
|
string filePath = PathHelper.MakeStreamingLoadPath(fileName);
|
||||||
string url = PathHelper.ConvertToWWWPath(filePath);
|
string url = PathHelper.ConvertToWWWPath(filePath);
|
||||||
_downloader = new UnityWebDataRequester();
|
_downloader = new UnityWebDataRequester();
|
||||||
@@ -513,7 +513,8 @@ namespace YooAsset
|
|||||||
// 解析APP里的补丁清单
|
// 解析APP里的补丁清单
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Manifest = PatchManifest.Deserialize(_downloader.GetText());
|
byte[] bytesData = _downloader.GetData();
|
||||||
|
Manifest = PatchManifest.DeserializeFromBinary(bytesData);
|
||||||
}
|
}
|
||||||
catch (System.Exception e)
|
catch (System.Exception e)
|
||||||
{
|
{
|
||||||
@@ -590,7 +591,7 @@ namespace YooAsset
|
|||||||
if (_steps == ESteps.CopyAppManifest)
|
if (_steps == ESteps.CopyAppManifest)
|
||||||
{
|
{
|
||||||
string savePath = PersistentHelper.GetCacheManifestFilePath(_buildinPackageName);
|
string savePath = PersistentHelper.GetCacheManifestFilePath(_buildinPackageName);
|
||||||
string fileName = YooAssetSettingsData.GetPatchManifestFileName(_buildinPackageName, _buildinPackageVersion);
|
string fileName = YooAssetSettingsData.GetPatchManifestBinaryFileName(_buildinPackageName, _buildinPackageVersion);
|
||||||
string filePath = PathHelper.MakeStreamingLoadPath(fileName);
|
string filePath = PathHelper.MakeStreamingLoadPath(fileName);
|
||||||
string url = PathHelper.ConvertToWWWPath(filePath);
|
string url = PathHelper.ConvertToWWWPath(filePath);
|
||||||
_downloader = new UnityWebFileRequester();
|
_downloader = new UnityWebFileRequester();
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ namespace YooAsset
|
|||||||
|
|
||||||
if (_steps == ESteps.LoadWebManifest)
|
if (_steps == ESteps.LoadWebManifest)
|
||||||
{
|
{
|
||||||
string fileName = YooAssetSettingsData.GetPatchManifestFileName(_packageName, _packageVersion);
|
string fileName = YooAssetSettingsData.GetPatchManifestBinaryFileName(_packageName, _packageVersion);
|
||||||
string webURL = GetPatchManifestRequestURL(fileName);
|
string webURL = GetPatchManifestRequestURL(fileName);
|
||||||
YooLogger.Log($"Beginning to request patch manifest : {webURL}");
|
YooLogger.Log($"Beginning to request patch manifest : {webURL}");
|
||||||
_downloader2 = new UnityWebDataRequester();
|
_downloader2 = new UnityWebDataRequester();
|
||||||
@@ -194,8 +194,8 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string content = _downloader2.GetText();
|
byte[] bytesData = _downloader2.GetData();
|
||||||
var manifest = PersistentHelper.SaveCacheManifestFile(_packageName, content);
|
var manifest = PersistentHelper.SaveCacheManifestFile(_packageName, bytesData);
|
||||||
_impl.SetLocalPatchManifest(manifest);
|
_impl.SetLocalPatchManifest(manifest);
|
||||||
FoundNewManifest = true;
|
FoundNewManifest = true;
|
||||||
_steps = ESteps.InitVerifyingCache;
|
_steps = ESteps.InitVerifyingCache;
|
||||||
|
|||||||
@@ -60,14 +60,16 @@ namespace YooAsset
|
|||||||
private readonly HostPlayModeImpl _impl;
|
private readonly HostPlayModeImpl _impl;
|
||||||
private readonly string _packageName;
|
private readonly string _packageName;
|
||||||
private readonly int _timeout;
|
private readonly int _timeout;
|
||||||
|
private readonly bool _appendTimeTicks;
|
||||||
private ESteps _steps = ESteps.None;
|
private ESteps _steps = ESteps.None;
|
||||||
private UnityWebDataRequester _downloader;
|
private UnityWebDataRequester _downloader;
|
||||||
|
|
||||||
internal HostPlayModeUpdatePackageVersionOperation(HostPlayModeImpl impl, string packageName, int timeout)
|
internal HostPlayModeUpdatePackageVersionOperation(HostPlayModeImpl impl, string packageName, int timeout, bool appendTimeTicks)
|
||||||
{
|
{
|
||||||
_impl = impl;
|
_impl = impl;
|
||||||
_packageName = packageName;
|
_packageName = packageName;
|
||||||
_timeout = timeout;
|
_timeout = timeout;
|
||||||
|
_appendTimeTicks = appendTimeTicks;
|
||||||
}
|
}
|
||||||
internal override void Start()
|
internal override void Start()
|
||||||
{
|
{
|
||||||
@@ -130,8 +132,11 @@ namespace YooAsset
|
|||||||
else
|
else
|
||||||
url = _impl.GetPatchDownloadMainURL(fileName);
|
url = _impl.GetPatchDownloadMainURL(fileName);
|
||||||
|
|
||||||
// 注意:在URL末尾添加时间戳
|
// 在URL末尾添加时间戳
|
||||||
return $"{url}?{System.DateTime.UtcNow.Ticks}";
|
if (_appendTimeTicks)
|
||||||
|
return $"{url}?{System.DateTime.UtcNow.Ticks}";
|
||||||
|
else
|
||||||
|
return url;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -109,15 +109,8 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public PatchBundle(string bundleName, string fileHash, string fileCRC, long fileSize, bool isRawFile, byte loadMethod, string[] tags)
|
public PatchBundle()
|
||||||
{
|
{
|
||||||
BundleName = bundleName;
|
|
||||||
FileHash = fileHash;
|
|
||||||
FileCRC = fileCRC;
|
|
||||||
FileSize = fileSize;
|
|
||||||
IsRawFile = isRawFile;
|
|
||||||
LoadMethod = loadMethod;
|
|
||||||
Tags = tags;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -266,48 +266,147 @@ namespace YooAsset
|
|||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 序列化
|
/// 序列化(JSON文件)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void Serialize(string savePath, PatchManifest patchManifest)
|
public static void SerializeToJson(string savePath, PatchManifest manifest)
|
||||||
{
|
{
|
||||||
string json = JsonUtility.ToJson(patchManifest);
|
string json = JsonUtility.ToJson(manifest, true);
|
||||||
FileUtility.CreateFile(savePath, json);
|
FileUtility.CreateFile(savePath, json);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 反序列化
|
/// 序列化(二进制文件)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static PatchManifest Deserialize(string jsonData)
|
public static void SerializeToBinary(string savePath, PatchManifest patchManifest)
|
||||||
{
|
{
|
||||||
PatchManifest patchManifest = JsonUtility.FromJson<PatchManifest>(jsonData);
|
using (FileStream fs = new FileStream(savePath, FileMode.Create))
|
||||||
if (patchManifest == null)
|
{
|
||||||
throw new System.Exception($"{nameof(PatchManifest)} deserialize object is null !");
|
// 创建缓存器
|
||||||
|
BufferWriter buffer = new BufferWriter(YooAssetSettings.PatchManifestFileMaxSize);
|
||||||
|
|
||||||
// 检测文件版本
|
// 写入文件标记
|
||||||
if (patchManifest.FileVersion != YooAssetSettings.PatchManifestFileVersion)
|
buffer.WriteUInt32(YooAssetSettings.PatchManifestFileSign);
|
||||||
throw new Exception($"The manifest file version are not compatible : {patchManifest.FileVersion} != {YooAssetSettings.PatchManifestFileVersion}");
|
|
||||||
|
// 写入文件版本
|
||||||
|
buffer.WriteUTF8(patchManifest.FileVersion);
|
||||||
|
|
||||||
|
// 写入文件头信息
|
||||||
|
buffer.WriteBool(patchManifest.EnableAddressable);
|
||||||
|
buffer.WriteInt32(patchManifest.OutputNameStyle);
|
||||||
|
buffer.WriteUTF8(patchManifest.PackageName);
|
||||||
|
buffer.WriteUTF8(patchManifest.PackageVersion);
|
||||||
|
|
||||||
|
// 写入资源列表
|
||||||
|
buffer.WriteInt32(patchManifest.AssetList.Count);
|
||||||
|
for (int i = 0; i < patchManifest.AssetList.Count; i++)
|
||||||
|
{
|
||||||
|
var patchAsset = patchManifest.AssetList[i];
|
||||||
|
buffer.WriteUTF8(patchAsset.Address);
|
||||||
|
buffer.WriteUTF8(patchAsset.AssetPath);
|
||||||
|
buffer.WriteUTF8Array(patchAsset.AssetTags);
|
||||||
|
buffer.WriteInt32(patchAsset.BundleID);
|
||||||
|
buffer.WriteInt32Array(patchAsset.DependIDs);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 写入资源包列表
|
||||||
|
buffer.WriteInt32(patchManifest.BundleList.Count);
|
||||||
|
for (int i = 0; i < patchManifest.BundleList.Count; i++)
|
||||||
|
{
|
||||||
|
var patchBundle = patchManifest.BundleList[i];
|
||||||
|
buffer.WriteUTF8(patchBundle.BundleName);
|
||||||
|
buffer.WriteUTF8(patchBundle.FileHash);
|
||||||
|
buffer.WriteUTF8(patchBundle.FileCRC);
|
||||||
|
buffer.WriteInt64(patchBundle.FileSize);
|
||||||
|
buffer.WriteBool(patchBundle.IsRawFile);
|
||||||
|
buffer.WriteByte(patchBundle.LoadMethod);
|
||||||
|
buffer.WriteUTF8Array(patchBundle.Tags);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 写入文件流
|
||||||
|
buffer.WriteToStream(fs);
|
||||||
|
fs.Flush();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 反序列化(二进制文件)
|
||||||
|
/// </summary>
|
||||||
|
public static PatchManifest DeserializeFromBinary(byte[] binaryData)
|
||||||
|
{
|
||||||
|
// 创建缓存器
|
||||||
|
BufferReader buffer = new BufferReader(binaryData);
|
||||||
|
|
||||||
|
// 读取文件标记
|
||||||
|
uint fileSign = buffer.ReadUInt32();
|
||||||
|
if (fileSign != YooAssetSettings.PatchManifestFileSign)
|
||||||
|
throw new Exception("Invalid manifest file !");
|
||||||
|
|
||||||
|
PatchManifest manifest = new PatchManifest();
|
||||||
|
{
|
||||||
|
// 读取文件版本
|
||||||
|
manifest.FileVersion = buffer.ReadUTF8();
|
||||||
|
if (manifest.FileVersion != YooAssetSettings.PatchManifestFileVersion)
|
||||||
|
throw new Exception($"The manifest file version are not compatible : {manifest.FileVersion} != {YooAssetSettings.PatchManifestFileVersion}");
|
||||||
|
|
||||||
|
// 读取文件头信息
|
||||||
|
manifest.EnableAddressable = buffer.ReadBool();
|
||||||
|
manifest.OutputNameStyle = buffer.ReadInt32();
|
||||||
|
manifest.PackageName = buffer.ReadUTF8();
|
||||||
|
manifest.PackageVersion = buffer.ReadUTF8();
|
||||||
|
|
||||||
|
// 读取资源列表
|
||||||
|
int patchAssetCount = buffer.ReadInt32();
|
||||||
|
manifest.AssetList = new List<PatchAsset>(patchAssetCount);
|
||||||
|
for (int i = 0; i < patchAssetCount; i++)
|
||||||
|
{
|
||||||
|
var patchAsset = new PatchAsset();
|
||||||
|
patchAsset.Address = buffer.ReadUTF8();
|
||||||
|
patchAsset.AssetPath = buffer.ReadUTF8();
|
||||||
|
patchAsset.AssetTags = buffer.ReadUTF8Array();
|
||||||
|
patchAsset.BundleID = buffer.ReadInt32();
|
||||||
|
patchAsset.DependIDs = buffer.ReadInt32Array();
|
||||||
|
manifest.AssetList.Add(patchAsset);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 读取资源包列表
|
||||||
|
int patchBundleCount = buffer.ReadInt32();
|
||||||
|
manifest.BundleList = new List<PatchBundle>(patchBundleCount);
|
||||||
|
for (int i = 0; i < patchBundleCount; i++)
|
||||||
|
{
|
||||||
|
var patchBundle = new PatchBundle();
|
||||||
|
patchBundle.BundleName = buffer.ReadUTF8();
|
||||||
|
patchBundle.FileHash = buffer.ReadUTF8();
|
||||||
|
patchBundle.FileCRC = buffer.ReadUTF8();
|
||||||
|
patchBundle.FileSize = buffer.ReadInt64();
|
||||||
|
patchBundle.IsRawFile = buffer.ReadBool();
|
||||||
|
patchBundle.LoadMethod = buffer.ReadByte();
|
||||||
|
patchBundle.Tags = buffer.ReadUTF8Array();
|
||||||
|
manifest.BundleList.Add(patchBundle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// BundleList
|
// BundleList
|
||||||
foreach (var patchBundle in patchManifest.BundleList)
|
foreach (var patchBundle in manifest.BundleList)
|
||||||
{
|
{
|
||||||
patchBundle.ParseBundle(patchManifest.PackageName, patchManifest.OutputNameStyle);
|
patchBundle.ParseBundle(manifest.PackageName, manifest.OutputNameStyle);
|
||||||
patchManifest.BundleDic.Add(patchBundle.BundleName, patchBundle);
|
manifest.BundleDic.Add(patchBundle.BundleName, patchBundle);
|
||||||
}
|
}
|
||||||
|
|
||||||
// AssetList
|
// AssetList
|
||||||
foreach (var patchAsset in patchManifest.AssetList)
|
foreach (var patchAsset in manifest.AssetList)
|
||||||
{
|
{
|
||||||
// 注意:我们不允许原始路径存在重名
|
// 注意:我们不允许原始路径存在重名
|
||||||
string assetPath = patchAsset.AssetPath;
|
string assetPath = patchAsset.AssetPath;
|
||||||
if (patchManifest.AssetDic.ContainsKey(assetPath))
|
if (manifest.AssetDic.ContainsKey(assetPath))
|
||||||
throw new Exception($"AssetPath have existed : {assetPath}");
|
throw new Exception($"AssetPath have existed : {assetPath}");
|
||||||
else
|
else
|
||||||
patchManifest.AssetDic.Add(assetPath, patchAsset);
|
manifest.AssetDic.Add(assetPath, patchAsset);
|
||||||
}
|
}
|
||||||
|
|
||||||
return patchManifest;
|
return manifest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 生成Bundle文件的正式名称
|
/// 生成Bundle文件的正式名称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -78,6 +78,10 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
return _simulatePatchManifest.IsIncludeBundleFile(fileName);
|
return _simulatePatchManifest.IsIncludeBundleFile(fileName);
|
||||||
}
|
}
|
||||||
|
bool IBundleServices.IsServicesValid()
|
||||||
|
{
|
||||||
|
return _simulatePatchManifest != null;
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -44,9 +44,9 @@ namespace YooAsset
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 异步更新资源版本号
|
/// 异步更新资源版本号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public UpdatePackageVersionOperation UpdatePackageVersionAsync(string packageName, int timeout)
|
public UpdatePackageVersionOperation UpdatePackageVersionAsync(string packageName, int timeout, bool appendTimeTicks)
|
||||||
{
|
{
|
||||||
var operation = new HostPlayModeUpdatePackageVersionOperation(this, packageName, timeout);
|
var operation = new HostPlayModeUpdatePackageVersionOperation(this, packageName, timeout, appendTimeTicks);
|
||||||
OperationSystem.StartOperation(operation);
|
OperationSystem.StartOperation(operation);
|
||||||
return operation;
|
return operation;
|
||||||
}
|
}
|
||||||
@@ -428,6 +428,10 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
return LocalPatchManifest.IsIncludeBundleFile(fileName);
|
return LocalPatchManifest.IsIncludeBundleFile(fileName);
|
||||||
}
|
}
|
||||||
|
bool IBundleServices.IsServicesValid()
|
||||||
|
{
|
||||||
|
return LocalPatchManifest != null;
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -129,6 +129,10 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
return _appPatchManifest.IsIncludeBundleFile(fileName);
|
return _appPatchManifest.IsIncludeBundleFile(fileName);
|
||||||
}
|
}
|
||||||
|
bool IBundleServices.IsServicesValid()
|
||||||
|
{
|
||||||
|
return _appPatchManifest != null;
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
namespace YooAsset
|
namespace YooAsset
|
||||||
{
|
{
|
||||||
internal interface IBundleServices
|
internal interface IBundleServices
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取资源包信息
|
/// 获取资源包信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -42,5 +42,10 @@ namespace YooAsset
|
|||||||
/// 是否包含资源文件
|
/// 是否包含资源文件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool IsIncludeBundleFile(string fileName);
|
bool IsIncludeBundleFile(string fileName);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 服务接口是否有效
|
||||||
|
/// </summary>
|
||||||
|
bool IsServicesValid();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -16,13 +16,23 @@ namespace YooAsset
|
|||||||
public string RawFileVariant = "rawfile";
|
public string RawFileVariant = "rawfile";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 补丁清单文件名称
|
/// 清单文件名称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string PatchManifestFileName = "PatchManifest";
|
public string PatchManifestFileName = "PatchManifest";
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 补丁清单文件格式版本
|
/// 清单文件头标记
|
||||||
|
/// </summary>
|
||||||
|
public const uint PatchManifestFileSign = 0x594F4F;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 清单文件极限大小(100MB)
|
||||||
|
/// </summary>
|
||||||
|
public const int PatchManifestFileMaxSize = 104857600;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 清单文件格式版本
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string PatchManifestFileVersion = "1.3.4";
|
public const string PatchManifestFileVersion = "1.3.4";
|
||||||
|
|
||||||
|
|||||||
@@ -51,11 +51,19 @@ namespace YooAsset
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取补丁清单文件完整名称
|
/// 获取补丁清单文件完整名称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string GetPatchManifestFileName(string packageName, string packageVersion)
|
public static string GetPatchManifestBinaryFileName(string packageName, string packageVersion)
|
||||||
{
|
{
|
||||||
return $"{Setting.PatchManifestFileName}_{packageName}_{packageVersion}.bytes";
|
return $"{Setting.PatchManifestFileName}_{packageName}_{packageVersion}.bytes";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取补丁清单文件完整名称
|
||||||
|
/// </summary>
|
||||||
|
public static string GetPatchManifestJsonFileName(string packageName, string packageVersion)
|
||||||
|
{
|
||||||
|
return $"{Setting.PatchManifestFileName}_{packageName}_{packageVersion}.json";
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取补丁清单哈希文件完整名称
|
/// 获取补丁清单哈希文件完整名称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -1,69 +0,0 @@
|
|||||||
using System;
|
|
||||||
|
|
||||||
namespace YooAsset
|
|
||||||
{
|
|
||||||
internal struct BitMask32
|
|
||||||
{
|
|
||||||
private int _mask;
|
|
||||||
|
|
||||||
public static implicit operator int(BitMask32 mask) { return mask._mask; }
|
|
||||||
public static implicit operator BitMask32(int mask) { return new BitMask32(mask); }
|
|
||||||
|
|
||||||
public BitMask32(int mask)
|
|
||||||
{
|
|
||||||
_mask = mask;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 打开位
|
|
||||||
/// </summary>
|
|
||||||
public void Open(int bit)
|
|
||||||
{
|
|
||||||
if (bit < 0 || bit > 31)
|
|
||||||
throw new ArgumentOutOfRangeException();
|
|
||||||
else
|
|
||||||
_mask |= 1 << bit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 关闭位
|
|
||||||
/// </summary>
|
|
||||||
public void Close(int bit)
|
|
||||||
{
|
|
||||||
if (bit < 0 || bit > 31)
|
|
||||||
throw new ArgumentOutOfRangeException();
|
|
||||||
else
|
|
||||||
_mask &= ~(1 << bit);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 位取反
|
|
||||||
/// </summary>
|
|
||||||
public void Reverse(int bit)
|
|
||||||
{
|
|
||||||
if (bit < 0 || bit > 31)
|
|
||||||
throw new ArgumentOutOfRangeException();
|
|
||||||
else
|
|
||||||
_mask ^= 1 << bit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 所有位取反
|
|
||||||
/// </summary>
|
|
||||||
public void Inverse()
|
|
||||||
{
|
|
||||||
_mask = ~_mask;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 比对位值
|
|
||||||
/// </summary>
|
|
||||||
public bool Test(int bit)
|
|
||||||
{
|
|
||||||
if (bit < 0 || bit > 31)
|
|
||||||
throw new ArgumentOutOfRangeException();
|
|
||||||
else
|
|
||||||
return (_mask & (1 << bit)) != 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
using System;
|
|
||||||
|
|
||||||
namespace YooAsset
|
|
||||||
{
|
|
||||||
internal struct BitMask64
|
|
||||||
{
|
|
||||||
private long _mask;
|
|
||||||
|
|
||||||
public static implicit operator long(BitMask64 mask) { return mask._mask; }
|
|
||||||
public static implicit operator BitMask64(long mask) { return new BitMask64(mask); }
|
|
||||||
|
|
||||||
public BitMask64(long mask)
|
|
||||||
{
|
|
||||||
_mask = mask;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 打开位
|
|
||||||
/// </summary>
|
|
||||||
public void Open(int bit)
|
|
||||||
{
|
|
||||||
if (bit < 0 || bit > 63)
|
|
||||||
throw new ArgumentOutOfRangeException();
|
|
||||||
else
|
|
||||||
_mask |= 1L << bit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 关闭位
|
|
||||||
/// </summary>
|
|
||||||
public void Close(int bit)
|
|
||||||
{
|
|
||||||
if (bit < 0 || bit > 63)
|
|
||||||
throw new ArgumentOutOfRangeException();
|
|
||||||
else
|
|
||||||
_mask &= ~(1L << bit);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 位取反
|
|
||||||
/// </summary>
|
|
||||||
public void Reverse(int bit)
|
|
||||||
{
|
|
||||||
if (bit < 0 || bit > 63)
|
|
||||||
throw new ArgumentOutOfRangeException();
|
|
||||||
else
|
|
||||||
_mask ^= 1L << bit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 所有位取反
|
|
||||||
/// </summary>
|
|
||||||
public void Inverse()
|
|
||||||
{
|
|
||||||
_mask = ~_mask;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 比对位值
|
|
||||||
/// </summary>
|
|
||||||
public bool Test(int bit)
|
|
||||||
{
|
|
||||||
if (bit < 0 || bit > 63)
|
|
||||||
throw new ArgumentOutOfRangeException();
|
|
||||||
else
|
|
||||||
return (_mask & (1L << bit)) != 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
160
Assets/YooAsset/Runtime/Utility/BufferReader.cs
Normal file
160
Assets/YooAsset/Runtime/Utility/BufferReader.cs
Normal file
@@ -0,0 +1,160 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
|
namespace YooAsset
|
||||||
|
{
|
||||||
|
internal class BufferReader
|
||||||
|
{
|
||||||
|
private readonly byte[] _buffer;
|
||||||
|
private int _index = 0;
|
||||||
|
|
||||||
|
public BufferReader(byte[] data)
|
||||||
|
{
|
||||||
|
_buffer = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 缓冲区容量
|
||||||
|
/// </summary>
|
||||||
|
public int Capacity
|
||||||
|
{
|
||||||
|
get { return _buffer.Length; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[] ReadBytes(int count)
|
||||||
|
{
|
||||||
|
CheckReaderIndex(count);
|
||||||
|
var data = new byte[count];
|
||||||
|
Buffer.BlockCopy(_buffer, _index, data, 0, count);
|
||||||
|
_index += count;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
public byte ReadByte()
|
||||||
|
{
|
||||||
|
CheckReaderIndex(1);
|
||||||
|
return _buffer[_index++];
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool ReadBool()
|
||||||
|
{
|
||||||
|
CheckReaderIndex(1);
|
||||||
|
return _buffer[_index++] == 1;
|
||||||
|
}
|
||||||
|
public short ReadInt16()
|
||||||
|
{
|
||||||
|
CheckReaderIndex(2);
|
||||||
|
if (BitConverter.IsLittleEndian)
|
||||||
|
{
|
||||||
|
short value = (short)((_buffer[_index]) | (_buffer[_index + 1] << 8));
|
||||||
|
_index += 2;
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
short value = (short)((_buffer[_index] << 8) | (_buffer[_index + 1]));
|
||||||
|
_index += 2;
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public ushort ReadUInt16()
|
||||||
|
{
|
||||||
|
return (ushort)ReadInt16();
|
||||||
|
}
|
||||||
|
public int ReadInt32()
|
||||||
|
{
|
||||||
|
CheckReaderIndex(4);
|
||||||
|
if (BitConverter.IsLittleEndian)
|
||||||
|
{
|
||||||
|
int value = (_buffer[_index]) | (_buffer[_index + 1] << 8) | (_buffer[_index + 2] << 16) | (_buffer[_index + 3] << 24);
|
||||||
|
_index += 4;
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int value = (_buffer[_index] << 24) | (_buffer[_index + 1] << 16) | (_buffer[_index + 2] << 8) | (_buffer[_index + 3]);
|
||||||
|
_index += 4;
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public uint ReadUInt32()
|
||||||
|
{
|
||||||
|
return (uint)ReadInt32();
|
||||||
|
}
|
||||||
|
public long ReadInt64()
|
||||||
|
{
|
||||||
|
CheckReaderIndex(8);
|
||||||
|
if (BitConverter.IsLittleEndian)
|
||||||
|
{
|
||||||
|
int i1 = (_buffer[_index]) | (_buffer[_index + 1] << 8) | (_buffer[_index + 2] << 16) | (_buffer[_index + 3] << 24);
|
||||||
|
int i2 = (_buffer[_index + 4]) | (_buffer[_index + 5] << 8) | (_buffer[_index + 6] << 16) | (_buffer[_index + 7] << 24);
|
||||||
|
_index += 8;
|
||||||
|
return (uint)i1 | ((long)i2 << 32);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int i1 = (_buffer[_index] << 24) | (_buffer[_index + 1] << 16) | (_buffer[_index + 2] << 8) | (_buffer[_index + 3]);
|
||||||
|
int i2 = (_buffer[_index + 4] << 24) | (_buffer[_index + 5] << 16) | (_buffer[_index + 6] << 8) | (_buffer[_index + 7]);
|
||||||
|
_index += 8;
|
||||||
|
return (uint)i2 | ((long)i1 << 32);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public ulong ReadUInt64()
|
||||||
|
{
|
||||||
|
return (ulong)ReadInt64();
|
||||||
|
}
|
||||||
|
|
||||||
|
public string ReadUTF8()
|
||||||
|
{
|
||||||
|
ushort count = ReadUInt16();
|
||||||
|
if (count == 0)
|
||||||
|
return string.Empty;
|
||||||
|
|
||||||
|
CheckReaderIndex(count);
|
||||||
|
string value = Encoding.UTF8.GetString(_buffer, _index, count);
|
||||||
|
_index += count;
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
public int[] ReadInt32Array()
|
||||||
|
{
|
||||||
|
ushort count = ReadUInt16();
|
||||||
|
int[] values = new int[count];
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
values[i] = ReadInt32();
|
||||||
|
}
|
||||||
|
return values;
|
||||||
|
}
|
||||||
|
public long[] ReadInt64Array()
|
||||||
|
{
|
||||||
|
ushort count = ReadUInt16();
|
||||||
|
long[] values = new long[count];
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
values[i] = ReadInt64();
|
||||||
|
}
|
||||||
|
return values;
|
||||||
|
}
|
||||||
|
public string[] ReadUTF8Array()
|
||||||
|
{
|
||||||
|
ushort count = ReadUInt16();
|
||||||
|
string[] values = new string[count];
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
values[i] = ReadUTF8();
|
||||||
|
}
|
||||||
|
return values;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Conditional("DEBUG")]
|
||||||
|
private void CheckReaderIndex(int length)
|
||||||
|
{
|
||||||
|
if (_index + length > Capacity)
|
||||||
|
{
|
||||||
|
throw new IndexOutOfRangeException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/YooAsset/Runtime/Utility/BufferReader.cs.meta
Normal file
11
Assets/YooAsset/Runtime/Utility/BufferReader.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 76257995ca887ad48ac02bd5d2174d9b
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
179
Assets/YooAsset/Runtime/Utility/BufferWriter.cs
Normal file
179
Assets/YooAsset/Runtime/Utility/BufferWriter.cs
Normal file
@@ -0,0 +1,179 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
namespace YooAsset
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 数据存储以小端字节序为标准
|
||||||
|
/// </summary>
|
||||||
|
internal class BufferWriter
|
||||||
|
{
|
||||||
|
private readonly byte[] _buffer;
|
||||||
|
private int _index = 0;
|
||||||
|
|
||||||
|
public BufferWriter(int capacity)
|
||||||
|
{
|
||||||
|
_buffer = new byte[capacity];
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 缓冲区容量
|
||||||
|
/// </summary>
|
||||||
|
public int Capacity
|
||||||
|
{
|
||||||
|
get { return _buffer.Length; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 将有效数据写入文件流
|
||||||
|
/// </summary>
|
||||||
|
public void WriteToStream(FileStream fileStream)
|
||||||
|
{
|
||||||
|
fileStream.Write(_buffer, 0, _index);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void WriteBytes(byte[] data)
|
||||||
|
{
|
||||||
|
int count = data.Length;
|
||||||
|
CheckWriterIndex(count);
|
||||||
|
Buffer.BlockCopy(data, 0, _buffer, _index, count);
|
||||||
|
_index += count;
|
||||||
|
}
|
||||||
|
public void WriteByte(byte value)
|
||||||
|
{
|
||||||
|
CheckWriterIndex(1);
|
||||||
|
_buffer[_index++] = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void WriteBool(bool value)
|
||||||
|
{
|
||||||
|
WriteByte((byte)(value ? 1 : 0));
|
||||||
|
}
|
||||||
|
public void WriteInt16(short value)
|
||||||
|
{
|
||||||
|
WriteUInt16((ushort)value);
|
||||||
|
}
|
||||||
|
public void WriteUInt16(ushort value)
|
||||||
|
{
|
||||||
|
CheckWriterIndex(2);
|
||||||
|
_buffer[_index++] = (byte)value;
|
||||||
|
_buffer[_index++] = (byte)(value >> 8);
|
||||||
|
}
|
||||||
|
public void WriteInt32(int value)
|
||||||
|
{
|
||||||
|
WriteUInt32((uint)value);
|
||||||
|
}
|
||||||
|
public void WriteUInt32(uint value)
|
||||||
|
{
|
||||||
|
CheckWriterIndex(4);
|
||||||
|
_buffer[_index++] = (byte)value;
|
||||||
|
_buffer[_index++] = (byte)(value >> 8);
|
||||||
|
_buffer[_index++] = (byte)(value >> 16);
|
||||||
|
_buffer[_index++] = (byte)(value >> 24);
|
||||||
|
}
|
||||||
|
public void WriteInt64(long value)
|
||||||
|
{
|
||||||
|
WriteUInt64((ulong)value);
|
||||||
|
}
|
||||||
|
public void WriteUInt64(ulong value)
|
||||||
|
{
|
||||||
|
CheckWriterIndex(8);
|
||||||
|
_buffer[_index++] = (byte)value;
|
||||||
|
_buffer[_index++] = (byte)(value >> 8);
|
||||||
|
_buffer[_index++] = (byte)(value >> 16);
|
||||||
|
_buffer[_index++] = (byte)(value >> 24);
|
||||||
|
_buffer[_index++] = (byte)(value >> 32);
|
||||||
|
_buffer[_index++] = (byte)(value >> 40);
|
||||||
|
_buffer[_index++] = (byte)(value >> 48);
|
||||||
|
_buffer[_index++] = (byte)(value >> 56);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void WriteUTF8(string value)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(value))
|
||||||
|
{
|
||||||
|
WriteUInt16(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
byte[] bytes = Encoding.UTF8.GetBytes(value);
|
||||||
|
int count = bytes.Length;
|
||||||
|
if (count > ushort.MaxValue)
|
||||||
|
throw new FormatException($"Write string length cannot be greater than {ushort.MaxValue} !");
|
||||||
|
|
||||||
|
WriteUInt16(Convert.ToUInt16(count));
|
||||||
|
WriteBytes(bytes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void WriteInt32Array(int[] values)
|
||||||
|
{
|
||||||
|
if (values == null)
|
||||||
|
{
|
||||||
|
WriteUInt16(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int count = values.Length;
|
||||||
|
if (count > ushort.MaxValue)
|
||||||
|
throw new FormatException($"Write array length cannot be greater than {ushort.MaxValue} !");
|
||||||
|
|
||||||
|
WriteUInt16(Convert.ToUInt16(count));
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
WriteInt32(values[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void WriteInt64Array(long[] values)
|
||||||
|
{
|
||||||
|
if (values == null)
|
||||||
|
{
|
||||||
|
WriteUInt16(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int count = values.Length;
|
||||||
|
if (count > ushort.MaxValue)
|
||||||
|
throw new FormatException($"Write array length cannot be greater than {ushort.MaxValue} !");
|
||||||
|
|
||||||
|
WriteUInt16(Convert.ToUInt16(count));
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
WriteInt64(values[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void WriteUTF8Array(string[] values)
|
||||||
|
{
|
||||||
|
if (values == null)
|
||||||
|
{
|
||||||
|
WriteUInt16(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int count = values.Length;
|
||||||
|
if (count > ushort.MaxValue)
|
||||||
|
throw new FormatException($"Write array length cannot be greater than {ushort.MaxValue} !");
|
||||||
|
|
||||||
|
WriteUInt16(Convert.ToUInt16(count));
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
WriteUTF8(values[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Conditional("DEBUG")]
|
||||||
|
private void CheckWriterIndex(int length)
|
||||||
|
{
|
||||||
|
if (_index + length > Capacity)
|
||||||
|
{
|
||||||
|
throw new IndexOutOfRangeException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/YooAsset/Runtime/Utility/BufferWriter.cs.meta
Normal file
11
Assets/YooAsset/Runtime/Utility/BufferWriter.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a270f91ca07a38445949cb5e8195f0a2
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -128,19 +128,19 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
YooLogger.Log($"Load sandbox patch manifest file : {packageName}");
|
YooLogger.Log($"Load sandbox patch manifest file : {packageName}");
|
||||||
string filePath = GetCacheManifestFilePath(packageName);
|
string filePath = GetCacheManifestFilePath(packageName);
|
||||||
string jsonData = File.ReadAllText(filePath);
|
byte[] bytesData = File.ReadAllBytes(filePath);
|
||||||
return PatchManifest.Deserialize(jsonData);
|
return PatchManifest.DeserializeFromBinary(bytesData);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 存储沙盒内清单文件
|
/// 存储沙盒内清单文件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static PatchManifest SaveCacheManifestFile(string packageName, string fileContent)
|
public static PatchManifest SaveCacheManifestFile(string packageName, byte[] fileBytesData)
|
||||||
{
|
{
|
||||||
YooLogger.Log($"Save sandbox patch manifest file : {packageName}");
|
YooLogger.Log($"Save sandbox patch manifest file : {packageName}");
|
||||||
var manifest = PatchManifest.Deserialize(fileContent);
|
var manifest = PatchManifest.DeserializeFromBinary(fileBytesData);
|
||||||
string savePath = GetCacheManifestFilePath(packageName);
|
string savePath = GetCacheManifestFilePath(packageName);
|
||||||
FileUtility.CreateFile(savePath, fileContent);
|
FileUtility.CreateFile(savePath, fileBytesData);
|
||||||
return manifest;
|
return manifest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -117,15 +117,25 @@ namespace YooAsset
|
|||||||
internal static class FileUtility
|
internal static class FileUtility
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 读取文件
|
/// 读取文件的文本数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string ReadFile(string filePath)
|
public static string ReadAllText(string filePath)
|
||||||
{
|
{
|
||||||
if (File.Exists(filePath) == false)
|
if (File.Exists(filePath) == false)
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
return File.ReadAllText(filePath, Encoding.UTF8);
|
return File.ReadAllText(filePath, Encoding.UTF8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 读取文件的字节数据
|
||||||
|
/// </summary>
|
||||||
|
public static byte[] ReadAllBytes(string filePath)
|
||||||
|
{
|
||||||
|
if (File.Exists(filePath) == false)
|
||||||
|
return null;
|
||||||
|
return File.ReadAllBytes(filePath);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 创建文件(如果已经存在则删除旧文件)
|
/// 创建文件(如果已经存在则删除旧文件)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -106,6 +106,18 @@ namespace YooAsset
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="packageName">资源包名称</param>
|
/// <param name="packageName">资源包名称</param>
|
||||||
public static AssetsPackage GetAssetsPackage(string packageName)
|
public static AssetsPackage GetAssetsPackage(string packageName)
|
||||||
|
{
|
||||||
|
var package = TryGetAssetsPackage(packageName);
|
||||||
|
if (package == null)
|
||||||
|
YooLogger.Warning($"Not found assets package : {packageName}");
|
||||||
|
return package;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 尝试获取资源包
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="packageName">资源包名称</param>
|
||||||
|
public static AssetsPackage TryGetAssetsPackage(string packageName)
|
||||||
{
|
{
|
||||||
if (_isInitialize == false)
|
if (_isInitialize == false)
|
||||||
throw new Exception($"{nameof(YooAssets)} not initialize !");
|
throw new Exception($"{nameof(YooAssets)} not initialize !");
|
||||||
@@ -118,8 +130,6 @@ namespace YooAsset
|
|||||||
if (package.PackageName == packageName)
|
if (package.PackageName == packageName)
|
||||||
return package;
|
return package;
|
||||||
}
|
}
|
||||||
|
|
||||||
YooLogger.Warning($"Not found assets package : {packageName}");
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,9 +5,7 @@ using System.IO;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using YooAsset.Editor;
|
using YooAsset.Editor;
|
||||||
|
|
||||||
/// <summary>
|
[DisplayName("打包特效纹理(自定义)")]
|
||||||
/// 按照文件名的首字母来划分资源
|
|
||||||
/// </summary>
|
|
||||||
public class PackEffectTexture : IPackRule
|
public class PackEffectTexture : IPackRule
|
||||||
{
|
{
|
||||||
private const string PackDirectory = "Assets/Effect/Textures/";
|
private const string PackDirectory = "Assets/Effect/Textures/";
|
||||||
|
|||||||
@@ -105,12 +105,12 @@ namespace YooAsset.Editor
|
|||||||
newList.Clear();
|
newList.Clear();
|
||||||
|
|
||||||
// 加载补丁清单1
|
// 加载补丁清单1
|
||||||
string jsonData1 = FileUtility.ReadFile(_patchManifestPath1);
|
byte[] bytesData1 = FileUtility.ReadAllBytes(_patchManifestPath1);
|
||||||
PatchManifest patchManifest1 = PatchManifest.Deserialize(jsonData1);
|
PatchManifest patchManifest1 = PatchManifest.DeserializeFromBinary(bytesData1);
|
||||||
|
|
||||||
// 加载补丁清单1
|
// 加载补丁清单1
|
||||||
string jsonData2 = FileUtility.ReadFile(_patchManifestPath2);
|
byte[] bytesData2 = FileUtility.ReadAllBytes(_patchManifestPath2);
|
||||||
PatchManifest patchManifest2 = PatchManifest.Deserialize(jsonData2);
|
PatchManifest patchManifest2 = PatchManifest.DeserializeFromBinary(bytesData2);
|
||||||
|
|
||||||
// 拷贝文件列表
|
// 拷贝文件列表
|
||||||
foreach (var patchBundle2 in patchManifest2.BundleList)
|
foreach (var patchBundle2 in patchManifest2.BundleList)
|
||||||
|
|||||||
@@ -51,8 +51,8 @@ namespace YooAsset.Editor
|
|||||||
string outputDirectory = Path.GetDirectoryName(patchManifestFilePath);
|
string outputDirectory = Path.GetDirectoryName(patchManifestFilePath);
|
||||||
|
|
||||||
// 加载补丁清单
|
// 加载补丁清单
|
||||||
string jsonData = FileUtility.ReadFile(patchManifestFilePath);
|
byte[] bytesData = FileUtility.ReadAllBytes(patchManifestFilePath);
|
||||||
PatchManifest patchManifest = PatchManifest.Deserialize(jsonData);
|
PatchManifest patchManifest = PatchManifest.DeserializeFromBinary(bytesData);
|
||||||
|
|
||||||
// 拷贝核心文件
|
// 拷贝核心文件
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ MonoBehaviour:
|
|||||||
ShowPackageView: 0
|
ShowPackageView: 0
|
||||||
EnableAddressable: 1
|
EnableAddressable: 1
|
||||||
UniqueBundleName: 0
|
UniqueBundleName: 0
|
||||||
|
ShowEditorAlias: 0
|
||||||
Packages:
|
Packages:
|
||||||
- PackageName: DefaultPackage
|
- PackageName: DefaultPackage
|
||||||
PackageDesc:
|
PackageDesc:
|
||||||
|
|||||||
@@ -2,6 +2,18 @@
|
|||||||
|
|
||||||
public class PatchEventDefine
|
public class PatchEventDefine
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 补丁包初始化失败
|
||||||
|
/// </summary>
|
||||||
|
public class InitializeFailed : IEventMessage
|
||||||
|
{
|
||||||
|
public static void SendEventMessage()
|
||||||
|
{
|
||||||
|
var msg = new InitializeFailed();
|
||||||
|
UniEvent.SendMessage(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 补丁流程步骤改变
|
/// 补丁流程步骤改变
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -2,6 +2,18 @@
|
|||||||
|
|
||||||
public class UserEventDefine
|
public class UserEventDefine
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 用户尝试再次初始化资源包
|
||||||
|
/// </summary>
|
||||||
|
public class UserTryInitialize : IEventMessage
|
||||||
|
{
|
||||||
|
public static void SendEventMessage()
|
||||||
|
{
|
||||||
|
var msg = new UserTryInitialize();
|
||||||
|
UniEvent.SendMessage(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 用户开始下载网络文件
|
/// 用户开始下载网络文件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ using UniFramework.Module;
|
|||||||
using YooAsset;
|
using YooAsset;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 初始化工作
|
/// 初始化资源包
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal class FsmPatchInit : IStateNode
|
internal class FsmInitialize : IStateNode
|
||||||
{
|
{
|
||||||
private StateMachine _machine;
|
private StateMachine _machine;
|
||||||
|
|
||||||
@@ -20,12 +20,8 @@ internal class FsmPatchInit : IStateNode
|
|||||||
}
|
}
|
||||||
void IStateNode.OnEnter()
|
void IStateNode.OnEnter()
|
||||||
{
|
{
|
||||||
// 加载更新面板
|
PatchEventDefine.PatchStatesChange.SendEventMessage("初始化资源包!");
|
||||||
var go = Resources.Load<GameObject>("PatchWindow");
|
UniModule.StartCoroutine(InitPackage());
|
||||||
GameObject.Instantiate(go);
|
|
||||||
|
|
||||||
// 初始化资源系统
|
|
||||||
UniModule.StartCoroutine(InitYooAsset());
|
|
||||||
}
|
}
|
||||||
void IStateNode.OnUpdate()
|
void IStateNode.OnUpdate()
|
||||||
{
|
{
|
||||||
@@ -34,19 +30,24 @@ internal class FsmPatchInit : IStateNode
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerator InitYooAsset()
|
private IEnumerator InitPackage()
|
||||||
{
|
{
|
||||||
var playMode = PatchManager.Instance.PlayMode;
|
var playMode = PatchManager.Instance.PlayMode;
|
||||||
|
|
||||||
// 创建默认的资源包
|
// 创建默认的资源包
|
||||||
var package = YooAssets.CreateAssetsPackage("DefaultPackage");
|
string packageName = "DefaultPackage";
|
||||||
YooAssets.SetDefaultAssetsPackage(package);
|
var package = YooAssets.TryGetAssetsPackage(packageName);
|
||||||
|
if (package == null)
|
||||||
|
{
|
||||||
|
package = YooAssets.CreateAssetsPackage(packageName);
|
||||||
|
YooAssets.SetDefaultAssetsPackage(package);
|
||||||
|
}
|
||||||
|
|
||||||
// 编辑器下的模拟模式
|
// 编辑器下的模拟模式
|
||||||
if (playMode == EPlayMode.EditorSimulateMode)
|
if (playMode == EPlayMode.EditorSimulateMode)
|
||||||
{
|
{
|
||||||
var createParameters = new EditorSimulateModeParameters();
|
var createParameters = new EditorSimulateModeParameters();
|
||||||
createParameters.SimulatePatchManifestPath = EditorSimulateModeHelper.SimulateBuild("DefaultPackage");
|
createParameters.SimulatePatchManifestPath = EditorSimulateModeHelper.SimulateBuild(packageName);
|
||||||
yield return package.InitializeAsync(createParameters);
|
yield return package.InitializeAsync(createParameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,7 +70,10 @@ internal class FsmPatchInit : IStateNode
|
|||||||
yield return package.InitializeAsync(createParameters);
|
yield return package.InitializeAsync(createParameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
_machine.ChangeState<FsmUpdateVersion>();
|
if (package.InitializeStatus == EOperationStatus.Succeed)
|
||||||
|
_machine.ChangeState<FsmUpdateVersion>();
|
||||||
|
else
|
||||||
|
PatchEventDefine.InitializeFailed.SendEventMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9c67e6e479b68e345afcdf325775c079
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -5,7 +5,7 @@ using UniFramework.Machine;
|
|||||||
using UniFramework.Module;
|
using UniFramework.Module;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 更新完毕
|
/// 流程更新完毕
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal class FsmPatchDone : IStateNode
|
internal class FsmPatchDone : IStateNode
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UniFramework.Machine;
|
||||||
|
using UniFramework.Module;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 流程准备工作
|
||||||
|
/// </summary>
|
||||||
|
internal class FsmPatchPrepare : IStateNode
|
||||||
|
{
|
||||||
|
private StateMachine _machine;
|
||||||
|
|
||||||
|
void IStateNode.OnCreate(StateMachine machine)
|
||||||
|
{
|
||||||
|
_machine = machine;
|
||||||
|
}
|
||||||
|
void IStateNode.OnEnter()
|
||||||
|
{
|
||||||
|
// 加载更新面板
|
||||||
|
var go = Resources.Load<GameObject>("PatchWindow");
|
||||||
|
GameObject.Instantiate(go);
|
||||||
|
|
||||||
|
_machine.ChangeState<FsmInitialize>();
|
||||||
|
}
|
||||||
|
void IStateNode.OnUpdate()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void IStateNode.OnExit()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -53,6 +53,7 @@ public class PatchManager : ModuleSingleton<PatchManager>, IModule
|
|||||||
PlayMode = playMode;
|
PlayMode = playMode;
|
||||||
|
|
||||||
// 注册监听事件
|
// 注册监听事件
|
||||||
|
_eventGroup.AddListener<UserEventDefine.UserTryInitialize>(OnHandleEventMessage);
|
||||||
_eventGroup.AddListener<UserEventDefine.UserBeginDownloadWebFiles>(OnHandleEventMessage);
|
_eventGroup.AddListener<UserEventDefine.UserBeginDownloadWebFiles>(OnHandleEventMessage);
|
||||||
_eventGroup.AddListener<UserEventDefine.UserTryUpdatePackageVersion>(OnHandleEventMessage);
|
_eventGroup.AddListener<UserEventDefine.UserTryUpdatePackageVersion>(OnHandleEventMessage);
|
||||||
_eventGroup.AddListener<UserEventDefine.UserTryUpdatePatchManifest>(OnHandleEventMessage);
|
_eventGroup.AddListener<UserEventDefine.UserTryUpdatePatchManifest>(OnHandleEventMessage);
|
||||||
@@ -60,7 +61,8 @@ public class PatchManager : ModuleSingleton<PatchManager>, IModule
|
|||||||
|
|
||||||
Debug.Log("开启补丁更新流程...");
|
Debug.Log("开启补丁更新流程...");
|
||||||
_machine = new StateMachine(this);
|
_machine = new StateMachine(this);
|
||||||
_machine.AddNode<FsmPatchInit>();
|
_machine.AddNode<FsmPatchPrepare>();
|
||||||
|
_machine.AddNode<FsmInitialize>();
|
||||||
_machine.AddNode<FsmUpdateVersion>();
|
_machine.AddNode<FsmUpdateVersion>();
|
||||||
_machine.AddNode<FsmUpdateManifest>();
|
_machine.AddNode<FsmUpdateManifest>();
|
||||||
_machine.AddNode<FsmCreateDownloader>();
|
_machine.AddNode<FsmCreateDownloader>();
|
||||||
@@ -68,7 +70,7 @@ public class PatchManager : ModuleSingleton<PatchManager>, IModule
|
|||||||
_machine.AddNode<FsmDownloadOver>();
|
_machine.AddNode<FsmDownloadOver>();
|
||||||
_machine.AddNode<FsmClearCache>();
|
_machine.AddNode<FsmClearCache>();
|
||||||
_machine.AddNode<FsmPatchDone>();
|
_machine.AddNode<FsmPatchDone>();
|
||||||
_machine.Run<FsmPatchInit>();
|
_machine.Run<FsmPatchPrepare>();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -81,7 +83,11 @@ public class PatchManager : ModuleSingleton<PatchManager>, IModule
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void OnHandleEventMessage(IEventMessage message)
|
private void OnHandleEventMessage(IEventMessage message)
|
||||||
{
|
{
|
||||||
if (message is UserEventDefine.UserBeginDownloadWebFiles)
|
if (message is UserEventDefine.UserTryInitialize)
|
||||||
|
{
|
||||||
|
_machine.ChangeState<FsmInitialize>();
|
||||||
|
}
|
||||||
|
else if (message is UserEventDefine.UserBeginDownloadWebFiles)
|
||||||
{
|
{
|
||||||
_machine.ChangeState<FsmDownloadFiles>();
|
_machine.ChangeState<FsmDownloadFiles>();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ public class PatchWindow : MonoBehaviour
|
|||||||
_messageBoxObj = transform.Find("UIWindow/MessgeBox").gameObject;
|
_messageBoxObj = transform.Find("UIWindow/MessgeBox").gameObject;
|
||||||
_messageBoxObj.SetActive(false);
|
_messageBoxObj.SetActive(false);
|
||||||
|
|
||||||
|
_eventGroup.AddListener<PatchEventDefine.InitializeFailed>(OnHandleEventMessage);
|
||||||
_eventGroup.AddListener<PatchEventDefine.PatchStatesChange>(OnHandleEventMessage);
|
_eventGroup.AddListener<PatchEventDefine.PatchStatesChange>(OnHandleEventMessage);
|
||||||
_eventGroup.AddListener<PatchEventDefine.FoundUpdateFiles>(OnHandleEventMessage);
|
_eventGroup.AddListener<PatchEventDefine.FoundUpdateFiles>(OnHandleEventMessage);
|
||||||
_eventGroup.AddListener<PatchEventDefine.DownloadProgressUpdate>(OnHandleEventMessage);
|
_eventGroup.AddListener<PatchEventDefine.DownloadProgressUpdate>(OnHandleEventMessage);
|
||||||
@@ -87,7 +88,15 @@ public class PatchWindow : MonoBehaviour
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void OnHandleEventMessage(IEventMessage message)
|
private void OnHandleEventMessage(IEventMessage message)
|
||||||
{
|
{
|
||||||
if (message is PatchEventDefine.PatchStatesChange)
|
if (message is PatchEventDefine.InitializeFailed)
|
||||||
|
{
|
||||||
|
System.Action callback = () =>
|
||||||
|
{
|
||||||
|
UserEventDefine.UserTryInitialize.SendEventMessage();
|
||||||
|
};
|
||||||
|
ShowMessageBox($"Failed to initialize package !", callback);
|
||||||
|
}
|
||||||
|
else if (message is PatchEventDefine.PatchStatesChange)
|
||||||
{
|
{
|
||||||
var msg = message as PatchEventDefine.PatchStatesChange;
|
var msg = message as PatchEventDefine.PatchStatesChange;
|
||||||
_tips.text = msg.Tips;
|
_tips.text = msg.Tips;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "com.tuyoogame.yooasset",
|
"name": "com.tuyoogame.yooasset",
|
||||||
"displayName": "YooAsset",
|
"displayName": "YooAsset",
|
||||||
"version": "1.3.7",
|
"version": "1.4.0-preview",
|
||||||
"unity": "2019.4",
|
"unity": "2019.4",
|
||||||
"description": "unity3d resources management system.",
|
"description": "unity3d resources management system.",
|
||||||
"author": {
|
"author": {
|
||||||
|
|||||||
@@ -6,6 +6,10 @@
|
|||||||
|
|
||||||
windows平台添加命令: **-force-gles**
|
windows平台添加命令: **-force-gles**
|
||||||
|
|
||||||
|
#### 问题:Unity2021编辑器运行游戏提示YooAssets is initialized !
|
||||||
|
|
||||||
|
尝试关闭:Project Setting ---> Editor ---> Enter Play Mode Options
|
||||||
|
|
||||||
#### 问题:YooAsset的DLL引用丢失导致编译报错了
|
#### 问题:YooAsset的DLL引用丢失导致编译报错了
|
||||||
|
|
||||||
1. 请在PlayerSetting里修改API Level为.NET 4.x或者.NET Framework
|
1. 请在PlayerSetting里修改API Level为.NET 4.x或者.NET Framework
|
||||||
@@ -36,7 +40,8 @@ internal class FsmClearCache : IFsmNode
|
|||||||
void IFsmNode.OnEnter()
|
void IFsmNode.OnEnter()
|
||||||
{
|
{
|
||||||
Debug.Log("清理未使用的缓存文件!");
|
Debug.Log("清理未使用的缓存文件!");
|
||||||
var operation = YooAssets.ClearUnusedCacheFiles();
|
var package = YooAssets.GetPackage("DefaultPackage");
|
||||||
|
var operation = package.ClearUnusedCacheFiles();
|
||||||
operation.Completed += Operation_Completed;
|
operation.Completed += Operation_Completed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 73 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 85 KiB |
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
#### 示例内容
|
#### 示例内容
|
||||||
|
|
||||||
**Basic Sample** 包含资源热更和加载的示例。
|
**Space Shooter** 太空战机DEMO,包含资源热更和加载的示例。
|
||||||
|
|
||||||
**Extension Sample** 包含编辑器扩展代码的示例。
|
**Extension Sample** 包含编辑器扩展代码的示例。
|
||||||
|
|
||||||
@@ -14,6 +14,6 @@
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
1. Basic Sample在导入完成后,打开YooAsset->AssetBundle Collector窗口。
|
1. Space Shooter在导入完成后,打开YooAsset->AssetBundle Collector窗口。
|
||||||
1. 点击修复按钮,然后点击Save按钮保存配置,最后关闭窗口。
|
1. 点击修复按钮,然后点击Save按钮保存配置,最后关闭窗口。
|
||||||
3. 找到Boot.scene场景启动游戏。
|
3. 找到Boot.scene场景启动游戏。
|
||||||
|
|||||||
Reference in New Issue
Block a user