Пример #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);
        }