Exemple #1
0
        public static LaunchResult Launch(IGameBundle bundle,
                                          string[] args, IApplicationConfig applicationConfig, string bindToIp, string levelLog)
        {
            StandaloneBundle = bundle;
            Config           = applicationConfig;
            _levelLog        = levelLog;
            _bindToIp        = bindToIp;

            var config     = BuildConfig();
            var serverTask = Task.Factory.StartNew(() => Bootstrap.Launch <Startup>(config));

            return(new LaunchResult
            {
                ServerTask = serverTask,
                ApiInitializationTask = Task <IGameServerApi> .Factory.StartNew(() =>
                {
                    while (serverTask.Status == TaskStatus.Running && Api == null)
                    {
                        Thread.Sleep(10);
                    }

                    if (Api == null)
                    {
                        throw new Exception("API not initialized");
                    }

                    return Api;
                })
            });
        }
Exemple #2
0
 public StandaloneModeRoomControllerFactory(IShamanComponents shamanComponents)
 {
     _bundle = StandaloneServerLauncher.StandaloneBundle;
     _bundle.OnInitialize(shamanComponents);
     _roomControllerFactory = _bundle.GetRoomControllerFactory();
     if (_roomControllerFactory == null)
     {
         throw new NullReferenceException("Game bundle returned null factory");
     }
 }