Exemple #1
0
        private void OnBackButton(object sender, BackPressedEventArgs e)
        {
            if (_gameScreen == null)
            {
                e.Handled = false;
            }
            else
            {
                e.Handled = true;

                var dlg = new MessageDialog("Are you sure you want to quit the game?", "Quit?");
                dlg.Commands.Add(new UICommand("Yes", command =>
                    {
                        _gameScreen.Cleanup();
                        _gameScreen = null;
                    }));
                dlg.Commands.Add(new UICommand("No"));
                dlg.CancelCommandIndex = 1;
                dlg.ShowAsync();
            }
        }
Exemple #2
0
        protected void OnGameStart()
        {
            if (MediaPlayer.GameHasControl)
                MediaPlayer.Stop();

            _gameScreen = new GameScreen(Content, _drawState.ScreenBounds);
            _gameScreen.OnGameOver += () =>
            {
                _gameScreen.Cleanup();
                _gameScreen = null;
            };
        }