public static void OnLanguageChange(this UIText self) { self.ActivatingComponent(); { if (I18NComponent.Instance.I18NTryGetText(self.__text_key, out var text) && self.keyParams != null) { text = string.Format(text, self.keyParams); } self.unity_uitext.text = text; } }
//当手动修改text的时候,需要将mono的i18textcomponent给禁用掉 static void __DisableI18Component(this UIText self, bool enable = false) { self.ActivatingComponent(); if (self.unity_i18ncomp_touched != null) { self.unity_i18ncomp_touched.enabled = enable; if (!enable) { Log.Warning($"组件{self.GetGameObject().name}, text在逻辑层进行了修改,所以应该去掉去预设里面的I18N组件,否则会被覆盖"); } } }
public static string GetText(this UIText self) { self.ActivatingComponent(); return(self.unity_uitext.text); }
public static void SetTextColor(this UIText self, Color color) { self.ActivatingComponent(); self.unity_uitext.color = color; }