Esempio n. 1
0
        /// <summary>
        /// Event handler for when the Quit Game menu entry is selected.
        /// </summary>
        void QuitGameMenuEntrySelected(object sender, PlayerIndexEventArgs e)
        {
            const string message = "Are you sure you want to quit this game?";

            MessageBoxScreen confirmQuitMessageBox = new MessageBoxScreen(message);

            confirmQuitMessageBox.Accepted += ConfirmQuitMessageBoxAccepted;

            ScreenManager.AddScreen(confirmQuitMessageBox, ControllingPlayer);
        }
Esempio n. 2
0
        public void ToggleSoundsSelected(object sender, PlayerIndexEventArgs e)
        {
            EngineGame.Instance.SoundsEnabled = !EngineGame.Instance.SoundsEnabled;

            SetMenuEntryText();
        }
Esempio n. 3
0
        /// <summary>
        /// Event handler for when the Frobnicate menu entry is selected.
        /// </summary>
        void FrobnicateMenuEntrySelected(object sender, PlayerIndexEventArgs e)
        {
            frobnicate = !frobnicate;

            SetMenuEntryText();
        }
Esempio n. 4
0
        /// <summary>
        /// Event handler for when the Elf menu entry is selected.
        /// </summary>
        void ElfMenuEntrySelected(object sender, PlayerIndexEventArgs e)
        {
            elf++;

            SetMenuEntryText();
        }
Esempio n. 5
0
 void ControllerEntrySelected(object sender, PlayerIndexEventArgs e)
 {
     ScreenManager.AddScreen(new ControllerOptionsScreen(), e.PlayerIndex);
 }
Esempio n. 6
0
        /// <summary>
        /// Event handler for when the Ungulate menu entry is selected.
        /// </summary>
        void UngulateMenuEntrySelected(object sender, PlayerIndexEventArgs e)
        {
            currentUngulate++;

            if (currentUngulate > Ungulate.Llama)
                currentUngulate = 0;

            SetMenuEntryText();
        }
Esempio n. 7
0
 void SoundsEntrySelected(object sender, PlayerIndexEventArgs e)
 {
     ScreenManager.AddScreen(new SoundOptionsScreen(), e.PlayerIndex);
 }
Esempio n. 8
0
        /// <summary>
        /// Event handler for when the Language menu entry is selected.
        /// </summary>
        void LanguageMenuEntrySelected(object sender, PlayerIndexEventArgs e)
        {
            currentLanguage = (currentLanguage + 1) % languages.Length;

            SetMenuEntryText();
        }
Esempio n. 9
0
        /// <summary>
        /// Event handler for when the Play Game menu entry is selected.
        /// </summary>
        void PlayGameMenuEntrySelected(object sender, PlayerIndexEventArgs e)
        {
            GameplayScreen gp = new GameplayScreen(EngineGame.Instance.LevelManager);
            LoadingScreen.Load(ScreenManager, true, e.PlayerIndex,
                               gp);
            ScreenManager.CurrentGameplay = gp;

            if (PlayGame != null)
            {
                PlayGame();
            }
        }
Esempio n. 10
0
 /// <summary>
 /// Event handler for when the Options menu entry is selected.
 /// </summary>
 void OptionsMenuEntrySelected(object sender, PlayerIndexEventArgs e)
 {
     ScreenManager.AddScreen(new OptionsMenuScreen(), e.PlayerIndex);
 }
Esempio n. 11
0
        void loadMenuEntry_Selected(object sender, PlayerIndexEventArgs e)
        {
            // Configure open file dialog box
            OpenFileDialog dlg = new OpenFileDialog();
            dlg.FileName = "Document"; // Default file name
            dlg.DefaultExt = ".txt"; // Default file extension
            dlg.Filter = "Text documents (.txt)|*.txt"; // Filter files by extension

            // Show open file dialog box
            Nullable<bool> result = dlg.ShowDialog();

            // Process open file dialog box results
            if (result == true)
            {
                // Open document
                ScreenManager.GameWorld.LevelManager.Clear();
                var levelWithExt = dlg.FileName.Split(new string[] { "Levels\\" }, StringSplitOptions.None)[1];
                var level = levelWithExt.Substring(0, levelWithExt.IndexOf('.'));
                ScreenManager.GameWorld.LoadLevel(level);
            }
        }
Esempio n. 12
0
 /// <summary>
 /// Event handler for when the user selects ok on the "are you sure
 /// you want to exit" message box.
 /// </summary>
 void ConfirmExitMessageBoxAccepted(object sender, PlayerIndexEventArgs e)
 {
     ScreenManager.Game.Exit();
 }
Esempio n. 13
0
        public void ToggleControllerSelected(object sender, PlayerIndexEventArgs e)
        {
            EngineGame.Instance.GamepadEnabled = !EngineGame.Instance.GamepadEnabled;

            SetMenuEntryText();
        }
Esempio n. 14
0
 /// <summary>
 /// Helper overload makes it easy to use OnCancel as a MenuEntry event handler.
 /// </summary>
 protected void OnCancel(object sender, PlayerIndexEventArgs e)
 {
     OnCancel(e.PlayerIndex);
 }
Esempio n. 15
0
 /// <summary>
 /// Event handler for when the user selects ok on the "are you sure
 /// you want to quit" message box. This uses the loading screen to
 /// transition from the game back to the main menu screen.
 /// </summary>
 void ConfirmQuitMessageBoxAccepted(object sender, PlayerIndexEventArgs e)
 {
     LoadingScreen.Load(ScreenManager, false, e.PlayerIndex, new BackgroundScreen(),
                                                             new MainMenuScreen());
 }