示例#1
0
文件: Menu.cs 项目: RimasR/JavaToCS
        public void showMenu()
        {
            List<Player> team1Players = new List<Player>();
            List<Player> team2Players = new List<Player>();
            int x;
            bool valid = false;
            try
            {

            } catch (Exception e)
            {

            }

            while (!valid)
            {
                Team team1 = new Team(input.GetText("Choose first team name: "));
                x = 1;
                while(x == 1)
                {
                    Player player = new Player();
                    player.SetName(input.GetText("Enter players full name: "));
                    player.SetPosition(input.GetText("Enter players position: "));
                    player.SetPlayerNumber(input.GetNumber("Enter players number: ", 0, 99));
                    team1Players.Add(player);
                    x = input.GetNumber("Would you like to add new player? 0 - no, 1 - yes", 0, 1);
                }

                Console.WriteLine("First team created.");

                Team team2 = new Team(input.GetText("Choose first team name: "));
                x = 1;
                while (x == 1)
                {
                    Player player = new Player();
                    player.SetName(input.GetText("Enter players full name: "));
                    player.SetPosition(input.GetText("Enter players position: "));
                    player.SetPlayerNumber(input.GetNumber("Enter players number: ", 0, 99));
                    team2Players.Add(player);
                    x = input.GetNumber("Would you like to add new player? 0 - no, 1 - yes", 0, 1);
                }
            }
        }
示例#2
0
文件: Team.cs 项目: RimasR/JavaToCS
 public void AddPlayer(Player player)
 {
     players.Add(player);
 }