Пример #1
0
        public void displayPlayerChoiceMenu(Player player)
        {
            int resp = 0;

            Console.WriteLine("\n{0}Please make a selection:\n", playerPrompt(player));
            Console.WriteLine("1. Finish turn");
            Console.WriteLine("2. View your details");
            Console.WriteLine("3. Purchase This Property");
            Console.WriteLine("4. Buy House for Property");
            Console.WriteLine("5. Trade Property with Player");
            Console.Write("(1-5)>");
            //read response
            resp = inputInteger();
            //if response is invalid redisplay menu
            if (resp == 0)
            {
                this.displayPlayerChoiceMenu(player);
            }

            //perform choice according to number input
            switch (resp)
            {
            case 1:
                break;

            case 2:
                Console.WriteLine("==================================");
                Console.WriteLine(player.FullDetailsToString());
                Console.WriteLine("==================================");
                this.displayPlayerChoiceMenu(player);
                break;

            case 3:
                this.purchaseProperty(player);
                this.displayPlayerChoiceMenu(player);
                break;

            case 4:
                this.buyHouse(player);
                this.displayPlayerChoiceMenu(player);
                break;

            case 5:
                this.tradeProperty(player);
                this.displayPlayerChoiceMenu(player);
                break;

            default:
                Console.WriteLine("That option is not avaliable. Please try again.");
                this.displayPlayerChoiceMenu(player);
                break;
            }
        }
Пример #2
0
        public void displayPlayerChoiceMenu(Player player)
        {
            int resp = 0;

            Console.WriteLine("\n{0}Please make a selection:\n", playerPrompt(player));
            Console.WriteLine("1. Finish turn");
            Console.WriteLine("2. View your details");
            Console.WriteLine("3. Purchase This Property");
            Console.WriteLine("4. Buy House for Property");
            Console.WriteLine("5. Trade Property with Player");
            Console.WriteLine("6. Save ALL Game");

            // 3.2-Serialisation add a method to open Binary File and Deserialize to object

            Console.Write("(1-6)>");
            //read response
            resp = inputInteger();
            //if response is invalid redisplay menu
            if (resp == 0)
            {
                this.displayPlayerChoiceMenu(player);
            }

            //perform choice according to number input
            switch (resp)
            {
            case 1:
                break;

            case 2:
                Console.WriteLine("==================================");
                Console.WriteLine(player.FullDetailsToString());
                Console.WriteLine("==================================");
                this.displayPlayerChoiceMenu(player);
                break;

            case 3:
                this.purchaseProperty(player);
                this.displayPlayerChoiceMenu(player);
                break;

            case 4:
                this.buyHouse(player);
                this.displayPlayerChoiceMenu(player);
                break;

            case 5:
                this.tradeProperty(player);
                this.displayPlayerChoiceMenu(player);
                break;

            // 3.2-Serialisation add a method to open Binary File and Deserialize to object
            case 6:
            {
                ArrayList properties = Board.access().getProperties();
                ArrayList players    = Board.access().getPlayers();

                WriteRead savetoBinary = new WriteRead();
                //savetoBinary.savePositionToBinary(board);


                savetoBinary.savePropertyToBinary(properties);
                savetoBinary.savePlayerToBinary(players);
                break;
            }

            default:
                Console.WriteLine("That option is not avaliable. Please try again.");
                this.displayPlayerChoiceMenu(player);
                break;
            }
        }
Пример #3
0
        public void displayPlayerChoiceMenu(Player player)
        {
            int resp = 0;
            Console.WriteLine("\n{0}Please make a selection:\n", playerPrompt(player));
            Console.WriteLine("1. Finish turn");
            Console.WriteLine("2. View your details");
            Console.WriteLine("3. Purchase This Property");
            Console.WriteLine("4. Buy House for Property");
            Console.WriteLine("5. Trade Property with Player");
            Console.Write("(1-5)>");
            //read response
            resp = inputInteger();
            //if response is invalid redisplay menu
            if (resp == 0)
                this.displayPlayerChoiceMenu(player);

            //perform choice according to number input
                switch (resp)
                {
                    case 1:
                        break;
                    case 2:
                        Console.WriteLine("==================================");
                        Console.WriteLine(player.FullDetailsToString());
                        Console.WriteLine("==================================");
                        this.displayPlayerChoiceMenu(player);
                        break;
                    case 3:
                        this.purchaseProperty(player);
                        this.displayPlayerChoiceMenu(player);
                        break;
                    case 4:
                        this.buyHouse(player);
                        this.displayPlayerChoiceMenu(player);
                        break;
                    case 5:
                        this.tradeProperty(player);
                        this.displayPlayerChoiceMenu(player);
                        break;
                    default:
                        Console.WriteLine("That option is not avaliable. Please try again.");
                        this.displayPlayerChoiceMenu(player);
                        break;
                }
        }
