/**********************************************************************
 *  Constructors
 **********************************************************************/
 public Shape(string shapeName)
 {
     _shapeName       = shapeName;
     _centerOfMyWorld = new Coordinates();
     _myCoordinates   = new Coordinates();
     _myColor         = _defaultColor;
 }
Esempio n. 2
0
 public static Card GenerateRandomCard()
 {
     return(new Card(
                CardShapes.GetRandom(),
                ShapeCounts.GetRandom(),
                ShapeColors.GetRandom(),
                ShapeFills.GetRandom()
                ));
 }
 public Shape(string shapeName, ShapeColors myColor, Coordinates myCoordinates)
 {
     _shapeName     = shapeName;
     _myColor       = myColor;
     _myCoordinates = myCoordinates;
 }
Esempio n. 4
0
        private SKShapeNode _CreateNode()
        {
            //Creating The Card:
            var rectangle =
                new CGRect(0, 0, Settings.Sizes.CardHeight, Settings.Sizes.CardWidth);
            var card = SKShapeNode.FromRect(rectangle, 5);

            card.FillColor   = Settings.Colors.CardBackgroundColor;
            card.StrokeColor = Settings.Colors.CardStrokeColor;


            //Create the Shape Node:

            //TODO: Check the actual shape enum
            var _totalShapes = ShapeCounts.GetInt(ShapeCount);
            var _fillColor   = ShapeColors.GetColor(ShapeColor);
            var _shapes      = new List <SKShapeNode>(_totalShapes);

            //generate each shape:
            for (int i = 0; i < _totalShapes; i++)
            {
                SKShapeNode _shapeNode = _GetShape();

                _shapeNode.StrokeColor = _fillColor;
                _shapeNode.LineWidth   = 5f;

                switch (ShapeFill)
                {
                case ShapeFill.Full:
                    _shapeNode.FillColor = _fillColor;
                    break;

                case ShapeFill.Half:
                    _shapeNode.FillTexture = SKTexture.FromImageNamed(NSBundle.MainBundle.PathForResource("stripes", "png"));
                    _shapeNode.FillColor   = card.FillColor;
                    break;

                default:     //None Case
                    _shapeNode.FillColor = card.FillColor;
                    break;
                }



                switch (ShapeCount)   //can this be done less idiomatic?
                {
                case ShapeCount.Two:
                    _shapeNode.Position = Settings.Positions.DoubleShapePosition(i);
                    break;

                case ShapeCount.Three:
                    _shapeNode.Position = Settings.Positions.TripleShapePosition(i);
                    break;

                default:     //case ShapeCount.One:
                    _shapeNode.Position = Settings.Positions.SingleShapePosition;
                    break;
                }

                _shapes.Add(_shapeNode);

                card.AddChild(_shapeNode);
            }

            return(card);
        }
Esempio n. 5
0
 public int TotalQtyByShapeColor(ShapeColors shapeColor)
 {
     return(ShapeVariants?.Where(v => v.ShapeColor == shapeColor).Sum(v => v.Qty) ?? '-');
 }
Esempio n. 6
0
 public ShapeVariant(ShapeColors shapeColor, int qty, bool additionalCharge)
 {
     ShapeColor = shapeColor;
     Qty = qty;
     AdditionalCharge = additionalCharge;
 }