private void MoveButton_Click(object sender, RoutedEventArgs e)
        {
            MessageBoxResult messageBoxResult;

            //int _selectedCollIndex = IndexCollSelected;
            //not shoised one or more components
            if (IndexCollSelected < -1)
            {
                messageBoxResult = MessageBox.Show("Please select the Checker", "Atention!");
                return;
            }
            if (checkBoxLeftDice.IsChecked == false && checkBoxRightDice.IsChecked == false)
            {
                messageBoxResult = MessageBox.Show("Please select any Dice or both", "Atention!");
                return;
            }
            if ((checkBoxLeftDice.IsChecked == false && checkBoxRightDice.IsEnabled == false) ||
                (checkBoxRightDice.IsChecked == false && checkBoxLeftDice.IsEnabled == false))
            {
                messageBoxResult = MessageBox.Show("Please select the Dice", "Atention!");
                return;
            }

            var number = (checkBoxLeftDice.IsChecked == true) ? Dice1.Number : Dice2.Number;

            if (IndexCollSelected == -1)
            {
                if (MyCheckerColor == White)
                {
                    GameHost.MoveCheckerFromBarAsync(User, Opponent, 0, number);
                }
                else
                {
                    GameHost.MoveCheckerFromBarAsync(User, Opponent, 1, number);
                }
            }
            else
            {
                GameHost.MoveCheckerAsync(User, Opponent, IndexCollSelected, number);
            }

            if (Dice1.Number != Dice2.Number && (checkBoxLeftDice.IsChecked == true || checkBoxRightDice.IsChecked == true))
            {
                if (checkBoxLeftDice.IsChecked == true)
                {
                    //CheckerLogic.CollUnSelected();
                    IndexCollSelected          = -5;
                    checkBoxLeftDice.IsEnabled = false;
                }
                else if (checkBoxRightDice.IsChecked == true)
                {
                    //CheckerLogic.CollUnSelected();
                    IndexCollSelected           = -5;
                    checkBoxRightDice.IsEnabled = false;
                }
            }
            CheckerLogic.CollUnSelected();
        }
Example #2
0
        public override void Move(CheckerLogic.Checker checker, CheckerLogic.CheckerPoint point)
        {
            //sprawdzenie czy pole jest wolne
            if (!checker.CheckIfFieldIsEmpty(point)) { } //wyjatek? Blad? Do przemyslenia

            //sprawdzenie czy figura może się tak poruszać
            if (!MoveRequirements.CheckHetmanMovement(Field, point)) { } //wyjatek? Blad? Do przemyslenia

            //sprawdzenie czy ruch dozwolony w kontekście ustawienia szachownicy, czy król nie zostałby szachowany itp.
            //TODO

            //wykonanie ruchu
            //TODO
        }
        //Roll Click
        private void RollButton_Click(object sender, RoutedEventArgs e)
        {
            CheckerLogic.ClearSelections();
            if (Master)
            {
                GameHost.RollAsync(User, Opponent);

                rollButton.IsEnabled = false;
                moveButton.IsEnabled = true;

                if (checkBoxLeftDice != null)
                {
                    checkBoxLeftDice.IsEnabled = true;
                }
                if (checkBoxRightDice != null)
                {
                    checkBoxRightDice.IsEnabled = true;
                }
            }
        }
Example #4
0
 public abstract void Move(CheckerLogic.Checker checker, CheckerPoint point);