예제 #1
0
 public override void Draw(
     float offsetX,
     float offsetY,
     DebugPrimitiveRenderer2D renderer)
 {
     renderer.color = new Color32(255, 255, 255, 255);
     if (_sprite != null)
     {
         renderer.AddSprite(
             offsetX + localLeftX,
             offsetY + localTopY,
             width,
             height,
             _sprite);
     }
     else if (_texture != null)
     {
         renderer.AddTexturedRectangle(
             offsetX + localLeftX,
             offsetY + localTopY,
             width,
             height,
             _texture);
     }
     else
     {
         renderer.AddRectangle(
             offsetX + localLeftX,
             offsetY + localTopY,
             width,
             height);
     }
 }
예제 #2
0
        public override void Draw(
            float offsetX,
            float offsetY,
            DebugPrimitiveRenderer2D renderer)
        {
            Color32 tmpColor = (isPointerDown) ? pointerDownColor : color;

            renderer.color = tmpColor;
            if (texture != null)
            {
                renderer.AddTexturedRectangle(
                    offsetX + localLeftX + borderWidth,
                    offsetY + localTopY + borderWidth,
                    width - (borderWidth * 2f),
                    height - (borderWidth * 2f),
                    texture);
            }
            else if (sprite != null)
            {
                renderer.AddSprite(
                    offsetX + localLeftX + borderWidth,
                    offsetY + localTopY + borderWidth,
                    width - (borderWidth * 2f),
                    height - (borderWidth * 2f),
                    sprite);
            }
            else
            {
                renderer.AddRectangle(
                    offsetX + localLeftX + borderWidth,
                    offsetY + localTopY + borderWidth,
                    width - (borderWidth * 2f),
                    height - (borderWidth * 2f));
            }

            Color32 tmpTextColor = (isPointerDown) ? pointerDownTextColor : textColor;

            renderer.color = tmpTextColor;
            renderer.AddText(
                text,
                offsetX + localLeftX + (width * 0.5f),
                offsetY + localTopY + (height * 0.5f),
                width - (borderWidth * 4f),
                height - (borderWidth * 4f),
                DebugPrimitiveRenderer.AlignX.Center,
                DebugPrimitiveRenderer.AlignY.Center);
        }
예제 #3
0
        public override void Draw(
            float offsetX,
            float offsetY,
            DebugPrimitiveRenderer2D renderer)
        {
            Color32 tmpColor = (on) ? onColor : offColor;

            renderer.color = tmpColor;
            if (_sprite != null)
            {
                renderer.AddSprite(
                    offsetX + localLeftX + borderWidth,
                    offsetY + localTopY + borderWidth,
                    width - (borderWidth * 2f),
                    height - (borderWidth * 2f),
                    _sprite);
            }
            else if (_texture != null)
            {
                renderer.AddTexturedRectangle(
                    offsetX + localLeftX + borderWidth,
                    offsetY + localTopY + borderWidth,
                    width - (borderWidth * 2f),
                    height - (borderWidth * 2f),
                    _texture);
            }
            else
            {
                renderer.AddRectangle(
                    offsetX + localLeftX + borderWidth,
                    offsetY + localTopY + borderWidth,
                    width - (borderWidth * 2f),
                    height - (borderWidth * 2f));
            }

            Color32 tmpTextColor = (on) ? onTextColor : offTextColor;

            DrawTextAuto(
                renderer,
                text,
                tmpTextColor,
                offsetX + localLeftX + (borderWidth * 2f),
                offsetY + localTopY + (borderWidth * 2f),
                width - (borderWidth * 4f),
                height - (borderWidth * 4f),
                _rotateToVertical);
        }