PrintCaretAndSelection() static public méthode

Print the caret and selection vertices. Note that it's expected that 'text' has been stripped clean of symbols.
static public PrintCaretAndSelection ( string text, int start, int end, BetterList caret, BetterList highlight ) : void
text string
start int
end int
caret BetterList
highlight BetterList
Résultat void
Exemple #1
0
    /// <summary>
    /// Fill the specified geometry buffer with vertices that would highlight the current selection.
    /// </summary>

    public void PrintOverlay(int start, int end, UIGeometry caret, UIGeometry highlight, Color caretColor, Color highlightColor)
    {
        if (caret != null)
        {
            caret.Clear();
        }
        if (highlight != null)
        {
            highlight.Clear();
        }
        if (!isValid)
        {
            return;
        }

        string text = processedText;

        UpdateNGUIText();

        int     startingCaretVerts = caret.verts.size;
        Vector2 center             = new Vector2(0.5f, 0.5f);
        float   alpha = finalAlpha;

        // If we have a highlight to work with, fill the buffer
        if (highlight != null && start != end)
        {
            int startingVertices = highlight.verts.size;
            NGUIText.PrintCaretAndSelection(text, start, end, caret.verts, highlight.verts);

            if (highlight.verts.size > startingVertices)
            {
                ApplyOffset(highlight.verts, startingVertices);

                Color32 c = new Color(highlightColor.r, highlightColor.g, highlightColor.b, highlightColor.a * alpha);

                for (int i = startingVertices; i < highlight.verts.size; ++i)
                {
                    highlight.uvs.Add(center);
                    highlight.cols.Add(c);
                }
            }
        }
        else
        {
            NGUIText.PrintCaretAndSelection(text, start, end, caret.verts, null);
        }

        // Fill the caret UVs and colors
        ApplyOffset(caret.verts, startingCaretVerts);
        Color32 cc = new Color(caretColor.r, caretColor.g, caretColor.b, caretColor.a * alpha);

        for (int i = startingCaretVerts; i < caret.verts.size; ++i)
        {
            caret.uvs.Add(center);
            caret.cols.Add(cc);
        }
    }
    static int PrintCaretAndSelection(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 5);
        string         arg0 = LuaScriptMgr.GetLuaString(L, 1);
        int            arg1 = (int)LuaScriptMgr.GetNumber(L, 2);
        int            arg2 = (int)LuaScriptMgr.GetNumber(L, 3);
        List <Vector3> arg3 = (List <Vector3>)LuaScriptMgr.GetNetObject(L, 4, typeof(List <Vector3>));
        List <Vector3> arg4 = (List <Vector3>)LuaScriptMgr.GetNetObject(L, 5, typeof(List <Vector3>));

        NGUIText.PrintCaretAndSelection(arg0, arg1, arg2, arg3, arg4);
        return(0);
    }
Exemple #3
0
    public void PrintOverlay(int start, int end, UIGeometry caret, UIGeometry highlight, Color caretColor, Color highlightColor)
    {
        if (caret != null)
        {
            caret.Clear();
        }
        if (highlight != null)
        {
            highlight.Clear();
        }
        if (!this.isValid)
        {
            return;
        }
        string processedText = this.processedText;

        this.UpdateNGUIText();
        int     size       = caret.verts.size;
        Vector2 item       = new Vector2(0.5f, 0.5f);
        float   finalAlpha = this.finalAlpha;

        if (highlight != null && start != end)
        {
            int size2 = highlight.verts.size;
            NGUIText.PrintCaretAndSelection(processedText, start, end, caret.verts, highlight.verts);
            if (highlight.verts.size > size2)
            {
                this.ApplyOffset(highlight.verts, size2);
                Color32 item2 = new Color(highlightColor.r, highlightColor.g, highlightColor.b, highlightColor.a * finalAlpha);
                for (int i = size2; i < highlight.verts.size; i++)
                {
                    highlight.uvs.Add(item);
                    highlight.cols.Add(item2);
                }
            }
        }
        else
        {
            NGUIText.PrintCaretAndSelection(processedText, start, end, caret.verts, null);
        }
        this.ApplyOffset(caret.verts, size);
        Color32 item3 = new Color(caretColor.r, caretColor.g, caretColor.b, caretColor.a * finalAlpha);

        for (int j = size; j < caret.verts.size; j++)
        {
            caret.uvs.Add(item);
            caret.cols.Add(item3);
        }
        NGUIText.bitmapFont  = null;
        NGUIText.dynamicFont = null;
    }
Exemple #4
0
 static int PrintCaretAndSelection(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 5);
         string arg0 = ToLua.CheckString(L, 1);
         int    arg1 = (int)LuaDLL.luaL_checknumber(L, 2);
         int    arg2 = (int)LuaDLL.luaL_checknumber(L, 3);
         BetterList <UnityEngine.Vector3> arg3 = (BetterList <UnityEngine.Vector3>)ToLua.CheckObject(L, 4, typeof(BetterList <UnityEngine.Vector3>));
         BetterList <UnityEngine.Vector3> arg4 = (BetterList <UnityEngine.Vector3>)ToLua.CheckObject(L, 5, typeof(BetterList <UnityEngine.Vector3>));
         NGUIText.PrintCaretAndSelection(arg0, arg1, arg2, arg3, arg4);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Exemple #5
