コード例 #1
0
        public static int MenuServer(List <string> options, bool exit)
        {
            ConsoleOptionsInterface optionsMenu = new ConsoleOptionsInterface(options, exit, false);
            int optionSelected = optionsMenu.Launch();

            return(optionSelected);
        }
コード例 #2
0
        public override int GetCorrespondingOrientationNum(int[] firstCoordinate)//gets user input
        {
            Console.WriteLine("\nPlease enter which direction to place your ship from the starting coordinate " + ConvertCoordinate(firstCoordinate) + ", that you entered: ");
            List <string> orientationOptions = new List <string> {
                "Up", "Down", "Left", "Right"
            };
            ConsoleOptionsInterface orientationMenu = new ConsoleOptionsInterface(orientationOptions, false, false);
            int numericSelection = orientationMenu.Launch();

            return(numericSelection);
        }
コード例 #3
0
        public Human(List <Gestures> gestures, string name)
        {
            this.wins     = 0;
            this.type     = "Human";
            this.name     = name;
            this.gestures = gestures;
            foreach (Gestures gesture in gestures)
            {
                this.gestureNames.Add(gesture.name);
            }

            this.gestureChoices = new ConsoleOptionsInterface(gestureNames, false, true);
        }
コード例 #4
0
        public void Run()
        {
            List <string> startOptions = new List <string> {
                "Play single player", "Play multiplayer", "Spectator Mode(Comp vs Comp)"
            };
            ConsoleOptionsInterface startMenu = new ConsoleOptionsInterface(startOptions, true, false);
            bool runGame = true;

            while (runGame == true)
            {
                int optionSelected = startMenu.Launch();//If optionSelected == 4, program automatically terminated.
                playersList = Setup.LoadBattleConsoles(optionSelected);
                playerOne   = playersList[0];
                playerTwo   = playersList[1];
                playerOne.SetBoard();
                playerTwo.SetBoard();
                TurnCycle(RandNumGen.GenerateRand(0, 2));
            }
        }
コード例 #5
0
        static void Main(string[] args)
        {
            bool          runProgram     = true;
            List <string> optionsStrings = new List <string> {
                "Create tournament", "See tournament rules"
            };
            ConsoleOptionsInterface optionsMenu = new ConsoleOptionsInterface(optionsStrings, true, false);
            Setup setupTournament = new Setup();

            do
            {
                setupTournament.WelcomeMessage();
                int selectedOption = optionsMenu.Launch();
                if (selectedOption == 1)
                {
                    setupTournament.Launch();
                }
                else if (selectedOption == 2)
                {
                    Rules.DisplayRules();
                }
            } while (runProgram == true);
        }