Esempio n. 1
0
        public void MoveGoose()
        {
            int amountOfSpaces;

            Logics.RollDice(out amountOfSpaces);
            if (PlayNextTrun == false)
            {
                if (Wait == false)
                {
                    PlayNextTrun = true;
                }
            }
            else
            {
                int tempField = Field;

                if (tempField + amountOfSpaces > 63)
                {
                    this.Field = 63 - (amountOfSpaces - (63 - tempField));
                }
                else
                {
                    this.Field = Field + amountOfSpaces;
                }
                Tuple <bool, SpecialField> SpecialField = Logics.IsSpecialField(Field);
                if (SpecialField.Item1 == true)
                {
                    ActionOfField(SpecialField.Item2);
                }
            }
        }
Esempio n. 2
0
        private void rollDiceButton_Click(object sender, EventArgs e)
        {
            rollDiceButton.Enabled = false;
            int thrownDiceNumber;

            gameLogics.RollDice(out thrownDiceNumber);
            diceButton.Text = thrownDiceNumber.ToString();
            Console.WriteLine("dice rolled");

            if (playerNumber == 1)
            {
                pictures[currentPositionPlayer1].SendToBack();
                currentPositionPlayer1 = currentPositionPlayer1 + thrownDiceNumber;
                if (currentPositionPlayer1 > 63)
                {
                    currentPositionPlayer1 = 63;
                }
                specialFieldAction(1);
                pictures[currentPositionPlayer1].Image = (Image)Properties.Resources.ResourceManager.GetObject("ganzenBordGansRood");
                pictures[currentPositionPlayer1].BringToFront();
                //deze plaatjes moeten allemaal nog aangepast worden
                if (currentPositionPlayer1 == currentPositionPlayer2)
                {
                    pictures[currentPositionPlayer1].Image = (Image)Properties.Resources.ResourceManager.GetObject("ganzenBordGansRoodEnGroen1");
                }
                if (currentPositionPlayer1 == currentPositionPlayer3)
                {
                    pictures[currentPositionPlayer1].Image = (Image)Properties.Resources.ResourceManager.GetObject("ganzenBordGansRoodEnBlauw1");
                }
                if (currentPositionPlayer1 == currentPositionPlayer4)
                {
                    pictures[currentPositionPlayer1].Image = (Image)Properties.Resources.ResourceManager.GetObject("ganzenBordGansRoodEnGeel1");
                }
                if (currentPositionPlayer1 == currentPositionPlayer2 && currentPositionPlayer1 == currentPositionPlayer3)
                {
                    pictures[currentPositionPlayer1].Image = (Image)Properties.Resources.ResourceManager.GetObject("ganzenBordGansRoodEnGroenEnBlauw");
                }
                if (currentPositionPlayer1 == currentPositionPlayer2 && currentPositionPlayer1 == currentPositionPlayer4)
                {
                    pictures[currentPositionPlayer1].Image = (Image)Properties.Resources.ResourceManager.GetObject("ganzenBordGansRood");
                }
                if (currentPositionPlayer1 == currentPositionPlayer3 && currentPositionPlayer1 == currentPositionPlayer4)
                {
                    pictures[currentPositionPlayer1].Image = (Image)Properties.Resources.ResourceManager.GetObject("ganzenBordGansRood");
                }
                if (currentPositionPlayer1 == currentPositionPlayer2 && currentPositionPlayer1 == currentPositionPlayer3 && currentPositionPlayer1 == currentPositionPlayer4)
                {
                }
                ranking.AddPoints(currentPosition);
                client.WriteMessage(ranking.Ranking.ToString());
                Console.WriteLine("stuur hier naar de server op welke positie de Client staat");
                Console.WriteLine(currentPositionPlayer1.ToString());
                Console.WriteLine("");
                client.WriteMessage(currentPositionPlayer1.ToString());
            }
            if (playerNumber == 2)
            {
                pictures[currentPositionPlayer2].SendToBack();
                currentPositionPlayer2 = currentPositionPlayer2 + thrownDiceNumber;
                if (currentPositionPlayer2 > 63)
                {
                    currentPositionPlayer2 = 63;
                }
                //specialFieldAction();
                pictures[currentPositionPlayer2].Image = (Image)Properties.Resources.ResourceManager.GetObject("ganzenBordGansGroen");
                pictures[currentPositionPlayer2].BringToFront();
                //deze plaatjes moeten allemaal nog aangepast worden
                if (currentPositionPlayer2 == currentPositionPlayer1)
                {
                    pictures[currentPositionPlayer2].Image = (Image)Properties.Resources.ResourceManager.GetObject("ganzenBordGansRoodEnGroen1");
                }
                if (currentPositionPlayer2 == currentPositionPlayer3)
                {
                    pictures[currentPositionPlayer2].Image = (Image)Properties.Resources.ResourceManager.GetObject("ganzenBordGansRoodEnBlauw1");
                }
                if (currentPositionPlayer2 == currentPositionPlayer4)
                {
                    pictures[currentPositionPlayer2].Image = (Image)Properties.Resources.ResourceManager.GetObject("ganzenBordGansRoodEnGeel1");
                }
                if (currentPositionPlayer2 == currentPositionPlayer1 && currentPositionPlayer2 == currentPositionPlayer3)
                {
                    pictures[currentPositionPlayer2].Image = (Image)Properties.Resources.ResourceManager.GetObject("ganzenBordGansRoodEnGroenEnBlauw");
                }
                if (currentPositionPlayer2 == currentPositionPlayer3 && currentPositionPlayer2 == currentPositionPlayer4)
                {
                    pictures[currentPositionPlayer2].Image = (Image)Properties.Resources.ResourceManager.GetObject("ganzenBordGansRood");
                }
                if (currentPositionPlayer2 == currentPositionPlayer1 && currentPositionPlayer2 == currentPositionPlayer4)
                {
                    pictures[currentPositionPlayer2].Image = (Image)Properties.Resources.ResourceManager.GetObject("ganzenBordGansRood");
                }
                if (currentPositionPlayer2 == currentPositionPlayer1 && currentPositionPlayer2 == currentPositionPlayer3 && currentPositionPlayer2 == currentPositionPlayer4)
                {
                }
                ranking.AddPoints(currentPosition);
                client.WriteMessage(ranking.Ranking.ToString());
                Console.WriteLine("stuur hier naar de server op welke positie de Client staat");
                Console.WriteLine(currentPositionPlayer2.ToString());
                Console.WriteLine("");
                client.WriteMessage(currentPositionPlayer2.ToString());
            }
            if (playerNumber == 3)
            {
                pictures[currentPositionPlayer3].SendToBack();
                currentPositionPlayer1 = currentPositionPlayer1 + thrownDiceNumber;
                pictures[currentPositionPlayer3].BringToFront();
            }
            if (playerNumber == 4)
            {
                pictures[currentPositionPlayer4].SendToBack();
                currentPositionPlayer1 = currentPositionPlayer1 + thrownDiceNumber;
                pictures[currentPositionPlayer4].BringToFront();
            }


            //if (Wait == true)
            //{
            //    if (!isSameTile())
            //        PlayNextTrun = false;
            //    else Wait = false;
            //}

            //if (PlayNextTrun)
            //{
            //    int newPosition = currentPosition + thrownDiceNumber;
            //    if (newPosition > 63)
            //    {
            //        newPosition = 63 - (thrownDiceNumber - (63 - currentPosition));
            //    }
            //    moveGoosePosition(playerColour, currentPosition, newPosition);
            //    currentPosition = newPosition;
            //    specialFieldAction();



            //    ranking.AddPoints(currentPosition);
            //}
            //else
            //    PlayNextTrun = true;

            //client.WriteMessage(ranking.Ranking.ToString());


            game();
        }