Пример #4
0
        /*----- MENU FOR PLAYER WHEN IN JAIL -----*/
        public void displayInJailPlayerChoice(Player player)
        {
            int resp = 0;
            Console.WriteLine("\n{0}Please make a selection:\n", playerPrompt(player));
            Console.WriteLine("\t1. Attempt to roll doubles to get Released");
            Console.WriteLine("\t2. View your details");
            Console.WriteLine("\t3. Trade Property with Player");
            Console.WriteLine("\t4. Mortgage Property");
            Console.WriteLine("\t5. Pay $50");

            //read response
            resp = inputInteger();
            //if response is invalid redisplay menu
            if (resp == 0)
                this.displayInJailPlayerChoice(player);

            switch (resp)
            {
                case 1:
                    player.hasRolledDoublesInJail();
                    //this.displayInJailPlayerChoice(player);
                    Console.WriteLine("\n\tPress ENTER to continue");
                    Console.ReadLine();
                    break;
                case 2:
                    Console.WriteLine("\n\t==================================");
                    Console.WriteLine(player.FullDetailsToString());
                    Console.WriteLine("\t====================================");
                    this.displayInJailPlayerChoice(player);
                    break;
                case 3:
                    this.tradeProperty(player);
                    this.displayInJailPlayerChoice(player);
                    break;
                case 4:
                    this.mortgageProperty(player);
                    this.displayInJailPlayerChoice(player);
                    break;
                case 5:
                    player.payFine();
                    Console.WriteLine("\n\tPress ENTER to continue");
                    Console.ReadLine();
                    break;
                default:
                    Console.WriteLine("\n\tThat option is not available!");
                    displayInJailPlayerChoice(player);
                    return;
            }
        }
Пример #5
0
        /*----- main menu display for players when playing -----*/
        public void displayPlayerChoiceMenu(Player player)
        {
            if (player.getJailStats() == true)
            {
                int resp = 0;
                Console.WriteLine("\n\t1. End Turn");

                resp = inputInteger();

                switch (resp)
                {
                    case 1:
                        break;
                }
            }
            else
            {
                int resp = 0;
                Console.WriteLine("\n{0}Please make a selection:\n", playerPrompt(player));
                Console.WriteLine("\t1. Finish turn");
                Console.WriteLine("\t2. View your details");
                Console.WriteLine("\t3. Purchase This Property");
                Console.WriteLine("\t4. Buy House for Property");
                Console.WriteLine("\t5. Trade Property with Player");
                Console.WriteLine("\t7. Mortgage Property");
                Console.WriteLine("\t8. Unmortgage Property");

                //if (player.getJailStats() == true && player.firstTurnInJail == false)
                //{
                //    Console.WriteLine("\t6. Pay $50.00 fine to get out of Jail");
                //}

                Console.Write("\t(1-7)>");
                //read response
                resp = inputInteger();
                //if response is invalid redisplay menu
                if (resp == 0)
                    this.displayPlayerChoiceMenu(player);

                //perform choice according to number input
                switch (resp)
                {
                    case 1:
                        //set firstTimeInJail to false to reset condition of player's first turn in Jail
                        //player.firstTurnInJail = false;
                        break;
                    case 2:
                        Console.WriteLine("\n\t==================================");
                        Console.WriteLine(player.FullDetailsToString());
                        Console.WriteLine("\t====================================");
                        this.displayPlayerChoiceMenu(player);
                        break;
                    case 3:
                        this.purchaseProperty(player);
                        this.displayPlayerChoiceMenu(player);
                        break;
                    case 4:
                        this.buyHouse(player);
                        this.displayPlayerChoiceMenu(player);
                        break;
                    case 5:
                        this.tradeProperty(player);
                        this.displayPlayerChoiceMenu(player);
                        break;
                    case 6:
                        player.payFine();
                        this.displayPlayerChoiceMenu(player);
                        break;
                    case 7:
                        this.mortgageProperty(player);
                        this.displayPlayerChoiceMenu(player);
                        break;
                    case 8:
                        this.unMortgageProperty(player);
                        this.displayPlayerChoiceMenu(player);
                        break;
                    default:
                        Console.WriteLine("That option is not avaliable. Please try again.");
                        this.displayPlayerChoiceMenu(player);
                        break;
                }
            }
        }
