Пример #1
0
        RoboPlayerPlugin playerActivationChanged(String playerName, Boolean activated)
        {
            RoboPlayerPlugin plugin = null;

            if (activated)
            {
                plugin = RoboManager.ActivatePlugin(playerName);
                plugin.Player.Position.PropertyChanged += Position_PropertyChanged;

                RoboPlayerControl control = new RoboPlayerControl();
                control.RoboPlayer = plugin.Player;
                playerPanel.Controls.Add(control);
            }
            else
            {
                plugin = RoboManager.ActivePlayers.FirstOrDefault(elem => elem.Name == playerName);
                if (plugin != null)
                {
                    plugin.Player.Position.PropertyChanged -= Position_PropertyChanged;
                    RoboPlayerControl playerControl = playerPanel.Controls
                                                      .Cast <RoboPlayerControl>()
                                                      .FirstOrDefault(control => control.RoboPlayer == plugin.Player);
                    if (playerControl != null)
                    {
                        playerPanel.Controls.Remove(playerControl);
                    }
                }
                RoboManager.DeactivatePlugin(playerName);
            }
            return(plugin);
        }
Пример #2
0
 private void RoboManager_GameStateChange(RoboManager sender, EventArgs <RoboGameState> eventArgs)
 {
     switch (eventArgs.Value)
     {
     case RoboGameState.Stopped:
         GameEnded();
         break;
     }
 }
Пример #3
0
        private void startGameToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (Board == null)
            {
                return;
            }

            RoboManager.StartGame();
            RoboManager.StartRound();
        }
Пример #4
0
        public RoboRallyForm()
        {
            InitializeComponent();

            Throttling  = 50;
            RoboManager = new RoboManager();
            RoboManager.GameStateChange += RoboManager_GameStateChange;
            CreateNewBoard();
            SetBoardEditorVisibility(true);
            folderBrowserDialog.SelectedPath = Directory.GetCurrentDirectory();
        }
Пример #5
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (DesignMode)
            {
                return;
            }

            RoboManager.LoadPlugins();

            foreach (RoboPlayerPlugin plugin in RoboManager.AvailablePlugins)
            {
                AddPluginToPlayerDropDown(plugin);
            }
        }