1/// <summary>2/// Update the visual text Text.3/// </summary>45 protected voidUpdateLabel()6{7if(m_TextComponent != null && m_TextComponent.font != null && m_PreventCallback == false)8{9// Prevent callback from the text component as we assign new text. This is to prevent a recursive call.10 m_PreventCallback = true;1112 string fullText;13if(compositionString.Length >0)14{15 fullText = text.Substring(0, m_StringPosition)+ compositionString + text.Substring(m_StringPosition);1617// Should adjust caret position18//Debug.Log("Handling IME Input... [" + compositionString + "] of length [" + compositionString.Length + "] at StringPosition [" + m_StringPosition + "]");19//for (int i = 0; i < compositionString.Length; i++)20// Debug.Log((uint)compositionString[i]);21}22else23{24 fullText = text;25//Debug.Log("Handling Input... [" + text + "]");26}2728 string processed;29if(inputType == InputType.Password)30 processed = new string(asteriskChar, fullText.Length);31else32 processed = fullText;3334 bool isEmpty = string.IsNullOrEmpty(fullText);3536if(m_Placeholder != null)37 m_Placeholder.enabled = isEmpty;3839if(!isEmpty)40{41SetCaretVisible();42}4344 m_TextComponent.text = processed +"\u200B";// Extra space is added for Caret tracking.4546// Special handling to limit the number of lines of text in the Input Field.47if(m_LineLimit >0)48{49 m_TextComponent.ForceMeshUpdate();5051// Check if text exceeds maximum number of lines.52if(m_TextComponent.textInfo.lineCount > m_LineLimit)53{54int lastValidCharacterIndex = m_TextComponent.textInfo.lineInfo[m_LineLimit -1].lastCharacterIndex;55int characterStringIndex = m_TextComponent.textInfo.characterInfo[lastValidCharacterIndex].index + m_TextComponent.textInfo.characterInfo[lastValidCharacterIndex].stringLength;56 text = processed.Remove(characterStringIndex, processed.Length - characterStringIndex);57 m_TextComponent.text = text +"\u200B";58}59}6061if(m_IsTextComponentUpdateRequired)62{63 m_IsTextComponentUpdateRequired = false;64 m_TextComponent.ForceMeshUpdate();65}6667MarkGeometryAsDirty();6869// Scrollbar should be updated.70 m_IsScrollbarUpdateRequired = true;7172 m_PreventCallback = false;73}74}
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/01/28 00:54