PrintOverlay() public method

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
return void
Esempio n. 1
0
    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);
    }
Esempio n. 2
0
    static int PrintOverlay(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 7);
        UILabel    obj  = (UILabel)LuaScriptMgr.GetUnityObjectSelf(L, 1, "UILabel");
        int        arg0 = (int)LuaScriptMgr.GetNumber(L, 2);
        int        arg1 = (int)LuaScriptMgr.GetNumber(L, 3);
        UIGeometry arg2 = (UIGeometry)LuaScriptMgr.GetNetObject(L, 4, typeof(UIGeometry));
        UIGeometry arg3 = (UIGeometry)LuaScriptMgr.GetNetObject(L, 5, typeof(UIGeometry));
        Color      arg4 = LuaScriptMgr.GetColor(L, 6);
        Color      arg5 = LuaScriptMgr.GetColor(L, 7);

        obj.PrintOverlay(arg0, arg1, arg2, arg3, arg4, arg5);
        return(0);
    }
Esempio n. 3
0
	static int PrintOverlay(IntPtr L)
	{
		try
		{
			ToLua.CheckArgsCount(L, 7);
			UILabel obj = (UILabel)ToLua.CheckObject<UILabel>(L, 1);
			int arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
			int arg1 = (int)LuaDLL.luaL_checknumber(L, 3);
			UIGeometry arg2 = (UIGeometry)ToLua.CheckObject<UIGeometry>(L, 4);
			UIGeometry arg3 = (UIGeometry)ToLua.CheckObject<UIGeometry>(L, 5);
			UnityEngine.Color arg4 = ToLua.ToColor(L, 6);
			UnityEngine.Color arg5 = ToLua.ToColor(L, 7);
			obj.PrintOverlay(arg0, arg1, arg2, arg3, arg4, arg5);
			return 0;
		}
		catch (Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}
Esempio n. 4
0
 static public int PrintOverlay(IntPtr l)
 {
     try {
         UILabel      self = (UILabel)checkSelf(l);
         System.Int32 a1;
         checkType(l, 2, out a1);
         System.Int32 a2;
         checkType(l, 3, out a2);
         UIGeometry a3;
         checkType(l, 4, out a3);
         UIGeometry a4;
         checkType(l, 5, out a4);
         UnityEngine.Color a5;
         checkType(l, 6, out a5);
         UnityEngine.Color a6;
         checkType(l, 7, out a6);
         self.PrintOverlay(a1, a2, a3, a4, a5, a6);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Esempio n. 5
0
    public void UpdateLabel()
    {
        if (!(label != null))
        {
            return;
        }
        if (mDoInit)
        {
            Init();
        }
        bool   isSelected = this.isSelected;
        string value      = this.value;
        bool   flag       = string.IsNullOrEmpty(value) && string.IsNullOrEmpty(Input.compositionString);

        label.color = ((!flag || isSelected) ? activeTextColor : mDefaultColor);
        string text;

        if (flag)
        {
            text = ((!isSelected) ? mDefaultText : string.Empty);
            RestoreLabelPivot();
        }
        else
        {
            if (inputType == InputType.Password)
            {
                text = string.Empty;
                string str = "*";
                if (label.bitmapFont != null && label.bitmapFont.bmFont != null && label.bitmapFont.bmFont.GetGlyph(42) == null)
                {
                    str = "x";
                }
                int i = 0;
                for (int length = value.Length; i < length; i++)
                {
                    text += str;
                }
            }
            else
            {
                text = value;
            }
            int    num  = isSelected ? Mathf.Min(text.Length, cursorPosition) : 0;
            string str2 = text.Substring(0, num);
            if (isSelected)
            {
                str2 += Input.compositionString;
            }
            text = str2 + text.Substring(num, text.Length - num);
            if (isSelected && label.overflowMethod == UILabel.Overflow.ClampContent && label.maxLineCount == 1)
            {
                int num2 = label.CalculateOffsetToFit(text);
                if (num2 == 0)
                {
                    mDrawStart = 0;
                    RestoreLabelPivot();
                }
                else if (num < mDrawStart)
                {
                    mDrawStart = num;
                    SetPivotToLeft();
                }
                else if (num2 < mDrawStart)
                {
                    mDrawStart = num2;
                    SetPivotToLeft();
                }
                else
                {
                    num2 = label.CalculateOffsetToFit(text.Substring(0, num));
                    if (num2 > mDrawStart)
                    {
                        mDrawStart = num2;
                        SetPivotToRight();
                    }
                }
                if (mDrawStart != 0)
                {
                    text = text.Substring(mDrawStart, text.Length - mDrawStart);
                }
            }
            else
            {
                mDrawStart = 0;
                RestoreLabelPivot();
            }
        }
        label.text = text;
        if (isSelected)
        {
            int num3 = mSelectionStart - mDrawStart;
            int num4 = mSelectionEnd - mDrawStart;
            if (mBlankTex == null)
            {
                mBlankTex = new Texture2D(2, 2, TextureFormat.ARGB32, mipmap: false);
                for (int j = 0; j < 2; j++)
                {
                    for (int k = 0; k < 2; k++)
                    {
                        mBlankTex.SetPixel(k, j, Color.white);
                    }
                }
                mBlankTex.Apply();
            }
            if (num3 != num4)
            {
                if (mHighlight == null)
                {
                    mHighlight              = NGUITools.AddWidget <UITexture>(label.cachedGameObject);
                    mHighlight.name         = "Input Highlight";
                    mHighlight.mainTexture  = mBlankTex;
                    mHighlight.fillGeometry = false;
                    mHighlight.pivot        = label.pivot;
                    mHighlight.SetAnchor(label.cachedTransform);
                }
                else
                {
                    mHighlight.pivot       = label.pivot;
                    mHighlight.mainTexture = mBlankTex;
                    mHighlight.MarkAsChanged();
                    mHighlight.enabled = true;
                }
            }
            if (mCaret == null)
            {
                mCaret              = NGUITools.AddWidget <UITexture>(label.cachedGameObject);
                mCaret.name         = "Input Caret";
                mCaret.mainTexture  = mBlankTex;
                mCaret.fillGeometry = false;
                mCaret.pivot        = label.pivot;
                mCaret.SetAnchor(label.cachedTransform);
            }
            else
            {
                mCaret.pivot       = label.pivot;
                mCaret.mainTexture = mBlankTex;
                mCaret.MarkAsChanged();
                mCaret.enabled = true;
            }
            if (num3 != num4)
            {
                label.PrintOverlay(num3, num4, mCaret.geometry, mHighlight.geometry, caretColor, selectionColor);
                mHighlight.enabled = mHighlight.geometry.hasVertices;
            }
            else
            {
                label.PrintOverlay(num3, num4, mCaret.geometry, null, caretColor, selectionColor);
                if (mHighlight != null)
                {
                    mHighlight.enabled = false;
                }
            }
            mNextBlink = RealTime.time + 0.5f;
            mLastAlpha = label.finalAlpha;
        }
        else
        {
            Cleanup();
        }
    }
Esempio n. 6
0
    /// <summary>
    /// Update the visual text label.
    /// </summary>

    public void UpdateLabel()
    {
        if (label != null)
        {
            if (mDoInit)
            {
                Init();
            }
            bool   selected = isSelected;
            string fullText = value;
            bool   isEmpty  = string.IsNullOrEmpty(fullText) && string.IsNullOrEmpty(Input.compositionString);
            label.color = (isEmpty && !selected) ? mDefaultColor : activeTextColor;
            string processed;

            if (isEmpty)
            {
                processed = selected ? "" : mDefaultText;
                RestoreLabelPivot();
            }
            else
            {
                if (inputType == InputType.Password)
                {
                    processed = "";

                    string asterisk = "*";

                    if (label.bitmapFont != null && label.bitmapFont.bmFont != null &&
                        label.bitmapFont.bmFont.GetGlyph('*') == null)
                    {
                        asterisk = "x";
                    }

                    for (int i = 0, imax = fullText.Length; i < imax; ++i)
                    {
                        processed += asterisk;
                    }
                }
                else
                {
                    processed = fullText;
                }

                // Start with text leading up to the selection
                int    selPos = selected ? Mathf.Min(processed.Length, cursorPosition) : 0;
                string left   = processed.Substring(0, selPos);

                // Append the composition string and the cursor character
                if (selected)
                {
                    left += Input.compositionString;
                }

                // Append the text from the selection onwards
                processed = left + processed.Substring(selPos, processed.Length - selPos);

                // Clamped content needs to be adjusted further
                if (selected && label.overflowMethod == UILabel.Overflow.ClampContent && label.maxLineCount == 1)
                {
                    // Determine what will actually fit into the given line
                    int offset = label.CalculateOffsetToFit(processed);

                    if (offset == 0)
                    {
                        mDrawStart = 0;
                        RestoreLabelPivot();
                    }
                    else if (selPos < mDrawStart)
                    {
                        mDrawStart = selPos;
                        SetPivotToLeft();
                    }
                    else if (offset < mDrawStart)
                    {
                        mDrawStart = offset;
                        SetPivotToLeft();
                    }
                    else
                    {
                        offset = label.CalculateOffsetToFit(processed.Substring(0, selPos));

                        if (offset > mDrawStart)
                        {
                            mDrawStart = offset;
                            SetPivotToRight();
                        }
                    }

                    // If necessary, trim the front
                    if (mDrawStart != 0)
                    {
                        processed = processed.Substring(mDrawStart, processed.Length - mDrawStart);
                    }
                }
                else
                {
                    mDrawStart = 0;
                    RestoreLabelPivot();
                }
            }

            label.text = processed;
#if MOBILE
            if (selected && (mKeyboard == null || inputShouldBeHidden))
#else
            if (selected)
#endif
            {
                int start = mSelectionStart - mDrawStart;
                int end   = mSelectionEnd - mDrawStart;

                // Blank texture used by selection and caret
                if (mBlankTex == null)
                {
                    mBlankTex = new Texture2D(2, 2, TextureFormat.ARGB32, false);
                    for (int y = 0; y < 2; ++y)
                    {
                        for (int x = 0; x < 2; ++x)
                        {
                            mBlankTex.SetPixel(x, y, Color.white);
                        }
                    }
                    mBlankTex.Apply();
                }

                // Create the selection highlight
                if (start != end)
                {
                    if (mHighlight == null)
                    {
                        mHighlight              = NGUITools.AddWidget <UITexture>(label.cachedGameObject);
                        mHighlight.name         = "Input Highlight";
                        mHighlight.mainTexture  = mBlankTex;
                        mHighlight.fillGeometry = false;
                        mHighlight.pivot        = label.pivot;
                        mHighlight.SetAnchor(label.cachedTransform);
                    }
                    else
                    {
                        mHighlight.pivot       = label.pivot;
                        mHighlight.mainTexture = mBlankTex;
                        mHighlight.MarkAsChanged();
                        mHighlight.enabled = true;
                    }
                }

                // Create the carter
                if (mCaret == null)
                {
                    mCaret              = NGUITools.AddWidget <UITexture>(label.cachedGameObject);
                    mCaret.name         = "Input Caret";
                    mCaret.mainTexture  = mBlankTex;
                    mCaret.fillGeometry = false;
                    mCaret.pivot        = label.pivot;
                    mCaret.SetAnchor(label.cachedTransform);
                }
                else
                {
                    mCaret.pivot       = label.pivot;
                    mCaret.mainTexture = mBlankTex;
                    mCaret.MarkAsChanged();
                    mCaret.enabled = true;
                }

                if (start != end)
                {
                    label.PrintOverlay(start, end, mCaret.geometry, mHighlight.geometry, caretColor, selectionColor);
                    mHighlight.enabled = mHighlight.geometry.hasVertices;
                }
                else
                {
                    label.PrintOverlay(start, end, mCaret.geometry, null, caretColor, selectionColor);
                    if (mHighlight != null)
                    {
                        mHighlight.enabled = false;
                    }
                }

                // Reset the blinking time
                mNextBlink = RealTime.time + 0.5f;
                mLastAlpha = label.finalAlpha;
            }
            else
            {
                Cleanup();
            }
        }
    }
Esempio n. 7
0
 public void UpdateLabel()
 {
     //IL_005c: Unknown result type (might be due to invalid IL or missing references)
     //IL_0067: Unknown result type (might be due to invalid IL or missing references)
     //IL_02cb: Unknown result type (might be due to invalid IL or missing references)
     //IL_02d0: Expected O, but got Unknown
     //IL_02ef: Unknown result type (might be due to invalid IL or missing references)
     //IL_04d9: Unknown result type (might be due to invalid IL or missing references)
     //IL_04df: Unknown result type (might be due to invalid IL or missing references)
     //IL_0520: Unknown result type (might be due to invalid IL or missing references)
     //IL_0526: Unknown result type (might be due to invalid IL or missing references)
     if (label != null)
     {
         if (mDoInit)
         {
             Init();
         }
         bool   isSelected = this.isSelected;
         string value      = this.value;
         bool   flag       = string.IsNullOrEmpty(value) && string.IsNullOrEmpty(Input.get_compositionString());
         label.color = ((!flag || isSelected) ? activeTextColor : mDefaultColor);
         string text;
         if (flag)
         {
             text = ((!isSelected) ? mDefaultText : string.Empty);
             RestoreLabelPivot();
         }
         else
         {
             if (inputType == InputType.Password)
             {
                 text = string.Empty;
                 string str = "*";
                 if (label.bitmapFont != null && label.bitmapFont.bmFont != null && label.bitmapFont.bmFont.GetGlyph(42) == null)
                 {
                     str = "x";
                 }
                 int i = 0;
                 for (int length = value.Length; i < length; i++)
                 {
                     text += str;
                 }
             }
             else
             {
                 text = value;
             }
             int    num  = isSelected ? Mathf.Min(text.Length, cursorPosition) : 0;
             string str2 = text.Substring(0, num);
             if (isSelected)
             {
                 str2 += Input.get_compositionString();
             }
             text = str2 + text.Substring(num, text.Length - num);
             if (isSelected && label.overflowMethod == UILabel.Overflow.ClampContent && label.maxLineCount == 1)
             {
                 int num2 = label.CalculateOffsetToFit(text);
                 if (num2 == 0)
                 {
                     mDrawStart = 0;
                     RestoreLabelPivot();
                 }
                 else if (num < mDrawStart)
                 {
                     mDrawStart = num;
                     SetPivotToLeft();
                 }
                 else if (num2 < mDrawStart)
                 {
                     mDrawStart = num2;
                     SetPivotToLeft();
                 }
                 else
                 {
                     num2 = label.CalculateOffsetToFit(text.Substring(0, num));
                     if (num2 > mDrawStart)
                     {
                         mDrawStart = num2;
                         SetPivotToRight();
                     }
                 }
                 if (mDrawStart != 0)
                 {
                     text = text.Substring(mDrawStart, text.Length - mDrawStart);
                 }
             }
             else
             {
                 mDrawStart = 0;
                 RestoreLabelPivot();
             }
         }
         label.text = text;
         if (isSelected && (mKeyboard == null || inputShouldBeHidden))
         {
             int num3 = mSelectionStart - mDrawStart;
             int num4 = mSelectionEnd - mDrawStart;
             if (mBlankTex == null)
             {
                 mBlankTex = new Texture2D(2, 2, 5, false);
                 for (int j = 0; j < 2; j++)
                 {
                     for (int k = 0; k < 2; k++)
                     {
                         mBlankTex.SetPixel(k, j, Color.get_white());
                     }
                 }
                 mBlankTex.Apply();
             }
             if (num3 != num4)
             {
                 if (mHighlight == null)
                 {
                     mHighlight = NGUITools.AddWidget <UITexture>(label.cachedGameObject);
                     mHighlight.set_name("Input Highlight");
                     mHighlight.mainTexture  = mBlankTex;
                     mHighlight.fillGeometry = false;
                     mHighlight.pivot        = label.pivot;
                     ((UIRect)mHighlight).SetAnchor(label.cachedTransform);
                 }
                 else
                 {
                     mHighlight.pivot       = label.pivot;
                     mHighlight.mainTexture = mBlankTex;
                     mHighlight.MarkAsChanged();
                     mHighlight.set_enabled(true);
                 }
             }
             if (mCaret == null)
             {
                 mCaret = NGUITools.AddWidget <UITexture>(label.cachedGameObject);
                 mCaret.set_name("Input Caret");
                 mCaret.mainTexture  = mBlankTex;
                 mCaret.fillGeometry = false;
                 mCaret.pivot        = label.pivot;
                 ((UIRect)mCaret).SetAnchor(label.cachedTransform);
             }
             else
             {
                 mCaret.pivot       = label.pivot;
                 mCaret.mainTexture = mBlankTex;
                 mCaret.MarkAsChanged();
                 mCaret.set_enabled(true);
             }
             if (num3 != num4)
             {
                 label.PrintOverlay(num3, num4, mCaret.geometry, mHighlight.geometry, caretColor, selectionColor);
                 mHighlight.set_enabled(mHighlight.geometry.hasVertices);
             }
             else
             {
                 label.PrintOverlay(num3, num4, mCaret.geometry, null, caretColor, selectionColor);
                 if (mHighlight != null)
                 {
                     mHighlight.set_enabled(false);
                 }
             }
             mNextBlink = RealTime.time + 0.5f;
             mLastAlpha = label.finalAlpha;
         }
         else
         {
             Cleanup();
         }
     }
 }