private void SaveSettings() { string jsonString; lock (globalLock) { var dict = new Dictionary <string, string>(); dict["AudioSettings"] = realtimeConfig != null?realtimeConfig.Serialize() : ""; dict[nameof(SelectedInputL)] = SelectedInputL.ToString(); dict[nameof(SelectedInputR)] = SelectedInputR.ToString(); dict[nameof(SelectedOutputL)] = SelectedOutputL.ToString(); dict[nameof(SelectedOutputR)] = SelectedOutputR.ToString(); dict[nameof(loadSampleDirectory)] = loadSampleDirectory; dict[nameof(saveSampleDirectory)] = saveSampleDirectory; dict[nameof(savePresetDirectory)] = savePresetDirectory; dict[nameof(VolumeSlider)] = VolumeSlider.ToString("0.000", CultureInfo.InvariantCulture); jsonString = JsonConvert.SerializeObject(dict, Formatting.Indented); if (jsonString != currentJsonSettings) { if (currentJsonSettings != null) // don't save on the first round, only compute the value you indend to save. This is so we don't touch the config every time the app opens { File.WriteAllText(settingsFile, jsonString); } currentJsonSettings = jsonString; } } }
public MainWindow() { InitializeComponent(); //UI tbSongName.DataContext = SuperSong; tbArtist.DataContext = SuperSong; //Timer media.MediaEnded += Media_MediaEnded; _timer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(1) }; _timer.Tick += _timer_Tick; //Slider TimeSlider.AddHandler(MouseLeftButtonUpEvent, new MouseButtonEventHandler(TimeSlider_MouseLeftButtonUp), true); TimeSlider.ValueChanged += TimeSlider_ValueChanged; VolumeSlider.ValueChanged += VolumeSlider_ValueChanged; VolumeSlider.AddHandler(MouseLeftButtonUpEvent, new MouseButtonEventHandler(VolumnSlider_MouseLeftButtonUp), true); //Playlist lvNowPlaying.ItemsSource = playlist; lvCustomPlaylist.ItemsSource = customplaylist; //Tooltip btnRepeatMode.DataContext = playmode; btnPlayRandomMode.DataContext = isPlayingRandomly; //Hook _hook = Hook.GlobalEvents(); _hook.KeyUp += _hook_KeyUp; }
private void VolumeGridPointerWheelChanged(object sender, PointerRoutedEventArgs e) { var mousePosition = e.GetCurrentPoint((UIElement)sender); var delta = mousePosition.Properties.MouseWheelDelta / 60f; var volume = (double)VolumeSlider.GetValue(Slider.ValueProperty); VolumeSlider.SetValue(Slider.ValueProperty, volume + delta); }
public void SetVolume(VolumeSlider volumeSlider) { audioMixer.SetFloat(volumeSlider.volumeType.ToString(), volumeSlider.volume); VolumeLevels.Remove(volumeSlider.volumeType); VolumeLevels.Add(volumeSlider.volumeType, volumeSlider.volume); // Save changes SaveSettings(); }
public SettingsPage() { InitializeComponent(); LoactionFrame.Navigate(typeof(AddFoldersView)); //MainPageViewModel.Current.Title = Consts.Localizer.GetString("SettingsText"); MainPageViewModel.Current.NeedShowTitle = false; // slider swallowed PointerReleasedEvent VolumeSlider.AddHandler(PointerReleasedEvent, new PointerEventHandler(Slider_PointerReleased), true); SystemTheme.Checked -= RadioButton_Checked; LightTheme.Checked -= RadioButton_Checked; DarkTheme.Checked -= RadioButton_Checked; AutoTheme.Checked -= RadioButton_Checked; SunThemeChecker.Checked -= SunThemeChecker_Checked; SunThemeChecker.Unchecked -= SunThemeChecker_Checked; SunThemeChecker.IsChecked = Settings.Current.SunTheme; if (Settings.Current.AutoTheme) { AutoTheme.IsChecked = true; } else { AutoTheme.IsChecked = false; switch (Settings.Current.Theme) { case ElementTheme.Default: SystemTheme.IsChecked = true; break; case ElementTheme.Light: LightTheme.IsChecked = true; break; case ElementTheme.Dark: DarkTheme.IsChecked = true; break; default: SystemTheme.IsChecked = true; break; } } SystemTheme.Checked += RadioButton_Checked; LightTheme.Checked += RadioButton_Checked; DarkTheme.Checked += RadioButton_Checked; AutoTheme.Checked += RadioButton_Checked; SunThemeChecker.Checked += SunThemeChecker_Checked; SunThemeChecker.Unchecked += SunThemeChecker_Checked; Task.Run(async() => { await Context.Init(); }); }
public void LoadContent(ContentManager content) { // Loading background picture mBackground = content.Load <Texture2D>("Buttons/pause"); var volumeOffImage = TextureManager.GetTexture("button_off"); var volumeOnImage = TextureManager.GetTexture("button_on"); mSpriteFont = content.Load <SpriteFont>("FileHeading"); mVolume = new Switch(volumeOnImage, volumeOffImage, new Point(200, 100), 64, 128, "An", "Aus"); mEffects = new Switch(volumeOnImage, volumeOffImage, new Point(200, 200), 64, 128, "An", "Aus"); mMusic = new Switch(volumeOnImage, volumeOffImage, new Point(200, 300), 64, 128, "An", "Aus"); mCheatMode = new Switch(volumeOnImage, volumeOffImage, new Point(200, 400), 64, 128, "An", "Aus"); mResolution = new MenuButton(new Point(200, 500), 75, 240, "Auflösung anpassen"); mVolume.LoadContent(content); mEffects.LoadContent(content); mMusic.LoadContent(content); mCheatMode.LoadContent(content); mResolution.LoadContent(content); var slider00 = content.Load <Texture2D>("Buttons/slider/Volumebar_00"); var slider01 = content.Load <Texture2D>("Buttons/slider/Volumebar_01"); var slider02 = content.Load <Texture2D>("Buttons/slider/Volumebar_02"); var slider03 = content.Load <Texture2D>("Buttons/slider/Volumebar_03"); var slider04 = content.Load <Texture2D>("Buttons/slider/Volumebar_04"); var slider05 = content.Load <Texture2D>("Buttons/slider/Volumebar_05"); var slider06 = content.Load <Texture2D>("Buttons/slider/Volumebar_06"); var slider07 = content.Load <Texture2D>("Buttons/slider/Volumebar_07"); var slider08 = content.Load <Texture2D>("Buttons/slider/Volumebar_08"); var slider09 = content.Load <Texture2D>("Buttons/slider/Volumebar_09"); var slider10 = content.Load <Texture2D>("Buttons/slider/Volumebar_10"); mVolumeSlider = new VolumeSlider(new Point(400, 100), 70, 300, slider00, slider01, slider02, slider03, slider04, slider05, slider06, slider07, slider08, slider09, slider10); mEffectSlider = new VolumeSlider(new Point(400, 200), 70, 300, slider00, slider01, slider02, slider03, slider04, slider05, slider06, slider07, slider08, slider09, slider10, VolumeSlider.VolumeMode.EffectVolume); mMusicSlider = new VolumeSlider(new Point(400, 300), 70, 300, slider00, slider01, slider02, slider03, slider04, slider05, slider06, slider07, slider08, slider09, slider10, VolumeSlider.VolumeMode.MusicVolume); mBackground = content.Load <Texture2D>("Menus/OptionsAndStatisticsMenu"); }
public Button() { InitializeComponent(); VolumeButton.MouseEnter += (sender, args) => { if (!ShowVolumeToolBar) { return; } _temporaryToken?.Cancel(); _temporaryToken = new CancellationTokenSource(); SliderContainer.Visibility = Visibility.Visible; }; VolumeButton.MouseLeave += (sender, args) => { if (!ShowVolumeToolBar) { return; } Task.Run(async delegate { var keep = _temporaryToken; await Task.Delay(TimeSpan.FromMilliseconds(500), keep.Token); Dispatcher.Invoke(delegate { SliderContainer.Visibility = Visibility.Collapsed; }); }); }; if (Mute) { SetButtonVisibility(Muted); } else if (Volume > 0.66) { SetButtonVisibility(VolumeHigh); } else if (Volume > 0.33) { SetButtonVisibility(VolumeMid); } else { SetButtonVisibility(VolumeLow); } VolumeSlider.SetBinding(Slider.VolumeProperty, new Binding("Volume") { Source = this, Mode = BindingMode.TwoWay }); }
public SettingsPage() { InitializeComponent(); LoactionFrame.Navigate(typeof(AddFoldersView)); //MainPageViewModel.Current.Title = Consts.Localizer.GetString("SettingsText"); MainPageViewModel.Current.NeedShowTitle = false; MainPageViewModel.Current.LeftTopColor = Resources["SystemControlForegroundBaseHighBrush"] as SolidColorBrush; // slider swallowed PointerReleasedEvent VolumeSlider.AddHandler(PointerReleasedEvent, new PointerEventHandler(Slider_PointerReleased), true); Task.Run(async() => { await Context.Init(); }); }
public GameLaunchSettingsViewModel() { StatusMessage = ""; NewProgramPathText = ""; NewProgramArgsText = ""; IsProgramPopupOpen = false; _audioTest = null; HasLoaded = false; LastVolumeSliderChanged = VolumeSlider.Music; InitImportMovieOption(); InitInGameConfigOptions(); InitSoundDevices(); InitRenderers(); InitMidiDevices(); LoadSettings(Sys.Settings.GameLaunchSettings); }
/// <summary> /// User selects to change volume /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Volume_Click(object sender, RoutedEventArgs e) { VolumeSlider.Value = App.playbackService.Player.Volume * 100; Volume.Visibility = Visibility.Collapsed; if (Settings.repeatEnabled) { RepeatEnabled.Visibility = Visibility.Collapsed; } else { Repeat.Visibility = Visibility.Collapsed; } if (Settings.shuffleEnabled) { ShuffleEnabled.Visibility = Visibility.Collapsed; } else { Shuffle.Visibility = Visibility.Collapsed; } VolumeSlider.Visibility = Visibility.Visible; VolumeSlider.Focus(FocusState.Programmatic); }
public AudioTestView() { InitializeComponent(); volumeSlider = new VolumeSlider(); volumeSlider.VolumeChanged += new EventHandler(OnVolumeSliderChanged); this.NAudioVolumeSlider.Child = volumeSlider; volumeMeter1 = new VolumeMeter(); volumeMeter2 = new VolumeMeter(); volumeMeter1.ForeColor = volumeMeter2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192))))); this.NAudioVolumeMeter1.Child = volumeMeter1; this.NAudioVolumeMeter2.Child = volumeMeter2; waveformPainter1 = new WaveformPainter(); waveformPainter2 = new WaveformPainter(); waveformPainter1.BackColor = waveformPainter2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192))))); waveformPainter1.ForeColor = waveformPainter2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.NAudioPainter1.Child = waveformPainter1; this.NAudioPainter2.Child = waveformPainter2; }
// Update is called once per frame void Update() { float volume = VolumeSlider.getVolumeSliderValue(); source.volume = volume / 10f; }
private void Image_MouseDown(object sender, MouseButtonEventArgs e) { VolumeSlider.ExpandSlider(); }
public void Init(object sender, EventArgs e) { string PreShow = File.ReadAllLines("./ShowData.txt")[0]; string Show = File.ReadAllLines("./ShowData.txt")[1]; string PostShow = File.ReadAllLines("./ShowData.txt")[2]; bool ShowTime = Boolean.Parse(File.ReadAllLines("./ShowData.txt")[5]); TimeSpan TimeVariance = GetVariance(); string StartValue = File.ReadAllLines("./ShowData.txt")[3]; DateTime StartTime = DateTime.Parse(File.ReadAllLines("./ShowData.txt")[3]) - TimeVariance; DateTime EndTime = DateTime.Parse(File.ReadAllLines("./ShowData.txt")[4]) - TimeVariance; if (ShowTime) { MessageBox.Show(DateTime.UtcNow.ToString()); } if (ShowTime) { MessageBox.Show((DateTime.Parse(File.ReadAllLines("./ShowData.txt")[3]) - TimeVariance).ToString()); } Streamer.URL = PreShow; Application.DoEvents(); this.Refresh(); Streamer.Refresh(); VolumeSlider.Refresh(); while (DateTime.UtcNow < StartTime) { try { WaitTimer.Text = "The Show will begin in: " + Math.Abs((DateTime.UtcNow - StartTime).Days).ToString() + " Days, " + Math.Abs((DateTime.UtcNow - StartTime).Hours).ToString() + " Hours, " + Math.Abs((DateTime.UtcNow - StartTime).Minutes).ToString() + " Minutes, " + Math.Abs((DateTime.UtcNow - StartTime).Seconds).ToString() + " Seconds."; } catch (Exception exception) { MessageBox.Show(exception.ToString()); } Application.DoEvents(); } WaitTimer.Text = ""; if (DateTime.UtcNow > EndTime) { WaitTimer.Text = "The Stream has ended."; return; } Streamer.URL = Show; Streamer.Ctlcontrols.currentPosition = 0; Streamer.Ctlcontrols.pause(); Streamer.settings.volume = 100; if (DateTime.UtcNow > StartTime && DateTime.UtcNow < EndTime) { Streamer.Ctlcontrols.currentPosition = (DateTime.UtcNow - StartTime).TotalSeconds; } while (DateTime.UtcNow >= StartTime && DateTime.UtcNow <= EndTime) { string mins = (DateTime.UtcNow - StartTime).Minutes.ToString(); if (mins.Length == 1) { mins = "0" + mins; } string secs = (DateTime.UtcNow - StartTime).Seconds.ToString(); if (secs.Length == 1) { secs = "0" + secs; } WaitTimer.Text = mins + ":" + secs; Application.DoEvents(); } Streamer.URL = PostShow; WaitTimer.Text = "The Stream has ended."; WaitTimer.ForeColor = System.Drawing.Color.Red; }
public void Initialize() { // Creating main menu MenuManager menuManager = new MenuManager(inputManager, "MainMenu"); ImageButton button = new ImageButton(spriteBatch, game, inputManager, new Vector2(Constants.RESOLUTION_VIRTUAL_WIDTH * 0.5f, Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f + 100.0f), Constants.GUI_START, "start"); button.onClick += new ImageButton.ButtonEventHandler(OnButtonPress); menuManager.AddButton(button); button = new ImageButton(spriteBatch, game, inputManager, new Vector2(Constants.RESOLUTION_VIRTUAL_WIDTH * 0.5f, Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f + 150.0f), Constants.GUI_OPTIONS, "options"); button.onClick += new ImageButton.ButtonEventHandler(OnButtonPress); menuManager.AddButton(button); button = new ImageButton(spriteBatch, game, inputManager, new Vector2(Constants.RESOLUTION_VIRTUAL_WIDTH * 0.5f, Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f + 200.0f), Constants.GUI_CREDITS, "credits"); button.onClick += new ImageButton.ButtonEventHandler(OnButtonPress); menuManager.AddButton(button); button = new ImageButton(spriteBatch, game, inputManager, new Vector2(Constants.RESOLUTION_VIRTUAL_WIDTH * 0.5f, Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f + 250.0f), Constants.GUI_QUIT, "quit"); button.onClick += new ImageButton.ButtonEventHandler(OnButtonPress); menuManager.AddButton(button); menuManager.initialize(); menu["MainMenu"] = menuManager; // Creating options menu menuManager = new MenuManager(inputManager, "Options"); button = new ImageButton(spriteBatch, game, inputManager, new Vector2(Constants.RESOLUTION_VIRTUAL_WIDTH * 0.5f, Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f + 50.0f), Constants.GUI_GAME_PLAY, "gameplay"); button.onClick += new ImageButton.ButtonEventHandler(OnButtonPress); menuManager.AddButton(button); button = new ImageButton(spriteBatch, game, inputManager, new Vector2(Constants.RESOLUTION_VIRTUAL_WIDTH * 0.5f, Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f + 100.0f), Constants.GUI_GRAPHICS, "graphics"); button.onClick += new ImageButton.ButtonEventHandler(OnButtonPress); menuManager.AddButton(button); button = new ImageButton(spriteBatch, game, inputManager, new Vector2(Constants.RESOLUTION_VIRTUAL_WIDTH * 0.5f, Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f + 150.0f), Constants.GUI_SOUND, "sound"); button.onClick += new ImageButton.ButtonEventHandler(OnButtonPress); menuManager.AddButton(button); button = new ImageButton(spriteBatch, game, inputManager, new Vector2(Constants.RESOLUTION_VIRTUAL_WIDTH * 0.5f, Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f + 200.0f), Constants.GUI_CONTROLS, "controls"); button.onClick += new ImageButton.ButtonEventHandler(OnButtonPress); menuManager.AddButton(button); button = new ImageButton(spriteBatch, game, inputManager, new Vector2(Constants.RESOLUTION_VIRTUAL_WIDTH * 0.5f, Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f + 250.0f), Constants.GUI_BACK, "options_back"); button.onClick += new ImageButton.ButtonEventHandler(OnButtonPress); menuManager.AddButton(button); menuManager.initialize(); menu["Options"] = menuManager; // Creating Sound Options Menu menuManager = new MenuManager(inputManager, "Sound"); button = new ImageButton(spriteBatch, game, inputManager, new Vector2(Constants.RESOLUTION_VIRTUAL_WIDTH * 0.5f, Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f + 100.0f), Constants.GUI_EFFECTS_VOLUME, "effect_volume"); VolumeSlider volumeSlider = new VolumeSlider(spriteBatch, game, audioManager, new Vector2(Constants.RESOLUTION_VIRTUAL_WIDTH * 0.5f + 300f, Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f + 100.0f), "effect_volume_slider"); menuManager.AddButton(button, volumeSlider); button = new ImageButton(spriteBatch, game, inputManager, new Vector2(Constants.RESOLUTION_VIRTUAL_WIDTH * 0.5f, Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f + 150.0f), Constants.GUI_MUSIC_VOLUME, "music_volume"); volumeSlider = new VolumeSlider(spriteBatch, game, null, new Vector2(Constants.RESOLUTION_VIRTUAL_WIDTH * 0.5f + 300f, Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f + 150.0f), "music_volume_slider"); menuManager.AddButton(button, volumeSlider); button = new ImageButton(spriteBatch, game, inputManager, new Vector2(Constants.RESOLUTION_VIRTUAL_WIDTH * 0.5f, Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f + 200.0f), Constants.GUI_BACK, "sound_options_back"); button.onClick += new ImageButton.ButtonEventHandler(OnButtonPress); menuManager.AddButton(button); menuManager.initialize(); menu["Sound"] = menuManager; // Creating Game Play Options Menu menuManager = new MenuManager(inputManager, "GamePlay"); button = new ImageButton(spriteBatch, game, inputManager, new Vector2(Constants.RESOLUTION_VIRTUAL_WIDTH * 0.5f, Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f + 150.0f), Constants.GUI_TUTORIAL, "tutorial"); Selection selection = new Selection(spriteBatch, game, new Vector2(Constants.RESOLUTION_VIRTUAL_WIDTH * 0.5f + 300f, Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f + 150.0f), "tutorial_selection"); selection.AddSelection("On", Constants.GUI_ON); selection.AddSelection("Off", Constants.GUI_OFF); menuManager.AddButton(button, selection); bool tut = bool.Parse(game.config.getValue("General", "Tutorial")); if (tut == true) { selection.Selection = "On"; } else { selection.Selection = "Off"; } button = new ImageButton(spriteBatch, game, inputManager, new Vector2(Constants.RESOLUTION_VIRTUAL_WIDTH * 0.5f, Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f + 200.0f), Constants.GUI_BACK, "game_play_options_back"); button.onClick += new ImageButton.ButtonEventHandler(OnButtonPress); menuManager.AddButton(button); menuManager.initialize(); menu["GamePlay"] = menuManager; // Creating Graphics Options Menu menuManager = new MenuManager(inputManager, "Graphics"); button = new ImageButton(spriteBatch, game, inputManager, new Vector2(Constants.RESOLUTION_VIRTUAL_WIDTH * 0.5f, Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f + 100.0f), Constants.GUI_SPECULAR, "specular"); selection = new Selection(spriteBatch, game, new Vector2(Constants.RESOLUTION_VIRTUAL_WIDTH * 0.5f + 300f, Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f + 100.0f), "specular_selection"); selection.AddSelection("High", Constants.GUI_HIGH); selection.AddSelection("Medium", Constants.GUI_MEDIUM); selection.AddSelection("Low", Constants.GUI_LOW); selection.AddSelection("Off", Constants.GUI_OFF); float specular = float.Parse(game.config.getValue("Video", "Specular")); selection.Selection = ParseSpecularConfig(specular); menuManager.AddButton(button, selection); /*button = new ImageButton(spriteBatch, game, inputManager, new Vector2(Constants.RESOLUTION_VIRTUAL_WIDTH * 0.5f, Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f + 150.0f), Constants.GUI_DYNAMIC_LIGHTING, "dynamic_lighting"); selection = new Selection(spriteBatch, game, new Vector2(Constants.RESOLUTION_VIRTUAL_WIDTH * 0.5f + 300f, Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f + 150.0f), "dynamic_lighting_selection"); selection.AddSelection("On", Constants.GUI_ON); selection.AddSelection("Off", Constants.GUI_OFF); bool dynLights = bool.Parse(game.config.getValue("Video", "DynamicLights")); if (dynLights == true) { selection.Selection = "On"; } else { selection.Selection = "Off"; } menuManager.AddButton(button, selection);*/ button = new ImageButton(spriteBatch, game, inputManager, new Vector2(Constants.RESOLUTION_VIRTUAL_WIDTH * 0.5f, Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f + 150.0f), Constants.GUI_SCREEN_MODE, "screen_mode"); selection = new Selection(spriteBatch, game, new Vector2(Constants.RESOLUTION_VIRTUAL_WIDTH * 0.5f + 300f, Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f + 150.0f), "screen_mode_selection"); selection.AddSelection("Fullscreen", Constants.GUI_FULLSCREEN); selection.AddSelection("Windowed", Constants.GUI_WINDOWED); if (bool.Parse(game.config.getValue("Video", "Fullscreen")) == true) { selection.Selection = "Fullscreen"; } else { selection.Selection = "Windowed"; } menuManager.AddButton(button, selection); button = new ImageButton(spriteBatch, game, inputManager, new Vector2(Constants.RESOLUTION_VIRTUAL_WIDTH * 0.5f, Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f + 200.0f), Constants.GUI_RESOLUTION, "resolution"); string output = game.Window.ClientBounds.Width + "x" + game.Window.ClientBounds.Height.ToString(); Label label = new Label(spriteBatch, game, new Vector2(Constants.RESOLUTION_VIRTUAL_WIDTH * 0.5f + 300f, Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f + 200.0f), "resolution_label", output); menuManager.AddButton(button, label); button = new ImageButton(spriteBatch, game, inputManager, new Vector2(Constants.RESOLUTION_VIRTUAL_WIDTH * 0.5f, Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f + 250.0f), Constants.GUI_BACK, "graphics_options_back"); button.onClick += new ImageButton.ButtonEventHandler(OnButtonPress); menuManager.AddButton(button); menuManager.initialize(); menu["Graphics"] = menuManager; // Creating Controls Options Menu menuManager = new MenuManager(inputManager, "Controls"); button = new ImageButton(spriteBatch, game, inputManager, new Vector2(Constants.RESOLUTION_VIRTUAL_WIDTH * 0.5f, Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f + 50.0f), Constants.GUI_SHOOT, "controls_shoot"); label = new Label(spriteBatch, game, new Vector2(Constants.RESOLUTION_VIRTUAL_WIDTH * 0.5f + 300f, Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f + 50.0f), "shoot_string", inputManager.shoot.ToString(), false); menuManager.AddButton(button, label); button = new ImageButton(spriteBatch, game, inputManager, new Vector2(Constants.RESOLUTION_VIRTUAL_WIDTH * 0.5f, Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f + 100.0f), Constants.GUI_UP, "controls_up"); label = new Label(spriteBatch, game, new Vector2(Constants.RESOLUTION_VIRTUAL_WIDTH * 0.5f + 300f, Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f + 100.0f), "up_string", inputManager.up.ToString(), false); menuManager.AddButton(button, label); button = new ImageButton(spriteBatch, game, inputManager, new Vector2(Constants.RESOLUTION_VIRTUAL_WIDTH * 0.5f, Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f + 150.0f), Constants.GUI_DOWN, "controls_down"); label = new Label(spriteBatch, game, new Vector2(Constants.RESOLUTION_VIRTUAL_WIDTH * 0.5f + 300f, Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f + 150.0f), "down_string", inputManager.down.ToString(), false); menuManager.AddButton(button, label); button = new ImageButton(spriteBatch, game, inputManager, new Vector2(Constants.RESOLUTION_VIRTUAL_WIDTH * 0.5f, Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f + 200.0f), Constants.GUI_LEFT, "controls_left"); label = new Label(spriteBatch, game, new Vector2(Constants.RESOLUTION_VIRTUAL_WIDTH * 0.5f + 300f, Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f + 200.0f), "left_string", inputManager.left.ToString(), false); menuManager.AddButton(button, label); button = new ImageButton(spriteBatch, game, inputManager, new Vector2(Constants.RESOLUTION_VIRTUAL_WIDTH * 0.5f, Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f + 250.0f), Constants.GUI_RIGHT, "controls_right"); label = new Label(spriteBatch, game, new Vector2(Constants.RESOLUTION_VIRTUAL_WIDTH * 0.5f + 300f, Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f + 250.0f), "right_string", inputManager.right.ToString(), false); menuManager.AddButton(button, label); button = new ImageButton(spriteBatch, game, inputManager, new Vector2(Constants.RESOLUTION_VIRTUAL_WIDTH * 0.5f, Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f + 300.0f), Constants.GUI_BACK, "controls_back"); button.onClick += new ImageButton.ButtonEventHandler(OnButtonPress); menuManager.AddButton(button); menuManager.initialize(); menu["Controls"] = menuManager; // Creating Credits Options Menu menuManager = new MenuManager(inputManager, "Credits"); button = new ImageButton(spriteBatch, game, inputManager, new Vector2(Constants.RESOLUTION_VIRTUAL_WIDTH * 0.5f, Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f + 250.0f), Constants.GUI_BACK, "credits_back"); button.onClick += new ImageButton.ButtonEventHandler(OnButtonPress); MenuImage menuImage = new MenuImage(spriteBatch, game, new Vector2(Constants.RESOLUTION_VIRTUAL_WIDTH * 0.5f, Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f + 150.0f), Constants.GUI_DEVELOPERS_CREDITS, "dev_text"); menuManager.AddButton(button, menuImage); menuManager.initialize(); menu["Credits"] = menuManager; // Creating Quit Menu menuManager = new MenuManager(inputManager, "Quit"); button = new ImageButton(spriteBatch, game, inputManager, new Vector2(Constants.RESOLUTION_VIRTUAL_WIDTH * 0.5f - 200, Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f + 150.0f), Constants.GUI_YES, "quit_yes"); label = new Label(spriteBatch, game, new Vector2(Constants.RESOLUTION_VIRTUAL_WIDTH * 0.5f, Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f), "quit_text", "Are you sure you want to quit?", false); button.onClick += new ImageButton.ButtonEventHandler(OnButtonPress); menuManager.AddButton(button, label); button = new ImageButton(spriteBatch, game, inputManager, new Vector2(Constants.RESOLUTION_VIRTUAL_WIDTH * 0.5f + 200, Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f + 150.0f), Constants.GUI_NO, "quit_no"); button.onClick += new ImageButton.ButtonEventHandler(OnButtonPress); menuManager.AddButton(button); menuManager.initialize(); menu["Quit"] = menuManager; currentMenuManager = menu["MainMenu"]; currentMenuManager.FadeIn(); keyChangeWarning = new Vector2(game.Window.ClientBounds.Width * 0.5f, game.Window.ClientBounds.Height * 0.5f); spriteFont = game.Content.Load<SpriteFont>(Constants.GUI_FONT); }
private void VolumeMaxButtonClick(object sender, RoutedEventArgs e) { var maxValue = (double)VolumeSlider.GetValue(Slider.MaximumProperty); VolumeSlider.SetValue(Slider.ValueProperty, maxValue); }
private void VolumeMuteButtonClick(object sender, RoutedEventArgs e) { VolumeSlider.SetValue(Slider.ValueProperty, 0); }