Merge branch 'popup-control' of https://github.com/Vocaluxe/Vocaluxe into jukebox
This commit is contained in:
commit
18f199f4ba
6 files changed
+303
-64
No files matched your search
@@ -0,0 +1,69 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<PopupScreenPlayerControl>
|
||||
<ScreenVersion>1</ScreenVersion>
|
||||
<StaticBG>
|
||||
<!--<Skin>: Texture name-->
|
||||
<Skin>Menu</Skin>
|
||||
<!--<X>, <Y>, <Z>, <W>, <H>: Static position, width and height-->
|
||||
<X>49</X>
|
||||
<Y>0</Y>
|
||||
<Z>0,00</Z>
|
||||
<W>1181</W>
|
||||
<H>50</H>
|
||||
<!--<Color>: Static color from ColorScheme (high priority)-->
|
||||
<!--or <R>, <G>, <B>, <A> (lower priority)-->
|
||||
<Color>Visible</Color>
|
||||
<!--<Reflection> If exists:-->
|
||||
<!-- <Space>: Reflection Space-->
|
||||
<!-- <Height>: Reflection Height-->
|
||||
</StaticBG>
|
||||
<ButtonNext>
|
||||
<!--<Skin>: Texture name-->
|
||||
<Skin>Button</Skin>
|
||||
<!--<SkinSelected>: Texture name for selected button-->
|
||||
<SkinSelected>Button</SkinSelected>
|
||||
<!--<X>, <Y>, <Z>, <W>, <H>: Button position, width and height-->
|
||||
<X>145</X>
|
||||
<Y>2</Y>
|
||||
<Z>0,00</Z>
|
||||
<W>150</W>
|
||||
<H>50</H>
|
||||
<!--<Color>: Button color from ColorScheme (high priority)-->
|
||||
<!--or <R>, <G>, <B>, <A> (lower priority)-->
|
||||
<Color>ButtonColor</Color>
|
||||
<!--<SColor>: Selected button color from ColorScheme (high priority)-->
|
||||
<!--or <SR>, <SG>, <SB>, <SA> (lower priority)-->
|
||||
<SColor>ButtonSColor</SColor>
|
||||
<Text>
|
||||
<!--<X>, <Y>: Text position-->
|
||||
<X>75</X>
|
||||
<Y>2</Y>
|
||||
<!--<H>: Text height-->
|
||||
<H>32</H>
|
||||
<!--<MaxW>: Maximum text width (if exists)-->
|
||||
<MaxW>142</MaxW>
|
||||
<!--<Color>: Text color from ColorScheme (high priority)-->
|
||||
<!--or <R>, <G>, <B>, <A> (lower priority)-->
|
||||
<Color>ButtonTextColor</Color>
|
||||
<!--<SColor>: Selected Text color from ColorScheme (high priority)-->
|
||||
<!--or <SR>, <SG>, <SB>, <SA> (lower priority)-->
|
||||
<SColor>ButtonTextSColor</SColor>
|
||||
<!--<Align>: Text align: Left, Center, Right-->
|
||||
<Align>Center</Align>
|
||||
<!--<Style>: Text style: Normal, Italic, Bold, BoldItalic-->
|
||||
<Style>Bold</Style>
|
||||
<!--<Font>: Text font name-->
|
||||
<Font>Normal</Font>
|
||||
<!--<Text>: Text or translation tag-->
|
||||
<Text>TR_SCREENMAIN_BUTTON_SING</Text>
|
||||
</Text>
|
||||
<!--<Reflection> If exists:-->
|
||||
<!-- <Space>: Reflection Space-->
|
||||
<!-- <Height>: Reflection Height-->
|
||||
<!--<SReflection> If exists:-->
|
||||
<!-- <Space>: Reflection Space of selected button-->
|
||||
<!-- <Height>: Reflection Height of selected button-->
|
||||
</ButtonNext>
|
||||
</PopupScreenPlayerControl>
|
||||
</root>
|
||||
+127
-58
@@ -34,6 +34,13 @@ namespace Vocaluxe.Menu
|
||||
ScreenNull = -1
|
||||
}
|
||||
|
||||
enum EPopupScreens
|
||||
{
|
||||
PopupPlayerControl = 0,
|
||||
|
||||
NoPopup = -1
|
||||
}
|
||||
|
||||
class CCursor
|
||||
{
|
||||
private Stopwatch _CursorFadingTimer;
|
||||
@@ -183,11 +190,12 @@ namespace Vocaluxe.Menu
|
||||
private static float _GlobalAlpha;
|
||||
private static float _ZOffset;
|
||||
|
||||
private static EScreens ActualScreen;
|
||||
private static EScreens NextScreen;
|
||||
private static EScreens _CurrentScreen;
|
||||
private static EScreens _NextScreen;
|
||||
private static EPopupScreens _CurrentPopupScreen;
|
||||
|
||||
private static List<CMenu> ScreenList = new List<CMenu>();
|
||||
private static CMenu[] Screens;
|
||||
private static List<CMenu> _Screens = new List<CMenu>();
|
||||
private static List<CMenu> _PopupScreens = new List<CMenu>();
|
||||
|
||||
public static float GlobalAlpha
|
||||
{
|
||||
@@ -204,27 +212,28 @@ namespace Vocaluxe.Menu
|
||||
{
|
||||
// Add Screens, must be the same order as in EScreens!
|
||||
CLog.StartBenchmark(1, "Build Screen List");
|
||||
ScreenList.Add(new CScreenTest());
|
||||
ScreenList.Add(new CScreenLoad());
|
||||
ScreenList.Add(new CScreenMain());
|
||||
ScreenList.Add(new CScreenSong());
|
||||
ScreenList.Add(new CScreenOptions());
|
||||
ScreenList.Add(new CScreenSing());
|
||||
ScreenList.Add(new CScreenProfiles());
|
||||
ScreenList.Add(new CScreenScore());
|
||||
ScreenList.Add(new CScreenHighscore());
|
||||
ScreenList.Add(new CScreenOptionsGame());
|
||||
ScreenList.Add(new CScreenOptionsSound());
|
||||
ScreenList.Add(new CScreenOptionsRecord());
|
||||
ScreenList.Add(new CScreenOptionsVideo());
|
||||
ScreenList.Add(new CScreenOptionsTheme());
|
||||
ScreenList.Add(new CScreenNames());
|
||||
CLog.StopBenchmark(1, "Build Screen List");
|
||||
_Screens.Add(new CScreenTest());
|
||||
_Screens.Add(new CScreenLoad());
|
||||
_Screens.Add(new CScreenMain());
|
||||
_Screens.Add(new CScreenSong());
|
||||
_Screens.Add(new CScreenOptions());
|
||||
_Screens.Add(new CScreenSing());
|
||||
_Screens.Add(new CScreenProfiles());
|
||||
_Screens.Add(new CScreenScore());
|
||||
_Screens.Add(new CScreenHighscore());
|
||||
_Screens.Add(new CScreenOptionsGame());
|
||||
_Screens.Add(new CScreenOptionsSound());
|
||||
_Screens.Add(new CScreenOptionsRecord());
|
||||
_Screens.Add(new CScreenOptionsVideo());
|
||||
_Screens.Add(new CScreenOptionsTheme());
|
||||
_Screens.Add(new CScreenNames());
|
||||
|
||||
Screens = ScreenList.ToArray();
|
||||
_PopupScreens.Add(new CPopupScreenPlayerControl());
|
||||
CLog.StopBenchmark(1, "Build Screen List");
|
||||
|
||||
ActualScreen = EScreens.ScreenLoad;
|
||||
NextScreen = EScreens.ScreenNull;
|
||||
_CurrentScreen = EScreens.ScreenLoad;
|
||||
_NextScreen = EScreens.ScreenNull;
|
||||
_CurrentPopupScreen = EPopupScreens.NoPopup;
|
||||
_FadingTimer = new Stopwatch();
|
||||
|
||||
_GlobalAlpha = 1f;
|
||||
@@ -244,50 +253,65 @@ namespace Vocaluxe.Menu
|
||||
CTheme.Cursor.h,
|
||||
CSettings.zNear);
|
||||
|
||||
for (int i = 0; i < Screens.Length; i++)
|
||||
for (int i = 0; i < _Screens.Count; i++)
|
||||
{
|
||||
CLog.StartBenchmark(1, "Load Theme " + Enum.GetNames(typeof(EScreens))[i]);
|
||||
Screens[i].LoadTheme();
|
||||
_Screens[i].LoadTheme();
|
||||
CLog.StopBenchmark(1, "Load Theme " + Enum.GetNames(typeof(EScreens))[i]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < _PopupScreens.Count; i++)
|
||||
{
|
||||
_PopupScreens[i].LoadTheme();
|
||||
}
|
||||
}
|
||||
|
||||
public static void ReloadTheme()
|
||||
{
|
||||
ReloadCursor();
|
||||
for (int i = 0; i < Screens.Length; i++)
|
||||
for (int i = 0; i < _Screens.Count; i++)
|
||||
{
|
||||
Screens[i].ReloadTheme();
|
||||
_Screens[i].ReloadTheme();
|
||||
}
|
||||
|
||||
for (int i = 0; i < _PopupScreens.Count; i++)
|
||||
{
|
||||
_PopupScreens[i].ReloadTheme();
|
||||
}
|
||||
}
|
||||
|
||||
public static void ReloadSkin()
|
||||
{
|
||||
ReloadCursor();
|
||||
for (int i = 0; i < Screens.Length; i++)
|
||||
for (int i = 0; i < _Screens.Count; i++)
|
||||
{
|
||||
Screens[i].ReloadTextures();
|
||||
_Screens[i].ReloadTextures();
|
||||
}
|
||||
|
||||
for (int i = 0; i < _PopupScreens.Count; i++)
|
||||
{
|
||||
_PopupScreens[i].ReloadTextures();
|
||||
}
|
||||
}
|
||||
|
||||
public static void SaveTheme()
|
||||
{
|
||||
CTheme.SaveTheme();
|
||||
for (int i = 0; i < Screens.Length; i++)
|
||||
for (int i = 0; i < _Screens.Count; i++)
|
||||
{
|
||||
Screens[i].SaveTheme();
|
||||
_Screens[i].SaveTheme();
|
||||
}
|
||||
|
||||
for (int i = 0; i < _PopupScreens.Count; i++)
|
||||
{
|
||||
_PopupScreens[i].SaveTheme();
|
||||
}
|
||||
}
|
||||
|
||||
public static void InitFirstScreen()
|
||||
{
|
||||
Screens[(int)ActualScreen].OnShow();
|
||||
Screens[(int)ActualScreen].OnShowFinish();
|
||||
}
|
||||
|
||||
public static CMenu GetScreen(int Index)
|
||||
{
|
||||
return Screens[Index];
|
||||
_Screens[(int)_CurrentScreen].OnShow();
|
||||
_Screens[(int)_CurrentScreen].OnShowFinish();
|
||||
}
|
||||
|
||||
public static bool UpdateGameLogic(CKeys Keys, CMouse Mouse)
|
||||
@@ -301,7 +325,7 @@ namespace Vocaluxe.Menu
|
||||
CSound.Update();
|
||||
CBackgroundMusic.Update();
|
||||
|
||||
if (CConfig.CoverLoading == ECoverLoading.TR_CONFIG_COVERLOADING_DYNAMIC && ActualScreen != EScreens.ScreenSing)
|
||||
if (CConfig.CoverLoading == ECoverLoading.TR_CONFIG_COVERLOADING_DYNAMIC && _CurrentScreen != EScreens.ScreenSing)
|
||||
CSongs.LoadCover(30L);
|
||||
|
||||
if (CSettings.GameState != EGameState.EditTheme)
|
||||
@@ -320,12 +344,13 @@ namespace Vocaluxe.Menu
|
||||
|
||||
public static bool Draw()
|
||||
{
|
||||
if ((NextScreen != EScreens.ScreenNull) && !_Fading)
|
||||
if ((_NextScreen != EScreens.ScreenNull) && !_Fading)
|
||||
{
|
||||
_Fading = true;
|
||||
_FadingTimer.Reset();
|
||||
_FadingTimer.Start();
|
||||
Screens[(int)NextScreen].OnShow();
|
||||
_Screens[(int)_NextScreen].OnShow();
|
||||
HidePopup(EPopupScreens.PopupPlayerControl);
|
||||
}
|
||||
|
||||
if (_Fading)
|
||||
@@ -342,30 +367,37 @@ namespace Vocaluxe.Menu
|
||||
|
||||
_GlobalAlpha = 1f;// -factor / 100f;
|
||||
_ZOffset = CSettings.zFar/2;
|
||||
Screens[(int)ActualScreen].Draw();
|
||||
_Screens[(int)_CurrentScreen].Draw();
|
||||
|
||||
_GlobalAlpha = factor;
|
||||
_ZOffset = 0f;
|
||||
Screens[(int)NextScreen].Draw();
|
||||
_Screens[(int)_NextScreen].Draw();
|
||||
|
||||
_GlobalAlpha = 1f;
|
||||
}
|
||||
else
|
||||
{
|
||||
Screens[(int)ActualScreen].OnClose();
|
||||
ActualScreen = NextScreen;
|
||||
NextScreen = EScreens.ScreenNull;
|
||||
Screens[(int)ActualScreen].OnShowFinish();
|
||||
Screens[(int)ActualScreen].ProcessMouseMove(_Cursor.X, _Cursor.Y);
|
||||
Screens[(int)ActualScreen].Draw();
|
||||
_Screens[(int)_CurrentScreen].OnClose();
|
||||
_CurrentScreen = _NextScreen;
|
||||
_NextScreen = EScreens.ScreenNull;
|
||||
CBackgroundMusic.Play();
|
||||
_Screens[(int)_CurrentScreen].OnShowFinish();
|
||||
_Screens[(int)_CurrentScreen].ProcessMouseMove(_Cursor.X, _Cursor.Y);
|
||||
_Screens[(int)_CurrentScreen].Draw();
|
||||
_Fading = false;
|
||||
_FadingTimer.Stop();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Screens[(int)ActualScreen].Draw();
|
||||
_Screens[(int)_CurrentScreen].Draw();
|
||||
}
|
||||
|
||||
for (int i = 0; i < _PopupScreens.Count; i++)
|
||||
{
|
||||
_PopupScreens[i].Draw();
|
||||
}
|
||||
|
||||
_Cursor.Draw();
|
||||
DrawDebugInfos();
|
||||
|
||||
@@ -374,7 +406,23 @@ namespace Vocaluxe.Menu
|
||||
|
||||
public static void FadeTo(EScreens Screen)
|
||||
{
|
||||
NextScreen = Screen;
|
||||
_NextScreen = Screen;
|
||||
}
|
||||
|
||||
public static void ShowPopup(EPopupScreens PopupScreen)
|
||||
{
|
||||
_PopupScreens[(int)PopupScreen].OnShow();
|
||||
_PopupScreens[(int)PopupScreen].OnShowFinish();
|
||||
_CurrentPopupScreen = PopupScreen;
|
||||
}
|
||||
|
||||
public static void HidePopup(EPopupScreens PopupScreen)
|
||||
{
|
||||
if (_CurrentPopupScreen != PopupScreen)
|
||||
return;
|
||||
|
||||
_PopupScreens[(int)PopupScreen].OnClose();
|
||||
_CurrentPopupScreen = EPopupScreens.NoPopup;
|
||||
}
|
||||
|
||||
public static void HideCursor()
|
||||
@@ -403,6 +451,16 @@ namespace Vocaluxe.Menu
|
||||
CSettings.MouseInacive();
|
||||
_Cursor.FadeOut();
|
||||
}
|
||||
|
||||
if (_CurrentScreen != EScreens.ScreenOptionsRecord && _CurrentScreen != EScreens.ScreenSing && _CurrentScreen != EScreens.ScreenNames
|
||||
&& _CurrentScreen != EScreens.ScreenSong &&
|
||||
KeyEvent.Key == Keys.Tab)
|
||||
{
|
||||
if (_CurrentPopupScreen == EPopupScreens.NoPopup)
|
||||
ShowPopup(EPopupScreens.PopupPlayerControl);
|
||||
else
|
||||
HidePopup(EPopupScreens.PopupPlayerControl);
|
||||
}
|
||||
|
||||
if (KeyEvent.ModSHIFT && (KeyEvent.Key == Keys.F1))
|
||||
{
|
||||
@@ -419,7 +477,14 @@ namespace Vocaluxe.Menu
|
||||
else
|
||||
{
|
||||
if (!_Fading)
|
||||
Resume &= Screens[(int)ActualScreen].HandleInput(KeyEvent);
|
||||
{
|
||||
bool handled = false;
|
||||
if (_CurrentPopupScreen != EPopupScreens.NoPopup)
|
||||
handled = !_PopupScreens[(int)_CurrentPopupScreen].HandleInput(KeyEvent);
|
||||
|
||||
if (!handled)
|
||||
Resume &= _Screens[(int)_CurrentScreen].HandleInput(KeyEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -433,8 +498,12 @@ namespace Vocaluxe.Menu
|
||||
|
||||
UpdateMousePosition(MouseEvent.X, MouseEvent.Y);
|
||||
|
||||
if (!_Fading && (_Cursor.IsActive || MouseEvent.LB || MouseEvent.RB))
|
||||
Resume &= Screens[(int)ActualScreen].HandleMouse(MouseEvent);
|
||||
bool handled = false;
|
||||
if (_CurrentPopupScreen != EPopupScreens.NoPopup)
|
||||
handled = !_PopupScreens[(int)_CurrentPopupScreen].HandleMouse(MouseEvent);
|
||||
|
||||
if (!handled && !_Fading && (_Cursor.IsActive || MouseEvent.LB || MouseEvent.RB))
|
||||
Resume &= _Screens[(int)_CurrentScreen].HandleMouse(MouseEvent);
|
||||
}
|
||||
return Resume;
|
||||
}
|
||||
@@ -449,7 +518,7 @@ namespace Vocaluxe.Menu
|
||||
if (KeyEvent.ModSHIFT && (KeyEvent.Key == Keys.F1))
|
||||
{
|
||||
CSettings.GameState = EGameState.Normal;
|
||||
Screens[(int)ActualScreen].NextInteraction();
|
||||
_Screens[(int)_CurrentScreen].NextInteraction();
|
||||
}
|
||||
else if (KeyEvent.ModALT && (KeyEvent.Key == Keys.Enter))
|
||||
{
|
||||
@@ -462,14 +531,14 @@ namespace Vocaluxe.Menu
|
||||
else
|
||||
{
|
||||
if (!_Fading)
|
||||
Screens[(int)ActualScreen].HandleInputThemeEditor(KeyEvent);
|
||||
_Screens[(int)_CurrentScreen].HandleInputThemeEditor(KeyEvent);
|
||||
}
|
||||
}
|
||||
|
||||
while (Mouse.PollEvent(ref MouseEvent))
|
||||
{
|
||||
if (!_Fading)
|
||||
Screens[(int)ActualScreen].HandleMouseThemeEditor(MouseEvent);
|
||||
_Screens[(int)_CurrentScreen].HandleMouseThemeEditor(MouseEvent);
|
||||
|
||||
UpdateMousePosition(MouseEvent.X, MouseEvent.Y);
|
||||
}
|
||||
@@ -483,7 +552,7 @@ namespace Vocaluxe.Menu
|
||||
|
||||
private static bool Update()
|
||||
{
|
||||
return Screens[(int)ActualScreen].UpdateGame();
|
||||
return _Screens[(int)_CurrentScreen].UpdateGame();
|
||||
}
|
||||
|
||||
private static void DrawDebugInfos()
|
||||
|
||||
@@ -862,13 +862,12 @@ namespace Vocaluxe.Menu
|
||||
{
|
||||
ResumeBG();
|
||||
_Active = true;
|
||||
CBackgroundMusic.Play();
|
||||
}
|
||||
|
||||
public virtual void OnClose()
|
||||
{
|
||||
PauseBG();
|
||||
CBackgroundMusic.Pause();
|
||||
_Active = false;
|
||||
}
|
||||
#endregion MenuHandler
|
||||
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using Vocaluxe.Base;
|
||||
using Vocaluxe.Lib.Draw;
|
||||
using Vocaluxe.Menu;
|
||||
|
||||
namespace Vocaluxe.Screens
|
||||
{
|
||||
class CPopupScreenPlayerControl : CMenu
|
||||
{
|
||||
// Version number for theme files. Increment it, if you've changed something on the theme files!
|
||||
const int ScreenVersion = 1;
|
||||
|
||||
private const string StaticBG = "StaticBG";
|
||||
|
||||
private const string ButtonNext = "ButtonNext";
|
||||
|
||||
public CPopupScreenPlayerControl()
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
protected override void Init()
|
||||
{
|
||||
base.Init();
|
||||
|
||||
_ThemeName = "PopupScreenPlayerControl";
|
||||
_ScreenVersion = ScreenVersion;
|
||||
|
||||
_ThemeStatics = new string[] { StaticBG };
|
||||
|
||||
List<string> buttons = new List<string>();
|
||||
buttons.Add(ButtonNext);
|
||||
_ThemeButtons = buttons.ToArray();
|
||||
}
|
||||
|
||||
public override bool HandleInput(KeyEvent KeyEvent)
|
||||
{
|
||||
if (KeyEvent.KeyPressed && !Char.IsControl(KeyEvent.Unicode))
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (KeyEvent.Key)
|
||||
{
|
||||
case Keys.Escape:
|
||||
case Keys.Back:
|
||||
CGraphics.HidePopup(EPopupScreens.PopupPlayerControl);
|
||||
return false;
|
||||
|
||||
case Keys.Enter:
|
||||
if (Buttons[htButtons(ButtonNext)].Selected)
|
||||
CBackgroundMusic.Next();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool HandleMouse(MouseEvent MouseEvent)
|
||||
{
|
||||
if (MouseEvent.LB && IsMouseOver(MouseEvent))
|
||||
{
|
||||
if (Buttons[htButtons(ButtonNext)].Selected)
|
||||
CBackgroundMusic.Next();
|
||||
|
||||
} else if (MouseEvent.LB)
|
||||
{
|
||||
CGraphics.HidePopup(EPopupScreens.PopupPlayerControl);
|
||||
return false;
|
||||
} else if (MouseEvent.RB)
|
||||
{
|
||||
CGraphics.HidePopup(EPopupScreens.PopupPlayerControl);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool UpdateGame()
|
||||
{
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void OnShow()
|
||||
{
|
||||
base.OnShow();
|
||||
|
||||
}
|
||||
|
||||
public override bool Draw()
|
||||
{
|
||||
if (!_Active)
|
||||
return false;
|
||||
|
||||
return base.Draw();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -65,10 +65,6 @@ namespace Vocaluxe.Screens
|
||||
CGraphics.FadeTo(EScreens.ScreenSong);
|
||||
break;
|
||||
|
||||
case Keys.T:
|
||||
CGraphics.FadeTo(EScreens.ScreenTest);
|
||||
break;
|
||||
|
||||
case Keys.Enter:
|
||||
if (Buttons[htButtons(ButtonSing)].Selected)
|
||||
CGraphics.FadeTo(EScreens.ScreenSong);
|
||||
|
||||
@@ -187,6 +187,7 @@
|
||||
<Compile Include="Program.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Screens\CPopupScreenPlayerControl.cs" />
|
||||
<Compile Include="Screens\CScreenHighscore.cs" />
|
||||
<Compile Include="Screens\CScreenLoad.cs" />
|
||||
<Compile Include="Screens\CScreenMain.cs" />
|
||||
|
||||
Reference in new issue
Block a user