0
    public void PrintOverlay(int start, int end, UIGeometry caret, UIGeometry highlight, Color caretColor, Color highlightColor)
    {
        caret?.Clear();
        highlight?.Clear();
        if (!isValid)
        {
            return;
        }
        string text = processedText;

        UpdateNGUIText();
        int     size = caret.verts.size;
        Vector2 item = new Vector2(0.5f, 0.5f);
        float   num  = finalAlpha;

        if (highlight != null && start != end)
        {
            int size2 = highlight.verts.size;
            NGUIText.PrintCaretAndSelection(text, start, end, caret.verts, highlight.verts);
            if (highlight.verts.size > size2)
            {
                ApplyOffset(highlight.verts, size2);
                Color32 item2 = new Color(highlightColor.r, highlightColor.g, highlightColor.b, highlightColor.a * num);
                for (int i = size2; i < highlight.verts.size; i++)
                {
                    highlight.uvs.Add(item);
                    highlight.cols.Add(item2);
                }
            }
        }
        else
        {
            NGUIText.PrintCaretAndSelection(text, start, end, caret.verts, null);
        }
        ApplyOffset(caret.verts, size);
        Color32 item3 = new Color(caretColor.r, caretColor.g, caretColor.b, caretColor.a * num);

        for (int i = size; i < caret.verts.size; i++)
        {
            caret.uvs.Add(item);
            caret.cols.Add(item3);
        }
    }
Exemple #6
0
 static public int PrintCaretAndSelection_s(IntPtr l)
 {
     try {
         System.String a1;
         checkType(l, 1, out a1);
         System.Int32 a2;
         checkType(l, 2, out a2);
         System.Int32 a3;
         checkType(l, 3, out a3);
         BetterList <UnityEngine.Vector3> a4;
         checkType(l, 4, out a4);
         BetterList <UnityEngine.Vector3> a5;
         checkType(l, 5, out a5);
         NGUIText.PrintCaretAndSelection(a1, a2, a3, a4, a5);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemple #7
0
    private static int PrintCaretAndSelection(IntPtr L)
    {
        int result;

        try
        {
            ToLua.CheckArgsCount(L, 5);
            string text  = ToLua.CheckString(L, 1);
            int    start = (int)LuaDLL.luaL_checknumber(L, 2);
            int    end   = (int)LuaDLL.luaL_checknumber(L, 3);
            BetterList <Vector3> caret     = (BetterList <Vector3>)ToLua.CheckObject(L, 4, typeof(BetterList <Vector3>));
            BetterList <Vector3> highlight = (BetterList <Vector3>)ToLua.CheckObject(L, 5, typeof(BetterList <Vector3>));
            NGUIText.PrintCaretAndSelection(text, start, end, caret, highlight);
            result = 0;
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
Exemple #8
0
    /// <summary>
    /// Fill the specified geometry buffer with vertices that would highlight the current selection.
    /// </summary>

    public void PrintOverlay(int start, int end, UIGeometry caret, UIGeometry highlight, Color caretColor, Color highlightColor)
    {
        if (caret != null)
        {
            caret.Clear();
        }
        if (highlight != null)
        {
            highlight.Clear();
        }
        if (!isValid)
        {
            return;
        }

        string text      = processedText;
        float  pixelSize = (mFont != null) ? mFont.pixelSize : 1f;
        float  scale     = mScale * pixelSize;
        bool   usePS     = usePrintedSize;

        if (usePS)
        {
            UpdateNGUIText(mPrintedSize, mWidth, mHeight);
        }
        else
        {
            UpdateNGUIText(fontSize, Mathf.RoundToInt(mWidth / scale), mHeight);
        }

        int     startingCaretVerts = caret.verts.size;
        Vector2 center             = new Vector2(0.5f, 0.5f);
        float   alpha = finalAlpha;

        // If we have a highlight to work with, fill the buffer
        if (highlight != null && start != end)
        {
            int startingVertices = highlight.verts.size;
            NGUIText.PrintCaretAndSelection(text, start, end, caret.verts, highlight.verts);

            if (highlight.verts.size > startingVertices)
            {
                ApplyOffset(highlight.verts, usePS, scale, startingVertices);

                Color32 c = new Color(highlightColor.r, highlightColor.g, highlightColor.b, highlightColor.a * alpha);

                for (int i = startingVertices; i < highlight.verts.size; ++i)
                {
                    highlight.uvs.Add(center);
                    highlight.cols.Add(c);
                }
            }
        }
        else
        {
            NGUIText.PrintCaretAndSelection(text, start, end, caret.verts, null);
        }

        // Fill the caret UVs and colors
        ApplyOffset(caret.verts, usePS, scale, startingCaretVerts);
        Color32 cc = new Color(caretColor.r, caretColor.g, caretColor.b, caretColor.a * alpha);

        for (int i = startingCaretVerts; i < caret.verts.size; ++i)
        {
            caret.uvs.Add(center);
            caret.cols.Add(cc);
        }
    }