示例#1
0
        //This method lets the developer gets the roll he wants to
        //make tests.
        public int GetDevRoll()
        {
            number = 0;
            char   addNumber = ' ';
            string rollValue = "";

            Sdl.SDL_Color yellow = new Sdl.SDL_Color(255, 255, 0);

            do
            {
                addNumber = hardware.ReadNumber();
                if (addNumber != '!' && addNumber != ' ' && addNumber != '?')
                {
                    rollValue += addNumber;
                }

                txtRoll = SdlTtf.TTF_RenderText_Solid(font.GetFontType(),
                                                      rollValue, yellow);
                hardware.WriteText(txtRoll, 950, 330);
                hardware.UpdateScreen();
            } while (addNumber != '!');

            if (rollValue != "")
            {
                number = Convert.ToInt32(rollValue);
            }

            return(number);
        }
示例#2
0
        //Show the first option of the menu. It only tells the user
        //to press one to roll the dices.
        public void ShowFirstStep(string lang)
        {
            font = new Font("font/fuenteproy.ttf", 12);
            Sdl.SDL_Color red = new Sdl.SDL_Color(255, 0, 0);

            if (lang == "spanish")
            {
                txtMenu = SdlTtf.TTF_RenderText_Solid(font.GetFontType(),
                                                      "Pulsa 1 para tirar dados", red);
            }
            else
            {
                txtMenu = SdlTtf.TTF_RenderText_Solid(font.GetFontType(),
                                                      "Press 1 to roll the dice.", red);
            }


            hardware.WriteText(txtMenu, 640, 330);
            hardware.UpdateScreen();
        }
