A game about forced loneliness, made by TACStudios
1using System; 2using System.Linq; 3 4namespace Unity.VisualScripting 5{ 6 public static class BoltFlowNameUtility 7 { 8 [Obsolete("This method is obsolete. Please use the new UnitTitle(unitType, short, includeStatus) instead.")] 9 public static string UnitTitle(Type unitType, bool @short) 10 { 11 if (@short) 12 { 13 var shortTitle = unitType.GetAttribute<UnitShortTitleAttribute>()?.title; 14 15 if (shortTitle != null) 16 { 17 return shortTitle; 18 } 19 } 20 21 var title = unitType.GetAttribute<UnitTitleAttribute>()?.title; 22 23 if (title != null) 24 { 25 return title; 26 } 27 28 return unitType.HumanName(); 29 } 30 31 public static string UnitTitle(Type unitType, bool @short, bool includeStatus) 32 { 33 var suffix = string.Empty; 34 if (includeStatus && Attribute.IsDefined(unitType, typeof(ObsoleteAttribute))) 35 suffix = " (Deprecated)"; 36 37 if (@short) 38 { 39 var shortTitle = unitType.GetAttribute<UnitShortTitleAttribute>()?.title; 40 41 if (shortTitle != null) 42 { 43 return $"{shortTitle} {suffix}"; 44 } 45 } 46 47 var title = unitType.GetAttribute<UnitTitleAttribute>()?.title; 48 49 return title != null ? $"{title} {suffix}" : $"{unitType.HumanName()} {suffix}"; 50 } 51 52 public static string UnitPreviousTitle(Type unitType) 53 { 54 var title = unitType.GetAttribute<RenamedFromAttribute>()?.previousName.Split('.').Last(); 55 return title ?? string.Empty; 56 } 57 } 58}