コード例 #1
0
 public void ChoosePiece(EnumShapes shape)
 {
     if (PieceList.Count > 0)
     {
         var piece = (from x in PieceList
                      where (int)x.ShapeUsed == (int)shape
                      select x).Single();
         piece.IsSelected = false;                 // its obvious now.
         PieceList.ReplaceAllWithGivenItem(piece); // this will become the new list
     }
     else
     {
         PieceCP newPiece = new PieceCP();
         newPiece.ShapeUsed = shape;
         newPiece.HowMany   = _gameContainer.SaveRoot !.Value;
         PieceList.ReplaceAllWithGivenItem(newPiece);
     }
     Visible = true; // obviously
 }
コード例 #2
0
        public async Task ShapeChosenAsync(EnumShapes shape)
        {
            var thisCard = _gameContainer.SaveRoot !.TrickList.Single();

            _gameContainer.SaveRoot.ShapeChosen = shape;
            _gameContainer.SaveRoot.Value       = shape switch
            {
                EnumShapes.Balls => thisCard.HowManyBalls,
                EnumShapes.Cubes => thisCard.HowManyCubes,
                EnumShapes.Cones => thisCard.HowManyCones,
                EnumShapes.Stars => thisCard.HowManyStars,
                _ => throw new BasicBlankException("Don't know what to use"),
            };

            _gameContainer.SaveRoot.GameStatus = EnumStatusList.Normal;
            _model !.ShapeChoose1 !.ChoosePiece(shape);
            if (_gameContainer.CloseShapeButtonAsync == null)
            {
                throw new BasicBlankException("Nobody is closing the shapes.  Rethink");
            }
            await _gameContainer.CloseShapeButtonAsync.Invoke();

            await _gameContainer.EndTurnAsync !.Invoke();
        }
コード例 #3
0
        public static CustomBasicList <SKPoint> GetPoints(EnumShapes shape, int howMany, SKPoint thisPoint, bool manually, float heightWidth)
        {
            float newLeft = 0;
            float margins;
            float mults;

            mults   = heightWidth / 16;
            margins = 3 * mults; // for proportions
            if (manually == true)
            {
                if (howMany == 3)
                {
                    return new CustomBasicList <SKPoint>()
                           {
                               new SKPoint(thisPoint.X + margins, thisPoint.Y + margins), new SKPoint(thisPoint.X + margins, thisPoint.Y + margins + heightWidth), new SKPoint(thisPoint.X + margins, thisPoint.Y + margins + heightWidth * 2)
                           }
                }
                ;
                else if (howMany == 1)
                {
                    return new CustomBasicList <SKPoint>()
                           {
                               new SKPoint(thisPoint.X + margins, thisPoint.Y + margins + heightWidth)
                           }
                }
                ;
                else
                {
                    return new CustomBasicList <SKPoint>()
                           {
                               new SKPoint(thisPoint.X + margins, thisPoint.Y + margins + (heightWidth / 2)), new SKPoint(thisPoint.X + margins, thisPoint.Y + margins + (heightWidth / 2) + heightWidth)
                           }
                };
            }
            float top1;
            float top2; // if only one, will be this one.
            float top3;
            float topFirstHalf;
            float topLastHalf;

            top1         = thisPoint.Y + margins;        // try this way instead.
            top2         = top1 + heightWidth + margins;
            top3         = top2 + heightWidth + margins; // try this way (?)
            topFirstHalf = thisPoint.Y + margins + heightWidth / 2;
            topLastHalf  = topFirstHalf + heightWidth + margins;
            switch (shape)
            {
            case EnumShapes.Balls:
            {
                newLeft = thisPoint.X + margins;

                break;
            }

            case EnumShapes.Cubes:
            {
                newLeft = thisPoint.X + heightWidth + margins * 2;
                break;
            }

            case EnumShapes.Cones:
            {
                newLeft = thisPoint.X + margins + heightWidth * 2 + margins * 2;
                break;
            }

            case EnumShapes.Stars:
            {
                newLeft = thisPoint.X + margins + heightWidth * 3 + margins * 3;
                break;
            }
            }

            if (howMany == 3)
            {
                return new CustomBasicList <SKPoint>()
                       {
                           new SKPoint(newLeft, top1), new SKPoint(newLeft, top2), new SKPoint(newLeft, top3)
                       }
            }
            ;
            else if (howMany == 1)
            {
                return new CustomBasicList <SKPoint>()
                       {
                           new SKPoint(newLeft, top2)
                       }
            }
            ;
            else
            {
                return new CustomBasicList <SKPoint>()
                       {
                           new SKPoint(newLeft, topFirstHalf), new SKPoint(newLeft, topLastHalf)
                       }
            };
            throw new BasicBlankException("Cannot get points");
        }
コード例 #4
0
        private static void ShapeUsedPropertyChanged(BindableObject bindable, object oldValue, object newValue)
        {
            var thisItem = (XactikaPieceXF)bindable;

            thisItem.Mains !.ShapeUsed = (EnumShapes)newValue;
        }