Show popup for 1.5 sec if volume changed by keyboard.
This commit is contained in:
1 parent
4eb22ddfbe
commit
ace002a7b1
2 files changed
+44
No files matched your search
@@ -201,6 +201,11 @@ namespace Vocaluxe.Menu
|
|||||||
private static List<CMenu> _Screens = new List<CMenu>();
|
private static List<CMenu> _Screens = new List<CMenu>();
|
||||||
private static List<CMenu> _PopupScreens = new List<CMenu>();
|
private static List<CMenu> _PopupScreens = new List<CMenu>();
|
||||||
|
|
||||||
|
private static float _SavedBackgroundMusicVolume;
|
||||||
|
private static float _SavedPreviewMusicVolume;
|
||||||
|
private static float _SavedGameMusicVolume;
|
||||||
|
private static Stopwatch _VolumePopupTimer;
|
||||||
|
|
||||||
public static float GlobalAlpha
|
public static float GlobalAlpha
|
||||||
{
|
{
|
||||||
get { return _GlobalAlpha; }
|
get { return _GlobalAlpha; }
|
||||||
@@ -249,6 +254,7 @@ namespace Vocaluxe.Menu
|
|||||||
_NextScreen = EScreens.ScreenNull;
|
_NextScreen = EScreens.ScreenNull;
|
||||||
_CurrentPopupScreen = EPopupScreens.NoPopup;
|
_CurrentPopupScreen = EPopupScreens.NoPopup;
|
||||||
_FadingTimer = new Stopwatch();
|
_FadingTimer = new Stopwatch();
|
||||||
|
_VolumePopupTimer = new Stopwatch();
|
||||||
|
|
||||||
_GlobalAlpha = 1f;
|
_GlobalAlpha = 1f;
|
||||||
_ZOffset = 0f;
|
_ZOffset = 0f;
|
||||||
@@ -324,6 +330,10 @@ namespace Vocaluxe.Menu
|
|||||||
|
|
||||||
public static void InitFirstScreen()
|
public static void InitFirstScreen()
|
||||||
{
|
{
|
||||||
|
_SavedBackgroundMusicVolume = CConfig.BackgroundMusicVolume;
|
||||||
|
_SavedGameMusicVolume = CConfig.GameMusicVolume;
|
||||||
|
_SavedPreviewMusicVolume = CConfig.PreviewMusicVolume;
|
||||||
|
|
||||||
_Screens[(int)_CurrentScreen].OnShow();
|
_Screens[(int)_CurrentScreen].OnShow();
|
||||||
_Screens[(int)_CurrentScreen].OnShowFinish();
|
_Screens[(int)_CurrentScreen].OnShowFinish();
|
||||||
}
|
}
|
||||||
@@ -530,11 +540,17 @@ namespace Vocaluxe.Menu
|
|||||||
if (PopupVolumeControlAllowed && isOverPopupVolumeControl)
|
if (PopupVolumeControlAllowed && isOverPopupVolumeControl)
|
||||||
{
|
{
|
||||||
if (_CurrentPopupScreen == EPopupScreens.NoPopup)
|
if (_CurrentPopupScreen == EPopupScreens.NoPopup)
|
||||||
|
{
|
||||||
ShowPopup(EPopupScreens.PopupVolumeControl);
|
ShowPopup(EPopupScreens.PopupVolumeControl);
|
||||||
|
_VolumePopupTimer.Reset();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isOverPopupVolumeControl && _CurrentPopupScreen == EPopupScreens.PopupVolumeControl)
|
if (!isOverPopupVolumeControl && _CurrentPopupScreen == EPopupScreens.PopupVolumeControl)
|
||||||
|
{
|
||||||
HidePopup(EPopupScreens.PopupVolumeControl);
|
HidePopup(EPopupScreens.PopupVolumeControl);
|
||||||
|
_VolumePopupTimer.Reset();
|
||||||
|
}
|
||||||
|
|
||||||
bool handled = false;
|
bool handled = false;
|
||||||
if (_CurrentPopupScreen != EPopupScreens.NoPopup)
|
if (_CurrentPopupScreen != EPopupScreens.NoPopup)
|
||||||
@@ -593,6 +609,32 @@ namespace Vocaluxe.Menu
|
|||||||
|
|
||||||
private static bool Update()
|
private static bool Update()
|
||||||
{
|
{
|
||||||
|
//User changed volume with keyboard, pop-up isn't visible yet
|
||||||
|
if ((_SavedPreviewMusicVolume != CConfig.PreviewMusicVolume || _SavedGameMusicVolume != CConfig.GameMusicVolume || _SavedBackgroundMusicVolume != CConfig.BackgroundMusicVolume)
|
||||||
|
&& (_CurrentPopupScreen != EPopupScreens.PopupVolumeControl && !_VolumePopupTimer.IsRunning))
|
||||||
|
{
|
||||||
|
_VolumePopupTimer.Start();
|
||||||
|
_SavedBackgroundMusicVolume = CConfig.BackgroundMusicVolume;
|
||||||
|
_SavedGameMusicVolume = CConfig.GameMusicVolume;
|
||||||
|
_SavedPreviewMusicVolume = CConfig.PreviewMusicVolume;
|
||||||
|
}
|
||||||
|
//User changed volume with keyboard, pop-up is already visible
|
||||||
|
else if ((_SavedPreviewMusicVolume != CConfig.PreviewMusicVolume || _SavedGameMusicVolume != CConfig.GameMusicVolume || _SavedBackgroundMusicVolume != CConfig.BackgroundMusicVolume)
|
||||||
|
&& (_CurrentPopupScreen == EPopupScreens.PopupVolumeControl && _VolumePopupTimer.IsRunning))
|
||||||
|
{
|
||||||
|
_VolumePopupTimer.Reset();
|
||||||
|
_VolumePopupTimer.Start();
|
||||||
|
_SavedBackgroundMusicVolume = CConfig.BackgroundMusicVolume;
|
||||||
|
_SavedGameMusicVolume = CConfig.GameMusicVolume;
|
||||||
|
_SavedPreviewMusicVolume = CConfig.PreviewMusicVolume;
|
||||||
|
}
|
||||||
|
if (_VolumePopupTimer.IsRunning && _VolumePopupTimer.ElapsedMilliseconds < 1500 && _CurrentPopupScreen != EPopupScreens.PopupVolumeControl)
|
||||||
|
ShowPopup(EPopupScreens.PopupVolumeControl);
|
||||||
|
if(_VolumePopupTimer.IsRunning && _VolumePopupTimer.ElapsedMilliseconds >= 1500 && _CurrentPopupScreen == EPopupScreens.PopupVolumeControl)
|
||||||
|
{
|
||||||
|
_VolumePopupTimer.Reset();
|
||||||
|
HidePopup(EPopupScreens.PopupVolumeControl);
|
||||||
|
}
|
||||||
if (_CurrentPopupScreen != EPopupScreens.NoPopup)
|
if (_CurrentPopupScreen != EPopupScreens.NoPopup)
|
||||||
_PopupScreens[(int)_CurrentPopupScreen].UpdateGame();
|
_PopupScreens[(int)_CurrentPopupScreen].UpdateGame();
|
||||||
return _Screens[(int)_CurrentScreen].UpdateGame();
|
return _Screens[(int)_CurrentScreen].UpdateGame();
|
||||||
|
|||||||
@@ -106,6 +106,8 @@ namespace Vocaluxe.Screens
|
|||||||
DragAndDropCover = new CStatic();
|
DragAndDropCover = new CStatic();
|
||||||
|
|
||||||
Playlists[htPlaylists(Playlist)].Init();
|
Playlists[htPlaylists(Playlist)].Init();
|
||||||
|
|
||||||
|
ApplyVolume();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool HandleInput(KeyEvent KeyEvent)
|
public override bool HandleInput(KeyEvent KeyEvent)
|
||||||
|
|||||||
Reference in new issue
Block a user