分散文件结构,添加了枚举类型的一个辅助类

This commit is contained in:
2023-09-20 11:04:11 +08:00
parent 8fec9bbc3a
commit a024cf600b
84 changed files with 3267 additions and 221 deletions
+41
View File
@@ -0,0 +1,41 @@
using System.Collections;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using UnityEngine;
namespace XericLibrary.Runtime.MacroLibrary
{
public static partial class MacroMath
{
#region
/// <summary>
/// 获取此处的物体名称,如果带有(clone)后缀,则省略这个后缀
/// </summary>
[MethodImpl(MethodImplOptions.NoInlining)]
public static string GetGameObjectNameWithoutClone(GameObject gameObject)
{
return GetGameObjectNameWithoutClone(gameObject.name);
}
/// <summary>
/// 获取此处的物体名称,如果带有(clone)后缀,则省略这个后缀
/// </summary>
[MethodImpl(MethodImplOptions.NoInlining)]
public static string GetGameObjectNameWithoutClone(string gameObjectName)
{
const string cloneSuffix = "(Clone)";
if(gameObjectName.EndsWith(cloneSuffix))
{
int suffixIndex = gameObjectName.LastIndexOf(cloneSuffix);
string nameWithoutClone = gameObjectName.Substring(0, suffixIndex);
return nameWithoutClone;
}
return gameObjectName;
}
#endregion
}
}