Ejemplo n.º 1
0
        void SaveButton(object sender, PlayerIndexEventArgs e)
        {
            mProfile.Audio.MasterVolume = masterVolumeSlider.Value;
            mProfile.Audio.MusicVolume = musicEffectSlider.Value;
            mProfile.Audio.SoundEffectsVolume = soundEffectSlider.Value;
            mProfile.Audio.NarrationVolume = narrationVolumeSlider.Value;

            //string message;
            //string[] prompt = { "Ok" };

            var device = (ScreenManager.Game as HalfCakedGame).Device;
            if (device != null)
            {
                Profile.SaveProfile(mProfile, "default.sav", device);
                SoundEffect.MasterVolume = mProfile.Audio.MasterVolume / 100f;
                MediaPlayer.Volume = mProfile.Audio.MasterVolume * mProfile.Audio.MusicVolume / 10000f;

                Console.WriteLine("Audio Settings Saved for " + mProfile.Name + "..." +
                    "\nMaster Volume: " + masterVolumeSlider.Value +
                    "\nMusic Effect Volume: " + musicEffectSlider.Value +
                    "\nSound Effect Volume: " + soundEffectSlider.Value +
                    "\nNarration Volume: " + narrationVolumeSlider.Value + "\n"
                );

                //message = "Audio Settings Saved for " + mProfile.Name;
            }
            else
            {
                Console.WriteLine("Unable to write to documents folder. Cannot save audio settings.");
                //message = "Unable to write to your documents folder. Cannot save audio settings.";
            }

            //MessageBoxScreen savedMessageBox = new MessageBoxScreen(message, prompt, 0);
            //ScreenManager.AddScreen(savedMessageBox, e.PlayerIndex);
        }
Ejemplo n.º 2
0
 void CancelButton(object sender, PlayerIndexEventArgs e)
 {
     mProfile.KeyBindings = originalBindings;
     base.OnCancel(sender, e);
 }
Ejemplo n.º 3
0
 void AcceptSelected(object sender, PlayerIndexEventArgs e)
 {
     // Tell the Keybinding screen what was selected...
     this.mReturnMethod.Invoke(this.mNewKey);
 }
Ejemplo n.º 4
0
 void ResetMenuEntrySelected(object sender, PlayerIndexEventArgs e)
 {
     mLevel.Reset();
     ExitScreen();
 }
Ejemplo n.º 5
0
 void NextLevelMenuEntrySelected(object sender, PlayerIndexEventArgs e)
 {
     LoadingScreen.Load(ScreenManager, true, e.PlayerIndex, new GameplayScreen(mLevel.LevelIdentifier+1));
 }
Ejemplo n.º 6
0
 void TestButton(object sender, PlayerIndexEventArgs e)
 {
 }
Ejemplo n.º 7
0
 void KeybindingPressed(object sender, PlayerIndexEventArgs e)
 {
 }
Ejemplo n.º 8
0
 void ConfirmResetMessageBoxAccepted(object sender, PlayerIndexEventArgs e)
 {
     mLevel.Reset();
     OnCancel(sender, e);
 }
Ejemplo n.º 9
0
        void ProfileMenuEntrySelected(object sender, PlayerIndexEventArgs e)
        {
            var scrn = new ProfileSelectionScreen((ScreenManager.Game as HalfCakedGame).Device);

            ScreenManager.AddScreen(scrn, null);
        }
Ejemplo n.º 10
0
        void KeybindingsMenuEntrySelected(object sender, PlayerIndexEventArgs e)
        {
            var scrn = new KeybindingsDialog((ScreenManager.Game as HalfCakedGame).CurrentProfile);

            ScreenManager.AddScreen(scrn, null);
        }
Ejemplo n.º 11
0
 void MakeProfile(object sender, PlayerIndexEventArgs e)
 {
     InputDialog dialog = new InputDialog("Please Enter a name for your profile:", "");
     dialog.Buttons[0].Pressed += AddProfile(dialog);
     ScreenManager.AddScreen(dialog, ControllingPlayer);
 }
Ejemplo n.º 12
0
 void Exit(object sender, PlayerIndexEventArgs e)
 {
     ExitScreen();
 }
Ejemplo n.º 13
0
        void ProfileMenuEntrySelected(object sender, PlayerIndexEventArgs e)
        {
            var device = (ScreenManager.Game as HalfCakedGame).Device;
            GameScreen msgbox;
            if (device != null)
                msgbox = new ProfileScreen(device);
            else
                msgbox = new MessageBoxScreen("Unable to write to your documents folder. Cannot save profiles.", new string[]{"Ok"}, 0);

            ScreenManager.AddScreen(msgbox, null);
        }
Ejemplo n.º 14
0
 void SaveButton(object sender, PlayerIndexEventArgs e)
 {
     HalfCakedGame game = ScreenManager.Game as HalfCakedGame;
     Profile.SaveProfile(mProfile, "default.sav", game.Device);
     ExitScreen();
 }
        void ProfileSelectedButton(object sender, PlayerIndexEventArgs e)
        {
            int index = mSelectedButton;

            Profile prof = mProfiles[index];
            Profile currentProf = (ScreenManager.Game as HalfCakedGame).CurrentProfile;

            if (prof == null)
            {
                if (mDefault == -1)
                    prof = currentProf;
                else
                {
                    prof = new Profile();
                }
                mReadingInput = true;
                prof.ProfileNumber = index;

                if(currentProf != null && mDefault != -1)
                    Profile.SaveProfile(prof, "profile" + index + ".sav", mDevice);
                else
                    Profile.SaveProfile(prof, "default.sav", mDevice);
                mProfiles[index] = prof;
                Buttons[index].Text = "";
                CreateDimensions();
                IsExiting = false;
                return;
            }

            if (currentProf != null && mDefault != -1)
            {
                if (currentProf.ProfileNumber == prof.ProfileNumber)
                {
                    ExitScreen();
                    return;
                }
                Profile.ChangeDefault(currentProf.ProfileNumber, prof.ProfileNumber, mDevice);
                (ScreenManager.Game as HalfCakedGame).CurrentProfile = prof;
            }
            if (mDefault == -1)
                Profile.SaveProfile(prof, "default.sav", mDevice);
        }
