コード例 #1
0
        /// <summary>
        /// Hides all the screens and shows the selected screen.
        /// </summary>
        private void SwitchToSelectedScreen()
        {
            game.HideScreens();

            switch ((SelectableMenuItems)SelectedItem)
            {
            case SelectableMenuItems.Play:
                var playScreen = game.Services.GetService <GameScreen>();
                playScreen.SetActive(true);
                playScreen.PlayMusic();
                break;

            case SelectableMenuItems.Help:
                game.Services.GetService <HelpScreen>().SetActive(true);
                break;

            case SelectableMenuItems.Credits:
                game.Services.GetService <CreditsScreen>().SetActive(true);
                break;

            case SelectableMenuItems.Quit:
                game.Exit();
                break;

            default:
                // Switch to the start screen as a backup
                var startScreen = game.Services.GetService <StartScreen>();
                startScreen.SetActive(true);
                startScreen.PlayMusic();
                break;
            }
        }
コード例 #2
0
 public void Exit()
 {
     game.Exit();
 }