diff --git a/Output/Languages/English.xml b/Output/Languages/English.xml
index 3455a91f..3c758738 100644
--- a/Output/Languages/English.xml
+++ b/Output/Languages/English.xml
@@ -188,6 +188,7 @@
Song-menu style
Song sorting
Tabs
+ Autoplay song previews
Game difficulty
Timer mode
Highscore style
diff --git a/Output/Languages/Swedish.xml b/Output/Languages/Swedish.xml
index 673f66f1..81bfe9f9 100644
--- a/Output/Languages/Swedish.xml
+++ b/Output/Languages/Swedish.xml
@@ -183,6 +183,7 @@
Låtmeny
Låtsortering
Flikar
+ Förhandsvisa låtar automatiskt
Spelets svårighetsgrad
Timerläge
Topplistsvy
diff --git a/Output/Themes/Changelog/Changelog_ScreenOptionsGame.txt b/Output/Themes/Changelog/Changelog_ScreenOptionsGame.txt
index fcc4de50..2aed5985 100644
--- a/Output/Themes/Changelog/Changelog_ScreenOptionsGame.txt
+++ b/Output/Themes/Changelog/Changelog_ScreenOptionsGame.txt
@@ -1,5 +1,10 @@
ScreenOptionsGame
+++++++++++
+Version 4:
+
+Add:
+
++++++++++
Version 3:
diff --git a/Output/Themes/Genius/Screens/ScreenOptionsGame.xml b/Output/Themes/Genius/Screens/ScreenOptionsGame.xml
index 2619d909..af212eaf 100644
--- a/Output/Themes/Genius/Screens/ScreenOptionsGame.xml
+++ b/Output/Themes/Genius/Screens/ScreenOptionsGame.xml
@@ -2,7 +2,7 @@
ScreenOptionsGame
- 3
+ 4
@@ -111,7 +111,7 @@
Outline
TR_SCREENOGAME_TABS
-
+
75
407
0
@@ -123,11 +123,25 @@
Center
Outline
+ TR_SCREENOGAME_AUTOPLAYPREVIEWS
+
+
+ 75
+ 467
+ 0
+ 27
+ 0
+
+
+ Left
+ Center
+
+ Outline
TR_SCREENOGAME_TIMERMODE
75
- 467
+ 527
0
27
0
@@ -425,7 +439,7 @@
Bold
2
-
+
SelectSlideArrowLeft
SelectSlideArrowRight
@@ -467,7 +481,7 @@
Bold
3
-
+
SelectSlideArrowLeft
SelectSlideArrowRight
@@ -509,6 +523,48 @@
Bold
2
+
+
+ SelectSlideArrowLeft
+ SelectSlideArrowRight
+ SelectSlide
+ SelectSlideArrowLeft
+ SelectSlideArrowRight
+
+ 500
+ 520
+ 715
+ 50
+ 0
+
+
+ 505
+ 525
+ 40
+ 40
+ 0
+
+
+ 1170
+ 525
+ 40
+ 40
+ 0
+
+
+
+
+
+
+
+ 27
+ 50
+ 0
+ 200
+ Outline
+ Bold
+ 2
+
diff --git a/Vocaluxe/Base/CConfig.cs b/Vocaluxe/Base/CConfig.cs
index 8172d7c6..d80e0024 100644
--- a/Vocaluxe/Base/CConfig.cs
+++ b/Vocaluxe/Base/CConfig.cs
@@ -171,6 +171,8 @@ namespace Vocaluxe.Base
[DefaultValue(ETimerMode.TR_CONFIG_TIMERMODE_REMAINING)] public ETimerMode TimerMode;
[XmlAltName("NumPlayer"), DefaultValue(2)] public int NumPlayers;
[DefaultValue(EOffOn.TR_CONFIG_OFF)] public EOffOn Tabs;
+ [DefaultValue(EOffOn.TR_CONFIG_OFF)] public EOffOn AutoplayPreviews;
+ [XmlAltName("AutoplayPreviewDelay"), DefaultValue(500)] public int AutoplayPreviewDelay;
[DefaultValue(ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTTOM)] public ELyricsPosition LyricsPosition;
[DefaultValue(0.1f)] public float MinLineBreakTime; //Minimum time to show the text before it is (to be) sung (if possible)
[XmlArrayItem("Player"), XmlArray] public string[] Players;
@@ -521,6 +523,10 @@ namespace Vocaluxe.Base
return "NumPlayers: 1.." + CSettings.MaxNumPlayer;
case "Tabs":
return "Order songs in tabs: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)));
+ case "AutoplayPreviews":
+ return "Automatically play song preview when selected: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)));
+ case "AutoplayPreviewDelay":
+ return "Delay before playback of autoplay previews is started in milliseconds";
case "LyricsPosition":
return "Position if lyrics on screen: " + CHelper.ListStrings(Enum.GetNames(typeof(ELyricsPosition)));
case "MinLineBreakTime":
diff --git a/Vocaluxe/Base/CMain.cs b/Vocaluxe/Base/CMain.cs
index d67f3eeb..6038c266 100644
--- a/Vocaluxe/Base/CMain.cs
+++ b/Vocaluxe/Base/CMain.cs
@@ -141,6 +141,16 @@ namespace Vocaluxe.Base
return CConfig.Config.Game.Tabs;
}
+ public EOffOn GetAutoplayPreviews()
+ {
+ return CConfig.Config.Game.AutoplayPreviews;
+ }
+
+ public int GetAutoplayPreviewDelay()
+ {
+ return CConfig.Config.Game.AutoplayPreviewDelay;
+ }
+
public EOffOn GetIgnoreArticles()
{
return CConfig.Config.Game.IgnoreArticles;
diff --git a/Vocaluxe/Base/CProfiles.cs b/Vocaluxe/Base/CProfiles.cs
index 1cf1d983..43841704 100644
--- a/Vocaluxe/Base/CProfiles.cs
+++ b/Vocaluxe/Base/CProfiles.cs
@@ -19,6 +19,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
+using System.Text.RegularExpressions;
using VocaluxeLib;
using VocaluxeLib.Draw;
using VocaluxeLib.Profile;
@@ -300,7 +301,7 @@ namespace Vocaluxe.Base
return new CProfile[0];
var list = new List(_Profiles.Values);
- list.Sort(_CompareByPlayerName);
+ list.Sort(_AlphaNumericCompareByPlayerName);
return list.ToArray();
}
@@ -646,9 +647,14 @@ namespace Vocaluxe.Base
_ProfilesChanged = true;
}
- private static int _CompareByPlayerName(CProfile a, CProfile b)
+ private static int _AlphaNumericCompareByPlayerName(CProfile a, CProfile b)
{
- return String.CompareOrdinal(a.PlayerName, b.PlayerName);
+ return _PadNumbersInString(a.PlayerName).CompareTo(_PadNumbersInString(b.PlayerName));
+ }
+
+ private static string _PadNumbersInString(string text)
+ {
+ return Regex.Replace(text, "[0-9]+", match => match.Value.PadLeft(4, '0'));
}
public static CAvatar GetAvatarByFilename(string fileName)
diff --git a/Vocaluxe/Screens/CScreenNames.cs b/Vocaluxe/Screens/CScreenNames.cs
index 873d4ad7..3d573d35 100644
--- a/Vocaluxe/Screens/CScreenNames.cs
+++ b/Vocaluxe/Screens/CScreenNames.cs
@@ -669,6 +669,7 @@ namespace Vocaluxe.Screens
_Texts["TextPlayer" + i].Visible = false;
_Equalizers["EqualizerPlayer" + i].Visible = false;
_SelectSlides["SelectSlideDuetPlayer" + i].Visible = false;
+ _ResetPlayerSelection(i - 1);
}
}
CConfig.SaveConfig();
diff --git a/Vocaluxe/Screens/CScreenOptionsGame.cs b/Vocaluxe/Screens/CScreenOptionsGame.cs
index 72a7d4e6..669be7ae 100644
--- a/Vocaluxe/Screens/CScreenOptionsGame.cs
+++ b/Vocaluxe/Screens/CScreenOptionsGame.cs
@@ -27,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 3; }
+ get { return 4; }
}
private const string _SelectSlideLanguage = "SelectSlideLanguage";
@@ -35,6 +35,7 @@ namespace Vocaluxe.Screens
private const string _SelectSlideSongMenu = "SelectSlideSongMenu";
private const string _SelectSlideSongSorting = "SelectSlideSongSorting";
private const string _SelectSlideTabs = "SelectSlideTabs";
+ private const string _SelectSlideAutoplayPreviews = "SelectSlideAutoplayPreviews";
private const string _SelectSlideTimerMode = "SelectSlideTimerMode";
private const string _SelectSlideHighscoreStyle = "SelectSlideHighscoreStyle";
@@ -60,6 +61,7 @@ namespace Vocaluxe.Screens
_SelectSlides[_SelectSlideSongMenu].SetValues((int)CConfig.SongMenu);
_SelectSlides[_SelectSlideSongSorting].SetValues((int)CConfig.Config.Game.SongSorting);
_SelectSlides[_SelectSlideTabs].SetValues((int)CConfig.Config.Game.Tabs);
+ _SelectSlides[_SelectSlideAutoplayPreviews].SetValues((int)CConfig.Config.Game.AutoplayPreviews);
_SelectSlides[_SelectSlideTimerMode].SetValues((int)CConfig.Config.Game.TimerMode);
_SelectSlides[_SelectSlideHighscoreStyle].SetValues((int)CConfig.Config.Game.HighscoreStyle);
}
@@ -142,6 +144,7 @@ namespace Vocaluxe.Screens
CConfig.SongMenu = (ESongMenu)_SelectSlides[_SelectSlideSongMenu].Selection;
CConfig.Config.Game.SongSorting = (ESongSorting)_SelectSlides[_SelectSlideSongSorting].Selection;
CConfig.Config.Game.Tabs = (EOffOn)_SelectSlides[_SelectSlideTabs].Selection;
+ CConfig.Config.Game.AutoplayPreviews = (EOffOn)_SelectSlides[_SelectSlideAutoplayPreviews].Selection;
CConfig.Config.Game.TimerMode = (ETimerMode)_SelectSlides[_SelectSlideTimerMode].Selection;
CConfig.Config.Game.HighscoreStyle = (EHighscoreStyle)_SelectSlides[_SelectSlideHighscoreStyle].Selection;
diff --git a/VocaluxeLib/IBasic.cs b/VocaluxeLib/IBasic.cs
index 26cb64bf..8eb73b2b 100644
--- a/VocaluxeLib/IBasic.cs
+++ b/VocaluxeLib/IBasic.cs
@@ -56,6 +56,8 @@ namespace VocaluxeLib
IEnumerable GetSongFolders();
ESongSorting GetSongSorting();
EOffOn GetTabs();
+ EOffOn GetAutoplayPreviews();
+ int GetAutoplayPreviewDelay();
EOffOn GetIgnoreArticles();
bool IsMicConfigured(int playerNr);
diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs
index d4328025..ecd41bb8 100644
--- a/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs
+++ b/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs
@@ -158,6 +158,9 @@ namespace VocaluxeLib.Menu.SongMenu
}
}
+ protected int _AutoplayDelayinMs = CBase.Config.GetAutoplayPreviewDelay();
+ protected System.Timers.Timer _AutoplayTimer = new System.Timers.Timer();
+
private SColorF _ColorInternal;
protected SColorF _Color
{
@@ -204,6 +207,7 @@ namespace VocaluxeLib.Menu.SongMenu
public virtual void Init()
{
_ResetPreview(false);
+ _InitializeAutoplayTimer();
_Initialized = true;
}
@@ -358,6 +362,42 @@ namespace VocaluxeLib.Menu.SongMenu
_PreviewNrInternal = -1;
}
+ protected void _PreviewSelectedSong()
+ {
+ _PreviewNr = _SelectionNr;
+ }
+
+ protected void _InitializeAutoplayTimer()
+ {
+ _AutoplayTimer.Interval = _AutoplayDelayinMs;
+ _AutoplayTimer.AutoReset = false;
+ _AutoplayTimer.Elapsed += (object sender, System.Timers.ElapsedEventArgs e) =>
+ {
+ _PreviewSelectedSong();
+ };
+ }
+
+ protected void _AutoplayPreviewIfEnabled()
+ {
+ if (CBase.Config.GetAutoplayPreviews() == EOffOn.TR_CONFIG_ON)
+ {
+ _PlayPreviewAfterDelay();
+ }
+ }
+
+ protected void _PlayPreviewAfterDelay()
+ {
+ if (!_AutoplayTimer.Enabled)
+ {
+ _AutoplayTimer.Start();
+ }
+ else
+ {
+ _AutoplayTimer.Stop();
+ _AutoplayTimer.Start();
+ }
+ }
+
#region ThemeEdit
public void MoveElement(int stepX, int stepY)
{
diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuList.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuList.cs
index 771854e1..2c85058a 100644
--- a/VocaluxeLib/Menu/SongMenu/CSongMenuList.cs
+++ b/VocaluxeLib/Menu/SongMenu/CSongMenuList.cs
@@ -204,7 +204,7 @@ namespace VocaluxeLib.Menu.SongMenu
public override void Update(SScreenSongOptions songOptions)
{
if (songOptions.Selection.RandomOnly)
- _PreviewNr = _SelectionNr;
+ _PreviewSelectedSong();
if (_Length < 0 && CBase.Songs.IsInCategory() && CBase.BackgroundMusic.GetLength() > 0)
_UpdateLength(CBase.Songs.GetVisibleSong(_PreviewNr));
@@ -300,7 +300,7 @@ namespace VocaluxeLib.Menu.SongMenu
SetSelectedSong(_SelectionNr < 0 ? 0 : _SelectionNr);
else
SetSelectedCategory(_SelectionNr < 0 ? 0 : _SelectionNr);
- _PreviewNr = _SelectionNr;
+ _PreviewSelectedSong();
_UpdateListIfRequired();
}
@@ -323,7 +323,7 @@ namespace VocaluxeLib.Menu.SongMenu
{
if (_SelectionNr >= 0 && _PreviewNr != _SelectionNr)
{
- _PreviewNr = _SelectionNr;
+ _PreviewSelectedSong();
keyEvent.Handled = true;
}
}
@@ -364,6 +364,7 @@ namespace VocaluxeLib.Menu.SongMenu
if (_SelectionNr > 0 && moveAllowed)
{
_SelectionNr--;
+ _AutoplayPreviewIfEnabled();
keyEvent.Handled = true;
}
break;
@@ -372,6 +373,7 @@ namespace VocaluxeLib.Menu.SongMenu
if (moveAllowed)
{
_SelectionNr++;
+ _AutoplayPreviewIfEnabled();
keyEvent.Handled = true;
}
break;
@@ -388,6 +390,7 @@ namespace VocaluxeLib.Menu.SongMenu
else if (_SelectionNr >= 1 && moveAllowed)
{
_SelectionNr -= 1;
+ _AutoplayPreviewIfEnabled();
keyEvent.Handled = true;
}
break;
@@ -404,12 +407,13 @@ namespace VocaluxeLib.Menu.SongMenu
else if (moveAllowed)
{
_SelectionNr += 1;
+ _AutoplayPreviewIfEnabled();
keyEvent.Handled = true;
}
break;
}
if (!CBase.Songs.IsInCategory())
- _PreviewNr = _SelectionNr;
+ _PreviewSelectedSong();
return keyEvent.Handled;
}
@@ -469,7 +473,7 @@ namespace VocaluxeLib.Menu.SongMenu
{
if (_PreviewNr == _SelectionNr)
return false;
- _PreviewNr = _SelectionNr;
+ _PreviewSelectedSong();
}
else
EnterSelectedCategory();
diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs
index 4dc50faf..18bcad8f 100644
--- a/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs
+++ b/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs
@@ -195,7 +195,7 @@ namespace VocaluxeLib.Menu.SongMenu
public override void Update(SScreenSongOptions songOptions)
{
if (songOptions.Selection.RandomOnly)
- _PreviewNr = _SelectionNr;
+ _PreviewSelectedSong();
if (_Length < 0 && CBase.Songs.IsInCategory() && CBase.BackgroundMusic.GetLength() > 0)
_UpdateLength(CBase.Songs.GetVisibleSong(_PreviewNr));
@@ -291,7 +291,7 @@ namespace VocaluxeLib.Menu.SongMenu
SetSelectedSong(_SelectionNr < 0 ? 0 : _SelectionNr);
else
SetSelectedCategory(_SelectionNr < 0 ? 0 : _SelectionNr);
- _PreviewNr = _SelectionNr;
+ _PreviewSelectedSong();
_UpdateListIfRequired();
}
@@ -314,7 +314,7 @@ namespace VocaluxeLib.Menu.SongMenu
{
if (_SelectionNr >= 0 && _PreviewNr != _SelectionNr)
{
- _PreviewNr = _SelectionNr;
+ _PreviewSelectedSong();
keyEvent.Handled = true;
}
}
@@ -355,6 +355,7 @@ namespace VocaluxeLib.Menu.SongMenu
if (_SelectionNr > 0 && moveAllowed)
{
_SelectionNr--;
+ _AutoplayPreviewIfEnabled();
keyEvent.Handled = true;
}
break;
@@ -363,6 +364,7 @@ namespace VocaluxeLib.Menu.SongMenu
if (moveAllowed)
{
_SelectionNr++;
+ _AutoplayPreviewIfEnabled();
keyEvent.Handled = true;
}
break;
@@ -379,6 +381,7 @@ namespace VocaluxeLib.Menu.SongMenu
else if (_SelectionNr >= _NumW && moveAllowed)
{
_SelectionNr -= _NumW;
+ _AutoplayPreviewIfEnabled();
keyEvent.Handled = true;
}
break;
@@ -395,12 +398,13 @@ namespace VocaluxeLib.Menu.SongMenu
else if (moveAllowed)
{
_SelectionNr += _NumW;
+ _AutoplayPreviewIfEnabled();
keyEvent.Handled = true;
}
break;
}
if (!CBase.Songs.IsInCategory())
- _PreviewNr = _SelectionNr;
+ _PreviewSelectedSong();
return keyEvent.Handled;
}
@@ -456,7 +460,7 @@ namespace VocaluxeLib.Menu.SongMenu
{
if (_PreviewNr == _SelectionNr)
return false;
- _PreviewNr = _SelectionNr;
+ _PreviewSelectedSong();
}
else
EnterSelectedCategory();