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;
var bundleName = packRule.GetBundleName(new PackRuleData(AssetPath));
var shareBundleName = $"share_{bundleName}.{YooAssetSettingsData.Setting.AssetBundleFileVariant}";
_shareBundleName = EditorTools.GetRegularPath(shareBundleName).ToLower();
if (YooAssetSettingsData.Setting.RegularBundleName)
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
{
/// <summary>
/// 000000000000000f000000000000000
/// 哈希值名称
/// </summary>
HashName = 1,
/// <summary>
/// 000000000000000f000000000000000.bundle
/// 资源包名称
/// </summary>
HashName_Extension = 2,
BundleName = 2,
/// <summary>
/// 000000000000000f000000000000000_bundle_name.bundle
/// 资源包名称 + 哈希值名称
/// </summary>
HashName_BundleName_Extension = 4,
BundleName_HashName = 4,
}
}

View File

@ -293,7 +293,10 @@ namespace YooAsset.Editor
// 根据规则设置获取资源包名称
IPackRule packRuleInstance = AssetBundleCollectorSettingData.GetPackRuleInstance(PackRuleName);
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)
{

View File

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