コード例 #1
0
        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;
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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;
        }