Update DefaultPackRule.cs

修改了默认的打包规则
pull/36/head
hevinci 2022-08-15 10:29:28 +08:00
parent 631547f8c7
commit b5be5b60da
1 changed files with 9 additions and 5 deletions

View File

@ -15,7 +15,8 @@ namespace YooAsset.Editor
{ {
string IPackRule.GetBundleName(PackRuleData data) string IPackRule.GetBundleName(PackRuleData data)
{ {
return StringUtility.RemoveExtension(data.AssetPath); string bundleName = StringUtility.RemoveExtension(data.AssetPath);
return EditorTools.GetRegularPath(bundleName).Replace('/', '_');
} }
} }
@ -32,7 +33,8 @@ namespace YooAsset.Editor
string IPackRule.GetBundleName(PackRuleData data) string IPackRule.GetBundleName(PackRuleData data)
{ {
return Path.GetDirectoryName(data.AssetPath); string bundleName = Path.GetDirectoryName(data.AssetPath);
return EditorTools.GetRegularPath(bundleName).Replace('/', '_');
} }
} }
@ -55,7 +57,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 bundleName; return EditorTools.GetRegularPath(bundleName).Replace('/', '_');
} }
else else
{ {
@ -72,7 +74,8 @@ namespace YooAsset.Editor
{ {
string IPackRule.GetBundleName(PackRuleData data) string IPackRule.GetBundleName(PackRuleData data)
{ {
return StringUtility.RemoveExtension(data.CollectPath); string bundleName = StringUtility.RemoveExtension(data.CollectPath);
return EditorTools.GetRegularPath(bundleName).Replace('/', '_');
} }
} }
@ -110,7 +113,8 @@ 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}");
return StringUtility.RemoveExtension(data.AssetPath); string bundleName = StringUtility.RemoveExtension(data.AssetPath);
return EditorTools.GetRegularPath(bundleName).Replace('/', '_');
} }
} }