protected override void OnExiting(object sender, EventArgs args) { base.OnExiting(sender, args); this.soundManager.StopBackgroundMusic(); if (networkManager != null) { networkManager.Disconnect(); } }
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(); }
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; }
private void button_quit_Clicked(Button sender) { _netMgr.Disconnect(); _stateManager.RequestStateChange <MainScreen>(); Dispose(); }