Esempio n. 1
0
        void Start_Game(object sender, RoutedEventArgs e)
        {
            start = true;
            pieces = new List<Piece>();

            //Adding every piece and positioning them in nest
            Piece blue1 = new Piece("ananas",1,1);
            pieces.Add(blue1);

            Piece blue2 = new Piece("ananas", 2, 1);
            pieces.Add(blue2);
            Piece blue3 = new Piece("ananas", 1, 2);
            pieces.Add(blue3);
            Piece blue4 = new Piece("ananas", 2, 2);
            pieces.Add(blue4);

            Piece lavender1 = new Piece("cherry", 8, 1);
            pieces.Add(lavender1);
            Piece lavender2 = new Piece("cherry", 9, 1);
            pieces.Add(lavender2);
            Piece lavender3 = new Piece("cherry", 8, 2);
            pieces.Add(lavender3);
            Piece lavender4 = new Piece("cherry", 9, 2);
            pieces.Add(lavender4);

            Piece lemon1 = new Piece("banan", 8, 8);
            pieces.Add(lemon1);
            Piece lemon2 = new Piece("banan", 9, 8);
            pieces.Add(lemon2);
            Piece lemon3 = new Piece("banan", 8, 9);
            pieces.Add(lemon3);
            Piece lemon4 = new Piece("banan", 9, 9);
            pieces.Add(lemon4);

            Piece green1 = new Piece("strawberry", 1, 8);
            pieces.Add(green1);
            Piece green2 = new Piece("strawberry", 2, 8);
            pieces.Add(green2);
            Piece green3 = new Piece("strawberry", 1, 9);
            pieces.Add(green3);
            Piece green4 = new Piece("strawberry", 2, 9);
            pieces.Add(green4);

            Pieces = pieces;

            //Show images of pieces on the board
            BitmapImage blueImg1 = blue1.getImage();
            blueStart1.Source = blueImg1;
            BitmapImage blueImg2 = blue2.getImage();
            blueStart2.Source = blueImg2;
            BitmapImage blueImg3 = blue3.getImage();
            blueStart3.Source = blueImg3;
            BitmapImage blueImg4 = blue4.getImage();
            blueStart4.Source = blueImg4;

            BitmapImage lavenderImg1 = lavender1.getImage();
            lavenderStart1.Source = lavenderImg1;
            BitmapImage lavenderImg2 = lavender2.getImage();
            lavenderStart2.Source = lavenderImg2;
            BitmapImage lavenderImg3 = lavender3.getImage();
            lavenderStart3.Source = lavenderImg3;
            BitmapImage lavenderImg4 = lavender4.getImage();
            lavenderStart4.Source = lavenderImg4;

            BitmapImage lemonImg1 = lemon1.getImage();
            lemonStart1.Source = lemonImg1;
            BitmapImage lemonImg2 = lemon2.getImage();
            lemonStart2.Source = lemonImg2;
            BitmapImage lemonImg3 = lemon3.getImage();
            lemonStart3.Source = lemonImg3;
            BitmapImage lemonImg4 = lemon4.getImage();
            lemonStart4.Source = lemonImg4;

            BitmapImage greenImg1 = green1.getImage();
            greenStart1.Source = greenImg1;
            BitmapImage greenImg2 = green2.getImage();
            greenStart2.Source = greenImg2;
            BitmapImage greenImg3 = green3.getImage();
            greenStart3.Source = greenImg3;
            BitmapImage greenImg4 = green4.getImage();
            greenStart4.Source = greenImg4;
        }