Ejemplo n.º 16
0
        void ResolutionMenuEntrySelected(object sender, PlayerIndexEventArgs e)
        {
            var scrn = new GraphicsDialog((ScreenManager.Game as HalfCakedGame).CurrentProfile);

            ScreenManager.AddScreen(scrn, null);
        }
Ejemplo n.º 17
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, null, new BackgroundScreen(),
                                                    new MainMenuScreen());
     Microsoft.Xna.Framework.Media.MediaPlayer.Stop();
 }
Ejemplo n.º 18
0
 void SoundMenuEntrySelected(object sender, PlayerIndexEventArgs e)
 {
     var scrn = new AudioOptionsDialog((ScreenManager.Game as HalfCakedGame).CurrentProfile);
     ScreenManager.AddScreen(scrn, null);
 }
Ejemplo n.º 19
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 level?\n     All current progress will be lost.";

            MessageBoxScreen confirmQuitMessageBox = new MessageBoxScreen(message);

            confirmQuitMessageBox.Buttons[0].Pressed += ConfirmQuitMessageBoxAccepted;

            ScreenManager.AddScreen(confirmQuitMessageBox, ControllingPlayer);
        }
Ejemplo n.º 20
0
 /// <summary>
 /// Event handler for when the Play Game menu entry is selected.
 /// </summary>
 void PlayGameMenuEntrySelected(object sender, PlayerIndexEventArgs e)
 {
     ScreenManager.AddScreen(new WorldSelectionScreen((ScreenManager.Game as HalfCakedGame).CurrentProfile), e.PlayerIndex);
 }
Ejemplo n.º 21
0
 void SaveButton(object sender, PlayerIndexEventArgs e)
 {
 }
Ejemplo n.º 22
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();
 }
Ejemplo n.º 23
0
 /// <summary>
 /// Event handler for when a level is selected
 /// </summary>
 void EntrySelected(object sender, PlayerIndexEventArgs e)
 {
     ScreenManager.AddScreen(new LevelSelectionScreen((ScreenManager.Game as HalfCakedGame).CurrentProfile, selectedEntry), e.PlayerIndex);
 }
Ejemplo n.º 24
0
 void ConfirmSaveMessageBoxAccepted(object sender, PlayerIndexEventArgs e)
 {
     var pss = new ProfileScreen((ScreenManager.Game as HalfCakedGame).Device);
     pss.ProfileSelected += ConfirmExitMessageBoxAccepted;
     ScreenManager.AddScreen(pss, e.PlayerIndex);
 }
Ejemplo n.º 25
0
 void QuitGameMenuEntrySelected(object sender, PlayerIndexEventArgs e)
 {
     LoadingScreen.Load(ScreenManager, false, null, new BackgroundScreen(),
                                                    new MainMenuScreen());
 }
Ejemplo n.º 26
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);
 }
Ejemplo n.º 27
0
 /// <summary>
 /// Event handler for when a level is selected
 /// </summary>
 void EntrySelected(object sender, PlayerIndexEventArgs e)
 {
     LoadingScreen.Load(ScreenManager, true, e.PlayerIndex,
                        new GameplayScreen(MenuEntries.IndexOf(sender as MenuEntry)));
 }
        void ConfirmExitMessageBoxAccepted(object sender, PlayerIndexEventArgs e)
        {
            mProfiles[mSelectedButton].Delete(mDevice);
            mProfiles[mSelectedButton] = null;
            Buttons[mSelectedButton].Text = "-Empty-";

            if (mSelectedButton == mDefault)
            {
                Profile prof = new Profile();
                prof.ProfileNumber = mDefault;
                (ScreenManager.Game as HalfCakedGame).CurrentProfile = prof;
                mDefault = -1;
            }

            mSelectedButton = -1;
            for (int i = 0; i < mProfiles.Length; i++)
            {
                if (mProfiles[i] != null)
                    mSelectedButton = i;
            }

            CreateDimensions();

            if (mSelectedButton == -1)
                mSelectedButton = 0;
        }
Ejemplo n.º 29
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);
 }
Ejemplo n.º 30
0
        void TestButton(object sender, PlayerIndexEventArgs e)
        {
            ResolutionChange();
            (ScreenManager.Game as HalfCakedGame).UpdateGraphics();

            const string message = "Apply these settings?";
            MessageBoxScreen testMessageBox = new MessageBoxScreen(message);
            testMessageBox.Buttons[0].Pressed += new EventHandler<PlayerIndexEventArgs>(ApplySettings);
            testMessageBox.Buttons[1].Pressed += new EventHandler<PlayerIndexEventArgs>(RevertSettings);
            testMessageBox.Cancelled += new EventHandler<PlayerIndexEventArgs>(RevertSettings);
            ScreenManager.AddScreen(testMessageBox, e.PlayerIndex);
        }