示例#1
0
        public override ApplyState Apply(ComputedStyle style, Value value)
        {
            // Get the border:
            BorderProperty border = GetBorder(style);

            if (value.IsAuto)
            {
                // Use color:
                value = style[Properties.ColorProperty.GlobalProperty];
            }

            // Apply the base colour:
            if (value.IsColour)
            {
                value = new ValueSet(new Value[] { value });
            }

            border.BaseColour = value;

            // Request paint:
            border.RequestPaint();

            // Ok!
            return(ApplyState.Ok);
        }
示例#2
0
        public override ApplyState Apply(ComputedStyle style, Value value)
        {
            // Get the border:
            BorderProperty border = GetBorder(style);

            if (value == null)
            {
                // No corners:
                border.Corners = null;
            }
            else
            {
                // Apply top left:
                border.SetCorner(RoundCornerPosition.TopLeft, value[0].GetDecimal(style.RenderData, GetAliased(0)));

                // Apply top right:
                border.SetCorner(RoundCornerPosition.TopRight, value[1].GetDecimal(style.RenderData, GetAliased(1)));

                // Apply bottom right:
                border.SetCorner(RoundCornerPosition.BottomLeft, value[2].GetDecimal(style.RenderData, GetAliased(2)));

                // Apply bottom left:
                border.SetCorner(RoundCornerPosition.BottomRight, value[3].GetDecimal(style.RenderData, GetAliased(3)));
            }

            // Request a layout:
            border.RequestLayout();

            // Ok!
            return(ApplyState.Ok);
        }
示例#3
0
        public override void Apply(ComputedStyle style, Value value)
        {
            // Get the border:
            BorderProperty border = GetBorder(style);

            if (value == null)
            {
                // No corners:
                border.Corners = null;
            }
            else
            {
                // Apply top left:
                border.SetCorner(RoundCornerPosition.TopLeft, value.GetPX(0));

                // Apply top right:
                border.SetCorner(RoundCornerPosition.TopRight, value.GetPX(1));

                // Apply bottom right:
                border.SetCorner(RoundCornerPosition.BottomLeft, value.GetPX(2));

                // Apply bottom left:
                border.SetCorner(RoundCornerPosition.BottomRight, value.GetPX(3));
            }

            // Request a layout:
            border.RequestLayout();
        }
示例#4
0
        public override void Apply(ComputedStyle style, Value value)
        {
            // Get the border:
            BorderProperty border = GetBorder(style);


            if (value != null && value.Type == ValueType.Text)
            {
                if (value.Text == "transparent")
                {
                    // Currently assume the default colour (black):
                    // (Use #00000000 instead)
                    value = null;
                }
            }

            // Apply the base colour:
            border.BaseColour = value;

            // Reset the border colour:
            border.ResetColour();

            // Tell it a colour changed:
            border.ColourChanged();
        }
示例#5
0
        public override void Apply(ComputedStyle style, Value value)
        {
            // Get the border:
            BorderProperty border = GetBorder(style);

            if (value == null)
            {
                border.WidthTop   = border.WidthLeft = 0;
                border.WidthRight = border.WidthBottom = 0;
            }
            else
            {
                border.WidthTop    = value.GetPX(0);
                border.WidthRight  = value.GetPX(1);
                border.WidthBottom = value.GetPX(2);
                border.WidthLeft   = value.GetPX(3);
            }

            // Does the border have any corners? If so, we need to update them:
            if (border.Corners != null)
            {
                border.Corners.Recompute();
            }

            // Request a layout:
            border.RequestLayout();

            // Set the styles size:
            style.SetSize();
        }
        public override void Apply(ComputedStyle style, Value value)
        {
            // Get the border:
            BorderProperty border = GetBorder(style);

            // Tell it a colour changed:
            border.ColourChanged();
        }
 public CircleProperty(
     Vector2 center        = new Vector2(),
     float diameter        = 1,
     Color color           = new Color(),
     BorderProperty border = new BorderProperty()
     ) : base(shapeType: ShapeType.Circle, center: center, angle: 0, color: color, border: border)
 {
     this.diameter = diameter;
 }