Пример #6
0
        public void displayPlayerJailMenu(Player player)
        {
            //Only display this option if we are in jail
            if (player.getIsInJail() == false)
            {
                displayPlayerChoiceMenu(player);
                return;
            }
            int resp = 0;
            Console.WriteLine("\n{0}Please make a selection:\n", playerPrompt(player));

            Console.WriteLine("1. Finish turn");
            Console.WriteLine("2. View your details");

            Console.WriteLine("3. Pay $50 to get out of jail");
            Console.WriteLine("4. Try roll doubles to get out of jail");

            Console.Write("(1-4)>");
            //read response
            resp = inputInteger();
            //if response is invalid redisplay menu
            if (resp == 0)
                this.displayPlayerJailMenu(player);

            //perform choice according to number input
            switch (resp)
            {
                case 1:
                    break;
                case 2:
                    Console.WriteLine("==================================");
                    Console.WriteLine(player.FullDetailsToString());
                    Console.WriteLine("==================================");
                    this.displayPlayerJailMenu(player);
                    break;
                case 3:
                    this.payJailFee(player);
                    this.displayPlayerJailMenu(player);
                    break;
                case 4:
                    this.rollDoublesJail(player);
                    this.displayPlayerJailMenu(player);
                    break;
                default:
                    Console.WriteLine("That option is not avaliable. Please try again.");
                    this.displayPlayerJailMenu(player);
                    break;
            }
        }
        public void displayPlayerChoiceMenu(Player player)
        {
            if (player.first == true)
            {
                int resp = 0;
                Console.WriteLine("1. Finish turn");
                Console.Write("(1-7)>");
                //read response
                resp = inputInteger();
                //if response is invalid redisplay menu
                if (resp == 0)
                    this.displayPlayerChoiceMenu(player);

                //perform choice according to number input
                switch (resp)
                {
                    case 1:
                        //player.first = false;
                        break;
                }
            }
            else
            {
                int resp = 0;
                Console.WriteLine("\n{0}Please make a selection:\n", playerPrompt(player));
                Console.WriteLine("1. Finish turn");
                Console.WriteLine("2. View your details");
                Console.WriteLine("3. Purchase This Property");
                Console.WriteLine("4. Buy House for Property");
                Console.WriteLine("5. Trade Property with Player");
                Console.WriteLine("6. Mortgage Property");
                Console.WriteLine("7. Un Mortgage Property");

                if (player.getJailStatis() == true && player.first == false)
                {
                    Console.WriteLine("9. Pay $50 to get out of jail");

                }
                Console.Write("(1-7)>");
                //read response
                resp = inputInteger();
                //if response is invalid redisplay menu
                if (resp == 0)
                    this.displayPlayerChoiceMenu(player);

                //perform choice according to number input
                switch (resp)
                {
                    case 1:
                        //player.first = false;
                        break;
                    case 2:
                        Console.WriteLine("==================================");
                        Console.WriteLine(player.FullDetailsToString());
                        Console.WriteLine("==================================");
                        this.displayPlayerChoiceMenu(player);
                        break;
                    case 3:
                        this.purchaseProperty(player);
                        this.displayPlayerChoiceMenu(player);
                        break;
                    case 4:
                        this.buyHouse(player);
                        this.displayPlayerChoiceMenu(player);
                        break;

                    case 5:
                        this.tradeProperty(player);
                        this.displayPlayerChoiceMenu(player);
                        break;
                    case 6:
                        this.mortgage_property(player);
                        this.displayPlayerChoiceMenu(player);
                        break;
                    case 7:
                        this.un_mortgage_property(player);
                        this.displayPlayerChoiceMenu(player);
                        break;
                    case 8:
                        this.buyHouse(player);
                        this.displayPlayerChoiceMenu(player);
                        break;

                    case 9:
                        player.payJailFine();
                        break;

                    default:
                        Console.WriteLine("That option is not avaliable. Please try again.");
                        this.displayPlayerChoiceMenu(player);
                        break;
                }
            }
        }