示例#3
0
        public void MoveChip(string color, int num, int rolledValue, ref int turn,
                             string lang)
        {
            IntPtr txtOca;


            Sdl.SDL_Color yellow = new Sdl.SDL_Color(255, 255, 0);
            font = new Font("font/fuenteproy.ttf", 12);

            if (lang == "spanis")
            {
                txtOca = SdlTtf.TTF_RenderText_Solid(font.GetFontType(),
                                                     "De oca a oca y tiras porque te toca! ", yellow);
            }
            else
            {
                txtOca = SdlTtf.TTF_RenderText_Solid(font.GetFontType(),
                                                     "Goose to goose, repeat your turn!", yellow);
            }


            foreach (Chip chip in chipslist)
            {
                //Check that im going to move the selected color
                // and chip number.
                if (chip.GetColor() == color && chip.GetNum() == num)
                {
                    //Switch for every color.
                    switch (color)
                    {
                    case "red":
                        //Switch for every value instead of 'if'.
                        switch (rolledValue)
                        {
                        //Added a new attribute to chip, to check how many
                        //positions have advanced, because the chip wont enter
                        //his finish color boxes until it haven't advanced 64 positions
                        case 1:
                            chip.SetPosChip((chip.GetPosChip() + rolledValue) - 1);

                            //Now check gooses.
                            if (chip.GetPosChip() == 5 || chip.GetPosChip() == 9 ||
                                chip.GetPosChip() == 14 || chip.GetPosChip() == 18 ||
                                chip.GetPosChip() == 23 || chip.GetPosChip() == 27 ||
                                chip.GetPosChip() == 32 || chip.GetPosChip() == 36 ||
                                chip.GetPosChip() == 45 || chip.GetPosChip() == 50 ||
                                chip.GetPosChip() == 54)
                            {
                                JumpToNextGoose(chip.GetPosChip());
                                player[turn].SetRepeatTurn(true);
                                hardware.WriteText(txtOca, 670, 500);
                            }
                            break;

                        case 2:
                            chip.SetPosChip((chip.GetPosChip() + rolledValue) - 1);
                            if (chip.GetPosChip() == 5 || chip.GetPosChip() == 9 ||
                                chip.GetPosChip() == 14 || chip.GetPosChip() == 18 ||
                                chip.GetPosChip() == 23 || chip.GetPosChip() == 27 ||
                                chip.GetPosChip() == 32 || chip.GetPosChip() == 36 ||
                                chip.GetPosChip() == 45 || chip.GetPosChip() == 50 ||
                                chip.GetPosChip() == 54)
                            {
                                JumpToNextGoose(chip.GetPosChip());
                                player[turn].SetRepeatTurn(true);
                                hardware.WriteText(txtOca, 670, 500);
                            }
                            break;

                        case 3:
                            chip.SetPosChip((chip.GetPosChip() + rolledValue) - 1);
                            if (chip.GetPosChip() == 5 || chip.GetPosChip() == 9 ||
                                chip.GetPosChip() == 14 || chip.GetPosChip() == 18 ||
                                chip.GetPosChip() == 23 || chip.GetPosChip() == 27 ||
                                chip.GetPosChip() == 32 || chip.GetPosChip() == 36 ||
                                chip.GetPosChip() == 45 || chip.GetPosChip() == 50 ||
                                chip.GetPosChip() == 54)
                            {
                                JumpToNextGoose(chip.GetPosChip());
                                player[turn].SetRepeatTurn(true);
                                hardware.WriteText(txtOca, 670, 500);
                            }
                            break;

                        case 4:
                            chip.SetPosChip((chip.GetPosChip() + rolledValue) - 1);
                            if (chip.GetPosChip() == 5 || chip.GetPosChip() == 9 ||
                                chip.GetPosChip() == 14 || chip.GetPosChip() == 18 ||
                                chip.GetPosChip() == 23 || chip.GetPosChip() == 27 ||
                                chip.GetPosChip() == 32 || chip.GetPosChip() == 36 ||
                                chip.GetPosChip() == 45 || chip.GetPosChip() == 50 ||
                                chip.GetPosChip() == 54)
                            {
                                JumpToNextGoose(chip.GetPosChip());
                                player[turn].SetRepeatTurn(true);
                                hardware.WriteText(txtOca, 670, 500);
                            }
                            break;

                        case 5:
                            chip.SetPosChip((chip.GetPosChip() + rolledValue) - 1);
                            if (chip.GetPosChip() == 5 || chip.GetPosChip() == 9 ||
                                chip.GetPosChip() == 14 || chip.GetPosChip() == 18 ||
                                chip.GetPosChip() == 23 || chip.GetPosChip() == 27 ||
                                chip.GetPosChip() == 32 || chip.GetPosChip() == 36 ||
                                chip.GetPosChip() == 45 || chip.GetPosChip() == 50 ||
                                chip.GetPosChip() == 54)
                            {
                                JumpToNextGoose(chip.GetPosChip());
                                player[turn].SetRepeatTurn(true);
                                hardware.WriteText(txtOca, 670, 500);
                            }
                            break;

                        case 6:
                            chip.SetPosChip((chip.GetPosChip() + rolledValue) - 1);
                            if (chip.GetPosChip() == 5 || chip.GetPosChip() == 9 ||
                                chip.GetPosChip() == 14 || chip.GetPosChip() == 18 ||
                                chip.GetPosChip() == 23 || chip.GetPosChip() == 27 ||
                                chip.GetPosChip() == 32 || chip.GetPosChip() == 36 ||
                                chip.GetPosChip() == 45 || chip.GetPosChip() == 50 ||
                                chip.GetPosChip() == 54)
                            {
                                JumpToNextGoose(chip.GetPosChip());
                                player[turn].SetRepeatTurn(true);
                                hardware.WriteText(txtOca, 670, 500);
                            }
                            player[turn].SetRepeatTurn(true);
                            break;
                        }

                        break;

                    case "blue":
                        switch (rolledValue)
                        {
                        case 1:
                            chip.SetPosChip((chip.GetPosChip() + rolledValue) - 1);
                            break;

                        case 2:
                            chip.SetPosChip((chip.GetPosChip() + rolledValue) - 1);
                            break;

                        case 3:
                            chip.SetPosChip((chip.GetPosChip() + rolledValue) - 1);
                            break;

                        case 4:
                            chip.SetPosChip((chip.GetPosChip() + rolledValue) - 1);
                            break;

                        case 5:
                            chip.SetPosChip((chip.GetPosChip() + rolledValue) - 1);
                            break;

                        case 6:
                            chip.SetPosChip((chip.GetPosChip() + rolledValue) - 1);
                            player[turn].SetRepeatTurn(true);
                            break;
                        }
                        break;

                    case "green":
                        switch (rolledValue)
                        {
                        case 1:
                            chip.SetPosChip((chip.GetPosChip() + rolledValue) - 1);
                            break;

                        case 2:
                            chip.SetPosChip((chip.GetPosChip() + rolledValue) - 1);
                            break;

                        case 3:
                            chip.SetPosChip((chip.GetPosChip() + rolledValue) - 1);
                            break;

                        case 4:
                            chip.SetPosChip((chip.GetPosChip() + rolledValue) - 1);
                            break;

                        case 5:
                            chip.SetPosChip((chip.GetPosChip() + rolledValue) - 1);
                            break;

                        case 6:
                            chip.SetPosChip((chip.GetPosChip() + rolledValue) - 1);
                            player[turn].SetRepeatTurn(true);
                            break;
                        }
                        break;

                    case "yellow":
                        switch (rolledValue)
                        {
                        case 1:
                            chip.SetPosChip((chip.GetPosChip() + rolledValue) - 1);
                            break;

                        case 2:
                            chip.SetPosChip((chip.GetPosChip() + rolledValue) - 1);
                            break;

                        case 3:
                            chip.SetPosChip((chip.GetPosChip() + rolledValue) - 1);
                            break;

                        case 4:
                            chip.SetPosChip((chip.GetPosChip() + rolledValue) - 1);
                            break;

                        case 5:
                            chip.SetPosChip((chip.GetPosChip() + rolledValue) - 1);
                            break;

                        case 6:
                            chip.SetPosChip((chip.GetPosChip() + rolledValue) - 1);
                            player[turn].SetRepeatTurn(true);
                            break;
                        }
                        break;
                    }
                }
            }
        }