コード例 #1
0
ファイル: ParticipantsServer.cs プロジェクト: DmitryZyr/CVARC
 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)
     };
 }
コード例 #2
0
ファイル: Program.cs プロジェクト: DmitryZyr/CVARC
 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)
     });
 }
コード例 #3
0
ファイル: Program.cs プロジェクト: air-labs/CVARC
        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)
            });
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: DmitryZyr/CVARC
 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);
     }
 }
コード例 #5
0
ファイル: Program.cs プロジェクト: air-labs/CVARC
 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);
     }
 }
コード例 #6
0
ファイル: ParticipantsServer.cs プロジェクト: DmitryZyr/CVARC
 private CompetitionsBundle GetCompetitionsBundle(HelloPackage helloPackage)
 {
     var competitionsBundle = CompetitionsBundle.Load(competitionsName, helloPackage.LevelName);
     competitionsBundle.competitions.HelloPackage = helloPackage;
     return competitionsBundle;
 }