Beispiel #1
0
        public static void TestClients(List <Tuple <string, string, string> > players, string host, int port)
        {
            List <ClientTester> clients = new List <ClientTester>();


            GameList.ListServerData server = new GameList.ListServerData();

            if (host != string.Empty)
            {
                server.Host = host;
                server.Port = port;
            }
            else
            {
                GetList("A_REGULAR_HUMAN_PLAYER", string.Empty);
                server = Link.FindServerWithMostPlayers();
            }


            for (int i = 0; i < players.Count; i++)
            {
                ClientTester t = BuildClient(i + 1, server.Host, server.Port, players[i].Item1, players[i].Item2, players[i].Item3);
                clients.Add(t);
                if (useThreads)
                {
                    t.Run();
                }

                if (delayJoin)
                {
                    Thread.Sleep(2000);
                }
            }

            if (!useThreads)
            {
                while (true)
                {
                    foreach (var t in clients)
                    {
                        t.Update();
                    }

                    Thread.Sleep(10);
                }
            }
            else
            {
                while (true)
                {
                    Thread.Sleep(100);
                }
            }
        }