Expand Options Screen (#856)
* Remove Graphics Options (new screen) * Remove Graphics Options (new screen) * Remove Graphics Options (new screen) * Remove Graphics Options (new screen) * Screen Version 4 * Screen Version 1 * Create Screen * Create Screen * Create Screen * Add Graphics Screen * Add Graphics * Add Graphics * Add Graphics * Add Graphics * Remove Graphics Options (new screen) * Remove Graphics Options (new screen) * Remove Graphics Options (new screen) * Create Screen * Add Graphics * Add OptionsGraphics Screen * Remove Graphics Options (new screen) * Add OptionsServer * Add creenOptionsServer * Add ScreenOptionsServer * Create Screen * Add Server options * Add Server options * Add Screen * Version 1 * Add Server Options * Add Server Options * Add Server Options * Add Screen * Add Screen * Add Screen * Add Server Options * Add Screen * Remove Graphics Options (new screen) * Add Screen * Add Screen * Add Server Options * Add Screen * Add Screen * Add Screen * Add Screen * Add Screen * Add Screen * Add Screen * Add Screen * Add Screen * Add Screen * Add Screen * Add Screen * Add Server options * Add SongFolder * Add Song Folder * Update Options * Add Song Folder * Remove Song Folder & Server Buttons * Remove Song Folder & Server Buttons * Version 6 * Remove Song Folder & Server Buttons * Add Song Folder * Add Song Folder * Add Song Folder * Add Song Folder * Add Song Folder * Add Song Folder * Add Song Folder * Version 4 * Remove Song Folder & Server Buttons * Add Song Folder * Add Song Folder * Create Screen * Create Screen * Create Screen
This commit is contained in:
1 parent
76d26239bd
commit
5af73e8c00
19 files changed
+1401
-634
No files matched your search
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<string>();
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<EOffOn>((int)CConfig.Config.Game.AutoplayPreviews);
|
||||
_SelectSlides[_SelectSlideTimerMode].SetValues<ETimerMode>((int)CConfig.Config.Game.TimerMode);
|
||||
_SelectSlides[_SelectSlideHighscoreStyle].SetValues<EHighscoreStyle>((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<string>();
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
#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<ETextureQuality>((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<EOffOn>((int)CConfig.Config.Graphics.FullScreen);
|
||||
_SelectSlides[_SelectSlideFullScreen].Selection = (int)CConfig.Config.Graphics.FullScreen;
|
||||
|
||||
_SelectSlides[_SelectSlideStretch].SetValues<EOffOn>((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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<ELyricStyle>((int)CConfig.Config.Theme.LyricStyle);
|
||||
_SelectSlides[_SelectSlideLyricsPosition].SetValues<ELyricsPosition>((int)CConfig.Config.Game.LyricsPosition);
|
||||
|
||||
_SelectSlides[_SelectSlideTextureQuality].SetValues<ETextureQuality>((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<EOffOn>((int)CConfig.Config.Graphics.FullScreen);
|
||||
_SelectSlides[_SelectSlideFullScreen].Selection = (int)CConfig.Config.Graphics.FullScreen;
|
||||
|
||||
_SelectSlides[_SelectSlideStretch].SetValues<EOffOn>((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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
#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<EOffOn>((int)CConfig.Config.Server.ServerActive);
|
||||
_SelectSlides[_SelectSlideServerEncryption].SetValues<EOffOn>((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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -346,6 +346,8 @@
|
||||
<Compile Include="Screens\CScreenOptionsVideo.cs" />
|
||||
<Compile Include="Screens\CScreenOptionsRecord.cs" />
|
||||
<Compile Include="Screens\CScreenOptionsTheme.cs" />
|
||||
<Compile Include="Screens\CScreenOptionsGraphics.cs" />
|
||||
<Compile Include="Screens\CScreenOptionsServer.cs" />
|
||||
<None Include="app.config">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
|
||||
Reference in new issue
Block a user