示例#1
0
        /// <summary>
        /// Constructs a new instance of <see cref="UnityServer"/> from "unity.config" file.
        /// </summary>
        public UnityServer()
        {
            var map = new ExeConfigurationFileMap {ExeConfigFilename = "unity.config"};
            var config = ConfigurationManager.OpenMappedExeConfiguration(map, ConfigurationUserLevel.None);
            UnityConfigurationSection section = (UnityConfigurationSection) config.GetSection("unity");
            _container = new UnityContainer();
            section.Configure(_container, "container");

            _shotTracker = _container.Resolve<IShotTracker>();
            _positionTracker = _container.Resolve<IPositionTracker>();
            _playerManagement = _container.Resolve<IPlayerManagement>();
            _signalStrengthTracker = _container.Resolve<ISignalStrengthTracker>();
            _gameManager = _container.Resolve<IGameManager>();
            ServerConsole = _container.Resolve<Console.Console>();
        }
 public void DetachPositionTracker( IPositionTracker<UserInfo> positionTracker )
 {
     if( positionTracker == null ) throw new ArgumentNullException( "positionTracker cannot be null" );
     if( _positionTrackers.Contains( positionTracker ) ) _positionTrackers.Remove( positionTracker );
 }