void LateUpdate() { if (TMP_TextUtilities.IsIntersectingRectTransform(m_TextComponent.rectTransform, Input.mousePosition, m_Camera)) { #region Example of Character Selection int charIndex = TMP_TextUtilities.FindIntersectingCharacter(m_TextComponent, Input.mousePosition, m_Camera, true); if (charIndex != -1 && charIndex != m_lastCharIndex) { m_lastCharIndex = charIndex; // Send event to any event listeners. SendOnCharacterSelection(m_TextComponent.textInfo.characterInfo[charIndex].character, charIndex); } #endregion #region Example of Word Selection // Check if Mouse intersects any words and if so assign a random color to that word. int wordIndex = TMP_TextUtilities.FindIntersectingWord(m_TextComponent, Input.mousePosition, m_Camera); if (wordIndex != -1 && wordIndex != m_lastWordIndex) { m_lastWordIndex = wordIndex; // Get the information about the selected word. TMP_WordInfo wInfo = m_TextComponent.textInfo.wordInfo[wordIndex]; // Send the event to any listeners. SendOnWordSelection(wInfo.GetWord(), wInfo.firstCharacterIndex, wInfo.characterCount); } #endregion #region Example of Link Handling // Check if mouse intersects with any links. int linkIndex = TMP_TextUtilities.FindIntersectingLink(m_TextComponent, Input.mousePosition, m_Camera); // Handle new Link selection. if (linkIndex != -1 && linkIndex != m_selectedLink) { m_selectedLink = linkIndex; // Get information about the link. TMP_LinkInfo linkInfo = m_TextComponent.textInfo.linkInfo[linkIndex]; // Send the event to any listeners. SendOnLinkSelection(linkInfo.GetLinkID(), linkInfo.GetLinkText(), linkIndex); } #endregion } }
// Token: 0x0600456E RID: 17774 RVA: 0x00174B44 File Offset: 0x00172F44 private void LateUpdate() { if (TMP_TextUtilities.IsIntersectingRectTransform(this.m_TextComponent.rectTransform, Input.mousePosition, this.m_Camera)) { int num = TMP_TextUtilities.FindIntersectingCharacter(this.m_TextComponent, Input.mousePosition, this.m_Camera, true); if (num != -1 && num != this.m_lastCharIndex) { this.m_lastCharIndex = num; this.SendOnCharacterSelection(this.m_TextComponent.textInfo.characterInfo[num].character, num); } int num2 = TMP_TextUtilities.FindIntersectingWord(this.m_TextComponent, Input.mousePosition, this.m_Camera); if (num2 != -1 && num2 != this.m_lastWordIndex) { this.m_lastWordIndex = num2; TMP_WordInfo tmp_WordInfo = this.m_TextComponent.textInfo.wordInfo[num2]; this.SendOnWordSelection(tmp_WordInfo.GetWord(), tmp_WordInfo.firstCharacterIndex, tmp_WordInfo.characterCount); } int num3 = TMP_TextUtilities.FindIntersectingLine(this.m_TextComponent, Input.mousePosition, this.m_Camera); if (num3 != -1 && num3 != this.m_lastLineIndex) { this.m_lastLineIndex = num3; TMP_LineInfo tmp_LineInfo = this.m_TextComponent.textInfo.lineInfo[num3]; char[] array = new char[tmp_LineInfo.characterCount]; int num4 = 0; while (num4 < tmp_LineInfo.characterCount && num4 < this.m_TextComponent.textInfo.characterInfo.Length) { array[num4] = this.m_TextComponent.textInfo.characterInfo[num4 + tmp_LineInfo.firstCharacterIndex].character; num4++; } string line = new string(array); this.SendOnLineSelection(line, tmp_LineInfo.firstCharacterIndex, tmp_LineInfo.characterCount); } int num5 = TMP_TextUtilities.FindIntersectingLink(this.m_TextComponent, Input.mousePosition, this.m_Camera); if (num5 != -1 && num5 != this.m_selectedLink) { this.m_selectedLink = num5; TMP_LinkInfo tmp_LinkInfo = this.m_TextComponent.textInfo.linkInfo[num5]; this.SendOnLinkSelection(tmp_LinkInfo.GetLinkID(), tmp_LinkInfo.GetLinkText(), num5); } } }
void LateUpdate() { if (TMP_TextUtilities.IsIntersectingRectTransform(m_TextComponent.rectTransform, Input.mousePosition, m_Camera)) { #region Example of Character or Sprite Selection int charIndex = TMP_TextUtilities.FindIntersectingCharacter(m_TextComponent, Input.mousePosition, m_Camera, true); if (charIndex != -1 && charIndex != m_lastCharIndex) { m_lastCharIndex = charIndex; TMP_TextElementType elementType = m_TextComponent.textInfo.characterInfo[charIndex].elementType; // Send event to any event listeners depending on whether it is a character or sprite. if (elementType == TMP_TextElementType.Character) { SendOnCharacterSelection(m_TextComponent.textInfo.characterInfo[charIndex].character, charIndex); } else if (elementType == TMP_TextElementType.Sprite) { SendOnSpriteSelection(m_TextComponent.textInfo.characterInfo[charIndex].character, charIndex); } } #endregion #region Example of Word Selection // Check if Mouse intersects any words and if so assign a random color to that word. int wordIndex = TMP_TextUtilities.FindIntersectingWord(m_TextComponent, Input.mousePosition, m_Camera); if (wordIndex != -1 && wordIndex != m_lastWordIndex) { m_lastWordIndex = wordIndex; // Get the information about the selected word. TMP_WordInfo wInfo = m_TextComponent.textInfo.wordInfo[wordIndex]; // Send the event to any listeners. SendOnWordSelection(wInfo.GetWord(), wInfo.firstCharacterIndex, wInfo.characterCount); } #endregion #region Example of Line Selection // Check if Mouse intersects any words and if so assign a random color to that word. int lineIndex = TMP_TextUtilities.FindIntersectingLine(m_TextComponent, Input.mousePosition, m_Camera); if (lineIndex != -1 && lineIndex != m_lastLineIndex) { m_lastLineIndex = lineIndex; // Get the information about the selected word. TMP_LineInfo lineInfo = m_TextComponent.textInfo.lineInfo[lineIndex]; // Send the event to any listeners. char[] buffer = new char[lineInfo.characterCount]; for (int i = 0; i < lineInfo.characterCount && i < m_TextComponent.textInfo.characterInfo.Length; i++) { buffer[i] = m_TextComponent.textInfo.characterInfo[i + lineInfo.firstCharacterIndex].character; } string lineText = new string(buffer); SendOnLineSelection(lineText, lineInfo.firstCharacterIndex, lineInfo.characterCount); } #endregion #region Example of Link Handling // Check if mouse intersects with any links. int linkIndex = TMP_TextUtilities.FindIntersectingLink(m_TextComponent, Input.mousePosition, m_Camera); // Handle new Link selection. if (linkIndex != -1 && linkIndex != m_selectedLink) { m_selectedLink = linkIndex; // Get information about the link. TMP_LinkInfo linkInfo = m_TextComponent.textInfo.linkInfo[linkIndex]; // Send the event to any listeners. SendOnLinkSelection(linkInfo.GetLinkID(), linkInfo.GetLinkText(), linkIndex); } #endregion } }