Пример #1
0
        private static Team SelectTeam(char sel)
        {
            do
            {
                input = "";

                Console.Write("Enter the 3-letter abbreviation for " +
                              $"{(sel.Equals('p') ? "your" : "opposing")} team selection: ");
                input = Console.ReadLine().ToUpper();

                if (IsAbbreviationValid(input))
                {
                    Console.WriteLine();
                    return(TeamRenders.RenderStockTeam(input));
                }

                TextFormat.Error("Invalid selection. Please try again.\n");
            } while (true);
        }
Пример #2
0
        private static Team AssignPlayerTeam()
        {
            Team t;

            #region Team Selection Menu Options
            Console.WriteLine(@"ANA | Anaheim Ducks         ARI | Arizona Coyotes        BOS | Boston Bruins");
            Console.WriteLine(@"BUF | Buffalo Sabres        CGY | Calgary Flames         CAR | Carolina Hurricanes");
            Console.WriteLine(@"CHI | Chicago Blackhawks    COL | Colorado Avalanche     CBJ | Columbus Blue Jackets");
            Console.WriteLine(@"DAL | Dallas Stars          DET | Detroit Red Wings      EDM | Edmonton Oilers");
            Console.WriteLine(@"FLA | Florida Panthers      LAK | Los Angeles Kings      MIN | Minnesota Wild");
            Console.WriteLine(@"MTL | Montreal Canadiens    NSH | Nashville Predators    NJD | New Jersey Devils");
            Console.WriteLine(@"NYI | New York Islanders    NYR | New York Rangers       OTT | Ottawa Senators");
            Console.WriteLine(@"PHI | Philadelphia Flyers   PIT | Pittsburgh Penguins    STL | Saint Louis Blues");
            Console.WriteLine(@"SJS | San Jose Sharks       TBL | Tampa Bay Lightning    TOR | Toronto Maple Leafs");
            Console.WriteLine(@"VAN | Vancouver Canucks     VGK | Vegas Golden Knights   WSH | Washington Capitals");
            Console.WriteLine("WPG | Winnipeg Jets\n");
            #endregion

            do
            {
                Console.Write("Enter the 3-letter abbreviation for your team: ");
                input = Console.ReadLine().ToUpper();
                if (IsAbbreviationValid(input))
                {
                    t = TeamRenders.RenderCustomTeam(TeamRenders.RenderStockTeam(input), customRoster);

                    if (t.Center.IsCustom && t.Winger.IsCustom && t.Defenseman.IsCustom)
                    {
                        TextFormat.Error($"\nWarning! The {newPlayerTeam} roster contains all custom players.\n" +
                                         "If you continue, you will be required to overwrite one of the preexisting " +
                                         "custom players.\nWould you like to continue?\n");

                        do
                        {
                            Console.Write("Select (Y)es/(N)o: ");
                            string overwriteInput = Console.ReadLine().Trim().ToLower();

                            switch (overwriteInput)
                            {
                            case "yes":
                            case "y":
                                return(t);

                            case "no":
                            case "n":
                                return(AssignPlayerTeam());

                            default:
                                TextFormat.Error("Invalid selection. Please try again.\n");
                                break;
                            }
                        } while (true);
                    }
                    else
                    {
                        return(t);
                    }
                }
                else
                {
                    TextFormat.Error("Invalid selection. Please try again.\n");
                }
            } while (true);
        }
Пример #3
0
        public static void Start(List <Player> customRoster)
        {
            Team userTeam;
            Team opponent;

            Console.Clear();

            Console.WriteLine("NHL Threes Exhibition Game\n");

            // Select teams
            #region Team Selection Menu Options
            Console.WriteLine(@"ANA | Anaheim Ducks         ARI | Arizona Coyotes        BOS | Boston Bruins");
            Console.WriteLine(@"BUF | Buffalo Sabres        CGY | Calgary Flames         CAR | Carolina Hurricanes");
            Console.WriteLine(@"CHI | Chicago Blackhawks    COL | Colorado Avalanche     CBJ | Columbus Blue Jackets");
            Console.WriteLine(@"DAL | Dallas Stars          DET | Detroit Red Wings      EDM | Edmonton Oilers");
            Console.WriteLine(@"FLA | Florida Panthers      LAK | Los Angeles Kings      MIN | Minnesota Wild");
            Console.WriteLine(@"MTL | Montreal Canadiens    NSH | Nashville Predators    NJD | New Jersey Devils");
            Console.WriteLine(@"NYI | New York Islanders    NYR | New York Rangers       OTT | Ottawa Senators");
            Console.WriteLine(@"PHI | Philadelphia Flyers   PIT | Pittsburgh Penguins    STL | Saint Louis Blues");
            Console.WriteLine(@"SJS | San Jose Sharks       TBL | Tampa Bay Lightning    TOR | Toronto Maple Leafs");
            Console.WriteLine(@"VAN | Vancouver Canucks     VGK | Vegas Golden Knights   WSH | Washington Capitals");
            Console.WriteLine("WPG | Winnipeg Jets\n");
            #endregion

            userTeam            = SelectTeam('p');
            userTeam.IsUserTeam = true;
            do
            {
                opponent = SelectTeam('c');

                if (userTeam.Name.Equals(opponent.Name))
                {
                    TextFormat.Error($"The {userTeam} has already been selected. Please try again.\n");
                }
            } while (userTeam.Name.Equals(opponent.Name));

            // Select player
            if (customRoster.Any())
            {
                userTeam = TeamRenders.RenderCustomTeam(userTeam, customRoster);
                opponent = TeamRenders.RenderCustomTeam(opponent, customRoster);
            }

            SelectPlayer(userTeam);

            // Home/away designations
            if (Roll(2) == 1)
            {
                home            = userTeam;
                away            = opponent;
                home.IsUserTeam = true;
            }
            else
            {
                home            = opponent;
                away            = userTeam;
                away.IsUserTeam = true;
            }
            home.IsHome = true;

            Console.Clear();
            Console.Write("TONIGHT! The visiting ");
            TextFormat.Away(away.Name);
            Console.WriteLine($" play against the {home}!\n");
            Thread.Sleep(1000);

            PlayGame();
        }