/// <summary> /// Constructs a new menu entry with the specified text. /// </summary> public Slider(string text, int value) { ChangesValue = true; this.text = text; this.value = value; mainLabel = new MenuEntry(text); valueLabel = new Label(value + "% "); }
/// <summary> /// Constructs a new menu entry with the specified text. /// </summary> public OptionPicker(string text, string[] choices) { ChangesValue = true; this.text = text; this.choices = choices; mainLabel = new MenuEntry(text); choiceLabel = new Label(choices[0]); }
/// <summary> /// Constructor fills in the menu contents. /// </summary> public LevelSelectionScreen(Profile p) : base("Level Selection") { for (int i = 1; i <= p.CurrentLevel + 1; i++) { MenuEntry entry = new MenuEntry("Level " + i); entry.Selected += EntrySelected; MenuEntries.Add(entry); } }
/// <summary> /// Constructs a new menu entry with the specified text. /// </summary> public ButtonGroup(string text, string[] choices) { ChangesValue = true; this.text = text; mainLabel = new MenuEntry(text); buttons = new Button[choices.Length]; for(int i = 0; i < choices.Length; i++) buttons[i] = new Button(choices[i]); mPaddingY = 5; }
/// <summary> /// Constructor fills in the menu contents. /// </summary> public CustomLevelSelectionScreen(Profile p) : base("Custom Level Selection") { foreach(string s in Directory.GetFiles(@"Content\Levels\Custom\", "*.xml", SearchOption.AllDirectories)) { Level curLevel = Level.LoadLevel(s); mLevels.Add(curLevel); MenuEntry entry = new MenuEntry(curLevel.Name); entry.Pressed += EntrySelected; MenuEntries.Add(entry); } MenuEntry backButton = new MenuEntry("Back"); backButton.Pressed += OnCancel; MenuEntries.Add(backButton); }
/// <summary> /// Constructor fills in the menu contents. /// </summary> public WorldSelectionScreen(Profile p) : base("World Selection") { for (int i = 0; Level.INIT_LID_FOR_WORLD[i] <= p.CurrentLevel && i < Level.WORLD_NAMES.Length; i++) { MenuEntry entry = new MenuEntry(Level.WORLD_NAMES[i]); entry.Pressed += EntrySelected; MenuEntries.Add(entry); } MenuEntry cstmButton = new MenuEntry("Custom Levels"); cstmButton.Pressed += CustomEntrySelected; MenuEntries.Add(cstmButton); MenuEntry backButton = new MenuEntry("Back"); backButton.Pressed += OnCancel; MenuEntries.Add(backButton); }
/// <summary> /// Constructor fills in the menu contents. /// </summary> public MainMenuScreen() : base("Half-Cake'd") { // Create our menu entries. MenuEntry playGameMenuEntry = new MenuEntry("Play Game"); MenuEntry optionsMenuEntry = new MenuEntry("Options"); MenuEntry exitMenuEntry = new MenuEntry("Exit"); // Hook up menu event handlers. playGameMenuEntry.Pressed += PlayGameMenuEntrySelected; optionsMenuEntry.Pressed += OptionsMenuEntrySelected; exitMenuEntry.Pressed += OnCancel; // Add entries to the menu. MenuEntries.Add(playGameMenuEntry); MenuEntries.Add(optionsMenuEntry); MenuEntries.Add(exitMenuEntry); }
/// <summary> /// Constructor fills in the menu contents. /// </summary> public LevelSelectionScreen(Profile p, int world) : base(Level.WORLD_NAMES[world] + ": Level Selection") { int last = (int)MathHelper.Min(Level.INIT_LID_FOR_WORLD[world + 1], p.CurrentLevel + 1); int first = Level.INIT_LID_FOR_WORLD[world]; mLevels = new Level[last-first]; for (int i = 0; i < last - first; i++) { mLevels[i] = Level.LoadLevel(i + first); MenuEntry entry = new MenuEntry(mLevels[i].Name); entry.Pressed += EntrySelected; MenuEntries.Add(entry); } MenuEntry backButton = new MenuEntry("Back"); backButton.Pressed += OnCancel; MenuEntries.Add(backButton); }
public AudioOptionsScreen(Profile curProfile) : base("Audio Settings") { Slider masterVolumeSlider = new Slider("Master Volume:", 50); Slider musicEffectSlider = new Slider("Music Volume:", 50); Slider soundEffectSlider = new Slider("Sound Effect Volume:", 50); Slider narrationVolumeSlider = new Slider("Narration Volume:", 50); MenuEntry saveMenuEntry = new MenuEntry("Save"); MenuEntry backMenuEntry = new MenuEntry("Back"); saveMenuEntry.Pressed += SaveButton; backMenuEntry.Pressed += OnCancel; MenuEntries.Add(masterVolumeSlider); MenuEntries.Add(musicEffectSlider); MenuEntries.Add(soundEffectSlider); MenuEntries.Add(narrationVolumeSlider); MenuEntries.Add(saveMenuEntry); MenuEntries.Add(backMenuEntry); mProfile = curProfile; }
public ProfileScreen(StorageDevice device) : base("Profile Management") { mDevice = device; indicator = new MenuEntry(""); indicator.Position = new Vector2(70, -100); indicator.State = UIState.Selected; var temp = Profile.LoadAll(mDevice); mProfiles = temp.Value; string[] profileOptions = { "Delete", "Rename", "Make Active" }; for (int i = 0; i < mProfiles.Count; i++) { if (mProfiles[i].ProfileNumber >= mNextProfile) mNextProfile = mProfiles[i].ProfileNumber + 1; ButtonGroup profileGroup = new ButtonGroup(mProfiles[i].Name, profileOptions); profileGroup.HideInactive = true; profileGroup.Buttons[0].Pressed += ConfirmDeleteProfile(mProfiles[i]); profileGroup.Buttons[1].Pressed += RenameProfile(mProfiles[i]); profileGroup.Buttons[2].Pressed += SetDefaultProfile(mProfiles[i]); MenuEntries.Add(profileGroup); } MenuEntry addMenuEntry = new MenuEntry("Add Profile"); addMenuEntry.Pressed += MakeProfile; MenuEntries.Add(addMenuEntry); MenuEntry backMenuEntry = new MenuEntry("Back"); backMenuEntry.Pressed += OnCancel; MenuEntries.Add(backMenuEntry); Default = temp.Key; }
/// <summary> /// Constructor. /// </summary> public PauseMenuScreen(Level level) : base("Paused") { // Flag that there is no need for the game to transition // off when the pause menu is on top of it. IsPopup = true; mLevel = level; // Create our menu entries. MenuEntry resumeGameMenuEntry = new MenuEntry("Resume Game"); MenuEntry restartLevelMenuEntry = new MenuEntry("Restart Level"); MenuEntry quitGameMenuEntry = new MenuEntry("Quit Game"); // Hook up menu event handlers. resumeGameMenuEntry.Pressed += OnCancel; quitGameMenuEntry.Pressed += QuitGameMenuEntrySelected; restartLevelMenuEntry.Pressed += RestartLevelMenuEntrySelected; // Add entries to the menu. MenuEntries.Add(resumeGameMenuEntry); MenuEntries.Add(restartLevelMenuEntry); MenuEntries.Add(quitGameMenuEntry); }
/// <summary> /// Constructor. /// </summary> public OptionsMenuScreen() : base("Options") { // Create our menu entries. MenuEntry profileMenuEntry = new MenuEntry("Profile"); MenuEntry keybindingsMenuEntry = new MenuEntry("Keybindings"); MenuEntry resolutionMenuEntry = new MenuEntry("Resolution"); MenuEntry soundMenuEntry = new MenuEntry("Sound"); MenuEntry backMenuEntry = new MenuEntry("Back"); // Hook up menu event handlers. profileMenuEntry.Selected += ProfileMenuEntrySelected; keybindingsMenuEntry.Selected += KeybindingsMenuEntrySelected; resolutionMenuEntry.Selected += ResolutionMenuEntrySelected; soundMenuEntry.Selected += SoundMenuEntrySelected; backMenuEntry.Selected += OnCancel; // Add entries to the menu. MenuEntries.Add(profileMenuEntry); MenuEntries.Add(keybindingsMenuEntry); MenuEntries.Add(resolutionMenuEntry); MenuEntries.Add(soundMenuEntry); MenuEntries.Add(backMenuEntry); }
public AudioOptionsScreen(Profile curProfile) : base("Audio Settings") { masterVolumeSlider = new Slider("Master Volume:", curProfile.Audio.MasterVolume); musicEffectSlider = new Slider("Music Volume:", curProfile.Audio.MusicVolume); soundEffectSlider = new Slider("Sound Effect Volume:", curProfile.Audio.SoundEffectsVolume); narrationVolumeSlider = new Slider("Narration Volume:", curProfile.Audio.NarrationVolume); MenuEntry saveMenuEntry = new MenuEntry("Save"); MenuEntry backMenuEntry = new MenuEntry("Back"); saveMenuEntry.Pressed += SaveButton; saveMenuEntry.Pressed += OnCancel; backMenuEntry.Pressed += OnCancel; MenuEntries.Add(masterVolumeSlider); MenuEntries.Add(musicEffectSlider); MenuEntries.Add(soundEffectSlider); MenuEntries.Add(narrationVolumeSlider); StackPanel btmPanel = new StackPanel(new UIElement[]{saveMenuEntry, backMenuEntry}); MenuEntries.Add(btmPanel); mProfile = curProfile; }
public GraphicsScreen(Profile curProfile) : base("Graphics Settings") { // Create our menu entries. OptionPicker displayModeMenuEntry = new OptionPicker("Display Mode:", new string[3] { "W", "W (NB)", "FS" }); OptionPicker resolutionMenuEntry = new OptionPicker( "Resolutions:", new string[3] { "A", "B", "C" }); MenuEntry testMenuEntry = new MenuEntry("Test"); MenuEntry saveMenuEntry = new MenuEntry("Save"); MenuEntry backMenuEntry = new MenuEntry("Back"); // Hook up menu event handlers. testMenuEntry.Pressed += TestButton; saveMenuEntry.Pressed += SaveButton; backMenuEntry.Pressed += OnCancel; // Add entries to the menu. MenuEntries.Add(displayModeMenuEntry); MenuEntries.Add(resolutionMenuEntry); MenuEntries.Add(testMenuEntry); MenuEntries.Add(saveMenuEntry); MenuEntries.Add(backMenuEntry); mProfile = curProfile; }
public KeybindingsScreen(Profile curProfile) : base("Keybindings") { mProfile = curProfile; originalBindings = curProfile.KeyBindings.Clone(); // Creates the keybindings menu... menuList = new List<KeybindingKV>() { new KeybindingKV("Move Forward", curProfile.KeyBindings.MoveForward){}, new KeybindingKV("Move Backwards", curProfile.KeyBindings.MoveBackwards){}, new KeybindingKV("Crouch", curProfile.KeyBindings.Crouch){}, new KeybindingKV("Jump", curProfile.KeyBindings.Jump){}, new KeybindingKV("Interact", curProfile.KeyBindings.Interact){}, new KeybindingKV("Pause", curProfile.KeyBindings.Pause){}, new KeybindingKV("Portal 1 (Pink) Fire", curProfile.KeyBindings.Portal1){}, new KeybindingKV("Portal 2 (Red) Fire", curProfile.KeyBindings.Portal2){}, }; foreach (KeybindingKV keyItem in menuList) { string title = keyItem.Key; string[] choices = new string[2]; choices[0] = keyItem.Value[0].ToString(); choices[1] = keyItem.Value[1].ToString(); ButtonGroup buttonRow = new ButtonGroup(title, choices); buttonRow.Buttons[0].Pressed += OpenKeybindingDialog(keyItem, buttonRow, 0); buttonRow.Buttons[1].Pressed += OpenKeybindingDialog(keyItem, buttonRow, 1); MenuEntries.Add(buttonRow); } // Menu Items that are special MenuEntry acceptMenuEntry = new MenuEntry("Accept"); MenuEntry cancelMenuEntry = new MenuEntry("Cancel"); // Event bindings acceptMenuEntry.Pressed += SaveButton; acceptMenuEntry.Pressed += OnCancel; cancelMenuEntry.Pressed += CancelButton; // Menu entries on our list StackPanel btmPanel = new StackPanel(new UIElement[] { acceptMenuEntry, cancelMenuEntry }); MenuEntries.Add(btmPanel); }
public GraphicsScreen(Profile curProfile) : base("Graphics Settings") { // Create our menu entries. //get an array of resolutions; mDisplayModePicker = new OptionPicker("Display Mode:", new string[3] { "Full Screen", "Windowed", "Windowed (No Borders)" }); mDisplayModePicker.SelectedChoice = (int)curProfile.Graphics.PresentationMode; mPrevMode = mDisplayModePicker.SelectedChoice; mResolutions = GraphicsAdapter.DefaultAdapter.SupportedDisplayModes.Select<DisplayMode, Vector2>(x => new Vector2(x.Width, x.Height)).ToList(); mResolutionPicker = new OptionPicker( "Resolutions:", mResolutions.Select<Vector2,String>(x => "" + x.X + " x " + x.Y).ToArray() ); mResolutionPicker.SelectedChoice = mResolutions.IndexOf( curProfile.Graphics.Resolution ); mPrevRes = mResolutionPicker.SelectedChoice; MenuEntry testMenuEntry = new MenuEntry("Test"); MenuEntry saveMenuEntry = new MenuEntry("Save"); MenuEntry backMenuEntry = new MenuEntry("Back"); // Hook up menu event handlers. testMenuEntry.Pressed += TestButton; saveMenuEntry.Pressed += SaveButton; saveMenuEntry.Pressed += OnCancel; backMenuEntry.Pressed += OnCancel; // Add entries to the menu. MenuEntries.Add(mDisplayModePicker); MenuEntries.Add(mResolutionPicker); StackPanel btmPanel = new StackPanel(new UIElement[] {testMenuEntry, saveMenuEntry, backMenuEntry }); MenuEntries.Add(btmPanel); mProfile = curProfile; }
public KeybindingsScreen(Profile curProfile) : base("Keybindings") { ButtonGroup bg1 = new ButtonGroup("A", new string[2] { "1", "3332" }); ButtonGroup bg2 = new ButtonGroup("BC", new string[2] { "1", "3332" }); ButtonGroup bg3 = new ButtonGroup("CAC", new string[2] { "---1", "2" }); ButtonGroup bg4 = new ButtonGroup("DCAB", new string[2] { "12", "23333" }); ButtonGroup bg5 = new ButtonGroup("EFGBA", new string[2] { "321", "23" }); MenuEntry backMenuEntry = new MenuEntry("Back"); backMenuEntry.Pressed += OnCancel; MenuEntries.Add(bg1); MenuEntries.Add(bg2); MenuEntries.Add(bg3); MenuEntries.Add(bg4); MenuEntries.Add(bg5); MenuEntries.Add(backMenuEntry); mProfile = curProfile; }