コード例 #1
0
ファイル: Sprite.cs プロジェクト: qutin/github-kgui-qutin
        override public void Render(RenderSupport support, float parentAlpha)
        {
            if (_clipRect != null)
            {
                Rect clipRect = support.PushClipRect(GetClipRectNR(stage));
                if (ToolSet.IsEmptyRect(ref clipRect))
                {
                    // empty clipping bounds - no need to render children.
                    support.PopClipRect();
                    return;
                }
            }
            base.Render(support, parentAlpha);

            if (_clipRect != null)
            {
                support.PopClipRect();
            }
        }
コード例 #2
0
        public override void Render(RenderSupport support, float parentAlpha)
        {
            if (_changed)
            {
                Update();
            }

            if (_textHeight == 0)
            {
                return;
            }

            Color c = GUI.color;

            c.a       = parentAlpha * this.alpha;
            GUI.color = c;

            Rect rect = support.GetNativeDrawRect(_width, _height, false);

            sHelperRect.x      = rect.x;
            sHelperRect.y      = rect.y;
            sHelperRect.width  = rect.width;
            sHelperRect.height = rect.height;
            support.PushClipRect(sHelperRect);
            rect.x += support.projectionMatrix.tx;
            rect.y += support.projectionMatrix.ty;

            GUI.BeginGroup(rect);
            this._compiler.Draw(Time.deltaTime);
            GUI.EndGroup();

            support.PopClipRect();

            c.a       = 1;
            GUI.color = c;
        }
コード例 #3
0
        public override void Render(RenderSupport support, float parentAlpha)
        {
            if (_text != null)
            {
                Color c = GUI.color;
                c.a       = parentAlpha * this.alpha;
                GUI.color = c;

                Rect rect = support.GetNativeDrawRect(_width, _height, false);
                sHelperRect.x      = rect.x;
                sHelperRect.y      = rect.y;
                sHelperRect.width  = rect.width;
                sHelperRect.height = rect.height;
                support.PushClipRect(sHelperRect);
                rect.x += support.projectionMatrix.tx;
                rect.y += support.projectionMatrix.ty;

                GUIStyle lastStyle;
                if (_input)
                {
                    GUI.SetNextControlName(internalId);
                    if (_singleLine)
                    {
                        lastStyle          = GUI.skin.textField;
                        GUI.skin.textField = _textFormat.style;
                        _text = GUI.TextField(rect, _text, _maxLength);
                        if (GUI.changed)
                        {
                            DispatchEventObsolete(sChange);
                            onChanged.Call();
                        }

                        GUI.skin.textField = lastStyle;
                    }
                    else if (_displayAsPassword)
                    {
                        _text = GUI.PasswordField(rect, _text, '*', _maxLength);
                        if (GUI.changed)
                        {
                            DispatchEventObsolete(sChange);
                            onChanged.Call();
                        }
                    }
                    else
                    {
                        lastStyle         = GUI.skin.textArea;
                        GUI.skin.textArea = _textFormat.style;
                        _text             = GUI.TextArea(rect, _text, _maxLength);
                        if (GUI.changed)
                        {
                            DispatchEventObsolete(sChange);
                            onChanged.Call();
                        }

                        GUI.skin.textArea = lastStyle;
                    }
                }
                else
                {
                    lastStyle      = GUI.skin.label;
                    GUI.skin.label = _textFormat.style;
                    GUI.Label(rect, _text);
                    GUI.skin.label = lastStyle;
                }
                support.PopClipRect();

                c.a       = 1;
                GUI.color = c;
            }
        }