Ejemplo n.º 1
0
 public NetworkParticipant[] GetParticipants(HelloPackage helloPackage)
 {
     var client = new ClientWithPackage(listener.AcceptTcpClient());
     var client2 = new ClientWithPackage(listener.AcceptTcpClient());
     CompetitionsBundle = GetCompetitionsBundle(helloPackage);
     return new[]
     {
         new NetworkParticipant(CompetitionsBundle.competitions, 0, client.Client), 
         new NetworkParticipant(CompetitionsBundle.competitions, 1, client2.Client)
     };
 }
Ejemplo n.º 2
0
 private static void InitCompetition(HelloPackage helloPackage, string competitionsName)
 {
     var participantsServer = new ParticipantsServer(competitionsName);
     var participantsTask = Task.Factory.StartNew(() => participantsServer.GetParticipants(helloPackage));
     RunClients("player2\\Client.exe", "player1\\Client.exe");
     participants = participantsTask.Result;
     competitionsBundle = participantsServer.CompetitionsBundle;
     participantsServer.CompetitionsBundle.competitions.Initialize(new CVARCEngine(competitionsBundle.Rules), new[]
     {
         new RobotSettings(0, false), 
         new RobotSettings(1, false)
     });
 }
Ejemplo n.º 3
0
        private static void InitCompetition(HelloPackage helloPackage, string competitionsName)
        {
            var participantsServer = new ParticipantsServer(competitionsName);
            var participantsTask   = Task.Factory.StartNew(() => participantsServer.GetParticipants(helloPackage));

            RunClients("player2\\Client.exe", "player1\\Client.exe");
            participants       = participantsTask.Result;
            competitionsBundle = participantsServer.CompetitionsBundle;
            participantsServer.CompetitionsBundle.competitions.Initialize(new CVARCEngine(competitionsBundle.Rules), new[]
            {
                new RobotSettings(0, false),
                new RobotSettings(1, false)
            });
        }
Ejemplo n.º 4
0
 private static void InternalMain(HelloPackage helloPackage, string competitionsName)
 {
     try
     {
         InitCompetition(helloPackage, competitionsName);
         Application.EnableVisualStyles();
         Application.SetCompatibleTextRenderingDefault(false);
         form = new TutorialForm(competitionsBundle.competitions);
         new Thread(() => competitionsBundle.competitions.ProcessParticipants(realTime, 60 * 1000, participants))
         {
             IsBackground = true
         }.Start();
         Application.Run(form);
     }
     catch (Exception e)
     {
         throw;//todo Убрать
         MessageBox.Show(e.Message, "CVARC Network", MessageBoxButtons.OK, MessageBoxIcon.Error);
         Environment.Exit(1);
     }
 }
Ejemplo n.º 5
0
 private static void InternalMain(HelloPackage helloPackage, string competitionsName)
 {
     try
     {
         InitCompetition(helloPackage, competitionsName);
         Application.EnableVisualStyles();
         Application.SetCompatibleTextRenderingDefault(false);
         form = new TutorialForm(competitionsBundle.competitions);
         new Thread(() => competitionsBundle.competitions.ProcessParticipants(realTime, 60 * 1000, participants))
         {
             IsBackground = true
         }.Start();
         Application.Run(form);
     }
     catch (Exception e)
     {
         throw;//todo Убрать
         MessageBox.Show(e.Message, "CVARC Network", MessageBoxButtons.OK, MessageBoxIcon.Error);
         Environment.Exit(1);
     }
 }
Ejemplo n.º 6
0
 private CompetitionsBundle GetCompetitionsBundle(HelloPackage helloPackage)
 {
     var competitionsBundle = CompetitionsBundle.Load(competitionsName, helloPackage.LevelName);
     competitionsBundle.competitions.HelloPackage = helloPackage;
     return competitionsBundle;
 }