示例#8
0
        public override ApplyState Apply(ComputedStyle style, Value value)
        {
            // Get the border:
            BorderProperty border = GetBorder(style);

            // Request a layout:
            border.RequestLayout();

            // Ok!
            return(ApplyState.Ok);
        }
 public LineProperty(
     Vector2 center        = new Vector2(),
     float length          = 1,
     float width           = 1,
     float angle           = 0,
     Color color           = new Color(),
     BorderProperty border = new BorderProperty()
     ) : base(shapeType: ShapeType.Line, center: center, angle: angle, color: color, border: border)
 {
     this.length = length;
     this.width  = width;
 }
示例#10
0
 public RectProperty(
     Vector2 center        = new Vector2(),
     float height          = 1,
     float width           = 1,
     float angle           = 0,
     Color color           = new Color(),
     BorderProperty border = new BorderProperty(),
     int layer             = 0
     ) : base(shapeType: ShapeType.Rect, center: center, angle: angle, color: color, border: border, layer: layer)
 {
     this.height = height;
     this.width  = width;
 }
示例#11
0
        /*
         * Constructor
         */

        protected ShapeProperty(
            ShapeType shapeType,
            Vector2 center        = new Vector2(),
            float angle           = 0,
            Color color           = new Color(),
            BorderProperty border = new BorderProperty(),
            int layer             = 0
            )
        {
            this.shapeType = shapeType;
            this.center    = center;
            this.angle     = angle;
            this.color     = color;
            this.border    = border;
            this.layer     = layer;
        }
        public override ApplyState Apply(ComputedStyle style, Value value)
        {
            // set background image if "fill" is presented

            // Get the border:
            BorderProperty border = GetBorder(style);

            // Request a layout:
            if (border != null)
            {
                border.RequestLayout();
            }

            // Ok!
            return(ApplyState.Ok);
        }
示例#13
0
        public override ApplyState Apply(ComputedStyle style, Value value)
        {
            // Get the border:
            BorderProperty border = GetBorder(style);

            // Does the border have any corners? If so, we need to update them:
            if (border.Corners != null)
            {
                border.Corners.ClearCorners();
            }

            // Request a layout:
            border.RequestLayout();

            // Ok!
            return(ApplyState.Ok);
        }
示例#14
0
        public override void Apply(ComputedStyle style, Value value)
        {
            // Get the border:
            BorderProperty border = GetBorder(style);

            if (value == null || string.IsNullOrEmpty(value.Text) || value.Text == "solid")
            {
                border.Style = BorderStyle.Solid;
            }
            else if (value.Text == "dashed")
            {
                border.Style = BorderStyle.Dashed;
            }

            // Request a layout:
            border.RequestLayout();
        }
示例#15
0
        RectProperty RectPropertyFromTile(Tile tile)
        {
            Vector2 center = CoordToVector(tile.position);
            float   length = tileSideLength;
            float   width  = tileSideLength;

            BorderProperty bp = new BorderProperty();

            if (tile.Rendered)
            {
                bp = new BorderProperty(style: BorderStyle.Solid, color: Color.black, thickness: borderThickness);
            }

            var color = Color.white;

            /*
             * switch (tile.type) {
             *  case TileType.Cave:
             *      color = Color.cyan;
             *      break;
             *  case TileType.Tower:
             *      color = Color.magenta;
             *      break;
             *  case TileType.Library:
             *      color = Color.green;
             *      break;
             *  case TileType.Castle:
             *      color = Color.yellow;
             *      break;
             *  case TileType.Blocked:
             *      color = Color.black;
             *      break;
             *  default:
             *      color = Color.white;
             *      break;
             * }
             */

            switch (tile.visibility)
            {
            case Visibility.Hidden:
                color.a = 0;
                break;

            case Visibility.Grayed:
                if (!tile.Rendered)
                {
                    color.a = 0;
                }
                else
                {
                    color.a = 0.03f;
                }
                break;

            case Visibility.Revealed:
                if (!tile.Rendered)
                {
                    color.a = 0;
                }
                else
                {
                    color.a = 1;
                }
                break;
            }

            return(new RectProperty(
                       center: center, height: length, width: width, color: color, border: bp
                       ));
        }
示例#16
0
 set => SetValue(BorderProperty, value);
示例#17
0
 set { SetValue(BorderProperty, value); }