스타일 가이드 수정 중
This commit is contained in:
@@ -545,6 +545,21 @@ namespace UVC.UIToolkit.Editor
|
||||
sb.AppendLine(" public static IEnumerable<string> GetAllIconNames() => _pathsByName.Keys;");
|
||||
sb.AppendLine();
|
||||
|
||||
sb.AppendLine(" /// <summary>");
|
||||
sb.AppendLine(" /// 리소스 경로로 아이콘 이름을 조회합니다.");
|
||||
sb.AppendLine(" /// </summary>");
|
||||
sb.AppendLine(" /// <param name=\"resourcePath\">리소스 경로 (예: Icons/Home)</param>");
|
||||
sb.AppendLine(" /// <returns>아이콘 이름, 없으면 빈 문자열</returns>");
|
||||
sb.AppendLine(" public static string GetIconName(string resourcePath)");
|
||||
sb.AppendLine(" {");
|
||||
sb.AppendLine(" foreach (var kvp in _pathsByName)");
|
||||
sb.AppendLine(" {");
|
||||
sb.AppendLine(" if (kvp.Value == resourcePath) return kvp.Key;");
|
||||
sb.AppendLine(" }");
|
||||
sb.AppendLine(" return string.Empty;");
|
||||
sb.AppendLine(" }");
|
||||
sb.AppendLine();
|
||||
|
||||
sb.AppendLine(" /// <summary>");
|
||||
sb.AppendLine(" /// 전체 아이콘 수를 반환합니다.");
|
||||
sb.AppendLine(" /// </summary>");
|
||||
|
||||
@@ -465,8 +465,22 @@ namespace UVC.UIToolkit.Editor
|
||||
sb.AppendLine(" /// <returns>아이콘 문자, 없으면 빈 문자열</returns>");
|
||||
sb.AppendLine(" public static string GetIcon(string iconName)");
|
||||
sb.AppendLine(" {");
|
||||
sb.AppendLine(" // 실제 유니코드 문자가 아니라 이스케이프 문자열인 경우 변환");
|
||||
sb.AppendLine(" if (iconName.StartsWith(\"\\u\") && iconName.Length == 6)");
|
||||
sb.AppendLine(" {");
|
||||
sb.AppendLine(" try");
|
||||
sb.AppendLine(" {");
|
||||
sb.AppendLine(" var code = Convert.ToInt32(iconName.Substring(2), 16);");
|
||||
sb.AppendLine(" iconName = char.ConvertFromUtf32(code);");
|
||||
sb.AppendLine(" }");
|
||||
sb.AppendLine(" catch");
|
||||
sb.AppendLine(" {");
|
||||
sb.AppendLine(" Debug.LogWarning($\"Failed to convert escape sequence: {iconName}\");");
|
||||
sb.AppendLine(" }");
|
||||
sb.AppendLine(" }");
|
||||
sb.AppendLine(" ");
|
||||
sb.AppendLine(" if(IsIconChar(iconName)) return iconName;");
|
||||
sb.AppendLine(" return _iconsByName.TryGetValue(iconName, out var icon) ? icon : string.Empty;");
|
||||
sb.AppendLine(" return _iconsByName.TryGetValue(iconName.ToLower(), out var icon) ? icon : string.Empty;");
|
||||
sb.AppendLine(" }");
|
||||
sb.AppendLine();
|
||||
|
||||
@@ -482,6 +496,19 @@ namespace UVC.UIToolkit.Editor
|
||||
sb.AppendLine(" public static bool IsIconChar(string iconChar) => _iconsByName.Values.Contains(iconChar);");
|
||||
sb.AppendLine();
|
||||
|
||||
sb.AppendLine(" /// <summary>");
|
||||
sb.AppendLine(" /// 유니코드 문자로 아이콘 이름을 조회합니다.");
|
||||
sb.AppendLine(" /// </summary>");
|
||||
sb.AppendLine(" public static string GetIconNameByChar(string iconChar)");
|
||||
sb.AppendLine(" {");
|
||||
sb.AppendLine(" foreach (var kvp in _iconsByName)");
|
||||
sb.AppendLine(" {");
|
||||
sb.AppendLine(" if (string.Equals(kvp.Value, iconChar, StringComparison.OrdinalIgnoreCase)) return kvp.Key;");
|
||||
sb.AppendLine(" }");
|
||||
sb.AppendLine(" return string.Empty;");
|
||||
sb.AppendLine(" }");
|
||||
sb.AppendLine();
|
||||
|
||||
sb.AppendLine(" /// <summary>");
|
||||
sb.AppendLine(" /// 모든 아이콘 이름 목록을 반환합니다.");
|
||||
sb.AppendLine(" /// </summary>");
|
||||
|
||||
Reference in New Issue
Block a user