示例#1
0
 private static void RunForm(Participant[] participants)
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     var form = new TutorialForm(competitionsBundle.competitions);
     Task.Factory.StartNew(() => competitionsBundle.competitions.ProcessParticipants(true, 60 * 1000, participants));
     Application.Run(form);
 }
示例#2
0
 private static void RunForm(Participant participant)
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     form = new TutorialForm(competitionsBundle.competitions) {KeyPreview = true};
     form.KeyDown += (sender, e) => competitionsBundle.competitions.ApplyCommand(Controller.GetCommand(e.KeyCode));
     form.KeyUp += (sender, e) => competitionsBundle.competitions.ApplyCommand(Command.Sleep(0));
     Task.Factory.StartNew(() => competitionsBundle.competitions.ProcessParticipants(true, int.MaxValue, participant));
     Application.Run(form);
 }
示例#3
0
 private static Participant[] InitCompetition()
 {
     var participantsServer = new ParticipantsServer(CompetitionsName);
     var participant = participantsServer.GetParticipant();
     competitionsBundle = participantsServer.CompetitionsBundle;
     var participants = new Participant[2];
     participants[participant.ControlledRobot] = participant;
     var botNumber = participant.ControlledRobot == 0 ? 1 : 0;
     participantsServer.CompetitionsBundle.competitions.Initialize(new CVARCEngine(participantsServer.CompetitionsBundle.Rules),
         new[] { new RobotSettings(participant.ControlledRobot, false), new RobotSettings(botNumber, true) });
     var botName = participantsServer.CompetitionsBundle.competitions.HelloPackage.Opponent ?? "None";
     participants[botNumber] = participantsServer.CompetitionsBundle.competitions.CreateBot(botName, botNumber);
     return participants;
 }