update editor code

pull/122/head
hevinci 2023-06-13 16:41:08 +08:00
parent 651b65d148
commit cf532a84ef
3 changed files with 15 additions and 4 deletions

View File

@ -251,7 +251,7 @@ namespace YooAsset.Editor
// 检测原生文件是否合规 // 检测原生文件是否合规
if (isRawFilePackRule) if (isRawFilePackRule)
{ {
string extension = StringUtility.RemoveFirstChar(System.IO.Path.GetExtension(assetPath)); string extension = EditorTools.RemoveFirstChar(System.IO.Path.GetExtension(assetPath));
if (extension == EAssetFileExtension.unity.ToString() || extension == EAssetFileExtension.prefab.ToString() || if (extension == EAssetFileExtension.unity.ToString() || extension == EAssetFileExtension.prefab.ToString() ||
extension == EAssetFileExtension.fbx.ToString() || extension == EAssetFileExtension.mat.ToString() || extension == EAssetFileExtension.fbx.ToString() || extension == EAssetFileExtension.mat.ToString() ||
extension == EAssetFileExtension.controller.ToString() || extension == EAssetFileExtension.anim.ToString() || extension == EAssetFileExtension.controller.ToString() || extension == EAssetFileExtension.anim.ToString() ||

View File

@ -40,7 +40,7 @@ namespace YooAsset.Editor
{ {
PackRuleResult IPackRule.GetPackRuleResult(PackRuleData data) PackRuleResult IPackRule.GetPackRuleResult(PackRuleData data)
{ {
string bundleName = StringUtility.RemoveExtension(data.AssetPath); string bundleName = PathUtility.RemoveExtension(data.AssetPath);
PackRuleResult result = new PackRuleResult(bundleName, DefaultPackRule.AssetBundleFileExtension); PackRuleResult result = new PackRuleResult(bundleName, DefaultPackRule.AssetBundleFileExtension);
return result; return result;
} }
@ -125,7 +125,7 @@ namespace YooAsset.Editor
} }
else else
{ {
bundleName = StringUtility.RemoveExtension(collectPath); bundleName = PathUtility.RemoveExtension(collectPath);
} }
PackRuleResult result = new PackRuleResult(bundleName, DefaultPackRule.AssetBundleFileExtension); PackRuleResult result = new PackRuleResult(bundleName, DefaultPackRule.AssetBundleFileExtension);

View File

@ -286,6 +286,18 @@ namespace YooAsset.Editor
#endregion #endregion
#region StringUtility #region StringUtility
public static string RemoveFirstChar(string str)
{
if (string.IsNullOrEmpty(str))
return str;
return str.Substring(1);
}
public static string RemoveLastChar(string str)
{
if (string.IsNullOrEmpty(str))
return str;
return str.Substring(0, str.Length - 1);
}
public static List<string> StringToStringList(string str, char separator) public static List<string> StringToStringList(string str, char separator)
{ {
List<string> result = new List<string>(); List<string> result = new List<string>();
@ -303,7 +315,6 @@ namespace YooAsset.Editor
} }
return result; return result;
} }
public static T NameToEnum<T>(string name) public static T NameToEnum<T>(string name)
{ {
if (Enum.IsDefined(typeof(T), name) == false) if (Enum.IsDefined(typeof(T), name) == false)