diff --git a/Output/Languages/en.xml b/Output/Languages/en.xml index b0cf6250..145e5f73 100644 --- a/Output/Languages/en.xml +++ b/Output/Languages/en.xml @@ -212,12 +212,15 @@ Sound Record Video - Lyrics/Graphics + Lyrics + Graphics Theme Credits + Server + Song Folder + Select the song folder you want to add Please restart the game for the changes to take effect. Server address - Add Song Folder Game Options Language Debug level @@ -228,7 +231,6 @@ Game difficulty Timer mode Highscore style - Select the song folder you want to add Record Options Device Input @@ -266,6 +268,10 @@ Cover size (pixels) Fullscreen Stretched + Server Options + Server active + Server encryption + Server address Video Options Video backgrounds Video preview @@ -282,7 +288,7 @@ Bottom right Volume Server address - Server is not running. Please check config.xml! + Server is not running. Please activate it and restart the game! We are sorry that Vocaluxe run into an error and crashed.\r\nTo help us fix the problem please send us a report.\r\nEdit the following log before submitting to remove possibly sensitive information. that you experienced an error.\r\nTo help us fix the problem please send us a report.\r\nEdit the following log before submitting to remove possibly sensitive information. diff --git a/Output/Themes/Changelog/Changelog_ScreenOptions.txt b/Output/Themes/Changelog/Changelog_ScreenOptions.txt index fdd4118f..5ec52d6a 100644 --- a/Output/Themes/Changelog/Changelog_ScreenOptions.txt +++ b/Output/Themes/Changelog/Changelog_ScreenOptions.txt @@ -1,5 +1,14 @@ ScreenOptions +++++++++++ +Version 4: +(2026 Mar 28) + +Add: +Grahpics Button +Server Button +Song Folder Button + ++++++++++ Version 3: (2025 Jan 13) @@ -19,4 +28,4 @@ Version 1: (2023 Dec 31) Add: - \ No newline at end of file + diff --git a/Output/Themes/Changelog/Changelog_ScreenOptionsGame.txt b/Output/Themes/Changelog/Changelog_ScreenOptionsGame.txt index 548df260..782fc40a 100644 --- a/Output/Themes/Changelog/Changelog_ScreenOptionsGame.txt +++ b/Output/Themes/Changelog/Changelog_ScreenOptionsGame.txt @@ -1,5 +1,10 @@ ScreenOptionsGame +Version 6: + +Remove: + + ++++++++++ Version 5: diff --git a/Output/Themes/Changelog/Changelog_ScreenOptionsGraphics.txt b/Output/Themes/Changelog/Changelog_ScreenOptionsGraphics.txt new file mode 100644 index 00000000..f0f45f08 --- /dev/null +++ b/Output/Themes/Changelog/Changelog_ScreenOptionsGraphics.txt @@ -0,0 +1,11 @@ +ScreenOptionsGraphics + +++++++++++ +Version 1: + +Add Graphics Options: + + + + + diff --git a/Output/Themes/Changelog/Changelog_ScreenOptionsLyrics.txt b/Output/Themes/Changelog/Changelog_ScreenOptionsLyrics.txt index 5ae10eb1..70269b7c 100644 --- a/Output/Themes/Changelog/Changelog_ScreenOptionsLyrics.txt +++ b/Output/Themes/Changelog/Changelog_ScreenOptionsLyrics.txt @@ -1,5 +1,10 @@ ScreenOptionsLyrics +++++++++++ +Version 4: +Remove Graphics Options +(moved to new Graphics Options screen) + ++++++++++ Version 3: diff --git a/Output/Themes/Changelog/Changelog_ScreenOptionsServer.txt b/Output/Themes/Changelog/Changelog_ScreenOptionsServer.txt new file mode 100644 index 00000000..8b3adb58 --- /dev/null +++ b/Output/Themes/Changelog/Changelog_ScreenOptionsServer.txt @@ -0,0 +1,9 @@ +ScreenOptionsServer + +++++++++++ +Version 1: + +Add Server Options: + + + diff --git a/Output/Themes/Vocaluxe 2024/Screens/ScreenOptions.xml b/Output/Themes/Vocaluxe 2024/Screens/ScreenOptions.xml index d649db31..cbd3c331 100644 --- a/Output/Themes/Vocaluxe 2024/Screens/ScreenOptions.xml +++ b/Output/Themes/Vocaluxe 2024/Screens/ScreenOptions.xml @@ -2,7 +2,7 @@ ScreenOptions - 3 + 4 @@ -25,27 +25,53 @@ 0 + + Warning + + + 695 + 700 + 1140 + 75 + -1 + + - + + + 1265 + 720 + -1.1 + 37.5 + 960 + + + Center + Center + + Outline + TR_SCREENO_WARNINGRESTART + + + + + + - diff --git a/Output/Themes/Vocaluxe 2024/Screens/ScreenOptionsGame.xml b/Output/Themes/Vocaluxe 2024/Screens/ScreenOptionsGame.xml index 0085c72b..49bd6726 100644 --- a/Output/Themes/Vocaluxe 2024/Screens/ScreenOptionsGame.xml +++ b/Output/Themes/Vocaluxe 2024/Screens/ScreenOptionsGame.xml @@ -2,7 +2,7 @@ ScreenOptionsGame - 5 + 6 @@ -25,17 +25,6 @@ 1 - - Warning - - - 325 - 900 - 1000 - 75 - -1 - - @@ -164,20 +153,6 @@ Outline TR_SCREENOGAME_HIGHSCORESTYLE - - 825 - 920 - -1.1 - 37.5 - 845 - - - Center - Center - - Outline - TR_SCREENO_WARNINGRESTART - - - diff --git a/Output/Themes/Vocaluxe 2024/Screens/ScreenOptionsGraphics.xml b/Output/Themes/Vocaluxe 2024/Screens/ScreenOptionsGraphics.xml new file mode 100644 index 00000000..ab4d86e6 --- /dev/null +++ b/Output/Themes/Vocaluxe 2024/Screens/ScreenOptionsGraphics.xml @@ -0,0 +1,341 @@ + + + + ScreenOptionsGrahpics + 1 + + + + Video + + + BG_Options + + + + + + + + + 0 + 60 + 1920 + 67.5 + 1 + + + + Warning + + + 710 + 900 + 1140 + 75 + -1 + + + + + + 960 + 75 + 0 + 40.5 + 0 + + + Center + Center + + Outline + TR_SCREENOGRAPHICS_OPTIONS + + + 112.5 + 160.5 + 0 + 40.5 + 0 + + + Left + Center + + Outline + TR_SCREENOGRAPHICS_TEXTUREQUALITY + + + 112.5 + 250.5 + 0 + 40.5 + 0 + + + Left + Center + + Outline + TR_SCREENOGRAPHICS_COVERSIZE + + + 112.5 + 340.5 + 0 + 40.5 + 0 + + + Left + Center + + Outline + TR_SCREENOGRAPHICS_FULLSCREEN + + + 112.5 + 430.5 + 0 + 40.5 + 0 + + + Left + Center + + Outline + TR_SCREENOGRAPHICS_STRETCH + + + 1280 + 920 + -1.1 + 37.5 + 960 + + + Center + Center + + Outline + TR_SCREENO_WARNINGRESTART + + + + + + + + + + + SelectSlideArrowLeft + SelectSlideArrowRight + SelectSlide + SelectSlideArrowLeft + SelectSlideArrowRight + + 750 + 150 + 1072.5 + 75 + 0 + + + 757.5 + 157.5 + 60 + 60 + 0 + + + 1755 + 157.5 + 60 + 60 + 0 + + + + + + + + 40.5 + 75 + 0 + 462 + Outline + Bold + 3 + + + + SelectSlideArrowLeft + SelectSlideArrowRight + SelectSlide + SelectSlideArrowLeft + SelectSlideArrowRight + + 750 + 240 + 1072.5 + 75 + 0 + + + 757.5 + 247.5 + 60 + 60 + 0 + + + 1755 + 247.5 + 60 + 60 + 0 + + + + + + + + 40.5 + 75 + 0 + 300 + Outline + Bold + 4 + + + + SelectSlideArrowLeft + SelectSlideArrowRight + SelectSlide + SelectSlideArrowLeft + SelectSlideArrowRight + + 750 + 330 + 1072.5 + 75 + 0 + + + 757.5 + 337.5 + 60 + 60 + 0 + + + 1755 + 337.5 + 60 + 60 + 0 + + + + + + + + 40.5 + 75 + 0 + 300 + Outline + Bold + 2 + + + + SelectSlideArrowLeft + SelectSlideArrowRight + SelectSlide + SelectSlideArrowLeft + SelectSlideArrowRight + + 750 + 420 + 1072.5 + 75 + 0 + + + 757.5 + 427.5 + 60 + 60 + 0 + + + 1755 + 427.5 + 60 + 60 + 0 + + + + + + + + 40.5 + 75 + 0 + 300 + Outline + Bold + 2 + + + + + + + + + diff --git a/Output/Themes/Vocaluxe 2024/Screens/ScreenOptionsLyrics.xml b/Output/Themes/Vocaluxe 2024/Screens/ScreenOptionsLyrics.xml index eb4e293c..7dbf1e00 100644 --- a/Output/Themes/Vocaluxe 2024/Screens/ScreenOptionsLyrics.xml +++ b/Output/Themes/Vocaluxe 2024/Screens/ScreenOptionsLyrics.xml @@ -2,7 +2,7 @@ ScreenOptionsLyrics - 3 + 4 @@ -25,28 +25,6 @@ 1 - - - - - 0 - 430.5 - 1920 - 67.5 - 1 - - - - Warning - - - 710 - 900 - 1140 - 75 - -1 - - @@ -63,7 +41,6 @@ Outline TR_SCREENOLYRICS_OPTIONS - 112.5 160.5 @@ -92,90 +69,6 @@ Outline TR_SCREENOLYRICS_POSITION - - 960 - 445.5 - 0 - 40.5 - 0 - - - Center - Center - - Outline - TR_SCREENOGRAPHICS_OPTIONS - - - 112.5 - 520.5 - 0 - 40.5 - 0 - - - Left - Center - - Outline - TR_SCREENOGRAPHICS_TEXTUREQUALITY - - - 112.5 - 610.5 - 0 - 40.5 - 0 - - - Left - Center - - Outline - TR_SCREENOGRAPHICS_COVERSIZE - - - 112.5 - 700.5 - 0 - 40.5 - 0 - - - Left - Center - - Outline - TR_SCREENOGRAPHICS_FULLSCREEN - - - 112.5 - 790.5 - 0 - 40.5 - 0 - - - Left - Center - - Outline - TR_SCREENOGRAPHICS_STRETCH - - - 1280 - 920 - -1.1 - 37.5 - 960 - - - Center - Center - - Outline - TR_SCREENO_WARNINGRESTART - + + + + + + + + SelectSlideArrowLeft + SelectSlideArrowRight + SelectSlide + SelectSlideArrowLeft + SelectSlideArrowRight + + 750 + 150 + 1072.5 + 75 + 0 + + + 757.5 + 157.5 + 60 + 60 + 0 + + + 1755 + 157.5 + 60 + 60 + 0 + + + + + + + + 40.5 + 75 + 0 + 300 + Outline + Bold + 3 + + + + SelectSlideArrowLeft + SelectSlideArrowRight + SelectSlide + SelectSlideArrowLeft + SelectSlideArrowRight + + 750 + 240 + 1072.5 + 75 + 0 + + + 757.5 + 247.5 + 60 + 60 + 0 + + + 1755 + 247.5 + 60 + 60 + 0 + + + + + + + + 40.5 + 75 + 0 + 300 + Outline + Bold + 3 + + + + + + + + + diff --git a/Vocaluxe/Base/CGraphics.cs b/Vocaluxe/Base/CGraphics.cs index 5803ddc5..eb0edf59 100644 --- a/Vocaluxe/Base/CGraphics.cs +++ b/Vocaluxe/Base/CGraphics.cs @@ -80,6 +80,8 @@ namespace Vocaluxe.Base _Screens.Add(new CScreenOptionsVideoAdjustments()); _Screens.Add(new CScreenOptionsLyrics()); _Screens.Add(new CScreenOptionsTheme()); + _Screens.Add(new CScreenOptionsGraphics()); + _Screens.Add(new CScreenOptionsServer()); _Screens.Add(new CScreenNames()); _Screens.Add(new CScreenCredits()); _Screens.Add(new CScreenParty()); @@ -655,4 +657,4 @@ namespace Vocaluxe.Base } #endregion private stuff } -} \ No newline at end of file +} diff --git a/Vocaluxe/Screens/CScreenOptions.cs b/Vocaluxe/Screens/CScreenOptions.cs index 6e8fb50e..1840afc4 100644 --- a/Vocaluxe/Screens/CScreenOptions.cs +++ b/Vocaluxe/Screens/CScreenOptions.cs @@ -16,9 +16,12 @@ #endregion using System.Windows.Forms; +using System.Linq; +using System.Collections.Generic; using Vocaluxe.Base; using VocaluxeLib; using VocaluxeLib.Menu; +using Vocaluxe.Lib.Sound; namespace Vocaluxe.Screens { @@ -27,7 +30,7 @@ namespace Vocaluxe.Screens // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion { - get { return 3; } + get { return 4; } } private const string _ButtonOptionsBack = "ButtonOptionsBack"; @@ -38,14 +41,41 @@ namespace Vocaluxe.Screens private const string _ButtonOptionsLyrics = "ButtonOptionsLyrics"; private const string _ButtonOptionsTheme = "ButtonOptionsTheme"; private const string _ButtonOptionsCredits = "ButtonOptionsCredits"; + private const string _ButtonOptionsGraphics = "ButtonOptionsGraphics"; + private const string _ButtonOptionsServer = "ButtonOptionsServer"; + private const string _ButtonSelectSongFolder = "ButtonSongFolder"; + + private const string _TextWarningRestart = "TextWarningRestart"; + private const string _StaticWarningRestart = "StaticWarningRestart"; + + private int _WarningStream = -1; + private bool _HasPlayedWarningSound = false; + + private static int PlaySound(ESounds sound, int volume) + { + int streamId = CSound.PlaySound(sound, false); + CSound.SetStreamVolume(streamId, volume); + + return streamId; + } public override void Init() { base.Init(); - _ThemeButtons = new string[] {_ButtonOptionsBack, _ButtonOptionsGame, _ButtonOptionsSound, _ButtonOptionsRecord, _ButtonOptionsVideo, _ButtonOptionsLyrics, _ButtonOptionsTheme}; + _ThemeButtons = new string[] {_ButtonOptionsBack, _ButtonOptionsGame, _ButtonOptionsSound, _ButtonOptionsRecord, _ButtonOptionsVideo, _ButtonOptionsLyrics, _ButtonOptionsTheme, _ButtonOptionsCredits, _ButtonOptionsGraphics, _ButtonOptionsServer, _ButtonSelectSongFolder}; + _ThemeTexts = new string[] {_TextWarningRestart}; + _ThemeStatics = new string[] {_StaticWarningRestart}; } + public override void LoadTheme(string xmlPath) + { + base.LoadTheme(xmlPath); + + _Texts[_TextWarningRestart].Visible = false; + _Statics[_StaticWarningRestart].Visible = false; + } + public override bool HandleInput(SKeyEvent keyEvent) { base.HandleInput(keyEvent); @@ -58,38 +88,81 @@ namespace Vocaluxe.Screens case Keys.Escape: case Keys.Back: CGraphics.FadeTo(EScreen.Main); + _LeaveScreen(); break; case Keys.S: CParty.SetNormalGameMode(); CGraphics.FadeTo(EScreen.Song); + _LeaveScreen(); break; case Keys.Enter: if (_Buttons[_ButtonOptionsBack].Selected) + { CGraphics.FadeTo(EScreen.Main); + _LeaveScreen(); + } if (_Buttons[_ButtonOptionsGame].Selected) + { CGraphics.FadeTo(EScreen.OptionsGame); + _LeaveScreen(); + } if (_Buttons[_ButtonOptionsSound].Selected) + { CGraphics.FadeTo(EScreen.OptionsSound); + _LeaveScreen(); + } if (_Buttons[_ButtonOptionsRecord].Selected) + { CGraphics.FadeTo(EScreen.OptionsRecord); + _LeaveScreen(); + } if (_Buttons[_ButtonOptionsVideo].Selected) + { CGraphics.FadeTo(EScreen.OptionsVideo); + _LeaveScreen(); + } if (_Buttons[_ButtonOptionsLyrics].Selected) + { CGraphics.FadeTo(EScreen.OptionsLyrics); + _LeaveScreen(); + } if (_Buttons[_ButtonOptionsTheme].Selected) + { CGraphics.FadeTo(EScreen.OptionsTheme); + _LeaveScreen(); + } + + if (_Buttons[_ButtonOptionsGraphics].Selected) + { + CGraphics.FadeTo(EScreen.OptionsGraphics); + _LeaveScreen(); + } + + if (_Buttons[_ButtonOptionsServer].Selected) + { + CGraphics.FadeTo(EScreen.OptionsServer); + _LeaveScreen(); + } if (_Buttons[_ButtonOptionsCredits].Selected) + { CGraphics.FadeTo(EScreen.Credits); + _LeaveScreen(); + } + if (_Buttons[_ButtonSelectSongFolder].Selected && CScreenOptions._OpenSongFolderDialog()) + { + _Texts[_TextWarningRestart].Visible = true; + _Statics[_StaticWarningRestart].Visible = true; + } break; } } @@ -103,38 +176,120 @@ namespace Vocaluxe.Screens if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent)) { if (_Buttons[_ButtonOptionsBack].Selected) + { CGraphics.FadeTo(EScreen.Main); + _LeaveScreen(); + } if (_Buttons[_ButtonOptionsGame].Selected) + { CGraphics.FadeTo(EScreen.OptionsGame); + _LeaveScreen(); + } if (_Buttons[_ButtonOptionsSound].Selected) + { CGraphics.FadeTo(EScreen.OptionsSound); + _LeaveScreen(); + } if (_Buttons[_ButtonOptionsRecord].Selected) + { CGraphics.FadeTo(EScreen.OptionsRecord); + _LeaveScreen(); + } if (_Buttons[_ButtonOptionsVideo].Selected) + { CGraphics.FadeTo(EScreen.OptionsVideo); + _LeaveScreen(); + } if (_Buttons[_ButtonOptionsLyrics].Selected) + { CGraphics.FadeTo(EScreen.OptionsLyrics); + _LeaveScreen(); + } if (_Buttons[_ButtonOptionsTheme].Selected) + { CGraphics.FadeTo(EScreen.OptionsTheme); + _LeaveScreen(); + } + + if (_Buttons[_ButtonOptionsGraphics].Selected) + { + CGraphics.FadeTo(EScreen.OptionsGraphics); + _LeaveScreen(); + } + + if (_Buttons[_ButtonOptionsServer].Selected) + { + CGraphics.FadeTo(EScreen.OptionsServer); + _LeaveScreen(); + } if (_Buttons[_ButtonOptionsCredits].Selected) + { CGraphics.FadeTo(EScreen.Credits); + _LeaveScreen(); + } + + if (_Buttons[_ButtonSelectSongFolder].Selected && CScreenOptions._OpenSongFolderDialog()) + { + _Texts[_TextWarningRestart].Visible = true; + _Statics[_StaticWarningRestart].Visible = true; + } } if (mouseEvent.RB) + { CGraphics.FadeTo(EScreen.Main); + _LeaveScreen(); + } return true; } public override bool UpdateGame() { + if (_Texts[_TextWarningRestart].Visible && !_HasPlayedWarningSound) + { + _WarningStream = CScreenOptions.PlaySound(ESounds.Warning, CConfig.SoundEffectVolume); + _HasPlayedWarningSound = true; + } + return true; } + + private static bool _OpenSongFolderDialog() + { + using (var dialog = new FolderBrowserDialog()) + { + dialog.Description = CLanguage.Translate("TR_SCREENO_SONGFOLDER"); + dialog.ShowNewFolderButton = true; + if (dialog.ShowDialog() == DialogResult.OK) + { + // Update config with new folder + var folders = CConfig.Config.Game.SongFolder?.ToList() ?? new List(); + if (!folders.Contains(dialog.SelectedPath)) + { + folders.Add(dialog.SelectedPath); + CConfig.Config.Game.SongFolder = folders.ToArray(); + CConfig.SaveConfig(); + } + return true; // Folder was selected + } + } + return false; // Dialog was cancelled + } + + private void _LeaveScreen() + { + if (_WarningStream != -1) + { + CSound.Close(_WarningStream); + _WarningStream = -1; + } + } } } diff --git a/Vocaluxe/Screens/CScreenOptionsGame.cs b/Vocaluxe/Screens/CScreenOptionsGame.cs index 0fac7e72..ae09cfd9 100644 --- a/Vocaluxe/Screens/CScreenOptionsGame.cs +++ b/Vocaluxe/Screens/CScreenOptionsGame.cs @@ -16,12 +16,9 @@ #endregion using System.Windows.Forms; -using System.Linq; -using System.Collections.Generic; using Vocaluxe.Base; using VocaluxeLib; using VocaluxeLib.Menu; -using Vocaluxe.Lib.Sound; namespace Vocaluxe.Screens { @@ -30,7 +27,7 @@ namespace Vocaluxe.Screens // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion { - get { return 5; } + get { return 6; } } private const string _SelectSlideLanguage = "SelectSlideLanguage"; @@ -43,31 +40,13 @@ namespace Vocaluxe.Screens private const string _SelectSlideHighscoreStyle = "SelectSlideHighscoreStyle"; private const string _ButtonExit = "ButtonExit"; - private const string _ButtonServer = "ButtonServer"; - private const string _ButtonSelectSongFolder = "ButtonSongFolder"; - - private const string _TextWarningRestart = "TextWarningRestart"; - private const string _StaticWarningRestart = "StaticWarningRestart"; - - private int _WarningStream = -1; - private bool _HasPlayedWarningSound = false; - - private static int PlaySound(ESounds sound, int volume) - { - int streamId = CSound.PlaySound(sound, false); - CSound.SetStreamVolume(streamId, volume); - - return streamId; - } public override void Init() { base.Init(); - _ThemeButtons = new string[] {_ButtonExit, _ButtonServer, _ButtonSelectSongFolder}; + _ThemeButtons = new string[] {_ButtonExit}; _ThemeSelectSlides = new string[] {_SelectSlideLanguage, _SelectSlideDebugLevel, _SelectSlideSongMenu, _SelectSlideSongSorting, _SelectSlideTabs, _SelectSlideTimerMode, _SelectSlideHighscoreStyle}; - _ThemeTexts = new string[] {_TextWarningRestart}; - _ThemeStatics = new string[] {_StaticWarningRestart}; } public override void LoadTheme(string xmlPath) @@ -84,9 +63,6 @@ namespace Vocaluxe.Screens _SelectSlides[_SelectSlideAutoplayPreviews].SetValues((int)CConfig.Config.Game.AutoplayPreviews); _SelectSlides[_SelectSlideTimerMode].SetValues((int)CConfig.Config.Game.TimerMode); _SelectSlides[_SelectSlideHighscoreStyle].SetValues((int)CConfig.Config.Game.HighscoreStyle); - - _Texts[_TextWarningRestart].Visible = false; - _Statics[_StaticWarningRestart].Visible = false; } public override bool HandleInput(SKeyEvent keyEvent) @@ -101,14 +77,12 @@ namespace Vocaluxe.Screens case Keys.Back: _SaveConfig(); CGraphics.FadeTo(EScreen.Options); - _LeaveScreen(); break; case Keys.S: CParty.SetNormalGameMode(); _SaveConfig(); CGraphics.FadeTo(EScreen.Song); - _LeaveScreen(); break; case Keys.Enter: @@ -116,16 +90,6 @@ namespace Vocaluxe.Screens { _SaveConfig(); CGraphics.FadeTo(EScreen.Options); - _LeaveScreen(); - } - else if (_Buttons[_ButtonServer].Selected) - { - CGraphics.ShowPopup(EPopupScreens.PopupServerQR); - } - else if (_Buttons[_ButtonSelectSongFolder].Selected && CScreenOptionsGame._OpenSongFolderDialog()) - { - _Texts[_TextWarningRestart].Visible = true; - _Statics[_StaticWarningRestart].Visible = true; } break; @@ -149,63 +113,22 @@ namespace Vocaluxe.Screens { _SaveConfig(); CGraphics.FadeTo(EScreen.Options); - _LeaveScreen(); } - if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent)) + if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent) && _Buttons[_ButtonExit].Selected) { - if (_Buttons[_ButtonExit].Selected) - { - CGraphics.FadeTo(EScreen.Options); - _SaveConfig(); - _LeaveScreen(); - } - else if (_Buttons[_ButtonServer].Selected) - { - CGraphics.ShowPopup(EPopupScreens.PopupServerQR); - } - else if (_Buttons[_ButtonSelectSongFolder].Selected && CScreenOptionsGame._OpenSongFolderDialog()) - { - _Texts[_TextWarningRestart].Visible = true; - _Statics[_StaticWarningRestart].Visible = true; - } + CGraphics.FadeTo(EScreen.Options); + _SaveConfig(); } return true; + } public override bool UpdateGame() - { - if (_Texts[_TextWarningRestart].Visible && !_HasPlayedWarningSound) - { - _WarningStream = CScreenOptionsGame.PlaySound(ESounds.Warning, CConfig.SoundEffectVolume); - _HasPlayedWarningSound = true; - } - + { return true; } - private static bool _OpenSongFolderDialog() - { - using (var dialog = new FolderBrowserDialog()) - { - dialog.Description = CLanguage.Translate("TR_SCREENOGAME_SONGFOLDER"); - dialog.ShowNewFolderButton = true; - if (dialog.ShowDialog() == DialogResult.OK) - { - // Update config with new folder - var folders = CConfig.Config.Game.SongFolder?.ToList() ?? new List(); - if (!folders.Contains(dialog.SelectedPath)) - { - folders.Add(dialog.SelectedPath); - CConfig.Config.Game.SongFolder = folders.ToArray(); - CConfig.SaveConfig(); - } - return true; // Folder was selected - } - } - return false; // Dialog was cancelled - } - private void _SaveConfig() { CLanguage.LanguageId = _SelectSlides[_SelectSlideLanguage].Selection; @@ -223,14 +146,5 @@ namespace Vocaluxe.Screens CSongs.Sorter.SongSorting = CConfig.Config.Game.SongSorting; CSongs.Categorizer.Tabs = CConfig.Config.Game.Tabs; } - - private void _LeaveScreen() - { - if (_WarningStream != -1) - { - CSound.Close(_WarningStream); - _WarningStream = -1; - } - } } } diff --git a/Vocaluxe/Screens/CScreenOptionsGraphics.cs b/Vocaluxe/Screens/CScreenOptionsGraphics.cs new file mode 100644 index 00000000..35d0dfbc --- /dev/null +++ b/Vocaluxe/Screens/CScreenOptionsGraphics.cs @@ -0,0 +1,206 @@ +#region license +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +#endregion + +using System; +using System.Windows.Forms; +using System.IO; +using Vocaluxe.Base; +using VocaluxeLib; +using VocaluxeLib.Menu; +using Vocaluxe.Lib.Sound; + +namespace Vocaluxe.Screens +{ + public class CScreenOptionsGraphics : CMenu + { + // Version number for theme files. Increment it, if you've changed something on the theme files! + protected override int _ScreenVersion + { + get { return 1; } + } + + private const string _SelectSlideTextureQuality = "SelectSlideTextureQuality"; + private const string _SelectSlideCoverSize = "SelectSlideCoverSize"; + private const string _SelectSlideFullScreen = "SelectSlideFullScreen"; + private const string _SelectSlideStretch = "SelectSlideStretch"; + private const string _TextWarningRestart = "TextWarningRestart"; + private const string _StaticWarningRestart = "StaticWarningRestart"; + private const string _ButtonExit = "ButtonExit"; + private static readonly string[] CoverSizes = { "32", "64", "128", "256", "512", "1024" }; + + private int _WarningStream = -1; + private bool _HasPlayedWarningSound = false; + + private static int PlaySound(ESounds sound, int volume) + { + int streamId = CSound.PlaySound(sound, false); + CSound.SetStreamVolume(streamId, volume); + + return streamId; + } + + public override void Init() + { + base.Init(); + + _ThemeButtons = new string[] {_ButtonExit}; + _ThemeSelectSlides = new string[] {_SelectSlideTextureQuality, _SelectSlideCoverSize, _SelectSlideFullScreen, _SelectSlideStretch}; + _ThemeTexts = new string[] {_TextWarningRestart}; + _ThemeStatics = new string[] {_StaticWarningRestart}; + } + + public override void LoadTheme(string xmlPath) + { + base.LoadTheme(xmlPath); + _SelectSlides[_SelectSlideTextureQuality].SetValues((int)CConfig.Config.Graphics.TextureQuality); + + _SelectSlides[_SelectSlideCoverSize].AddValues(CoverSizes); + int currentCoverSize = CConfig.Config.Graphics.CoverSize; + int index = Array.IndexOf(CoverSizes, currentCoverSize.ToString()); + _SelectSlides[_SelectSlideCoverSize].Selection = index; + + _SelectSlides[_SelectSlideFullScreen].SetValues((int)CConfig.Config.Graphics.FullScreen); + _SelectSlides[_SelectSlideFullScreen].Selection = (int)CConfig.Config.Graphics.FullScreen; + + _SelectSlides[_SelectSlideStretch].SetValues((int)CConfig.Config.Graphics.Stretch); + _SelectSlides[_SelectSlideStretch].Selection = (int)CConfig.Config.Graphics.Stretch; + + _Texts[_TextWarningRestart].Visible = false; + _Statics[_StaticWarningRestart].Visible = false; + } + + public override bool HandleInput(SKeyEvent keyEvent) + { + base.HandleInput(keyEvent); + + switch (keyEvent.Key) + { + case Keys.Escape: + case Keys.Back: + _SaveConfig(); + CGraphics.FadeTo(EScreen.Options); + _LeaveScreen(); + break; + + case Keys.S: + CParty.SetNormalGameMode(); + _SaveConfig(); + CGraphics.FadeTo(EScreen.Song); + _LeaveScreen(); + break; + + case Keys.Enter: + if (_Buttons[_ButtonExit].Selected) + { + _SaveConfig(); + CGraphics.FadeTo(EScreen.Options); + _LeaveScreen(); + } + break; + + case Keys.Left: + _SaveConfig(); + break; + + case Keys.Right: + _SaveConfig(); + break; + } + return true; + } + + public override bool HandleMouse(SMouseEvent mouseEvent) + { + base.HandleMouse(mouseEvent); + + if (mouseEvent.RB) + { + _SaveConfig(); + CGraphics.FadeTo(EScreen.Options); + _LeaveScreen(); + } + if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent)) + { + _SaveConfig(); + if (_Buttons[_ButtonExit].Selected) + { + CGraphics.FadeTo(EScreen.Options); + _LeaveScreen(); + } + } + return true; + } + + public override bool UpdateGame() + { + if (_Texts[_TextWarningRestart].Visible && !_HasPlayedWarningSound) + { + _WarningStream = CScreenOptionsGraphics.PlaySound(ESounds.Warning, CConfig.SoundEffectVolume); + _HasPlayedWarningSound = true; + } + return true; + } + + private void _SaveConfig() + { + // Detect Texture quality change + ETextureQuality _currentTextureQuality = CConfig.Config.Graphics.TextureQuality; + ETextureQuality _newTextureQuality = (ETextureQuality)_SelectSlides[_SelectSlideTextureQuality].Selection; + if (_currentTextureQuality != _newTextureQuality) + { + _Texts[_TextWarningRestart].Visible = true; + _Statics[_StaticWarningRestart].Visible = true; + CConfig.Config.Graphics.TextureQuality = _newTextureQuality; + } + else + { + CConfig.Config.Graphics.TextureQuality = _newTextureQuality; + } + + // Detect Cover size change + string selectedValue = CoverSizes[_SelectSlides[_SelectSlideCoverSize].Selection]; + int currentCoverSize = CConfig.Config.Graphics.CoverSize; + int newCoverSize = int.Parse(selectedValue); + if (currentCoverSize != newCoverSize) + { + string flagPath = Path.Combine(CSettings.DataFolder, "DeleteCoverDB.flag"); + File.Create(flagPath).Dispose(); + _Texts[_TextWarningRestart].Visible = true; + _Statics[_StaticWarningRestart].Visible = true; + CConfig.Config.Graphics.CoverSize = newCoverSize; + } + else + { + CConfig.Config.Graphics.CoverSize = newCoverSize; + } + + CConfig.Config.Graphics.FullScreen = (EOffOn)_SelectSlides[_SelectSlideFullScreen].Selection; + CConfig.Config.Graphics.Stretch = (EOffOn)_SelectSlides[_SelectSlideStretch].Selection; + + CConfig.SaveConfig(); + } + + private void _LeaveScreen() + { + if (_WarningStream != -1) + { + CSound.Close(_WarningStream); + _WarningStream = -1; + } + } + } +} diff --git a/Vocaluxe/Screens/CScreenOptionsLyrics.cs b/Vocaluxe/Screens/CScreenOptionsLyrics.cs index 27e259b5..ed4ce6b5 100644 --- a/Vocaluxe/Screens/CScreenOptionsLyrics.cs +++ b/Vocaluxe/Screens/CScreenOptionsLyrics.cs @@ -21,7 +21,6 @@ using System.IO; using Vocaluxe.Base; using VocaluxeLib; using VocaluxeLib.Menu; -using Vocaluxe.Lib.Sound; namespace Vocaluxe.Screens { @@ -30,39 +29,19 @@ namespace Vocaluxe.Screens // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion { - get { return 3; } + get { return 4; } } private const string _SelectSlideLyricStyle = "SelectSlideLyricStyle"; private const string _SelectSlideLyricsPosition = "SelectSlideLyricsPosition"; - private const string _SelectSlideTextureQuality = "SelectSlideTextureQuality"; - private const string _SelectSlideCoverSize = "SelectSlideCoverSize"; - private const string _SelectSlideFullScreen = "SelectSlideFullScreen"; - private const string _SelectSlideStretch = "SelectSlideStretch"; - private const string _TextWarningRestart = "TextWarningRestart"; - private const string _StaticWarningRestart = "StaticWarningRestart"; private const string _ButtonExit = "ButtonExit"; - private static readonly string[] CoverSizes = { "32", "64", "128", "256", "512", "1024" }; - - private int _WarningStream = -1; - private bool _HasPlayedWarningSound = false; - - private static int PlaySound(ESounds sound, int volume) - { - int streamId = CSound.PlaySound(sound, false); - CSound.SetStreamVolume(streamId, volume); - - return streamId; - } public override void Init() { base.Init(); _ThemeButtons = new string[] {_ButtonExit}; - _ThemeSelectSlides = new string[] {_SelectSlideLyricStyle, _SelectSlideLyricsPosition, _SelectSlideTextureQuality, _SelectSlideCoverSize, _SelectSlideFullScreen, _SelectSlideStretch}; - _ThemeTexts = new string[] {_TextWarningRestart}; - _ThemeStatics = new string[] {_StaticWarningRestart}; + _ThemeSelectSlides = new string[] {_SelectSlideLyricStyle, _SelectSlideLyricsPosition}; } public override void LoadTheme(string xmlPath) @@ -70,22 +49,6 @@ namespace Vocaluxe.Screens base.LoadTheme(xmlPath); _SelectSlides[_SelectSlideLyricStyle].SetValues((int)CConfig.Config.Theme.LyricStyle); _SelectSlides[_SelectSlideLyricsPosition].SetValues((int)CConfig.Config.Game.LyricsPosition); - - _SelectSlides[_SelectSlideTextureQuality].SetValues((int)CConfig.Config.Graphics.TextureQuality); - - _SelectSlides[_SelectSlideCoverSize].AddValues(CoverSizes); - int currentCoverSize = CConfig.Config.Graphics.CoverSize; - int index = Array.IndexOf(CoverSizes, currentCoverSize.ToString()); - _SelectSlides[_SelectSlideCoverSize].Selection = index; - - _SelectSlides[_SelectSlideFullScreen].SetValues((int)CConfig.Config.Graphics.FullScreen); - _SelectSlides[_SelectSlideFullScreen].Selection = (int)CConfig.Config.Graphics.FullScreen; - - _SelectSlides[_SelectSlideStretch].SetValues((int)CConfig.Config.Graphics.Stretch); - _SelectSlides[_SelectSlideStretch].Selection = (int)CConfig.Config.Graphics.Stretch; - - _Texts[_TextWarningRestart].Visible = false; - _Statics[_StaticWarningRestart].Visible = false; } public override bool HandleInput(SKeyEvent keyEvent) @@ -101,14 +64,12 @@ namespace Vocaluxe.Screens case Keys.Back: _SaveConfig(); CGraphics.FadeTo(EScreen.Options); - _LeaveScreen(); break; case Keys.S: CParty.SetNormalGameMode(); _SaveConfig(); CGraphics.FadeTo(EScreen.Song); - _LeaveScreen(); break; case Keys.Enter: @@ -116,7 +77,6 @@ namespace Vocaluxe.Screens { _SaveConfig(); CGraphics.FadeTo(EScreen.Options); - _LeaveScreen(); } break; @@ -140,7 +100,6 @@ namespace Vocaluxe.Screens { _SaveConfig(); CGraphics.FadeTo(EScreen.Options); - _LeaveScreen(); } if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent)) { @@ -148,7 +107,6 @@ namespace Vocaluxe.Screens if (_Buttons[_ButtonExit].Selected) { CGraphics.FadeTo(EScreen.Options); - _LeaveScreen(); } } return true; @@ -156,63 +114,14 @@ namespace Vocaluxe.Screens public override bool UpdateGame() { - if (_Texts[_TextWarningRestart].Visible && !_HasPlayedWarningSound) - { - _WarningStream = CScreenOptionsLyrics.PlaySound(ESounds.Warning, CConfig.SoundEffectVolume); - _HasPlayedWarningSound = true; - } return true; } - + private void _SaveConfig() { CConfig.Config.Game.LyricsPosition = (ELyricsPosition)_SelectSlides[_SelectSlideLyricsPosition].Selection; CConfig.Config.Theme.LyricStyle = (ELyricStyle)_SelectSlides[_SelectSlideLyricStyle].Selection; - - // Detect Texture quality change - ETextureQuality _currentTextureQuality = CConfig.Config.Graphics.TextureQuality; - ETextureQuality _newTextureQuality = (ETextureQuality)_SelectSlides[_SelectSlideTextureQuality].Selection; - if (_currentTextureQuality != _newTextureQuality) - { - _Texts[_TextWarningRestart].Visible = true; - _Statics[_StaticWarningRestart].Visible = true; - CConfig.Config.Graphics.TextureQuality = _newTextureQuality; - } - else - { - CConfig.Config.Graphics.TextureQuality = _newTextureQuality; - } - - // Detect Cover size change - string selectedValue = CoverSizes[_SelectSlides[_SelectSlideCoverSize].Selection]; - int currentCoverSize = CConfig.Config.Graphics.CoverSize; - int newCoverSize = int.Parse(selectedValue); - if (currentCoverSize != newCoverSize) - { - string flagPath = Path.Combine(CSettings.DataFolder, "DeleteCoverDB.flag"); - File.Create(flagPath).Dispose(); - _Texts[_TextWarningRestart].Visible = true; - _Statics[_StaticWarningRestart].Visible = true; - CConfig.Config.Graphics.CoverSize = newCoverSize; - } - else - { - CConfig.Config.Graphics.CoverSize = newCoverSize; - } - - CConfig.Config.Graphics.FullScreen = (EOffOn)_SelectSlides[_SelectSlideFullScreen].Selection; - CConfig.Config.Graphics.Stretch = (EOffOn)_SelectSlides[_SelectSlideStretch].Selection; - CConfig.SaveConfig(); } - - private void _LeaveScreen() - { - if (_WarningStream != -1) - { - CSound.Close(_WarningStream); - _WarningStream = -1; - } - } } } diff --git a/Vocaluxe/Screens/CScreenOptionsServer.cs b/Vocaluxe/Screens/CScreenOptionsServer.cs new file mode 100644 index 00000000..bf34cfcb --- /dev/null +++ b/Vocaluxe/Screens/CScreenOptionsServer.cs @@ -0,0 +1,198 @@ +#region license +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +#endregion + +using System; +using System.Windows.Forms; +using System.IO; +using Vocaluxe.Base; +using VocaluxeLib; +using VocaluxeLib.Menu; +using Vocaluxe.Lib.Sound; + +namespace Vocaluxe.Screens +{ + public class CScreenOptionsServer : CMenu + { + // Version number for theme files. Increment it, if you've changed something on the theme files! + protected override int _ScreenVersion + { + get { return 1; } + } + + private const string _SelectSlideServerActive = "SelectSlideServerActive"; + private const string _SelectSlideServerEncryption = "SelectSlideServerEncryption"; + private const string _TextWarningRestart = "TextWarningRestart"; + private const string _StaticWarningRestart = "StaticWarningRestart"; + private const string _ButtonServer = "ButtonServer"; + private const string _ButtonExit = "ButtonExit"; + + private int _WarningStream = -1; + private bool _HasPlayedWarningSound = false; + + private static int PlaySound(ESounds sound, int volume) + { + int streamId = CSound.PlaySound(sound, false); + CSound.SetStreamVolume(streamId, volume); + + return streamId; + } + + public override void Init() + { + base.Init(); + + _ThemeButtons = new string[] {_ButtonExit, _ButtonServer}; + _ThemeSelectSlides = new string[] {_SelectSlideServerActive, _SelectSlideServerEncryption}; + _ThemeTexts = new string[] {_TextWarningRestart}; + _ThemeStatics = new string[] {_StaticWarningRestart}; + } + + public override void LoadTheme(string xmlPath) + { + base.LoadTheme(xmlPath); + _SelectSlides[_SelectSlideServerActive].SetValues((int)CConfig.Config.Server.ServerActive); + _SelectSlides[_SelectSlideServerEncryption].SetValues((int)CConfig.Config.Server.ServerEncryption); + + _Texts[_TextWarningRestart].Visible = false; + _Statics[_StaticWarningRestart].Visible = false; + } + + public override bool HandleInput(SKeyEvent keyEvent) + { + base.HandleInput(keyEvent); + + switch (keyEvent.Key) + { + case Keys.Escape: + case Keys.Back: + _SaveConfig(); + CGraphics.FadeTo(EScreen.Options); + _LeaveScreen(); + break; + + case Keys.S: + CParty.SetNormalGameMode(); + _SaveConfig(); + CGraphics.FadeTo(EScreen.Song); + _LeaveScreen(); + break; + + case Keys.Enter: + if (_Buttons[_ButtonExit].Selected) + { + _SaveConfig(); + CGraphics.FadeTo(EScreen.Options); + _LeaveScreen(); + } + else if (_Buttons[_ButtonServer].Selected) + { + CGraphics.ShowPopup(EPopupScreens.PopupServerQR); + } + break; + + case Keys.Left: + _SaveConfig(); + break; + + case Keys.Right: + _SaveConfig(); + break; + } + return true; + } + + public override bool HandleMouse(SMouseEvent mouseEvent) + { + base.HandleMouse(mouseEvent); + + if (mouseEvent.RB) + { + _SaveConfig(); + CGraphics.FadeTo(EScreen.Options); + _LeaveScreen(); + } + if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent)) + { + if (_Buttons[_ButtonExit].Selected) + { + CGraphics.FadeTo(EScreen.Options); + _SaveConfig(); + _LeaveScreen(); + } + else if (_Buttons[_ButtonServer].Selected) + { + CGraphics.ShowPopup(EPopupScreens.PopupServerQR); + } + } + return true; + } + + public override bool UpdateGame() + { + if (_Texts[_TextWarningRestart].Visible && !_HasPlayedWarningSound) + { + _WarningStream = CScreenOptionsServer.PlaySound(ESounds.Warning, CConfig.SoundEffectVolume); + _HasPlayedWarningSound = true; + } + return true; + } + + private void _SaveConfig() + { + // Detect server activation change + int _currentServerActive = (int)CConfig.Config.Server.ServerActive; + int _newServerActive = _SelectSlides[_SelectSlideServerActive].Selection; + + if (_currentServerActive != _newServerActive) + { + _Texts[_TextWarningRestart].Visible = true; + _Statics[_StaticWarningRestart].Visible = true; + CConfig.Config.Server.ServerActive = (EOffOn)_newServerActive; + } + else + { + CConfig.Config.Server.ServerActive = (EOffOn)_newServerActive; + } + + // Detect server encryption change + int _currentServerEncryption = (int)CConfig.Config.Server.ServerEncryption; + int _newServerEncryption = _SelectSlides[_SelectSlideServerEncryption].Selection; + + if (_currentServerEncryption != _newServerEncryption) + { + _Texts[_TextWarningRestart].Visible = true; + _Statics[_StaticWarningRestart].Visible = true; + CConfig.Config.Server.ServerEncryption = (EOffOn)_newServerEncryption; + } + else + { + CConfig.Config.Server.ServerEncryption = (EOffOn)_newServerEncryption; + } + + CConfig.SaveConfig(); + } + + private void _LeaveScreen() + { + if (_WarningStream != -1) + { + CSound.Close(_WarningStream); + _WarningStream = -1; + } + } + } +} diff --git a/Vocaluxe/Vocaluxe.csproj b/Vocaluxe/Vocaluxe.csproj index f6b62f83..620c2f9b 100644 --- a/Vocaluxe/Vocaluxe.csproj +++ b/Vocaluxe/Vocaluxe.csproj @@ -346,6 +346,8 @@ + + Designer diff --git a/VocaluxeLib/Enums.cs b/VocaluxeLib/Enums.cs index 8f9c3409..bca16b53 100644 --- a/VocaluxeLib/Enums.cs +++ b/VocaluxeLib/Enums.cs @@ -426,6 +426,8 @@ namespace VocaluxeLib OptionsVideoAdjustments, OptionsLyrics, OptionsTheme, + OptionsGraphics, + OptionsServer, Names, Credits,