public void MessageInfo(string LabelInfo, int TypeInfo) { LeanTween.scale(gameObject, Vector3.one, 0f); System.Globalization.CultureInfo cultureInfo = System.Threading.Thread.CurrentThread.CurrentCulture; System.Globalization.TextInfo textInfo = cultureInfo.TextInfo; Label.text = textInfo.ToUpper(LabelInfo); switch (TypeInfo) { case 1: Btn3.gameObject.SetActive(false); Btn2.gameObject.SetActive(true); break; case 2: Btn2.gameObject.SetActive(false); Btn3.gameObject.SetActive(false); break; default: Btn2.gameObject.SetActive(true); Btn3.gameObject.SetActive(true); break; } }
private string DoFirstLetterCase(NamePart name, bool upper, TextInfo textInfo) { string nameValue = name; if (string.IsNullOrEmpty(nameValue)) { return nameValue; } char c = nameValue[0]; if (upper) { c = textInfo.ToUpper(c); } else { c = textInfo.ToLower(c); } if (nameValue.Length > 1) { nameValue = c.ToString() + nameValue.Substring(1); } else { nameValue = c.ToString(); } return nameValue; }
private static Func<string, string> GetCaseChange(TextInfo info, string text) { if (info.ToLower(text) == text) return (txt) => info.ToTitleCase(txt); else if (info.ToUpper(text) == text) return (txt) => info.ToLower(txt); else return (txt) => info.ToUpper(txt); }
private string DoFirstWordCasing(NamePart name, NameGeneratorCasingOption casing, TextInfo textInfo) { if (name.ExplicitCasing) return name; switch (casing) { case NameGeneratorCasingOption.Camel: return TestHasAdjacentUpperCase(name) ? (string)name : DoFirstLetterCase(name, false, textInfo); case NameGeneratorCasingOption.Pascal: return TestHasAdjacentUpperCase(name) ? (string)name : DoFirstLetterCase(name, true, textInfo); case NameGeneratorCasingOption.Lower: return TestHasAdjacentUpperCase(name) ? (string)name : textInfo.ToLower(name); case NameGeneratorCasingOption.Upper: return textInfo.ToUpper(name); } return null; }