Add Song Folder in Game Options (#776)
* Screen Version 5 * Add Song Folder Button * Add Song Folder Button * Add Song Folder Button * Add Song Folder Button * Add Song Folder Button * Add Song Folder Button
This commit is contained in:
1 parent
463a617332
commit
33cadb8b35
4 files changed
+120
-6
No files matched your search
@@ -211,6 +211,7 @@
|
||||
<string name="TR_SCREENO_BUTTON_CREDITS">Credits</string>
|
||||
<string name="TR_SCREENO_WARNINGRESTART">Please restart the game for the changes to take effect.</string>
|
||||
<string name="TR_SCREENOGAME_BUTTON_SERVER">Server address</string>
|
||||
<string name="TR_SCREENOGAME_BUTTON_SONGFOLDER">Add Song Folder</string>
|
||||
<string name="TR_SCREENOGAME_OPTIONS">Game Options</string>
|
||||
<string name="TR_SCREENOGAME_LANGUAGE">Language</string>
|
||||
<string name="TR_SCREENOGAME_DEBUGLEVEL">Debug level</string>
|
||||
@@ -221,6 +222,7 @@
|
||||
<string name="TR_SCREENOGAME_DIFFICULTY">Game difficulty</string>
|
||||
<string name="TR_SCREENOGAME_TIMERMODE">Timer mode</string>
|
||||
<string name="TR_SCREENOGAME_HIGHSCORESTYLE">Highscore style</string>
|
||||
<string name="TR_SCREENOGAME_SONGFOLDER">Select the song folder you want to add</string>
|
||||
<string name="TR_SCREENORECORD_OPTIONS">Record Options</string>
|
||||
<string name="TR_SCREENORECORD_DEVICE">Device</string>
|
||||
<string name="TR_SCREENORECORD_INPUT">Input</string>
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
ScreenOptionsGame
|
||||
|
||||
++++++++++
|
||||
Version 5:
|
||||
|
||||
Add:
|
||||
<ButtonSongFolder>
|
||||
++++++++++
|
||||
Version 4:
|
||||
|
||||
@@ -16,4 +21,4 @@ Version 2:
|
||||
|
||||
Add:
|
||||
<ButtonServer>
|
||||
++++++++++
|
||||
++++++++++
|
||||
@@ -2,7 +2,7 @@
|
||||
<Screen xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<Informations>
|
||||
<ScreenName>ScreenOptionsGame</ScreenName>
|
||||
<ScreenVersion>4</ScreenVersion>
|
||||
<ScreenVersion>5</ScreenVersion>
|
||||
</Informations>
|
||||
<Backgrounds>
|
||||
<Background Name="Background1">
|
||||
@@ -25,6 +25,17 @@
|
||||
<Z>1</Z>
|
||||
</Rect>
|
||||
</Static>
|
||||
<Static Name="StaticWarningRestart">
|
||||
<Skin>Warning</Skin>
|
||||
<Color Name="StaticWarningColor" />
|
||||
<Rect>
|
||||
<X>325</X>
|
||||
<Y>900</Y>
|
||||
<W>1000</W>
|
||||
<H>75</H>
|
||||
<Z>-1</Z>
|
||||
</Rect>
|
||||
</Static>
|
||||
</Statics>
|
||||
<Texts>
|
||||
<Text Name="TextTitle">
|
||||
@@ -153,6 +164,20 @@
|
||||
<Font>Outline</Font>
|
||||
<Text>TR_SCREENOGAME_HIGHSCORESTYLE</Text>
|
||||
</Text>
|
||||
<Text Name="TextWarningRestart">
|
||||
<X>825</X>
|
||||
<Y>920</Y>
|
||||
<Z>-1.1</Z>
|
||||
<H>37.5</H>
|
||||
<MaxW>845</MaxW>
|
||||
<Color Name="TextWarningColor" />
|
||||
<SelColor Name="TextWarningColor" />
|
||||
<Align>Center</Align>
|
||||
<ResizeAlign>Center</ResizeAlign>
|
||||
<Style>Bold</Style>
|
||||
<Font>Outline</Font>
|
||||
<Text>TR_SCREENO_WARNINGRESTART</Text>
|
||||
</Text>
|
||||
</Texts>
|
||||
<Buttons>
|
||||
<Button Name="ButtonExit">
|
||||
@@ -225,6 +250,41 @@
|
||||
<Space>15</Space>
|
||||
</SelReflection>
|
||||
</Button>
|
||||
<Button Name="ButtonSongFolder">
|
||||
<Skin>Button</Skin>
|
||||
<SkinSelected>Button</SkinSelected>
|
||||
<Rect>
|
||||
<X>1350</X>
|
||||
<Y>900</Y>
|
||||
<W>225</W>
|
||||
<H>75</H>
|
||||
<Z>0</Z>
|
||||
</Rect>
|
||||
<Color Name="ButtonColor" />
|
||||
<SelColor Name="ButtonSelColor" />
|
||||
<Text Name="Text">
|
||||
<X>115</X>
|
||||
<Y>18</Y>
|
||||
<Z>0</Z>
|
||||
<H>40.5</H>
|
||||
<MaxW>213</MaxW>
|
||||
<Color Name="ButtonTextColor" />
|
||||
<SelColor Name="ButtonTextSelColor" />
|
||||
<Align>Center</Align>
|
||||
<ResizeAlign>Center</ResizeAlign>
|
||||
<Style>Bold</Style>
|
||||
<Font>Outline</Font>
|
||||
<Text>TR_SCREENOGAME_BUTTON_SONGFOLDER</Text>
|
||||
</Text>
|
||||
<Reflection>
|
||||
<Height>39</Height>
|
||||
<Space>15</Space>
|
||||
</Reflection>
|
||||
<SelReflection>
|
||||
<Height>39</Height>
|
||||
<Space>15</Space>
|
||||
</SelReflection>
|
||||
</Button>
|
||||
</Buttons>
|
||||
<SongMenus />
|
||||
<Lyrics />
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#region license
|
||||
#region license
|
||||
// This file is part of Vocaluxe.
|
||||
//
|
||||
// Vocaluxe is free software: you can redistribute it and/or modify
|
||||
@@ -16,6 +16,8 @@
|
||||
#endregion
|
||||
|
||||
using System.Windows.Forms;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using Vocaluxe.Base;
|
||||
using VocaluxeLib;
|
||||
using VocaluxeLib.Menu;
|
||||
@@ -27,7 +29,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 4; }
|
||||
get { return 5; }
|
||||
}
|
||||
|
||||
private const string _SelectSlideLanguage = "SelectSlideLanguage";
|
||||
@@ -41,13 +43,19 @@ namespace Vocaluxe.Screens
|
||||
|
||||
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";
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
|
||||
_ThemeButtons = new string[] {_ButtonExit, _ButtonServer};
|
||||
_ThemeButtons = new string[] {_ButtonExit, _ButtonServer, _ButtonSelectSongFolder};
|
||||
_ThemeSelectSlides = new string[] {_SelectSlideLanguage, _SelectSlideDebugLevel, _SelectSlideSongMenu, _SelectSlideSongSorting, _SelectSlideTabs, _SelectSlideTimerMode, _SelectSlideHighscoreStyle};
|
||||
_ThemeTexts = new string[] {_TextWarningRestart};
|
||||
_ThemeStatics = new string[] {_StaticWarningRestart};
|
||||
}
|
||||
|
||||
public override void LoadTheme(string xmlPath)
|
||||
@@ -64,6 +72,9 @@ 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)
|
||||
@@ -93,7 +104,14 @@ namespace Vocaluxe.Screens
|
||||
CGraphics.FadeTo(EScreen.Options);
|
||||
}
|
||||
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;
|
||||
|
||||
case Keys.Left:
|
||||
@@ -126,7 +144,14 @@ namespace Vocaluxe.Screens
|
||||
_SaveConfig();
|
||||
}
|
||||
else if (_Buttons[_ButtonServer].Selected)
|
||||
{
|
||||
CGraphics.ShowPopup(EPopupScreens.PopupServerQR);
|
||||
}
|
||||
else if (_Buttons[_ButtonSelectSongFolder].Selected && CScreenOptionsGame._OpenSongFolderDialog())
|
||||
{
|
||||
_Texts[_TextWarningRestart].Visible = true;
|
||||
_Statics[_StaticWarningRestart].Visible = true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -136,6 +161,28 @@ namespace Vocaluxe.Screens
|
||||
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;
|
||||
@@ -154,4 +201,4 @@ namespace Vocaluxe.Screens
|
||||
CSongs.Categorizer.Tabs = CConfig.Config.Game.Tabs;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user