DrawCursor() public method

Draw this GUIStyle with selected content.

public DrawCursor ( Rect position, GUIContent content, int controlID, int Character ) : void
position Rect
content GUIContent
controlID int
Character int
return void
コード例 #1
0
 static int DrawCursor(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 5);
         UnityEngine.GUIStyle   obj  = (UnityEngine.GUIStyle)ToLua.CheckObject(L, 1, typeof(UnityEngine.GUIStyle));
         UnityEngine.Rect       arg0 = (UnityEngine.Rect)ToLua.CheckObject(L, 2, typeof(UnityEngine.Rect));
         UnityEngine.GUIContent arg1 = (UnityEngine.GUIContent)ToLua.CheckObject(L, 3, typeof(UnityEngine.GUIContent));
         int arg2 = (int)LuaDLL.luaL_checknumber(L, 4);
         int arg3 = (int)LuaDLL.luaL_checknumber(L, 5);
         obj.DrawCursor(arg0, arg1, arg2, arg3);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
コード例 #2
0
 static public int DrawCursor(IntPtr l)
 {
     try {
         UnityEngine.GUIStyle self = (UnityEngine.GUIStyle)checkSelf(l);
         UnityEngine.Rect     a1;
         checkValueType(l, 2, out a1);
         UnityEngine.GUIContent a2;
         checkType(l, 3, out a2);
         System.Int32 a3;
         checkType(l, 4, out a3);
         System.Int32 a4;
         checkType(l, 5, out a4);
         self.DrawCursor(a1, a2, a3, a4);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #3
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;
        }