static int _m_ForceMeshUpdate(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); TMPro.TextMeshProUGUI gen_to_be_invoked = (TMPro.TextMeshProUGUI)translator.FastGetCSObj(L, 1); int gen_param_count = LuaAPI.lua_gettop(L); if (gen_param_count == 1) { gen_to_be_invoked.ForceMeshUpdate( ); return(0); } if (gen_param_count == 2 && LuaTypes.LUA_TBOOLEAN == LuaAPI.lua_type(L, 2)) { bool _ignoreInactive = LuaAPI.lua_toboolean(L, 2); gen_to_be_invoked.ForceMeshUpdate(_ignoreInactive); return(0); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to TMPro.TextMeshProUGUI.ForceMeshUpdate!")); }
internal void ArrangeMessages() { m_VisibleMessages = 0; m_Height = 0; m_Width = 0; if (!Visible) { return; } switch (Mode) { case MessageModeType.Say: case MessageModeType.Whisper: case MessageModeType.Yell: case MessageModeType.Spell: case MessageModeType.NpcFrom: case MessageModeType.BarkLoud: case MessageModeType.BarkLow: int i = 0; while (m_VisibleMessages < m_Messages.Length) { var onscreenMessage = m_Messages.GetItemAt(m_VisibleMessages); var size = m_TextMesh.GetPreferredValues(onscreenMessage.RichText); if (m_Height + size.y <= Constants.OnscreenMessageHeight) { m_VisibleMessages++; m_Width = Mathf.Max(m_Width, size.x); m_Height += size.y; onscreenMessage.VisibleSince = Mathf.Min(OpenTibiaUnity.TicksMillis, onscreenMessage.VisibleSince); m_TextMesh.text += (i++ == 0 ? "" : "\n") + onscreenMessage.RichText; continue; } break; } break; default: if (m_Messages.Length > 0) { var onscreenMessage = m_Messages.GetItemAt(0); m_TextMesh.text = onscreenMessage.RichText; var size = m_TextMesh.GetPreferredValues(); m_VisibleMessages = 1; m_Width = size.x; m_Height = size.y; onscreenMessage.VisibleSince = Mathf.Min(OpenTibiaUnity.TicksMillis, onscreenMessage.VisibleSince); } break; } m_TextMesh.ForceMeshUpdate(); }
public void DoLocalize_TMPUGUILabel(string MainTranslation, string SecondaryTranslation) { { //--[ Localize Font Object ]---------- #if TextMeshPro_Pre53 TMPro.TextMeshProFont newFont = GetSecondaryTranslatedObj <TMPro.TextMeshProFont>(ref MainTranslation, ref SecondaryTranslation); #else TMPro.TMP_FontAsset newFont = GetSecondaryTranslatedObj <TMPro.TMP_FontAsset>(ref MainTranslation, ref SecondaryTranslation); #endif if (newFont != null) { if (mTarget_TMPUGUILabel.font != newFont) { mTarget_TMPUGUILabel.font = newFont; } } else { //--[ Localize Font Material ]---------- Material newMat = GetSecondaryTranslatedObj <Material>(ref MainTranslation, ref SecondaryTranslation); if (newMat != null && mTarget_TMPUGUILabel.fontMaterial != newMat) { mTarget_TMPUGUILabel.fontMaterial = newMat; } } } if (mInitializeAlignment) { mInitializeAlignment = false; mOriginalAlignmentTMPro = mTarget_TMPUGUILabel.alignment; } if (!string.IsNullOrEmpty(MainTranslation) && mTarget_TMPUGUILabel.text != MainTranslation) { if (Localize.CurrentLocalizeComponent.CorrectAlignmentForRTL) { if (mTarget_TMPUGUILabel.alignment <= TMPro.TextAlignmentOptions.TopJustified) { mTarget_TMPUGUILabel.alignment = LocalizationManager.IsRight2Left ? TMPro.TextAlignmentOptions.TopRight : mOriginalAlignmentTMPro; } else if (mTarget_TMPUGUILabel.alignment <= TMPro.TextAlignmentOptions.Justified) { mTarget_TMPUGUILabel.alignment = LocalizationManager.IsRight2Left ? TMPro.TextAlignmentOptions.Right : mOriginalAlignmentTMPro; } else { mTarget_TMPUGUILabel.alignment = LocalizationManager.IsRight2Left ? TMPro.TextAlignmentOptions.BottomRight : mOriginalAlignmentTMPro; } } mTarget_TMPUGUILabel.text = MainTranslation; mTarget_TMPUGUILabel.ForceMeshUpdate(); } }
public void Initialize(string title, string progress) { m_RectTransform = GetComponent <RectTransform>(); // Set value text. m_ValueText.text = progress; m_ValueText.ForceMeshUpdate(); // Set name text and margin to make room for value text. Vector4 margin = m_NameText.margin; margin.z = 4 + (string.IsNullOrEmpty(progress) ? 0 : m_ValueText.renderedWidth + s_NameAndValueSpacing); m_NameText.margin = margin; m_NameText.text = title; }
public void Initialize(string title, string description, string progress) { m_RectTransform = GetComponent <RectTransform>(); // Set progress text. m_ProgressText.text = progress; m_ProgressText.ForceMeshUpdate(); // Set title text and margin to make room for progress text. Vector4 margin = m_TitleText.margin; margin.z = 4 + (string.IsNullOrEmpty(progress) ? 0 : m_ProgressText.renderedWidth + s_TitleAndProgressSpacing); m_TitleText.margin = margin; m_TitleText.text = title; // Set description text. m_DescriptionText.text = description; }