Added first version of the jukebox popup

This commit is contained in:
Stephan Sundermann committed 2012-03-01 23:09:33 +01:00
1 parent 18f199f4ba
commit a6dbdb101b
8 files changed
+233 -16

No files matched your search

@@ -18,16 +18,16 @@
<!-- <Space>: Reflection Space--> <!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height--> <!-- <Height>: Reflection Height-->
</StaticBG> </StaticBG>
<ButtonNext> <ButtonPrevious>
<!--<Skin>: Texture name--> <!--<Skin>: Texture name-->
<Skin>Button</Skin> <Skin>PreviousIcon</Skin>
<!--<SkinSelected>: Texture name for selected button--> <!--<SkinSelected>: Texture name for selected button-->
<SkinSelected>Button</SkinSelected> <SkinSelected>PreviousIcon</SkinSelected>
<!--<X>, <Y>, <Z>, <W>, <H>: Button position, width and height--> <!--<X>, <Y>, <Z>, <W>, <H>: Button position, width and height-->
<X>145</X> <X>50</X>
<Y>2</Y> <Y>0</Y>
<Z>0,00</Z> <Z>0,00</Z>
<W>150</W> <W>50</W>
<H>50</H> <H>50</H>
<!--<Color>: Button color from ColorScheme (high priority)--> <!--<Color>: Button color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)--> <!--or <R>, <G>, <B>, <A> (lower priority)-->
@@ -56,7 +56,148 @@
<!--<Font>: Text font name--> <!--<Font>: Text font name-->
<Font>Normal</Font> <Font>Normal</Font>
<!--<Text>: Text or translation tag--> <!--<Text>: Text or translation tag-->
<Text>TR_SCREENMAIN_BUTTON_SING</Text> <Text></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-->
</ButtonPrevious>
<ButtonPlay>
<!--<Skin>: Texture name-->
<Skin>PlayIcon</Skin>
<!--<SkinSelected>: Texture name for selected button-->
<SkinSelected>PlayIcon</SkinSelected>
<!--<X>, <Y>, <Z>, <W>, <H>: Button position, width and height-->
<X>125</X>
<Y>5</Y>
<Z>0,00</Z>
<W>40</W>
<H>40</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></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-->
</ButtonPlay>
<ButtonPause>
<!--<Skin>: Texture name-->
<Skin>PauseIcon</Skin>
<!--<SkinSelected>: Texture name for selected button-->
<SkinSelected>PauseIcon</SkinSelected>
<!--<X>, <Y>, <Z>, <W>, <H>: Button position, width and height-->
<X>125</X>
<Y>5</Y>
<Z>0,00</Z>
<W>40</W>
<H>40</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></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-->
</ButtonPause>
<ButtonNext>
<!--<Skin>: Texture name-->
<Skin>NextIcon</Skin>
<!--<SkinSelected>: Texture name for selected button-->
<SkinSelected>NextIcon</SkinSelected>
<!--<X>, <Y>, <Z>, <W>, <H>: Button position, width and height-->
<X>190</X>
<Y>0</Y>
<Z>0,00</Z>
<W>50</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>190</X>
<Y>25</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></Text>
</Text> </Text>
<!--<Reflection> If exists:--> <!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space--> <!-- <Space>: Reflection Space-->
+4
View File
@@ -216,6 +216,10 @@
<DuetIcon>DuetIcon.png</DuetIcon> <DuetIcon>DuetIcon.png</DuetIcon>
<VideoIcon>VideoIcon.png</VideoIcon> <VideoIcon>VideoIcon.png</VideoIcon>
<Invisible>Invisible.png</Invisible> <Invisible>Invisible.png</Invisible>
<PreviousIcon>PreviousIcon.png</PreviousIcon>
<NextIcon>NextIcon.png</NextIcon>
<PlayIcon>PlayIcon.png</PlayIcon>
<PauseIcon>PauseIcon.png</PauseIcon>
</Skins> </Skins>
<Videos> <Videos>
<BG_Video>[Blue]BG_Video.mp4</BG_Video> <BG_Video>[Blue]BG_Video.mp4</BG_Video>
+4
View File
@@ -216,6 +216,10 @@
<DuetIcon>DuetIcon.png</DuetIcon> <DuetIcon>DuetIcon.png</DuetIcon>
<VideoIcon>VideoIcon.png</VideoIcon> <VideoIcon>VideoIcon.png</VideoIcon>
<Invisible>Invisible.png</Invisible> <Invisible>Invisible.png</Invisible>
<PreviousIcon>PreviousIcon.png</PreviousIcon>
<NextIcon>NextIcon.png</NextIcon>
<PlayIcon>PlayIcon.png</PlayIcon>
<PauseIcon>PauseIcon.png</PauseIcon>
</Skins> </Skins>
<Videos> <Videos>
<BG_Video>[Green]BG_Video.mp4</BG_Video> <BG_Video>[Green]BG_Video.mp4</BG_Video>
+4
View File
@@ -216,6 +216,10 @@
<DuetIcon>DuetIcon.png</DuetIcon> <DuetIcon>DuetIcon.png</DuetIcon>
<VideoIcon>VideoIcon.png</VideoIcon> <VideoIcon>VideoIcon.png</VideoIcon>
<Invisible>Invisible.png</Invisible> <Invisible>Invisible.png</Invisible>
<PreviousIcon>PreviousIcon.png</PreviousIcon>
<NextIcon>NextIcon.png</NextIcon>
<PlayIcon>PlayIcon.png</PlayIcon>
<PauseIcon>PauseIcon.png</PauseIcon>
</Skins> </Skins>
<Videos> <Videos>
<BG_Video>[Red]BG_Video.mp4</BG_Video> <BG_Video>[Red]BG_Video.mp4</BG_Video>
+4
View File
@@ -216,6 +216,10 @@
<DuetIcon>DuetIcon.png</DuetIcon> <DuetIcon>DuetIcon.png</DuetIcon>
<VideoIcon>VideoIcon.png</VideoIcon> <VideoIcon>VideoIcon.png</VideoIcon>
<Invisible>Invisible.png</Invisible> <Invisible>Invisible.png</Invisible>
<PreviousIcon>PreviousIcon.png</PreviousIcon>
<NextIcon>NextIcon.png</NextIcon>
<PlayIcon>PlayIcon.png</PlayIcon>
<PauseIcon>PauseIcon.png</PauseIcon>
</Skins> </Skins>
<Videos> <Videos>
<BG_Video>[Yellow]BG_Video.mp4</BG_Video> <BG_Video>[Yellow]BG_Video.mp4</BG_Video>
+38 -5
View File
@@ -13,11 +13,13 @@ namespace Vocaluxe.Base
{ {
private static CHelper Helper = new CHelper(); private static CHelper Helper = new CHelper();
private static int _CurrentMusicStream = -1; private static int _CurrentMusicStream = -1;
private static int _PreviousMusicIndex = 0;
private static string _CurrentMusicFilePath = String.Empty; private static string _CurrentMusicFilePath = String.Empty;
private static List<string> _AllFileNames = new List<string>(); private static List<string> _AllFileNames = new List<string>();
private static List<string> _NotPlayedFileNames = new List<string>(); private static List<string> _NotPlayedFileNames = new List<string>();
private static List<string> _BGMusicFileNames = new List<string>(); private static List<string> _BGMusicFileNames = new List<string>();
private static List<string> _PreviousFileNames = new List<string>();
private static bool _OwnMusicAdded; private static bool _OwnMusicAdded;
private static bool _BackgroundMusicAdded; private static bool _BackgroundMusicAdded;
@@ -83,13 +85,25 @@ namespace Vocaluxe.Base
{ {
if (_AllFileNames.Count > 0) if (_AllFileNames.Count > 0)
{ {
Stop(); if (_PreviousMusicIndex == _PreviousFileNames.Count - 1 || _PreviousFileNames.Count == 0) //We are not currently in the previous list
{
Stop();
if (_NotPlayedFileNames.Count == 0)
_NotPlayedFileNames.AddRange(_AllFileNames);
if (_NotPlayedFileNames.Count == 0) _CurrentMusicFilePath = _NotPlayedFileNames[CGame.Rand.Next(_NotPlayedFileNames.Count)];
_NotPlayedFileNames.AddRange(_AllFileNames); _NotPlayedFileNames.Remove(_CurrentMusicFilePath);
_CurrentMusicFilePath = _NotPlayedFileNames[CGame.Rand.Next(_NotPlayedFileNames.Count)]; _PreviousFileNames.Add(_CurrentMusicFilePath);
_NotPlayedFileNames.Remove(_CurrentMusicFilePath); _PreviousMusicIndex = _PreviousFileNames.Count - 1;
}
else if(_PreviousFileNames.Count > 0) //We are in the previous list
{
Stop();
_PreviousMusicIndex++;
_CurrentMusicFilePath = _PreviousFileNames[_PreviousMusicIndex];
}
_CurrentMusicStream = CSound.Load(_CurrentMusicFilePath); _CurrentMusicStream = CSound.Load(_CurrentMusicFilePath);
CSound.SetStreamVolume(_CurrentMusicStream, 0f); CSound.SetStreamVolume(_CurrentMusicStream, 0f);
@@ -99,6 +113,25 @@ namespace Vocaluxe.Base
Stop(); Stop();
} }
public static void Previous()
{
if (_PreviousFileNames.Count > 0 || _PreviousMusicIndex >= 0)
{
Stop();
_PreviousMusicIndex--;
if (_PreviousMusicIndex < 0)
_PreviousMusicIndex = 0; //No previous songs left, so play the first
_CurrentMusicFilePath = _PreviousFileNames[_PreviousMusicIndex];
_CurrentMusicStream = CSound.Load(_CurrentMusicFilePath);
CSound.SetStreamVolume(_CurrentMusicStream, 0f);
Play();
}
}
public static void ApplyVolume() public static void ApplyVolume()
{ {
CSound.SetStreamVolume(_CurrentMusicStream, CConfig.BackgroundMusicVolume); CSound.SetStreamVolume(_CurrentMusicStream, CConfig.BackgroundMusicVolume);
+4 -1
View File
@@ -552,7 +552,10 @@ namespace Vocaluxe.Menu
private static bool Update() private static bool Update()
{ {
return _Screens[(int)_CurrentScreen].UpdateGame(); bool popup = true;
if (_CurrentPopupScreen != EPopupScreens.NoPopup)
popup = _PopupScreens[(int)_CurrentPopupScreen].UpdateGame();
return _Screens[(int)_CurrentScreen].UpdateGame() && popup;
} }
private static void DrawDebugInfos() private static void DrawDebugInfos()
+27 -3
View File
@@ -16,7 +16,11 @@ namespace Vocaluxe.Screens
const int ScreenVersion = 1; const int ScreenVersion = 1;
private const string StaticBG = "StaticBG"; private const string StaticBG = "StaticBG";
private const string Cover = "Cover";
private const string ButtonPrevious = "ButtonPrevious";
private const string ButtonPlay = "ButtonPlay";
private const string ButtonPause = "ButtonPause";
private const string ButtonNext = "ButtonNext"; private const string ButtonNext = "ButtonNext";
public CPopupScreenPlayerControl() public CPopupScreenPlayerControl()
@@ -31,15 +35,19 @@ namespace Vocaluxe.Screens
_ThemeName = "PopupScreenPlayerControl"; _ThemeName = "PopupScreenPlayerControl";
_ScreenVersion = ScreenVersion; _ScreenVersion = ScreenVersion;
_ThemeStatics = new string[] { StaticBG }; _ThemeStatics = new string[] { StaticBG, Cover };
List<string> buttons = new List<string>(); List<string> buttons = new List<string>();
buttons.Add(ButtonPlay);
buttons.Add(ButtonPause);
buttons.Add(ButtonPrevious);
buttons.Add(ButtonNext); buttons.Add(ButtonNext);
_ThemeButtons = buttons.ToArray(); _ThemeButtons = buttons.ToArray();
} }
public override bool HandleInput(KeyEvent KeyEvent) public override bool HandleInput(KeyEvent KeyEvent)
{ {
base.HandleInput(KeyEvent);
if (KeyEvent.KeyPressed && !Char.IsControl(KeyEvent.Unicode)) if (KeyEvent.KeyPressed && !Char.IsControl(KeyEvent.Unicode))
{ {
@@ -57,6 +65,15 @@ namespace Vocaluxe.Screens
if (Buttons[htButtons(ButtonNext)].Selected) if (Buttons[htButtons(ButtonNext)].Selected)
CBackgroundMusic.Next(); CBackgroundMusic.Next();
break; break;
if (Buttons[htButtons(ButtonPrevious)].Selected)
;//CBackgroundMusic.Previous();
break;
if (Buttons[htButtons(ButtonPlay)].Selected)
CBackgroundMusic.Play();
break;
if (Buttons[htButtons(ButtonPause)].Selected)
CBackgroundMusic.Pause();
break;
} }
} }
@@ -65,11 +82,17 @@ namespace Vocaluxe.Screens
public override bool HandleMouse(MouseEvent MouseEvent) public override bool HandleMouse(MouseEvent MouseEvent)
{ {
base.HandleMouse(MouseEvent);
if (MouseEvent.LB && IsMouseOver(MouseEvent)) if (MouseEvent.LB && IsMouseOver(MouseEvent))
{ {
if (Buttons[htButtons(ButtonNext)].Selected) if (Buttons[htButtons(ButtonNext)].Selected)
CBackgroundMusic.Next(); CBackgroundMusic.Next();
if (Buttons[htButtons(ButtonPrevious)].Selected)
CBackgroundMusic.Previous();
if (Buttons[htButtons(ButtonPlay)].Selected)
CBackgroundMusic.Play();
if (Buttons[htButtons(ButtonPause)].Selected)
CBackgroundMusic.Pause();
} else if (MouseEvent.LB) } else if (MouseEvent.LB)
{ {
CGraphics.HidePopup(EPopupScreens.PopupPlayerControl); CGraphics.HidePopup(EPopupScreens.PopupPlayerControl);
@@ -84,7 +107,8 @@ namespace Vocaluxe.Screens
public override bool UpdateGame() public override bool UpdateGame()
{ {
Buttons[htButtons(ButtonPause)].Visible = CBackgroundMusic.IsPlaying();
Buttons[htButtons(ButtonPlay)].Visible = !CBackgroundMusic.IsPlaying();
return true; return true;
} }