update editor code

pull/62/head
hevinci 2022-12-21 12:04:56 +08:00
parent 4a158319e5
commit 66cd491493
4 changed files with 20 additions and 19 deletions

View File

@ -184,8 +184,11 @@ namespace YooAsset.Editor
{ {
IPackRule packRule = PackDirectory.StaticPackRule; IPackRule packRule = PackDirectory.StaticPackRule;
var bundleName = packRule.GetBundleName(new PackRuleData(AssetPath)); var bundleName = packRule.GetBundleName(new PackRuleData(AssetPath));
var shareBundleName = $"share_{bundleName}.{YooAssetSettingsData.Setting.AssetBundleFileVariant}"; if (YooAssetSettingsData.Setting.RegularBundleName)
_shareBundleName = EditorTools.GetRegularPath(shareBundleName).ToLower(); bundleName = EditorTools.GetRegularPath(bundleName).Replace('/', '_').Replace('.', '_').ToLower();
else
bundleName = EditorTools.GetRegularPath(bundleName).ToLower();
_shareBundleName = $"share_{bundleName}.{YooAssetSettingsData.Setting.AssetBundleFileVariant}";
} }
} }

View File

@ -7,18 +7,18 @@ namespace YooAsset.Editor
public enum EOutputNameStyle public enum EOutputNameStyle
{ {
/// <summary> /// <summary>
/// 000000000000000f000000000000000 /// 哈希值名称
/// </summary> /// </summary>
HashName = 1, HashName = 1,
/// <summary> /// <summary>
/// 000000000000000f000000000000000.bundle /// 资源包名称
/// </summary> /// </summary>
HashName_Extension = 2, BundleName = 2,
/// <summary> /// <summary>
/// 000000000000000f000000000000000_bundle_name.bundle /// 资源包名称 + 哈希值名称
/// </summary> /// </summary>
HashName_BundleName_Extension = 4, BundleName_HashName = 4,
} }
} }

View File

@ -293,7 +293,10 @@ namespace YooAsset.Editor
// 根据规则设置获取资源包名称 // 根据规则设置获取资源包名称
IPackRule packRuleInstance = AssetBundleCollectorSettingData.GetPackRuleInstance(PackRuleName); IPackRule packRuleInstance = AssetBundleCollectorSettingData.GetPackRuleInstance(PackRuleName);
string bundleName = packRuleInstance.GetBundleName(new PackRuleData(assetPath, CollectPath, group.GroupName)); string bundleName = packRuleInstance.GetBundleName(new PackRuleData(assetPath, CollectPath, group.GroupName));
return EditorTools.GetRegularPath(bundleName).ToLower(); if(YooAssetSettingsData.Setting.RegularBundleName)
return EditorTools.GetRegularPath(bundleName).Replace('/', '_').Replace('.', '_').ToLower();
else
return EditorTools.GetRegularPath(bundleName).ToLower();
} }
private List<string> GetAssetTags(AssetBundleCollectorGroup group) private List<string> GetAssetTags(AssetBundleCollectorGroup group)
{ {

View File

@ -15,8 +15,7 @@ namespace YooAsset.Editor
{ {
string IPackRule.GetBundleName(PackRuleData data) string IPackRule.GetBundleName(PackRuleData data)
{ {
string bundleName = StringUtility.RemoveExtension(data.AssetPath); return StringUtility.RemoveExtension(data.AssetPath);
return EditorTools.GetRegularPath(bundleName).Replace('/', '_');
} }
} }
@ -33,8 +32,7 @@ namespace YooAsset.Editor
string IPackRule.GetBundleName(PackRuleData data) string IPackRule.GetBundleName(PackRuleData data)
{ {
string bundleName = Path.GetDirectoryName(data.AssetPath); return Path.GetDirectoryName(data.AssetPath);
return EditorTools.GetRegularPath(bundleName).Replace('/', '_');
} }
} }
@ -58,7 +56,7 @@ namespace YooAsset.Editor
if (Path.HasExtension(splits[0])) if (Path.HasExtension(splits[0]))
throw new Exception($"Not found root directory : {assetPath}"); throw new Exception($"Not found root directory : {assetPath}");
string bundleName = $"{data.CollectPath}/{splits[0]}"; string bundleName = $"{data.CollectPath}/{splits[0]}";
return EditorTools.GetRegularPath(bundleName).Replace('/', '_'); return bundleName;
} }
else else
{ {
@ -79,13 +77,11 @@ namespace YooAsset.Editor
string collectPath = data.CollectPath; string collectPath = data.CollectPath;
if (AssetDatabase.IsValidFolder(collectPath)) if (AssetDatabase.IsValidFolder(collectPath))
{ {
string bundleName = collectPath; return collectPath;
return EditorTools.GetRegularPath(bundleName).Replace('/', '_');
} }
else else
{ {
string bundleName = StringUtility.RemoveExtension(collectPath); return StringUtility.RemoveExtension(collectPath);
return EditorTools.GetRegularPath(bundleName).Replace('/', '_');
} }
} }
} }
@ -126,8 +122,7 @@ namespace YooAsset.Editor
if (depends.Length != 1) if (depends.Length != 1)
throw new Exception($"{nameof(PackRawFile)} is not support estension : {extension}"); throw new Exception($"{nameof(PackRawFile)} is not support estension : {extension}");
string bundleName = data.AssetPath; return data.AssetPath;
return EditorTools.GetRegularPath(bundleName).Replace('/', '_').Replace('.', '_');
} }
} }