UILabel.PrintOverlay C# (CSharp) Méthode

PrintOverlay() public méthode

Fill the specified geometry buffer with vertices that would highlight the current selection.
public PrintOverlay ( int start, int end, UIGeometry, caret, UIGeometry, highlight, Color caretColor, Color highlightColor ) : void
start int
end int
caret UIGeometry,
highlight UIGeometry,
caretColor Color
highlightColor Color
Résultat void
	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(defaultFontSize, mWidth, 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, 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);
		}
	}

Usage Example

    public static int PrintOverlay(IntPtr l)
    {
        int result;

        try
        {
            UILabel uILabel = (UILabel)LuaObject.checkSelf(l);
            int     start;
            LuaObject.checkType(l, 2, out start);
            int end;
            LuaObject.checkType(l, 3, out end);
            UIGeometry caret;
            LuaObject.checkType <UIGeometry>(l, 4, out caret);
            UIGeometry highlight;
            LuaObject.checkType <UIGeometry>(l, 5, out highlight);
            Color caretColor;
            LuaObject.checkType(l, 6, out caretColor);
            Color highlightColor;
            LuaObject.checkType(l, 7, out highlightColor);
            uILabel.PrintOverlay(start, end, caret, highlight, caretColor, highlightColor);
            LuaObject.pushValue(l, true);
            result = 1;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
All Usage Examples Of UILabel::PrintOverlay