Ejemplo n.º 1
0
        protected override void OnExiting(object sender, EventArgs args)
        {
            base.OnExiting(sender, args);

            this.soundManager.StopBackgroundMusic();

            if (networkManager != null)
            {
                networkManager.Disconnect();
            }
        }
Ejemplo n.º 2
0
        public void Run()
        {
            Logger.Debug("Initialising GameController.");

            ShowSplashScreen();

            _configurationManager.LoadFromFile(PathHelpers.ExecutableRelativeFile("client_config.toml"));

            _resourceManager.LoadBaseResources();
            _resourceManager.LoadLocalResources();

            //Setup Cluwne first, as the rest depends on it.
            SetupCluwne();
            CleanupSplashScreen();

            //Initialization of private members
            _messageLogger.Initialize();
            _entityNetworkManager.Initialize();
            _tileDefinitionManager.InitializeResources();

            var prototypeManager = IoCManager.Resolve <IPrototypeManager>();

            prototypeManager.LoadDirectory(PathHelpers.ExecutableRelativeFile("Prototypes"));
            prototypeManager.Resync();
            _networkManager.Initialize();
            _netGrapher.Initialize();
            _userInterfaceManager.Initialize();

            _stateManager.RequestStateChange <MainScreen>();

            FrameEventArgs _frameEvent;

            // EventArgs _frameEventArgs;
            _clock = new Clock();

            while (CluwneLib.IsRunning == true)
            {
                var lastFrameTime = _clock.ElapsedTime.AsSeconds();
                _clock.Restart();
                _frameEvent = new FrameEventArgs(lastFrameTime);
                CluwneLib.ClearCurrentRendertarget(Color.Black);
                CluwneLib.Screen.DispatchEvents();
                CluwneLib.RunIdle(this, _frameEvent);
                CluwneLib.Screen.Display();
            }
            _networkManager.Disconnect();
            CluwneLib.Terminate();
            Logger.Info("GameController terminated.");

            IoCManager.Resolve <IConfigurationManager>().SaveToFile();
        }
Ejemplo n.º 3
0
        public void Disconnect()
        {
            OnPlayerDisconnect(TileGrid.Player, TileGrid.ColorComparer(TileGrid.activeColor), bannerManager.LobbyBannerPos);

            bannerManager.RemoveLobbyBanners();

            if (TileGrid.GameState == GameStates.QuitGame)
            {
                bannerManager.RemoveGameBanners();
            }

            networkManager.Disconnect();
            IsDisconnected = true;
        }
Ejemplo n.º 4
0
 private void button_quit_Clicked(Button sender)
 {
     _netMgr.Disconnect();
     _stateManager.RequestStateChange <MainScreen>();
     Dispose();
 }