Merge pull request #333 from Jiiniasu/Instant-Preview
Option to autoplay previews
This commit is contained in:
11 files changed
+148
-16
No files matched your search
@@ -188,6 +188,7 @@
|
||||
<string name="TR_SCREENOGAME_SONGMENU">Song-menu style</string>
|
||||
<string name="TR_SCREENOGAME_SONGSORTING">Song sorting</string>
|
||||
<string name="TR_SCREENOGAME_TABS">Tabs</string>
|
||||
<string name="TR_SCREENOGAME_AUTOPLAYPREVIEWS">Autoplay song previews</string>
|
||||
<string name="TR_SCREENOGAME_DIFFICULTY">Game difficulty</string>
|
||||
<string name="TR_SCREENOGAME_TIMERMODE">Timer mode</string>
|
||||
<string name="TR_SCREENOGAME_HIGHSCORESTYLE">Highscore style</string>
|
||||
|
||||
@@ -183,6 +183,7 @@
|
||||
<string name="TR_SCREENOGAME_SONGMENU">Låtmeny</string>
|
||||
<string name="TR_SCREENOGAME_SONGSORTING">Låtsortering</string>
|
||||
<string name="TR_SCREENOGAME_TABS">Flikar</string>
|
||||
<string name="TR_SCREENOGAME_AUTOPLAYPREVIEWS">Förhandsvisa låtar automatiskt</string>
|
||||
<string name="TR_SCREENOGAME_DIFFICULTY">Spelets svårighetsgrad</string>
|
||||
<string name="TR_SCREENOGAME_TIMERMODE">Timerläge</string>
|
||||
<string name="TR_SCREENOGAME_HIGHSCORESTYLE">Topplistsvy</string>
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
ScreenOptionsGame
|
||||
|
||||
++++++++++
|
||||
Version 4:
|
||||
|
||||
Add:
|
||||
<SelectSlideAutoplayPreviews>
|
||||
++++++++++
|
||||
Version 3:
|
||||
|
||||
|
||||
@@ -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>3</ScreenVersion>
|
||||
<ScreenVersion>4</ScreenVersion>
|
||||
</Informations>
|
||||
<Backgrounds>
|
||||
<Background Name="Background1">
|
||||
@@ -111,7 +111,7 @@
|
||||
<Font>Outline</Font>
|
||||
<Text>TR_SCREENOGAME_TABS</Text>
|
||||
</Text>
|
||||
<Text Name="TextTimerMode">
|
||||
<Text Name="TextAutoplayPreviews">
|
||||
<X>75</X>
|
||||
<Y>407</Y>
|
||||
<Z>0</Z>
|
||||
@@ -123,11 +123,25 @@
|
||||
<ResizeAlign>Center</ResizeAlign>
|
||||
<Style>Bold</Style>
|
||||
<Font>Outline</Font>
|
||||
<Text>TR_SCREENOGAME_AUTOPLAYPREVIEWS</Text>
|
||||
</Text>
|
||||
<Text Name="TextTimerMode">
|
||||
<X>75</X>
|
||||
<Y>467</Y>
|
||||
<Z>0</Z>
|
||||
<H>27</H>
|
||||
<MaxW>0</MaxW>
|
||||
<Color Name="TextColor" />
|
||||
<SelColor Name="TextSelColor" />
|
||||
<Align>Left</Align>
|
||||
<ResizeAlign>Center</ResizeAlign>
|
||||
<Style>Bold</Style>
|
||||
<Font>Outline</Font>
|
||||
<Text>TR_SCREENOGAME_TIMERMODE</Text>
|
||||
</Text>
|
||||
<Text Name="TextHighScoreStyle">
|
||||
<X>75</X>
|
||||
<Y>467</Y>
|
||||
<Y>527</Y>
|
||||
<Z>0</Z>
|
||||
<H>27</H>
|
||||
<MaxW>0</MaxW>
|
||||
@@ -425,7 +439,7 @@
|
||||
<TextStyle>Bold</TextStyle>
|
||||
<NumVisible>2</NumVisible>
|
||||
</SelectSlide>
|
||||
<SelectSlide Name="SelectSlideTimerMode">
|
||||
<SelectSlide Name="SelectSlideAutoplayPreviews">
|
||||
<Skin/>
|
||||
<SkinArrowLeft>SelectSlideArrowLeft</SkinArrowLeft>
|
||||
<SkinArrowRight>SelectSlideArrowRight</SkinArrowRight>
|
||||
@@ -467,7 +481,7 @@
|
||||
<TextStyle>Bold</TextStyle>
|
||||
<NumVisible>3</NumVisible>
|
||||
</SelectSlide>
|
||||
<SelectSlide Name="SelectSlideHighscoreStyle">
|
||||
<SelectSlide Name="SelectSlideTimerMode">
|
||||
<Skin/>
|
||||
<SkinArrowLeft>SelectSlideArrowLeft</SkinArrowLeft>
|
||||
<SkinArrowRight>SelectSlideArrowRight</SkinArrowRight>
|
||||
@@ -509,6 +523,48 @@
|
||||
<TextStyle>Bold</TextStyle>
|
||||
<NumVisible>2</NumVisible>
|
||||
</SelectSlide>
|
||||
<SelectSlide Name="SelectSlideHighscoreStyle">
|
||||
<Skin/>
|
||||
<SkinArrowLeft>SelectSlideArrowLeft</SkinArrowLeft>
|
||||
<SkinArrowRight>SelectSlideArrowRight</SkinArrowRight>
|
||||
<SkinSelected>SelectSlide</SkinSelected>
|
||||
<SkinArrowLeftSelected>SelectSlideArrowLeft</SkinArrowLeftSelected>
|
||||
<SkinArrowRightSelected>SelectSlideArrowRight</SkinArrowRightSelected>
|
||||
<Rect>
|
||||
<X>500</X>
|
||||
<Y>520</Y>
|
||||
<W>715</W>
|
||||
<H>50</H>
|
||||
<Z>0</Z>
|
||||
</Rect>
|
||||
<RectArrowLeft>
|
||||
<X>505</X>
|
||||
<Y>525</Y>
|
||||
<W>40</W>
|
||||
<H>40</H>
|
||||
<Z>0</Z>
|
||||
</RectArrowLeft>
|
||||
<RectArrowRight>
|
||||
<X>1170</X>
|
||||
<Y>525</Y>
|
||||
<W>40</W>
|
||||
<H>40</H>
|
||||
<Z>0</Z>
|
||||
</RectArrowRight>
|
||||
<Color Name="SelectSlideColor" />
|
||||
<SelColor Name="SelectSlideSelColor" />
|
||||
<ArrowColor Name="ArrowColor" />
|
||||
<ArrowSelColor Name="ArrowSelColor" />
|
||||
<TextColor Name="TextColorAlpha" />
|
||||
<TextSelColor Name="TextSelColor" />
|
||||
<TextH>27</TextH>
|
||||
<TextRelativeX>50</TextRelativeX>
|
||||
<TextRelativeY>0</TextRelativeY>
|
||||
<TextMaxW>200</TextMaxW>
|
||||
<TextFont>Outline</TextFont>
|
||||
<TextStyle>Bold</TextStyle>
|
||||
<NumVisible>2</NumVisible>
|
||||
</SelectSlide>
|
||||
</SelectSlides>
|
||||
<SingNotes />
|
||||
<NameSelections />
|
||||
|
||||
@@ -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":
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<ESongMenu>((int)CConfig.SongMenu);
|
||||
_SelectSlides[_SelectSlideSongSorting].SetValues<ESongSorting>((int)CConfig.Config.Game.SongSorting);
|
||||
_SelectSlides[_SelectSlideTabs].SetValues<EOffOn>((int)CConfig.Config.Game.Tabs);
|
||||
_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);
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -56,6 +56,8 @@ namespace VocaluxeLib
|
||||
IEnumerable<string> GetSongFolders();
|
||||
ESongSorting GetSongSorting();
|
||||
EOffOn GetTabs();
|
||||
EOffOn GetAutoplayPreviews();
|
||||
int GetAutoplayPreviewDelay();
|
||||
EOffOn GetIgnoreArticles();
|
||||
|
||||
bool IsMicConfigured(int playerNr);
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in new issue
Block a user