/** * <summary> * Moves to the key change scene * </summary> */ private void ChangeKeys(object sender, EventArgs e) { if (!isConnected) { WaveServices.SoundPlayer.StopAllSounds(); //We create a new scene of the same class (myscene, playablescene, test, etc.) of the current scene WaveServices.UnregisterService <NetworkService>(); ScreenContext screenContext = new ScreenContext(new KeysScene(this.GetType())); WaveServices.ScreenContextManager.To(screenContext); } }
private void Disconnect() { networkService.Disconnect(); WaveServices.SoundPlayer.StopAllSounds(); //We create a new scene of the same class (myscene, playablescene, test, etc.) of the current scene WaveServices.UnregisterService <NetworkService>(); WaveServices.RegisterService(new NetworkService()); Scene newScene = Activator.CreateInstance(this.GetType()) as Scene; ScreenContext screenContext = new ScreenContext(newScene); WaveServices.ScreenContextManager.To(screenContext); }