UnityEngine.GUIStyle.DrawWithTextSelection C# (CSharp) Method

DrawWithTextSelection() public method

Draw this GUIStyle with selected content.

public DrawWithTextSelection ( Rect position, GUIContent content, int controlID, int firstSelectedCharacter, int lastSelectedCharacter ) : void
position Rect
content GUIContent
controlID int
firstSelectedCharacter int
lastSelectedCharacter int
return void
        public void DrawWithTextSelection(Rect position, GUIContent content, int controlID, int firstSelectedCharacter, int lastSelectedCharacter)
        {
            this.DrawWithTextSelection(position, content, controlID, firstSelectedCharacter, lastSelectedCharacter, false);
        }

Same methods

GUIStyle::DrawWithTextSelection ( Rect position, GUIContent content, int controlID, int firstSelectedCharacter, int lastSelectedCharacter, bool drawSelectionAsComposition ) : void

Usage Example

コード例 #1
0
        public void DrawCursor(string newText)
        {
            string text = this.text;
            int    num  = cursorIndex;

            if (Input.compositionString.Length > 0)
            {
                m_Content.text = newText.Substring(0, cursorIndex) + Input.compositionString + newText.Substring(selectIndex);
                num           += Input.compositionString.Length;
            }
            else
            {
                m_Content.text = newText;
            }

            graphicalCursorPos = style.GetCursorPixelPosition(new Rect(0f, 0f, position.width, position.height), m_Content, num);
            Vector2 contentOffset = style.contentOffset;

            style.contentOffset       -= scrollOffset;
            style.Internal_clipOffset  = scrollOffset;
            Input.compositionCursorPos = graphicalCursorPos + new Vector2(position.x, position.y + style.lineHeight) - scrollOffset;
            if (Input.compositionString.Length > 0)
            {
                style.DrawWithTextSelection(position, m_Content, controlID, cursorIndex, cursorIndex + Input.compositionString.Length, drawSelectionAsComposition: true);
            }
            else
            {
                style.DrawWithTextSelection(position, m_Content, controlID, cursorIndex, selectIndex);
            }

            if (m_iAltCursorPos != -1)
            {
                style.DrawCursor(position, m_Content, controlID, m_iAltCursorPos);
            }

            style.contentOffset       = contentOffset;
            style.Internal_clipOffset = Vector2.zero;
            m_Content.text            = text;
        }
All Usage Examples Of UnityEngine.GUIStyle::DrawWithTextSelection