Ejemplo n.º 1
0
        //fills the board with empty and colored blocks
        private void initiateRandomly(Canvas canvas, int size, Random rnd)
        {
            for (int i = 0; i < size; i++)
            {
                for (int j = 0; j < size; j++)
                {
                    Case rect = new Case(canvas.Height, canvas.Width, size, rnd);

                    Canvas.SetLeft(rect.getRect(), i * canvas.Width / size);
                    Canvas.SetTop(rect.getRect(), j * canvas.Width / size);

                    board[i, j] = rect;
                    rectBoard[i, j] = rect.getRect();
                    canvas.Children.Add(rect.getRect());

                }

            }
        }
Ejemplo n.º 2
0
 //wible canvas
 private void Canvas_Loaded_3(object sender, RoutedEventArgs e)
 {
     Random random = new Random();
     Canvas canvas = sender as Canvas;
     wibleCanvas = canvas;
     Case wibleCase = new Case(canvas.Height*6, canvas.Width, size, rnd, false);
     wible = wibleCase.getRect();
     Canvas.SetLeft(wibleCase.getRect(), 0);
     Canvas.SetTop(wibleCase.getRect(), 0);
     wible.Fill = new SolidColorBrush(Colors.White);
     wible.Stroke = new SolidColorBrush(Colors.White);
     wible.Visibility = Visibility.Collapsed;
     canvas.Children.Add(wibleCase.getRect());
 }
Ejemplo n.º 3
0
 //this method sets a block so that it will return isEmpty == true
 private void empty(Case square)
 {
     square.getRect().Fill = new SolidColorBrush(Colors.White);
     square.takeColor();
 }
Ejemplo n.º 4
0
        //init hand
        private void Canvas_Loaded_2(object sender, RoutedEventArgs e)
        {
            Random random = new Random();
            rnd = random;
            Canvas canvas = sender as Canvas;
            handCanvas = canvas;
            for (int i = 0; i < size; i++)
            {
                Case handCase = new Case(canvas.Height*6, canvas.Width, size, rnd, false);

                Canvas.SetLeft(handCase.getRect(), i * canvas.Width / size);
                Canvas.SetTop(handCase.getRect(), 0);

                hand[i] = handCase;
                canvas.Children.Add(handCase.getRect());
            }

            drawLabelsForHand(size, canvas);
        }