예제 #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 RoboManagerControlBinding_Format(object sender, ConvertEventArgs e)
        {
            RoboPlayerControl control = new RoboPlayerControl();

            control.RoboPlayer = e.Value as RoboPlayer;
            e.Value            = control;
        }