Implement a common Interface for all MenuElements

Also remove CSongMenu and replace it with a factory class
This commit is contained in:
Flamefire committed 2014-10-19 17:17:39 +02:00
1 parent 9479f3b3ff
commit ae7a7fd390
52 files changed
+1043 -1855

No files matched your search

@@ -144,12 +144,6 @@ namespace VocaluxeLib.PartyModes.Challenge
return true; return true;
} }
public override bool Draw()
{
base.Draw();
return true;
}
private void _RebuildSlides() private void _RebuildSlides()
{ {
// build num player slide (min player ... max player); // build num player slide (min player ... max player);
@@ -310,12 +310,6 @@ namespace VocaluxeLib.PartyModes.Challenge
return true; return true;
} }
public override bool Draw()
{
base.Draw();
return true;
}
private void _NextRound() private void _NextRound()
{ {
_Data.ScreenMain.FadeToNameSelection = false; _Data.ScreenMain.FadeToNameSelection = false;
@@ -356,8 +350,8 @@ namespace VocaluxeLib.PartyModes.Challenge
for (int i = 0; i < _GameState.NumPlayerAtOnce; i++) for (int i = 0; i < _GameState.NumPlayerAtOnce; i++)
{ {
//static //static
_NextPlayerStatics[i].Rect.X = x; _NextPlayerStatics[i].X = x;
_NextPlayerStatics[i].Rect.Y = staticY; _NextPlayerStatics[i].Y = staticY;
_NextPlayerStatics[i].Visible = true; _NextPlayerStatics[i].Visible = true;
//text //text
_NextPlayerTexts[i].X = x + _Statics[_StaticNextPlayer].Rect.W / 2; _NextPlayerTexts[i].X = x + _Statics[_StaticNextPlayer].Rect.W / 2;
@@ -473,11 +467,11 @@ namespace VocaluxeLib.PartyModes.Challenge
float maxw = ((CBase.Settings.GetRenderW() - _Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow) / 2 - 5; float maxw = ((CBase.Settings.GetRenderW() - _Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow) / 2 - 5;
roundRow.TextPlayer[column].X = x; roundRow.TextPlayer[column].X = x;
roundRow.TextPlayer[column].Y = numberY; roundRow.TextPlayer[column].Y = numberY;
roundRow.TextPlayer[column].MaxWidth = maxw; roundRow.TextPlayer[column].W = maxw;
//Score //Score
roundRow.TextScores[column].X = x; roundRow.TextScores[column].X = x;
roundRow.TextScores[column].Y = numberY + delta; roundRow.TextScores[column].Y = numberY + delta;
roundRow.TextScores[column].MaxWidth = maxw; roundRow.TextScores[column].W = maxw;
} }
numberY = numberY + 2 * delta; numberY = numberY + 2 * delta;
} }
@@ -144,12 +144,6 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
return true; return true;
} }
public override bool Draw()
{
base.Draw();
return true;
}
private void _RebuildSlides() private void _RebuildSlides()
{ {
// build num player slide (min player ... max player); // build num player slide (min player ... max player);
@@ -310,12 +310,6 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
return true; return true;
} }
public override bool Draw()
{
base.Draw();
return true;
}
private void _NextRound() private void _NextRound()
{ {
_Data.ScreenMain.FadeToNameSelection = false; _Data.ScreenMain.FadeToNameSelection = false;
@@ -356,8 +350,8 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
for (int i = 0; i < _GameState.NumPlayerAtOnce; i++) for (int i = 0; i < _GameState.NumPlayerAtOnce; i++)
{ {
//static //static
_NextPlayerStatics[i].Rect.X = x; _NextPlayerStatics[i].X = x;
_NextPlayerStatics[i].Rect.Y = staticY; _NextPlayerStatics[i].Y = staticY;
_NextPlayerStatics[i].Visible = true; _NextPlayerStatics[i].Visible = true;
//text //text
_NextPlayerTexts[i].X = x + _Statics[_StaticNextPlayer].Rect.W / 2; _NextPlayerTexts[i].X = x + _Statics[_StaticNextPlayer].Rect.W / 2;
@@ -473,11 +467,11 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
float maxw = ((CBase.Settings.GetRenderW() - _Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow) / 2 - 5; float maxw = ((CBase.Settings.GetRenderW() - _Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow) / 2 - 5;
roundRow.TextPlayer[column].X = x; roundRow.TextPlayer[column].X = x;
roundRow.TextPlayer[column].Y = numberY; roundRow.TextPlayer[column].Y = numberY;
roundRow.TextPlayer[column].MaxWidth = maxw; roundRow.TextPlayer[column].W = maxw;
//Score //Score
roundRow.TextScores[column].X = x; roundRow.TextScores[column].X = x;
roundRow.TextScores[column].Y = numberY + delta; roundRow.TextScores[column].Y = numberY + delta;
roundRow.TextScores[column].MaxWidth = maxw; roundRow.TextScores[column].W = maxw;
} }
numberY = numberY + delta + delta; numberY = numberY + delta + delta;
} }
@@ -158,12 +158,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe
return true; return true;
} }
public override bool Draw()
{
base.Draw();
return true;
}
private void _FillSlides() private void _FillSlides()
{ {
_SelectSlides[_SelectSlideNumFields].Clear(); _SelectSlides[_SelectSlideNumFields].Clear();
@@ -369,12 +369,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe
return true; return true;
} }
public override bool Draw()
{
base.Draw();
return true;
}
public override void OnClose() public override void OnClose()
{ {
base.OnClose(); base.OnClose();
@@ -410,12 +404,12 @@ namespace VocaluxeLib.PartyModes.TicTacToe
{ {
if (i < _GameData.NumFields) if (i < _GameData.NumFields)
{ {
_Fields[i].Button.Rect.W = _FieldSize; _Fields[i].Button.W = _FieldSize;
_Fields[i].Button.Rect.H = _FieldSize; _Fields[i].Button.H = _FieldSize;
_Fields[i].Button.Rect.X = x; _Fields[i].Button.X = x;
_Fields[i].Button.Rect.Y = y; _Fields[i].Button.Y = y;
_Fields[i].Button.Visible = true; _Fields[i].Button.Visible = true;
_Fields[i].Button.Enabled = true; _Fields[i].Button.Selectable = true;
column++; column++;
if ((i + 1) >= numOneRow * (row + 1)) if ((i + 1) >= numOneRow * (row + 1))
{ {
@@ -430,7 +424,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
else else
{ {
_Fields[i].Button.Visible = false; _Fields[i].Button.Visible = false;
_Fields[i].Button.Enabled = false; _Fields[i].Button.Selectable = false;
} }
} }
} }
@@ -439,14 +433,14 @@ namespace VocaluxeLib.PartyModes.TicTacToe
{ {
for (int i = 0; i < _GameData.Rounds.Count; i++) for (int i = 0; i < _GameData.Rounds.Count; i++)
{ {
_Fields[i].Button.Enabled = true; _Fields[i].Button.Selectable = true;
_Fields[i].Button.Texture = _Buttons[_ButtonField].Texture; _Fields[i].Button.Texture = _Buttons[_ButtonField].Texture;
_Fields[i].Button.Color = _Buttons[_ButtonField].Color; _Fields[i].Button.Color = _Buttons[_ButtonField].Color;
_Fields[i].Button.SelColor = _Buttons[_ButtonField].SelColor; _Fields[i].Button.SelColor = _Buttons[_ButtonField].SelColor;
_Fields[i].Content = _GameData.Rounds[i]; _Fields[i].Content = _GameData.Rounds[i];
if (_Fields[i].Content.Finished) if (_Fields[i].Content.Finished)
{ {
_Fields[i].Button.Enabled = false; _Fields[i].Button.Selectable = false;
_Fields[i].Button.Texture = CBase.Songs.GetSongByID(_Fields[i].Content.SongID).CoverTextureBig; _Fields[i].Button.Texture = CBase.Songs.GetSongByID(_Fields[i].Content.SongID).CoverTextureBig;
_Fields[i].Button.Color = CBase.Themes.GetPlayerColor(_Fields[i].Content.Winner); _Fields[i].Button.Color = CBase.Themes.GetPlayerColor(_Fields[i].Content.Winner);
_Fields[i].Button.SelColor = CBase.Themes.GetPlayerColor(_Fields[i].Content.Winner); _Fields[i].Button.SelColor = CBase.Themes.GetPlayerColor(_Fields[i].Content.Winner);
@@ -456,17 +450,17 @@ namespace VocaluxeLib.PartyModes.TicTacToe
_Fields[i].Button.Texture = CBase.Songs.GetSongByID(_Fields[i].Content.SongID).CoverTextureBig; _Fields[i].Button.Texture = CBase.Songs.GetSongByID(_Fields[i].Content.SongID).CoverTextureBig;
_Fields[i].Button.Color = new SColorF(1, 1, 1, 1); _Fields[i].Button.Color = new SColorF(1, 1, 1, 1);
_Fields[i].Button.SelColor = new SColorF(1, 1, 1, 1); _Fields[i].Button.SelColor = new SColorF(1, 1, 1, 1);
_Fields[i].Button.Enabled = false; _Fields[i].Button.Selectable = false;
} }
if (_Status == EStatus.JokerRetry && _Fields[i].Content.Finished) if (_Status == EStatus.JokerRetry && _Fields[i].Content.Finished)
{ {
_Fields[i].Button.SelColor = CBase.Themes.GetPlayerColor(_GameData.Team + 1); _Fields[i].Button.SelColor = CBase.Themes.GetPlayerColor(_GameData.Team + 1);
_Fields[i].Button.Enabled = true; _Fields[i].Button.Selectable = true;
} }
if (_Status == EStatus.JokerRetry && !_Fields[i].Content.Finished) if (_Status == EStatus.JokerRetry && !_Fields[i].Content.Finished)
_Fields[i].Button.Enabled = false; _Fields[i].Button.Selectable = false;
if (_Status == EStatus.FieldSelected) if (_Status == EStatus.FieldSelected)
_Fields[i].Button.Enabled = false; _Fields[i].Button.Selectable = false;
} }
} }
@@ -615,14 +609,14 @@ namespace VocaluxeLib.PartyModes.TicTacToe
_Buttons[_ButtonJokerRandomT2].Visible = true; _Buttons[_ButtonJokerRandomT2].Visible = true;
_Buttons[_ButtonJokerRandomT1].Text.Text = _GameData.NumJokerRandom[0].ToString(); _Buttons[_ButtonJokerRandomT1].Text.Text = _GameData.NumJokerRandom[0].ToString();
_Buttons[_ButtonJokerRandomT2].Text.Text = _GameData.NumJokerRandom[1].ToString(); _Buttons[_ButtonJokerRandomT2].Text.Text = _GameData.NumJokerRandom[1].ToString();
_Buttons[_ButtonJokerRandomT1].Enabled = _GameData.NumJokerRandom[0] > 0; _Buttons[_ButtonJokerRandomT1].Selectable = _GameData.NumJokerRandom[0] > 0;
_Buttons[_ButtonJokerRandomT2].Enabled = _GameData.NumJokerRandom[1] > 0; _Buttons[_ButtonJokerRandomT2].Selectable = _GameData.NumJokerRandom[1] > 0;
_Buttons[_ButtonJokerRetryT1].Visible = true; _Buttons[_ButtonJokerRetryT1].Visible = true;
_Buttons[_ButtonJokerRetryT2].Visible = true; _Buttons[_ButtonJokerRetryT2].Visible = true;
_Buttons[_ButtonJokerRetryT1].Text.Text = _GameData.NumJokerRetry[0].ToString(); _Buttons[_ButtonJokerRetryT1].Text.Text = _GameData.NumJokerRetry[0].ToString();
_Buttons[_ButtonJokerRetryT2].Text.Text = _GameData.NumJokerRetry[1].ToString(); _Buttons[_ButtonJokerRetryT2].Text.Text = _GameData.NumJokerRetry[1].ToString();
_Buttons[_ButtonJokerRetryT1].Enabled = _GameData.NumJokerRetry[0] > 0; _Buttons[_ButtonJokerRetryT1].Selectable = _GameData.NumJokerRetry[0] > 0;
_Buttons[_ButtonJokerRetryT2].Enabled = _GameData.NumJokerRetry[1] > 0; _Buttons[_ButtonJokerRetryT2].Selectable = _GameData.NumJokerRetry[1] > 0;
} }
private void _NextRound() private void _NextRound()
@@ -666,7 +660,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
_PartyMode.DataFromScreen(ThemeName, _Data); _PartyMode.DataFromScreen(ThemeName, _Data);
} }
private int _BuildWinnerPossibilities() private void _BuildWinnerPossibilities()
{ {
var numOneRow = (int)Math.Sqrt(_GameData.NumFields); var numOneRow = (int)Math.Sqrt(_GameData.NumFields);
_Possibilities = new int[(numOneRow * 2) + 2,numOneRow]; _Possibilities = new int[(numOneRow * 2) + 2,numOneRow];
@@ -693,7 +687,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe
_Possibilities[i, c] = (numOneRow - 1) * c + (numOneRow - 1); _Possibilities[i, c] = (numOneRow - 1) * c + (numOneRow - 1);
} }
} }
return 0;
} }
private int _GetWinner() private int _GetWinner()
@@ -186,18 +186,17 @@ namespace Vocaluxe.Screens
return true; return true;
} }
public override bool Draw() public override void Draw()
{ {
if (!_Active) if (!_Active)
return false; return;
base.Draw();
_Statics[_StaticCover].Texture = CBackgroundMusic.Cover; _Statics[_StaticCover].Texture = CBackgroundMusic.Cover;
if (CBackgroundMusic.VideoEnabled && _VideoPreview && CBackgroundMusic.SongHasVideo) if (CBackgroundMusic.VideoEnabled && _VideoPreview && CBackgroundMusic.SongHasVideo)
CDraw.DrawTexture(CBackgroundMusic.GetVideoTexture(), _Statics[_StaticCover].Rect, EAspect.Crop); CDraw.DrawTexture(CBackgroundMusic.GetVideoTexture(), _Statics[_StaticCover].Rect, EAspect.Crop);
_Buttons[_ButtonPause].Visible = CBackgroundMusic.IsPlaying; _Buttons[_ButtonPause].Visible = CBackgroundMusic.IsPlaying;
_Buttons[_ButtonPlay].Visible = !CBackgroundMusic.IsPlaying; _Buttons[_ButtonPlay].Visible = !CBackgroundMusic.IsPlaying;
_Texts[_TextCurrentSong].Text = CBackgroundMusic.ArtistAndTitle; _Texts[_TextCurrentSong].Text = CBackgroundMusic.ArtistAndTitle;
return base.Draw();
} }
private void _StartSong(int songNr) private void _StartSong(int songNr)
+3 -5
View File
@@ -101,12 +101,10 @@ namespace Vocaluxe.Screens
return true; return true;
} }
public override bool Draw() public override void Draw()
{ {
if (!_Active) if (_Active)
return false; base.Draw();
return base.Draw();
} }
private void _GenerateQRs() private void _GenerateQRs()
@@ -100,12 +100,10 @@ namespace Vocaluxe.Screens
return true; return true;
} }
public override bool Draw() public override void Draw()
{ {
if (!_Active) if (_Active)
return false; base.Draw();
return base.Draw();
} }
private void _SaveConfig() private void _SaveConfig()
+12 -13
View File
@@ -57,12 +57,12 @@ namespace Vocaluxe.Screens
public float X public float X
{ {
get { return _Image.Rect.X; } get { return _Image.X; }
set set
{ {
_Image.Rect.X = value; _Image.X = value;
_ImgDot.Rect.X = value + _ParticleOffsetX; _ImgDot.X = value + _ParticleOffsetX;
_Particle.Rect.X = value + _ParticleOffsetX; _Particle.X = value + _ParticleOffsetX;
} }
} }
public float Y public float Y
@@ -70,9 +70,9 @@ namespace Vocaluxe.Screens
get { return _Image.Rect.Y; } get { return _Image.Rect.Y; }
set set
{ {
_Image.Rect.Y = value; _Image.Y = value;
_ImgDot.Rect.Y = value + _ParticleOffsetY; _ImgDot.Y = value + _ParticleOffsetY;
_Particle.Rect.Y = value + _ParticleOffsetY; _Particle.Y = value + _ParticleOffsetY;
} }
} }
@@ -142,7 +142,7 @@ namespace Vocaluxe.Screens
private CTextureRef _TexNamePantero; private CTextureRef _TexNamePantero;
private CTextureRef _TexNamePinky007; private CTextureRef _TexNamePinky007;
private static SColorF _BGColor = new SColorF(0, 0.18f, 0.474f, 1); private static readonly SColorF _BGColor = new SColorF(0, 0.18f, 0.474f, 1);
public override void Init() public override void Init()
{ {
@@ -358,7 +358,7 @@ namespace Vocaluxe.Screens
_LogoTimer.Start(); _LogoTimer.Start();
} }
public override bool Draw() public override void Draw()
{ {
base.Draw(); base.Draw();
@@ -381,7 +381,6 @@ namespace Vocaluxe.Screens
foreach (CText text in _ParagraphTexts) foreach (CText text in _ParagraphTexts)
text.Draw(); text.Draw();
} }
return true;
} }
private bool _Animation() private bool _Animation()
@@ -391,9 +390,9 @@ namespace Vocaluxe.Screens
{ {
active = true; active = true;
_Logo.Rect.Y = -270 + (270f / 3000f) * _LogoTimer.ElapsedMilliseconds; _Logo.Y = -270 + (270f / 3000f) * _LogoTimer.ElapsedMilliseconds;
_StarsRed.Rect.Y = _Logo.Rect.Y; _StarsRed.Y = _Logo.Y;
_StarsBlue.Rect.Y = _Logo.Rect.Y; _StarsBlue.Y = _Logo.Y;
if (_LogoTimer.ElapsedMilliseconds >= 2000 && !_CreditsTimer.IsRunning) if (_LogoTimer.ElapsedMilliseconds >= 2000 && !_CreditsTimer.IsRunning)
_CreditsTimer.Start(); _CreditsTimer.Start();
if (_LogoTimer.ElapsedMilliseconds >= 3000) if (_LogoTimer.ElapsedMilliseconds >= 3000)
+2 -5
View File
@@ -161,15 +161,12 @@ namespace Vocaluxe.Screens
return true; return true;
} }
public override bool Draw() public override void Draw()
{ {
_DrawBG();
if (_CurrentIntroVideo >= 0 && _CurrentIntroVideo < _Intros.Length) if (_CurrentIntroVideo >= 0 && _CurrentIntroVideo < _Intros.Length)
_Intros[_CurrentIntroVideo].Draw(); _Intros[_CurrentIntroVideo].Draw();
_DrawFG(); base.Draw();
return true;
} }
public override void OnClose() public override void OnClose()
+2 -38
View File
@@ -140,50 +140,14 @@ namespace Vocaluxe.Screens
return true; return true;
} }
// ReSharper disable RedundantOverridenMember
public override void OnShow()
{
base.OnShow();
//if (Snowflakes != null)
// Snowflakes.Resume();
}
// ReSharper restore RedundantOverridenMember
public override bool UpdateGame() public override bool UpdateGame()
{ {
bool profileOK = CProfiles.NumProfiles > 0; bool profileOK = CProfiles.NumProfiles > 0;
_Statics[_StaticWarningProfiles].Visible = !profileOK; _Statics[_StaticWarningProfiles].Visible = !profileOK;
_Texts[_TextWarningProfiles].Visible = !profileOK; _Texts[_TextWarningProfiles].Visible = !profileOK;
_Buttons[_ButtonSing].Enabled = profileOK; _Buttons[_ButtonSing].Selectable = profileOK;
_Buttons[_ButtonParty].Enabled = profileOK; _Buttons[_ButtonParty].Selectable = profileOK;
return true; return true;
} }
public override bool Draw()
{
_DrawBG();
//if (Snowflakes == null)
// Snowflakes = new CParticleEffect(300, new SColorF(1, 1, 1, 1), new SRectF(0, 0, CSettings.iRenderW, 0, 0.5f), "Snowflake", 25, EParticeType.Snow);
//Snowflakes.Update();
//Snowflakes.Draw();
_DrawFG();
return true;
}
// ReSharper disable RedundantOverridenMember
public override void OnClose()
{
base.OnClose();
//if (Snowflakes != null)
// Snowflakes.Pause();
}
// ReSharper restore RedundantOverridenMember
} }
} }
+7 -15
View File
@@ -104,6 +104,7 @@ namespace Vocaluxe.Screens
_ChooseAvatarStatic = GetNewStatic(); _ChooseAvatarStatic = GetNewStatic();
_ChooseAvatarStatic.Visible = false; _ChooseAvatarStatic.Visible = false;
_ChooseAvatarStatic.Aspect = EAspect.Crop; _ChooseAvatarStatic.Aspect = EAspect.Crop;
_AddStatic(_ChooseAvatarStatic);
CProfiles.AddProfileChangedCallback(_OnProfileChanged); CProfiles.AddProfileChangedCallback(_OnProfileChanged);
} }
@@ -358,8 +359,8 @@ namespace Vocaluxe.Screens
//Update of Drag/Drop-Texture //Update of Drag/Drop-Texture
CStatic selectedPlayer = _NameSelections[_NameSelection].TilePlayerAvatar(mouseEvent); CStatic selectedPlayer = _NameSelections[_NameSelection].TilePlayerAvatar(mouseEvent);
_ChooseAvatarStatic.Visible = true; _ChooseAvatarStatic.Visible = true;
_ChooseAvatarStatic.Rect = selectedPlayer.Rect; _ChooseAvatarStatic.MaxRect = selectedPlayer.Rect;
_ChooseAvatarStatic.Rect.Z = CSettings.ZNear; _ChooseAvatarStatic.Z = CSettings.ZNear;
_ChooseAvatarStatic.Color = new SColorF(1, 1, 1, 1); _ChooseAvatarStatic.Color = new SColorF(1, 1, 1, 1);
_ChooseAvatarStatic.Texture = selectedPlayer.Texture; _ChooseAvatarStatic.Texture = selectedPlayer.Texture;
} }
@@ -375,8 +376,8 @@ namespace Vocaluxe.Screens
//Update of Drag/Drop-Texture //Update of Drag/Drop-Texture
CStatic selectedPlayer = _Statics[_StaticPlayerAvatar[i]]; CStatic selectedPlayer = _Statics[_StaticPlayerAvatar[i]];
_ChooseAvatarStatic.Visible = true; _ChooseAvatarStatic.Visible = true;
_ChooseAvatarStatic.Rect = selectedPlayer.Rect; _ChooseAvatarStatic.MaxRect = selectedPlayer.Rect;
_ChooseAvatarStatic.Rect.Z = CSettings.ZNear; _ChooseAvatarStatic.Z = CSettings.ZNear;
_ChooseAvatarStatic.Color = new SColorF(1, 1, 1, 1); _ChooseAvatarStatic.Color = new SColorF(1, 1, 1, 1);
_ChooseAvatarStatic.Texture = selectedPlayer.Texture; _ChooseAvatarStatic.Texture = selectedPlayer.Texture;
break; break;
@@ -389,8 +390,8 @@ namespace Vocaluxe.Screens
if (mouseEvent.LBH && _SelectedProfileID >= 0 && !_SelectingFast) if (mouseEvent.LBH && _SelectedProfileID >= 0 && !_SelectingFast)
{ {
//Update coords for Drag/Drop-Texture //Update coords for Drag/Drop-Texture
_ChooseAvatarStatic.Rect.X += mouseEvent.X - _OldMouseX; _ChooseAvatarStatic.X += mouseEvent.X - _OldMouseX;
_ChooseAvatarStatic.Rect.Y += mouseEvent.Y - _OldMouseY; _ChooseAvatarStatic.Y += mouseEvent.Y - _OldMouseY;
_OldMouseX = mouseEvent.X; _OldMouseX = mouseEvent.X;
_OldMouseY = mouseEvent.Y; _OldMouseY = mouseEvent.Y;
} }
@@ -564,15 +565,6 @@ namespace Vocaluxe.Screens
base.OnClose(); base.OnClose();
CRecord.Stop(); CRecord.Stop();
} }
public override bool Draw()
{
base.Draw();
if (_ChooseAvatarStatic.Visible)
_ChooseAvatarStatic.Draw();
return true;
}
#endregion public methods #endregion public methods
#region private methods #region private methods
-6
View File
@@ -122,11 +122,5 @@ namespace Vocaluxe.Screens
{ {
return true; return true;
} }
public override bool Draw()
{
base.Draw();
return true;
}
} }
} }
-6
View File
@@ -131,12 +131,6 @@ namespace Vocaluxe.Screens
return true; return true;
} }
public override bool Draw()
{
base.Draw();
return true;
}
private void _SaveConfig() private void _SaveConfig()
{ {
CLanguage.LanguageId = _SelectSlides[_SelectSlideLanguage].Selection; CLanguage.LanguageId = _SelectSlides[_SelectSlideLanguage].Selection;
-6
View File
@@ -113,12 +113,6 @@ namespace Vocaluxe.Screens
return true; return true;
} }
public override bool Draw()
{
base.Draw();
return true;
}
private void _SaveConfig() private void _SaveConfig()
{ {
CConfig.LyricsPosition = (ELyricsPosition)_SelectSlides[_SelectSlideLyricsPosition].Selection; CConfig.LyricsPosition = (ELyricsPosition)_SelectSlides[_SelectSlideLyricsPosition].Selection;
+6 -17
View File
@@ -253,6 +253,10 @@ namespace Vocaluxe.Screens
_Equalizers[_EqualizerChannel2].Reset(); _Equalizers[_EqualizerChannel2].Reset();
} }
bool showWarning = !_CheckMicConfig();
_Statics[_StaticWarning].Visible = showWarning;
_Texts[_TextWarning].Visible = showWarning;
return true; return true;
} }
@@ -297,20 +301,9 @@ namespace Vocaluxe.Screens
CBackgroundMusic.Disabled = true; CBackgroundMusic.Disabled = true;
} }
public override bool Draw() public override void Draw()
{ {
_DrawBG(); base.Draw();
if (!_CheckMicConfig())
{
_Statics[_StaticWarning].Visible = true;
_Texts[_TextWarning].Visible = true;
}
else
{
_Statics[_StaticWarning].Visible = false;
_Texts[_TextWarning].Visible = false;
}
for (int i = 0; i < _StaticEnergyChannel.Length; i++) for (int i = 0; i < _StaticEnergyChannel.Length; i++)
{ {
@@ -326,10 +319,6 @@ namespace Vocaluxe.Screens
new SColorF(1f, 1f, 1f, 1f), rect); new SColorF(1f, 1f, 1f, 1f), rect);
} }
} }
_DrawFG();
return true;
} }
public override void OnClose() public override void OnClose()
-6
View File
@@ -131,12 +131,6 @@ namespace Vocaluxe.Screens
return true; return true;
} }
public override bool Draw()
{
base.Draw();
return true;
}
public override void OnShow() public override void OnShow()
{ {
base.OnShow(); base.OnShow();
-7
View File
@@ -164,13 +164,6 @@ namespace Vocaluxe.Screens
return true; return true;
} }
public override bool Draw()
{
base.Draw();
return true;
}
public override void OnClose() public override void OnClose()
{ {
base.OnClose(); base.OnClose();
-7
View File
@@ -127,13 +127,6 @@ namespace Vocaluxe.Screens
return true; return true;
} }
public override bool Draw()
{
base.Draw();
return true;
}
private void _UpdateSelection() private void _UpdateSelection()
{ {
if (_PartyModeInfos.Count == 0) if (_PartyModeInfos.Count == 0)
+21 -31
View File
@@ -56,7 +56,6 @@ namespace Vocaluxe.Screens
private int _Round; private int _Round;
private CPoints _Points; private CPoints _Points;
private Stopwatch _Timer; private Stopwatch _Timer;
private bool _SlideShowBGAvailable;
public override void Init() public override void Init()
{ {
@@ -78,6 +77,7 @@ namespace Vocaluxe.Screens
_StaticPointsBarDrawnPoints = new double[CSettings.MaxNumPlayer]; _StaticPointsBarDrawnPoints = new double[CSettings.MaxNumPlayer];
_SlideShowBG = GetNewBackground(); _SlideShowBG = GetNewBackground();
_AddBackground(_SlideShowBG);
} }
public override bool HandleInput(SKeyEvent keyEvent) public override bool HandleInput(SKeyEvent keyEvent)
@@ -134,7 +134,7 @@ namespace Vocaluxe.Screens
_SetVisibility(); _SetVisibility();
_UpdateRatings(); _UpdateRatings();
_SlideShowBGAvailable = _UpdateBackground(); _SlideShowBG.Visible = _UpdateBackground();
} }
public override bool UpdateGame() public override bool UpdateGame()
@@ -167,16 +167,16 @@ namespace Vocaluxe.Screens
var direction = (string)_ScreenSettings[_ScreenSettingAnimationDirection].GetValue(); var direction = (string)_ScreenSettings[_ScreenSettingAnimationDirection].GetValue();
if (direction.ToLower() == "vertical") if (direction.ToLower() == "vertical")
{ {
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.W = ((float)_StaticPointsBarDrawnPoints[p]) * _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].W = ((float)_StaticPointsBarDrawnPoints[p]) *
(_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.W / CSettings.MaxScore); (_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].W / CSettings.MaxScore);
} }
else else
{ {
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H = ((float)_StaticPointsBarDrawnPoints[p]) * _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].H = ((float)_StaticPointsBarDrawnPoints[p]) *
(_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H / CSettings.MaxScore); (_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].H / CSettings.MaxScore);
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.Y = _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H + _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Y = _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].H +
_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.Y - _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Y -
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H; _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].H;
} }
} }
} }
@@ -184,16 +184,6 @@ namespace Vocaluxe.Screens
return true; return true;
} }
public override bool Draw()
{
if (_SlideShowBGAvailable)
_SlideShowBG.Draw();
else
_DrawBG();
_DrawFG();
return true;
}
private static string _GetRating(double points) private static string _GetRating(double points)
{ {
string rating = String.Empty; string rating = String.Empty;
@@ -337,13 +327,13 @@ namespace Vocaluxe.Screens
_StaticPointsBarDrawnPoints[p] = 0.0; _StaticPointsBarDrawnPoints[p] = 0.0;
if (pointAnimDirection.ToLower() == "vertical") if (pointAnimDirection.ToLower() == "vertical")
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.W = 0; _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].W = 0;
else else
{ {
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H = 0; _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].H = 0;
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.Y = _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H + _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Y = _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].H +
_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.Y - _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Y -
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H; _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].H;
} }
if (CProfiles.IsProfileIDValid(players[p].ProfileID)) if (CProfiles.IsProfileIDValid(players[p].ProfileID))
_Statics[_StaticAvatar[p, CGame.NumPlayer - 1]].Texture = CProfiles.GetAvatarTextureFromProfile(players[p].ProfileID); _Statics[_StaticAvatar[p, CGame.NumPlayer - 1]].Texture = CProfiles.GetAvatarTextureFromProfile(players[p].ProfileID);
@@ -355,16 +345,16 @@ namespace Vocaluxe.Screens
{ {
if (pointAnimDirection.ToLower() == "vertical") if (pointAnimDirection.ToLower() == "vertical")
{ {
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.W = ((float)players[p].Points) * _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].W = ((float)players[p].Points) *
(_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.W / CSettings.MaxScore); (_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].W / CSettings.MaxScore);
} }
else else
{ {
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H = ((float)players[p].Points) * _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].H = ((float)players[p].Points) *
(_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H / CSettings.MaxScore); (_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].H / CSettings.MaxScore);
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.Y = _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H + _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Y = _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].H +
_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.Y - _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Y -
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H; _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].H;
} }
_StaticPointsBarDrawnPoints[p] = players[p].Points; _StaticPointsBarDrawnPoints[p] = players[p].Points;
} }
+3 -5
View File
@@ -456,7 +456,7 @@ namespace Vocaluxe.Screens
_LoadNextSong(); _LoadNextSong();
} }
public override bool Draw() public override void Draw()
{ {
if (_Active) if (_Active)
{ {
@@ -501,8 +501,6 @@ namespace Vocaluxe.Screens
_SingNotes[_SingBars].Draw(_NoteLines[i], CGame.Players[i].SungLines, i); _SingNotes[_SingBars].Draw(_NoteLines[i], CGame.Players[i].SungLines, i);
_DrawLyricHelper(); _DrawLyricHelper();
return true;
} }
public override void OnClose() public override void OnClose()
@@ -1314,7 +1312,7 @@ namespace Vocaluxe.Screens
_TimeRects[i].Rect.Color = _Statics[_StaticTimeLineExpandedNormal].Color; _TimeRects[i].Rect.Color = _Statics[_StaticTimeLineExpandedNormal].Color;
} }
} }
_Statics[_StaticTimePointer].Rect.X = stat.Rect.X + stat.Rect.W * (currentTime / totalTime); _Statics[_StaticTimePointer].X = stat.X + stat.W * (currentTime / totalTime);
break; break;
} }
} }
@@ -1325,7 +1323,7 @@ namespace Vocaluxe.Screens
switch (CConfig.TimerLook) switch (CConfig.TimerLook)
{ {
case ETimerLook.TR_CONFIG_TIMERLOOK_NORMAL: case ETimerLook.TR_CONFIG_TIMERLOOK_NORMAL:
_TimeLineRect = new SRectF(stat.Rect.X, stat.Rect.Y, 0f, stat.Rect.H, stat.Rect.Z); _TimeLineRect = stat.Rect;
_Statics[_StaticTimePointer].Visible = false; _Statics[_StaticTimePointer].Visible = false;
break; break;
+10 -12
View File
@@ -92,7 +92,7 @@ namespace Vocaluxe.Screens
private int _SelectedSongID; private int _SelectedSongID;
private int _SelectedCategoryIndex; private int _SelectedCategoryIndex;
private CSongMenu _SongMenu; private ISongMenu _SongMenu;
private CPlaylist _Playlist; private CPlaylist _Playlist;
public CScreenSong() public CScreenSong()
@@ -229,7 +229,7 @@ namespace Vocaluxe.Screens
{ {
_PlaylistActive = !_PlaylistActive; _PlaylistActive = !_PlaylistActive;
_Playlist.Selected = _PlaylistActive; _Playlist.Selected = _PlaylistActive;
_SongMenu.Active = !_PlaylistActive; _SongMenu.Selected = !_PlaylistActive;
} }
break; break;
@@ -400,8 +400,8 @@ namespace Vocaluxe.Screens
if (_DragAndDropActive) if (_DragAndDropActive)
{ {
_DragAndDropCover.Rect.X += mouseEvent.X - _OldMousePosX; _DragAndDropCover.X += mouseEvent.X - _OldMousePosX;
_DragAndDropCover.Rect.Y += mouseEvent.Y - _OldMousePosY; _DragAndDropCover.Y += mouseEvent.Y - _OldMousePosY;
} }
_OldMousePosX = mouseEvent.X; _OldMousePosX = mouseEvent.X;
_OldMousePosY = mouseEvent.Y; _OldMousePosY = mouseEvent.Y;
@@ -410,14 +410,14 @@ namespace Vocaluxe.Screens
{ {
_PlaylistActive = true; _PlaylistActive = true;
_Playlist.Selected = _PlaylistActive; _Playlist.Selected = _PlaylistActive;
_SongMenu.Active = !_PlaylistActive; _SongMenu.Selected = !_PlaylistActive;
_ToggleSongOptions(ESongOptionsView.None); _ToggleSongOptions(ESongOptionsView.None);
} }
else if (CHelper.IsInBounds(_SongMenu.Rect, mouseEvent)) else if (CHelper.IsInBounds(_SongMenu.Rect, mouseEvent))
{ {
_PlaylistActive = false; _PlaylistActive = false;
_Playlist.Selected = _PlaylistActive; _Playlist.Selected = _PlaylistActive;
_SongMenu.Active = !_PlaylistActive; _SongMenu.Selected = !_PlaylistActive;
} }
@@ -588,7 +588,7 @@ namespace Vocaluxe.Screens
if (!_DragAndDropActive && _Playlist.Visible && CSongs.NumSongsVisible > 0 && _SongMenu.GetSelectedSongNr() != -1) if (!_DragAndDropActive && _Playlist.Visible && CSongs.NumSongsVisible > 0 && _SongMenu.GetSelectedSongNr() != -1)
{ {
_DragAndDropCover = _SongMenu.GetSelectedSongCover(); _DragAndDropCover = _SongMenu.GetSelectedSongCover();
_DragAndDropCover.Rect.Z = CSettings.ZNear; _DragAndDropCover.Z = CSettings.ZNear;
_Playlist.DragAndDropSongID = CSongs.VisibleSongs[_SongMenu.GetSelectedSongNr()].ID; _Playlist.DragAndDropSongID = CSongs.VisibleSongs[_SongMenu.GetSelectedSongNr()].ID;
_DragAndDropActive = true; _DragAndDropActive = true;
return true; return true;
@@ -641,7 +641,7 @@ namespace Vocaluxe.Screens
if (_Sso.Selection.PartyMode) if (_Sso.Selection.PartyMode)
_ToggleSongOptions(ESongOptionsView.None); _ToggleSongOptions(ESongOptionsView.None);
_SongMenu.Active = !_PlaylistActive; _SongMenu.Selected = !_PlaylistActive;
_SongMenu.SmallView = _Playlist.Visible; _SongMenu.SmallView = _Playlist.Visible;
if (_Playlist.ActivePlaylistID != -1) if (_Playlist.ActivePlaylistID != -1)
@@ -698,14 +698,12 @@ namespace Vocaluxe.Screens
return true; return true;
} }
public override bool Draw() public override void Draw()
{ {
base.Draw(); base.Draw();
if (_DragAndDropActive) if (_DragAndDropActive)
_DragAndDropCover.Draw(); _DragAndDropCover.Draw();
return true;
} }
public override void OnClose() public override void OnClose()
@@ -1279,7 +1277,7 @@ namespace Vocaluxe.Screens
_SongMenu.SmallView = false; _SongMenu.SmallView = false;
_PlaylistActive = false; _PlaylistActive = false;
_Playlist.Selected = _PlaylistActive; _Playlist.Selected = _PlaylistActive;
_SongMenu.Active = !_PlaylistActive; _SongMenu.Selected = !_PlaylistActive;
_Playlist.ClosePlaylist(); _Playlist.ClosePlaylist();
} }
} }
+6 -1
View File
@@ -44,7 +44,7 @@ namespace VocaluxeLib.Menu
public SThemeColor Color; public SThemeColor Color;
} }
public class CBackground : IMenuElement public class CBackground : CMenuElementBase, IMenuElement, IThemeable
{ {
private readonly int _PartyModeID; private readonly int _PartyModeID;
private SThemeBackground _Theme; private SThemeBackground _Theme;
@@ -56,6 +56,11 @@ namespace VocaluxeLib.Menu
private CVideoStream _VideoStream; private CVideoStream _VideoStream;
public bool Selectable
{
get { return false; }
}
public SColorF Color; public SColorF Color;
public bool ThemeLoaded public bool ThemeLoaded
{ {
+23 -27
View File
@@ -39,7 +39,7 @@ namespace VocaluxeLib.Menu
public SReflection SelReflection; public SReflection SelReflection;
} }
public class CButton : IMenuElement public sealed class CButton : CMenuElementBase, IMenuElement, IThemeable
{ {
private SThemeButton _Theme; private SThemeButton _Theme;
private bool _ThemeLoaded; private bool _ThemeLoaded;
@@ -47,7 +47,6 @@ namespace VocaluxeLib.Menu
public CTextureRef Texture; public CTextureRef Texture;
public CTextureRef SelTexture; public CTextureRef SelTexture;
public SRectF Rect;
public SColorF Color; public SColorF Color;
public SColorF SelColor; public SColorF SelColor;
@@ -75,27 +74,24 @@ namespace VocaluxeLib.Menu
} }
} }
private bool _Selected; public override bool Selected
public bool Selected
{ {
get { return _Selected; }
set set
{ {
_Selected = value; base.Selected = value;
Text.Selected = value; Text.Selected = value;
} }
} }
public bool Visible = true; private bool _Selectable = true;
private bool _Enabled = true;
public bool Enabled public bool Selectable
{ {
get { return _Enabled; } get { return _Selectable; }
set set
{ {
_Enabled = value; _Selectable = value;
if (!_Enabled) if (!_Selectable)
_Selected = false; Selected = false;
} }
} }
@@ -141,7 +137,7 @@ namespace VocaluxeLib.Menu
SkinSelected = button._Theme.SkinSelected SkinSelected = button._Theme.SkinSelected
}; };
Rect = button.Rect; MaxRect = button.MaxRect;
Color = button.Color; Color = button.Color;
SelColor = button.Color; SelColor = button.Color;
Texture = button.Texture; Texture = button.Texture;
@@ -151,7 +147,7 @@ namespace VocaluxeLib.Menu
_SelText = _SelText == null ? null : new CText(button._SelText); _SelText = _SelText == null ? null : new CText(button._SelText);
Selected = false; Selected = false;
EditMode = false; EditMode = false;
_Enabled = button._Enabled; _Selectable = button._Selectable;
_Reflection = button._Reflection; _Reflection = button._Reflection;
_ReflectionHeight = button._ReflectionHeight; _ReflectionHeight = button._ReflectionHeight;
@@ -248,14 +244,14 @@ namespace VocaluxeLib.Menu
return _ThemeLoaded; return _ThemeLoaded;
} }
public void Draw(bool forceDraw = false) public void Draw()
{ {
if (!Visible && CBase.Settings.GetProgramState() != EProgramState.EditTheme && !forceDraw) if (!Visible && CBase.Settings.GetProgramState() != EProgramState.EditTheme)
return; return;
CTextureRef texture; CTextureRef texture;
if (!Selected && !Pressed || !_Enabled) if (!Selected && !Pressed || !_Selectable)
{ {
texture = Texture ?? CBase.Themes.GetSkinTexture(_Theme.Skin, _PartyModeID); texture = Texture ?? CBase.Themes.GetSkinTexture(_Theme.Skin, _PartyModeID);
@@ -323,7 +319,7 @@ namespace VocaluxeLib.Menu
_Theme.Color.Get(_PartyModeID, out Color); _Theme.Color.Get(_PartyModeID, out Color);
_Theme.SelColor.Get(_PartyModeID, out SelColor); _Theme.SelColor.Get(_PartyModeID, out SelColor);
Rect = _Theme.Rect; MaxRect = _Theme.Rect;
_Reflection = _Theme.Reflection.Enabled; _Reflection = _Theme.Reflection.Enabled;
if (_Reflection) if (_Reflection)
@@ -357,8 +353,8 @@ namespace VocaluxeLib.Menu
#region ThemeEdit #region ThemeEdit
public void MoveElement(int stepX, int stepY) public void MoveElement(int stepX, int stepY)
{ {
Rect.X += stepX; X += stepX;
Rect.Y += stepY; Y += stepY;
_Theme.Rect.X += stepX; _Theme.Rect.X += stepX;
_Theme.Rect.Y += stepY; _Theme.Rect.Y += stepY;
@@ -366,13 +362,13 @@ namespace VocaluxeLib.Menu
public void ResizeElement(int stepW, int stepH) public void ResizeElement(int stepW, int stepH)
{ {
Rect.W += stepW; W += stepW;
if (Rect.W <= 0) if (W <= 0)
Rect.W = 1; W = 1;
Rect.H += stepH; H += stepH;
if (Rect.H <= 0) if (H <= 0)
Rect.H = 1; H = 1;
_Theme.Rect.W = Rect.W; _Theme.Rect.W = Rect.W;
_Theme.Rect.H = Rect.H; _Theme.Rect.H = Rect.H;
+15 -20
View File
@@ -45,13 +45,12 @@ namespace VocaluxeLib.Menu
public SReflection Reflection; public SReflection Reflection;
} }
public class CEqualizer : IMenuElement public class CEqualizer : CMenuElementBase, IMenuElement, IThemeable
{ {
private readonly int _PartyModeID; private readonly int _PartyModeID;
private SThemeEqualizer _Theme; private SThemeEqualizer _Theme;
private bool _ThemeLoaded; private bool _ThemeLoaded;
public SRectF Rect;
public SColorF Color; public SColorF Color;
public SColorF MaxColor; public SColorF MaxColor;
public float Space; public float Space;
@@ -60,9 +59,6 @@ namespace VocaluxeLib.Menu
public float ReflectionSpace; public float ReflectionSpace;
public float ReflectionHeight; public float ReflectionHeight;
public bool Selected;
public bool Visible;
public string GetThemeName() public string GetThemeName()
{ {
return _Theme.Name; return _Theme.Name;
@@ -77,19 +73,20 @@ namespace VocaluxeLib.Menu
private int _MaxBar; private int _MaxBar;
private float _MaxVolume; private float _MaxVolume;
public bool Selectable
{
get { return false; }
}
public CEqualizer(int partyModeID) public CEqualizer(int partyModeID)
{ {
_PartyModeID = partyModeID; _PartyModeID = partyModeID;
_Theme = new SThemeEqualizer(); _Theme = new SThemeEqualizer();
_ThemeLoaded = false; _ThemeLoaded = false;
Rect = new SRectF();
Color = new SColorF(); Color = new SColorF();
MaxColor = new SColorF(); MaxColor = new SColorF();
Selected = false;
Visible = true;
Reflection = false; Reflection = false;
ReflectionSpace = 0f; ReflectionSpace = 0f;
ReflectionHeight = 0f; ReflectionHeight = 0f;
@@ -100,8 +97,6 @@ namespace VocaluxeLib.Menu
_PartyModeID = partyModeID; _PartyModeID = partyModeID;
_Theme = theme; _Theme = theme;
Visible = true;
LoadSkin(); LoadSkin();
} }
@@ -247,7 +242,7 @@ namespace VocaluxeLib.Menu
_Theme.Color.Get(_PartyModeID, out Color); _Theme.Color.Get(_PartyModeID, out Color);
_Theme.MaxColor.Get(_PartyModeID, out MaxColor); _Theme.MaxColor.Get(_PartyModeID, out MaxColor);
Rect = _Theme.Rect; MaxRect = _Theme.Rect;
Space = _Theme.Space; Space = _Theme.Space;
Reflection = _Theme.Reflection.Enabled; Reflection = _Theme.Reflection.Enabled;
if (Reflection) if (Reflection)
@@ -275,8 +270,8 @@ namespace VocaluxeLib.Menu
#region ThemeEdit #region ThemeEdit
public void MoveElement(int stepX, int stepY) public void MoveElement(int stepX, int stepY)
{ {
Rect.X += stepX; X += stepX;
Rect.Y += stepY; Y += stepY;
_Theme.Rect.X += stepX; _Theme.Rect.X += stepX;
_Theme.Rect.Y += stepY; _Theme.Rect.Y += stepY;
@@ -284,15 +279,15 @@ namespace VocaluxeLib.Menu
public void ResizeElement(int stepW, int stepH) public void ResizeElement(int stepW, int stepH)
{ {
Rect.W += stepW; W += stepW;
if (Rect.W <= 0) if (W <= 0)
Rect.W = 1; W = 1;
_Theme.Rect.W = Rect.W; _Theme.Rect.W = Rect.W;
Rect.H += stepH; H += stepH;
if (Rect.H <= 0) if (H <= 0)
Rect.H = 1; H = 1;
_Theme.Rect.H = Rect.H; _Theme.Rect.H = Rect.H;
} }
+25 -51
View File
@@ -33,7 +33,7 @@ namespace VocaluxeLib.Menu
public SThemeColor SColor; public SThemeColor SColor;
} }
public class CLyric : IMenuElement public class CLyric : CMenuElementBase, IMenuElement, IThemeable
{ {
private readonly int _PartyModeID; private readonly int _PartyModeID;
private SThemeLyrics _Theme; private SThemeLyrics _Theme;
@@ -45,18 +45,17 @@ namespace VocaluxeLib.Menu
private CSongLine _Line; private CSongLine _Line;
private CText _Text; private CText _Text;
private float _X;
private float _Y;
private float _MaxW;
private float _Z;
private float _H;
private float _Width; private float _Width;
private float _Alpha = 1f; private float _Alpha = 1f;
private float _CurrentBeat = -1; private float _CurrentBeat = -1;
public bool Selectable
{
get { return false; }
}
public string GetThemeName() public string GetThemeName()
{ {
return _Theme.Name; return _Theme.Name;
@@ -67,25 +66,9 @@ namespace VocaluxeLib.Menu
get { return _ThemeLoaded; } get { return _ThemeLoaded; }
} }
public SRectF Rect
{
get { return new SRectF(_X, _Y, _MaxW, _H, _Z); }
private set
{
_X = value.X;
_Y = value.Y;
_MaxW = value.W;
_H = value.H;
_Z = value.Z;
}
}
private SColorF _Color; private SColorF _Color;
private SColorF _ColorProcessed; private SColorF _ColorProcessed;
public bool Selected;
public bool Visible = true;
public float Alpha public float Alpha
{ {
get { return _Alpha; } get { return _Alpha; }
@@ -106,12 +89,6 @@ namespace VocaluxeLib.Menu
_Color = new SColorF(); _Color = new SColorF();
_ColorProcessed = new SColorF(); _ColorProcessed = new SColorF();
_X = 0f;
_Y = 0f;
_Z = 0f;
_MaxW = 1f;
_H = 1f;
_Width = 1f;
_Line = new CSongLine(); _Line = new CSongLine();
_Text = new CText(_PartyModeID); _Text = new CText(_PartyModeID);
@@ -169,7 +146,6 @@ namespace VocaluxeLib.Menu
_Theme.Color.Color = _Color; _Theme.Color.Color = _Color;
_Theme.SColor.Color = _ColorProcessed; _Theme.SColor.Color = _ColorProcessed;
LoadSkin(); LoadSkin();
_Text = new CText(_X, _Y, _Z, _H, _MaxW, EAlignment.Left, EStyle.Bold, "Normal", _Color, String.Empty);
} }
return _ThemeLoaded; return _ThemeLoaded;
} }
@@ -198,7 +174,7 @@ namespace VocaluxeLib.Menu
public float GetCurrentLyricPosX() public float GetCurrentLyricPosX()
{ {
return _X - _Width / 2; return X - _Width / 2;
} }
public void Update(float currentBeat) public void Update(float currentBeat)
@@ -234,7 +210,7 @@ namespace VocaluxeLib.Menu
private void _DrawSlide() private void _DrawSlide()
{ {
float x = _X - _Width / 2; float x = X - _Width / 2;
foreach (CSongNote note in _Line.Notes) foreach (CSongNote note in _Line.Notes)
{ {
@@ -275,7 +251,7 @@ namespace VocaluxeLib.Menu
private void _DrawZoom() private void _DrawZoom()
{ {
float x = _X - _Width / 2; // most left position float x = X - _Width / 2; // most left position
//find last active note //find last active note
int lastNote = _Line.FindPreviousNote((int)_CurrentBeat); int lastNote = _Line.FindPreviousNote((int)_CurrentBeat);
@@ -356,7 +332,7 @@ namespace VocaluxeLib.Menu
private void _DrawFill() private void _DrawFill()
{ {
float x = _X - _Width / 2; // most left position float x = X - _Width / 2; // most left position
foreach (CSongNote note in _Line.Notes) foreach (CSongNote note in _Line.Notes)
{ {
@@ -381,7 +357,7 @@ namespace VocaluxeLib.Menu
private void _DrawJump() private void _DrawJump()
{ {
float x = _X - _Width / 2; // most left position float x = X - _Width / 2; // most left position
//find last active note //find last active note
int lastNote = _Line.FindPreviousNote((int)_CurrentBeat); int lastNote = _Line.FindPreviousNote((int)_CurrentBeat);
@@ -455,8 +431,8 @@ namespace VocaluxeLib.Menu
_Theme.Color.Get(_PartyModeID, out _Color); _Theme.Color.Get(_PartyModeID, out _Color);
_Theme.SColor.Get(_PartyModeID, out _ColorProcessed); _Theme.SColor.Get(_PartyModeID, out _ColorProcessed);
Rect = _Theme.Rect; MaxRect = _Theme.Rect;
_Text = new CText(_X, _Y, _Z, _H, _MaxW, EAlignment.Left, EStyle.Bold, "Normal", _Color, String.Empty); _Text = new CText(X, Y, Z, H, W, EAlignment.Left, EStyle.Bold, "Normal", _Color, String.Empty);
} }
public void ReloadSkin() public void ReloadSkin()
@@ -473,26 +449,24 @@ namespace VocaluxeLib.Menu
#region ThemeEdit #region ThemeEdit
public void MoveElement(int stepX, int stepY) public void MoveElement(int stepX, int stepY)
{ {
SRectF rect = Rect; X += stepX;
rect.X += stepX; Y += stepY;
rect.Y += stepY; _Theme.Rect.X += stepX;
Rect = rect; _Theme.Rect.Y += stepY;
_Theme.Rect = rect;
} }
public void ResizeElement(int stepW, int stepH) public void ResizeElement(int stepW, int stepH)
{ {
SRectF rect = Rect; W += stepW;
rect.W += stepW; if (W <= 0)
if (rect.W <= 0) W = 1;
rect.W = 1;
rect.H += stepH; H += stepH;
if (rect.H <= 0) if (H <= 0)
rect.H = 1; H = 1;
Rect = rect; _Theme.Rect.W = Rect.W;
_Theme.Rect = rect; _Theme.Rect.H = Rect.H;
} }
#endregion ThemeEdit #endregion ThemeEdit
} }
+27 -18
View File
@@ -81,6 +81,7 @@ namespace VocaluxeLib.Menu
protected string[] _ThemePlaylists; protected string[] _ThemePlaylists;
protected string[] _ThemeParticleEffects; protected string[] _ThemeParticleEffects;
protected string[] _ThemeScreenSettings; protected string[] _ThemeScreenSettings;
protected readonly Dictionary<string, CScreenSetting> _ScreenSettings = new Dictionary<string, CScreenSetting>();
// ReSharper restore MemberCanBePrivate.Global // ReSharper restore MemberCanBePrivate.Global
@@ -117,9 +118,15 @@ namespace VocaluxeLib.Menu
} }
#region ThemeHandler #region ThemeHandler
protected override void _ClearElements()
{
base._ClearElements();
_ScreenSettings.Clear();
}
private delegate void AddElementHandler<in T>(T element, String key); private delegate void AddElementHandler<in T>(T element, String key);
private void _LoadThemeElement<T>(IEnumerable<string> elements, AddElementHandler<T> addElementHandler, CXMLReader xmlReader) where T : IMenuElement private void _LoadThemeElement<T>(IEnumerable<string> elements, AddElementHandler<T> addElementHandler, CXMLReader xmlReader) where T : IThemeable
{ {
if (elements != null) if (elements != null)
{ {
@@ -198,7 +205,7 @@ namespace VocaluxeLib.Menu
_AddSingNote(new CSingNotesClassic(sb, PartyModeID), sb.Name); _AddSingNote(new CSingNotesClassic(sb, PartyModeID), sb.Name);
foreach (SThemeSongMenu sm in Theme.SongMenus) foreach (SThemeSongMenu sm in Theme.SongMenus)
_AddSongMenu(new CSongMenu(sm, PartyModeID), sm.Name); _AddSongMenu(CSongMenuFactory.GetSongMenu(sm, PartyModeID), sm.Name);
foreach (SThemeStatic st in Theme.Statics) foreach (SThemeStatic st in Theme.Statics)
_AddStatic(new CStatic(st, PartyModeID), st.Name); _AddStatic(new CStatic(st, PartyModeID), st.Name);
@@ -227,6 +234,11 @@ namespace VocaluxeLib.Menu
} }
} }
private void _AddScreenSetting(CScreenSetting screenSetting, string name)
{
_ScreenSettings.Add(name, screenSetting);
}
public virtual void LoadThemeOld(string xmlPath) public virtual void LoadThemeOld(string xmlPath)
{ {
string file = Path.Combine(xmlPath, ThemeName + ".xml"); string file = Path.Combine(xmlPath, ThemeName + ".xml");
@@ -247,7 +259,15 @@ namespace VocaluxeLib.Menu
_LoadThemeElement<CText>(_ThemeTexts, _AddText, xmlReader); _LoadThemeElement<CText>(_ThemeTexts, _AddText, xmlReader);
_LoadThemeElement<CButton>(_ThemeButtons, _AddButton, xmlReader); _LoadThemeElement<CButton>(_ThemeButtons, _AddButton, xmlReader);
_LoadThemeElement<CSelectSlide>(_ThemeSelectSlides, _AddSelectSlide, xmlReader); _LoadThemeElement<CSelectSlide>(_ThemeSelectSlides, _AddSelectSlide, xmlReader);
_LoadThemeElement<CSongMenu>(_ThemeSongMenus, _AddSongMenu, xmlReader); foreach (string elName in _ThemeSongMenus)
{
ISongMenu element = CSongMenuFactory.GetSongMenu(PartyModeID);
if (element.LoadTheme("//root/" + ThemeName, elName, xmlReader))
_AddSongMenu(element, elName);
else
CBase.Log.LogError("Can't load songmenu \"" + elName + "\" in screen " + ThemeName);
}
_LoadThemeElement<CSongMenuFramework>(_ThemeSongMenus, _AddSongMenu, xmlReader);
_LoadThemeElement<CLyric>(_ThemeLyrics, _AddLyric, xmlReader); _LoadThemeElement<CLyric>(_ThemeLyrics, _AddLyric, xmlReader);
_LoadThemeElement<CSingNotesClassic>(_ThemeSingNotes, _AddSingNote, xmlReader); _LoadThemeElement<CSingNotesClassic>(_ThemeSingNotes, _AddSingNote, xmlReader);
_LoadThemeElement<CNameSelection>(_ThemeNameSelections, _AddNameSelection, xmlReader); _LoadThemeElement<CNameSelection>(_ThemeNameSelections, _AddNameSelection, xmlReader);
@@ -293,7 +313,7 @@ namespace VocaluxeLib.Menu
Theme.ParticleEffects.Add(el.GetTheme()); Theme.ParticleEffects.Add(el.GetTheme());
foreach (CPlaylist el in _Playlists) foreach (CPlaylist el in _Playlists)
Theme.Playlists.Add(el.GetTheme()); Theme.Playlists.Add(el.GetTheme());
foreach (CScreenSetting el in _ScreenSettings) foreach (CScreenSetting el in _ScreenSettings.Values)
Theme.ScreenSettings.Add(el.GetTheme()); Theme.ScreenSettings.Add(el.GetTheme());
foreach (CSelectSlide el in _SelectSlides) foreach (CSelectSlide el in _SelectSlides)
Theme.SelectSlides.Add(el.GetTheme()); Theme.SelectSlides.Add(el.GetTheme());
@@ -301,7 +321,7 @@ namespace VocaluxeLib.Menu
Theme.Statics.Add(el.GetTheme()); Theme.Statics.Add(el.GetTheme());
foreach (CText el in _Texts) foreach (CText el in _Texts)
Theme.Texts.Add(el.GetTheme()); Theme.Texts.Add(el.GetTheme());
foreach (CSongMenu el in _SongMenus) foreach (CSongMenuFramework el in _SongMenus)
Theme.SongMenus.Add(el.GetTheme()); Theme.SongMenus.Add(el.GetTheme());
foreach (CSingNotes el in _SingNotes) foreach (CSingNotes el in _SingNotes)
Theme.SingNotes.Add(el.GetTheme()); Theme.SingNotes.Add(el.GetTheme());
@@ -342,7 +362,7 @@ namespace VocaluxeLib.Menu
foreach (CSelectSlide slide in _SelectSlides) foreach (CSelectSlide slide in _SelectSlides)
slide.ReloadSkin(); slide.ReloadSkin();
foreach (CSongMenu sm in _SongMenus) foreach (CSongMenuFramework sm in _SongMenus)
sm.ReloadSkin(); sm.ReloadSkin();
foreach (CLyric lyric in _Lyrics) foreach (CLyric lyric in _Lyrics)
@@ -362,9 +382,6 @@ namespace VocaluxeLib.Menu
foreach (CParticleEffect pe in _ParticleEffects) foreach (CParticleEffect pe in _ParticleEffects)
pe.ReloadSkin(); pe.ReloadSkin();
foreach (CScreenSetting se in _ScreenSettings)
se.ReloadSkin();
} }
public virtual void UnloadSkin() public virtual void UnloadSkin()
@@ -384,7 +401,7 @@ namespace VocaluxeLib.Menu
foreach (CSelectSlide slide in _SelectSlides) foreach (CSelectSlide slide in _SelectSlides)
slide.UnloadSkin(); slide.UnloadSkin();
foreach (CSongMenu sm in _SongMenus) foreach (CSongMenuFramework sm in _SongMenus)
sm.UnloadSkin(); sm.UnloadSkin();
foreach (CLyric lyric in _Lyrics) foreach (CLyric lyric in _Lyrics)
@@ -404,9 +421,6 @@ namespace VocaluxeLib.Menu
foreach (CParticleEffect pe in _ParticleEffects) foreach (CParticleEffect pe in _ParticleEffects)
pe.UnloadSkin(); pe.UnloadSkin();
foreach (CScreenSetting se in _ScreenSettings)
se.UnloadSkin();
} }
public virtual void ReloadTheme(string xmlPath) public virtual void ReloadTheme(string xmlPath)
@@ -478,11 +492,6 @@ namespace VocaluxeLib.Menu
return new CSelectSlide(slide); return new CSelectSlide(slide);
} }
public CSongMenu GetNewSongMenu()
{
return new CSongMenu(PartyModeID);
}
public CLyric GetNewLyric() public CLyric GetNewLyric()
{ {
return new CLyric(PartyModeID); return new CLyric(PartyModeID);
+39
View File
@@ -0,0 +1,39 @@
namespace VocaluxeLib.Menu
{
public abstract class CMenuElementBase
{
public bool Visible { get; set; }
public bool Highlighted { get; set; }
public virtual bool Selected { get; set; }
public virtual SRectF Rect
{
get { return MaxRect; }
}
// Those values are the ones from MaxRect for easier accessibility
public virtual float X { get; set; }
public virtual float Y { get; set; }
public virtual float Z { get; set; }
public virtual float W { get; set; }
public float H { get; set; }
public virtual SRectF MaxRect
{
get { return new SRectF(X, Y, W, H, Z); }
set
{
X = value.X;
Y = value.Y;
W = value.W;
H = value.H;
Z = value.Z;
}
}
protected CMenuElementBase()
{
Visible = true;
}
}
}
+11 -20
View File
@@ -75,6 +75,7 @@ namespace VocaluxeLib.Menu
_ChooseAvatarStatic = GetNewStatic(); _ChooseAvatarStatic = GetNewStatic();
_ChooseAvatarStatic.Visible = false; _ChooseAvatarStatic.Visible = false;
_ChooseAvatarStatic.Aspect = EAspect.Crop; _ChooseAvatarStatic.Aspect = EAspect.Crop;
_AddStatic(_ChooseAvatarStatic);
CBase.Profiles.AddProfileChangedCallback(_OnProfileChanged); CBase.Profiles.AddProfileChangedCallback(_OnProfileChanged);
} }
@@ -379,8 +380,8 @@ namespace VocaluxeLib.Menu
//Update of Drag/Drop-Texture //Update of Drag/Drop-Texture
CStatic selectedPlayer = _NameSelections[_NameSelection].TilePlayerAvatar(mouseEvent); CStatic selectedPlayer = _NameSelections[_NameSelection].TilePlayerAvatar(mouseEvent);
_ChooseAvatarStatic.Visible = true; _ChooseAvatarStatic.Visible = true;
_ChooseAvatarStatic.Rect = selectedPlayer.Rect; _ChooseAvatarStatic.MaxRect = selectedPlayer.Rect;
_ChooseAvatarStatic.Rect.Z = CBase.Settings.GetZNear(); _ChooseAvatarStatic.Z = CBase.Settings.GetZNear();
_ChooseAvatarStatic.Color = new SColorF(1, 1, 1, 1); _ChooseAvatarStatic.Color = new SColorF(1, 1, 1, 1);
_ChooseAvatarStatic.Texture = selectedPlayer.Texture; _ChooseAvatarStatic.Texture = selectedPlayer.Texture;
} }
@@ -390,8 +391,8 @@ namespace VocaluxeLib.Menu
if (mouseEvent.LBH && _SelectedProfileID >= 0 && !_SelectingFast) if (mouseEvent.LBH && _SelectedProfileID >= 0 && !_SelectingFast)
{ {
//Update coords for Drag/Drop-Texture //Update coords for Drag/Drop-Texture
_ChooseAvatarStatic.Rect.X += mouseEvent.X - _OldMouseX; _ChooseAvatarStatic.X += mouseEvent.X - _OldMouseX;
_ChooseAvatarStatic.Rect.Y += mouseEvent.Y - _OldMouseY; _ChooseAvatarStatic.Y += mouseEvent.Y - _OldMouseY;
_OldMouseX = mouseEvent.X; _OldMouseX = mouseEvent.X;
_OldMouseY = mouseEvent.Y; _OldMouseY = mouseEvent.Y;
} }
@@ -554,16 +555,6 @@ namespace VocaluxeLib.Menu
_UpdateButtonState(); _UpdateButtonState();
} }
public override bool Draw()
{
base.Draw();
if (_ChooseAvatarStatic.Visible)
_ChooseAvatarStatic.Draw();
return true;
}
public abstract void Back(); public abstract void Back();
public abstract void Next(); public abstract void Next();
@@ -711,17 +702,17 @@ namespace VocaluxeLib.Menu
private void _UpdateButtonState() private void _UpdateButtonState()
{ {
_Buttons[_ButtonIncreaseTeams].Enabled = _NumTeams < _PartyMode.GetMaxTeams(); _Buttons[_ButtonIncreaseTeams].Selectable = _NumTeams < _PartyMode.GetMaxTeams();
_Buttons[_ButtonDecreaseTeams].Enabled = _NumTeams > _PartyMode.GetMinTeams(); _Buttons[_ButtonDecreaseTeams].Selectable = _NumTeams > _PartyMode.GetMinTeams();
if (_NumPlayerTeams != null && _NumPlayerTeams.Length > _CurrentTeam) if (_NumPlayerTeams != null && _NumPlayerTeams.Length > _CurrentTeam)
{ {
_Buttons[_ButtonIncreasePlayer].Enabled = _NumPlayerTeams[_CurrentTeam] < _PartyMode.GetMaxPlayerPerTeam(); _Buttons[_ButtonIncreasePlayer].Selectable = _NumPlayerTeams[_CurrentTeam] < _PartyMode.GetMaxPlayerPerTeam();
_Buttons[_ButtonDecreasePlayer].Enabled = _NumPlayerTeams[_CurrentTeam] > _PartyMode.GetMinPlayerPerTeam(); _Buttons[_ButtonDecreasePlayer].Selectable = _NumPlayerTeams[_CurrentTeam] > _PartyMode.GetMinPlayerPerTeam();
} }
else else
{ {
_Buttons[_ButtonIncreasePlayer].Enabled = false; _Buttons[_ButtonIncreasePlayer].Selectable = false;
_Buttons[_ButtonDecreasePlayer].Enabled = false; _Buttons[_ButtonDecreasePlayer].Selectable = false;
} }
} }
+22 -27
View File
@@ -56,7 +56,7 @@ namespace VocaluxeLib.Menu
public SThemeColor Color; public SThemeColor Color;
} }
public class CNameSelection : IMenuElement public class CNameSelection : CMenuElementBase, IMenuElement, IThemeable
{ {
private class CTile private class CTile
{ {
@@ -86,10 +86,6 @@ namespace VocaluxeLib.Menu
get { return _ThemeLoaded; } get { return _ThemeLoaded; }
} }
public bool Selected;
public bool Visible = true;
public SRectF Rect;
private readonly List<CTile> _Tiles; private readonly List<CTile> _Tiles;
private CTextureRef _TextureEmptyTile; private CTextureRef _TextureEmptyTile;
@@ -113,12 +109,15 @@ namespace VocaluxeLib.Menu
private CStatic _PlayerSelector; private CStatic _PlayerSelector;
public bool Selectable
{
get { return Visible; }
}
public CNameSelection(int partyModeID) public CNameSelection(int partyModeID)
{ {
_PartyModeID = partyModeID; _PartyModeID = partyModeID;
_Theme = new SThemeNameSelection(); _Theme = new SThemeNameSelection {Tiles = new SThemeNameSelectionTiles {Name = new SThemeNameSelectionName()}};
_Theme.Tiles = new SThemeNameSelectionTiles();
_Theme.Tiles.Name = new SThemeNameSelectionName();
_Tiles = new List<CTile>(); _Tiles = new List<CTile>();
_VisibleProfiles = new List<int>(); _VisibleProfiles = new List<int>();
@@ -141,12 +140,8 @@ namespace VocaluxeLib.Menu
{ {
_PrepareTiles(); _PrepareTiles();
_PlayerSelector = new CStatic(_PartyModeID) _PlayerSelector = new CStatic(_PartyModeID, _TextureTileSelected, new SColorF(), new SRectF(0, 0, _Theme.Tiles.W + 6, _Theme.Tiles.H + 6, Rect.Z - 0.5f));
{ _PlayerSelector.Visible = false;
Texture = _TextureTileSelected,
Rect = new SRectF(0, 0, _Theme.Tiles.W + 6, _Theme.Tiles.H + 6, Rect.Z - 0.5f),
Visible = false
};
_UpdateVisibleProfiles(); _UpdateVisibleProfiles();
@@ -224,8 +219,8 @@ namespace VocaluxeLib.Menu
//Update PlayerSelector-Coords //Update PlayerSelector-Coords
if (_Player > -1 && _ActualSelection == i) if (_Player > -1 && _ActualSelection == i)
{ {
_PlayerSelector.Rect.X = tile.Avatar.Rect.X - 3; _PlayerSelector.X = tile.Avatar.Rect.X - 3;
_PlayerSelector.Rect.Y = tile.Avatar.Rect.Y - 3; _PlayerSelector.Y = tile.Avatar.Rect.Y - 3;
} }
} }
@@ -432,7 +427,7 @@ namespace VocaluxeLib.Menu
_Theme.ColorEmptyTile.Get(_PartyModeID, out _ColorEmptyTile); _Theme.ColorEmptyTile.Get(_PartyModeID, out _ColorEmptyTile);
_Theme.Tiles.Name.Color.Get(_PartyModeID, out _ColorNameTile); _Theme.Tiles.Name.Color.Get(_PartyModeID, out _ColorNameTile);
Rect = _Theme.Rect; MaxRect = _Theme.Rect;
} }
public void ReloadSkin() public void ReloadSkin()
@@ -529,8 +524,8 @@ namespace VocaluxeLib.Menu
#region ThemeEdit #region ThemeEdit
public void MoveElement(int stepX, int stepY) public void MoveElement(int stepX, int stepY)
{ {
Rect.X += stepX; X += stepX;
Rect.Y += stepY; Y += stepY;
_Theme.Rect.X += stepX; _Theme.Rect.X += stepX;
_Theme.Rect.Y += stepY; _Theme.Rect.Y += stepY;
@@ -538,16 +533,16 @@ namespace VocaluxeLib.Menu
public void ResizeElement(int stepW, int stepH) public void ResizeElement(int stepW, int stepH)
{ {
Rect.W += stepW; W += stepW;
if (Rect.W <= 0) if (W <= 0)
Rect.W = 1; W = 1;
Rect.H += stepH; H += stepH;
if (Rect.H <= 0) if (H <= 0)
Rect.H = 1; H = 1;
_Theme.Rect.W = Rect.W; _Theme.Rect.W = W;
_Theme.Rect.H = Rect.H; _Theme.Rect.H = H;
} }
#endregion ThemeEdit #endregion ThemeEdit
} }
+96 -462
View File
@@ -32,9 +32,6 @@ namespace VocaluxeLib.Menu
private int _PrevMouseX; private int _PrevMouseX;
private int _PrevMouseY; private int _PrevMouseY;
protected int _MouseDX;
protected int _MouseDY;
protected bool _Active; protected bool _Active;
protected readonly COrderedDictionaryLite<CButton> _Buttons; protected readonly COrderedDictionaryLite<CButton> _Buttons;
@@ -42,30 +39,28 @@ namespace VocaluxeLib.Menu
protected readonly COrderedDictionaryLite<CBackground> _Backgrounds; protected readonly COrderedDictionaryLite<CBackground> _Backgrounds;
protected readonly COrderedDictionaryLite<CStatic> _Statics; protected readonly COrderedDictionaryLite<CStatic> _Statics;
protected readonly COrderedDictionaryLite<CSelectSlide> _SelectSlides; protected readonly COrderedDictionaryLite<CSelectSlide> _SelectSlides;
protected readonly COrderedDictionaryLite<CSongMenu> _SongMenus; protected readonly COrderedDictionaryLite<ISongMenu> _SongMenus;
protected readonly COrderedDictionaryLite<CLyric> _Lyrics; protected readonly COrderedDictionaryLite<CLyric> _Lyrics;
protected readonly COrderedDictionaryLite<CSingNotes> _SingNotes; protected readonly COrderedDictionaryLite<CSingNotes> _SingNotes;
protected readonly COrderedDictionaryLite<CNameSelection> _NameSelections; protected readonly COrderedDictionaryLite<CNameSelection> _NameSelections;
protected readonly COrderedDictionaryLite<CEqualizer> _Equalizers; protected readonly COrderedDictionaryLite<CEqualizer> _Equalizers;
protected readonly COrderedDictionaryLite<CPlaylist> _Playlists; protected readonly COrderedDictionaryLite<CPlaylist> _Playlists;
protected readonly COrderedDictionaryLite<CParticleEffect> _ParticleEffects; protected readonly COrderedDictionaryLite<CParticleEffect> _ParticleEffects;
protected readonly COrderedDictionaryLite<CScreenSetting> _ScreenSettings;
public CObjectInteractions() protected CObjectInteractions()
{ {
_Backgrounds = new COrderedDictionaryLite<CBackground>(this); _Backgrounds = new COrderedDictionaryLite<CBackground>(this);
_Buttons = new COrderedDictionaryLite<CButton>(this); _Buttons = new COrderedDictionaryLite<CButton>(this);
_Texts = new COrderedDictionaryLite<CText>(this); _Texts = new COrderedDictionaryLite<CText>(this);
_Statics = new COrderedDictionaryLite<CStatic>(this); _Statics = new COrderedDictionaryLite<CStatic>(this);
_SelectSlides = new COrderedDictionaryLite<CSelectSlide>(this); _SelectSlides = new COrderedDictionaryLite<CSelectSlide>(this);
_SongMenus = new COrderedDictionaryLite<CSongMenu>(this); _SongMenus = new COrderedDictionaryLite<ISongMenu>(this);
_Lyrics = new COrderedDictionaryLite<CLyric>(this); _Lyrics = new COrderedDictionaryLite<CLyric>(this);
_SingNotes = new COrderedDictionaryLite<CSingNotes>(this); _SingNotes = new COrderedDictionaryLite<CSingNotes>(this);
_NameSelections = new COrderedDictionaryLite<CNameSelection>(this); _NameSelections = new COrderedDictionaryLite<CNameSelection>(this);
_Equalizers = new COrderedDictionaryLite<CEqualizer>(this); _Equalizers = new COrderedDictionaryLite<CEqualizer>(this);
_Playlists = new COrderedDictionaryLite<CPlaylist>(this); _Playlists = new COrderedDictionaryLite<CPlaylist>(this);
_ParticleEffects = new COrderedDictionaryLite<CParticleEffect>(this); _ParticleEffects = new COrderedDictionaryLite<CParticleEffect>(this);
_ScreenSettings = new COrderedDictionaryLite<CScreenSetting>(this);
} }
public virtual void Init() public virtual void Init()
@@ -75,13 +70,11 @@ namespace VocaluxeLib.Menu
_PrevMouseX = 0; _PrevMouseX = 0;
_PrevMouseY = 0; _PrevMouseY = 0;
_MouseDX = 0;
_MouseDY = 0;
_Active = false; _Active = false;
} }
protected void _ClearElements() protected virtual void _ClearElements()
{ {
_Interactions.Clear(); _Interactions.Clear();
_Backgrounds.Clear(); _Backgrounds.Clear();
@@ -96,7 +89,6 @@ namespace VocaluxeLib.Menu
_Equalizers.Clear(); _Equalizers.Clear();
_Playlists.Clear(); _Playlists.Clear();
_ParticleEffects.Clear(); _ParticleEffects.Clear();
_ScreenSettings.Clear();
} }
#region MenuHandler #region MenuHandler
@@ -149,8 +141,8 @@ namespace VocaluxeLib.Menu
ProcessMouseMove(mouseEvent.X, mouseEvent.Y); ProcessMouseMove(mouseEvent.X, mouseEvent.Y);
if (selection != _Selection) if (selection != _Selection)
{ {
_UnsetHighlighted(selection); _GetElement(selection).Highlighted = false;
_SetHighlighted(_Selection); _GetElement(_Selection).Highlighted = true;
} }
if (mouseEvent.LB) if (mouseEvent.LB)
@@ -164,7 +156,7 @@ namespace VocaluxeLib.Menu
public virtual bool HandleInputThemeEditor(SKeyEvent keyEvent) public virtual bool HandleInputThemeEditor(SKeyEvent keyEvent)
{ {
_UnsetHighlighted(_Selection); _GetElement(_Selection).Highlighted = false;
if (!keyEvent.KeyPressed) if (!keyEvent.KeyPressed)
{ {
switch (keyEvent.Key) switch (keyEvent.Key)
@@ -213,9 +205,9 @@ namespace VocaluxeLib.Menu
public virtual bool HandleMouseThemeEditor(SMouseEvent mouseEvent) public virtual bool HandleMouseThemeEditor(SMouseEvent mouseEvent)
{ {
_UnsetHighlighted(_Selection); _GetElement(_Selection).Highlighted = false;
_MouseDX = mouseEvent.X - _PrevMouseX; int mouseDX = mouseEvent.X - _PrevMouseX;
_MouseDY = mouseEvent.Y - _PrevMouseY; int mouseDY = mouseEvent.Y - _PrevMouseY;
int stepX = 0; int stepX = 0;
int stepY = 0; int stepY = 0;
@@ -235,7 +227,7 @@ namespace VocaluxeLib.Menu
if (mouseEvent.X - _PrevMouseX <= -5) if (mouseEvent.X - _PrevMouseX <= -5)
stepX -= 5; stepX -= 5;
_PrevMouseX = mouseEvent.X - (_MouseDX - stepX); _PrevMouseX = mouseEvent.X - (mouseDX - stepX);
} }
while (Math.Abs(mouseEvent.Y - _PrevMouseY) >= 5) while (Math.Abs(mouseEvent.Y - _PrevMouseY) >= 5)
@@ -246,7 +238,7 @@ namespace VocaluxeLib.Menu
if (mouseEvent.Y - _PrevMouseY <= -5) if (mouseEvent.Y - _PrevMouseY <= -5)
stepY -= 5; stepY -= 5;
_PrevMouseY = mouseEvent.Y - (_MouseDY - stepY); _PrevMouseY = mouseEvent.Y - (mouseDY - stepY);
} }
} }
@@ -258,13 +250,13 @@ namespace VocaluxeLib.Menu
_MoveElement(stepX, stepY); _MoveElement(stepX, stepY);
if (mouseEvent.Mod == EModifier.Ctrl) if (mouseEvent.Mod == EModifier.Ctrl)
_MoveElement(_MouseDX, _MouseDY); _MoveElement(mouseDX, mouseDY);
if (mouseEvent.Mod == EModifier.Shift) if (mouseEvent.Mod == EModifier.Shift)
_ResizeElement(stepX, stepY); _ResizeElement(stepX, stepY);
if (mouseEvent.Mod == (EModifier.Shift | EModifier.Ctrl)) if (mouseEvent.Mod == (EModifier.Shift | EModifier.Ctrl))
_ResizeElement(_MouseDX, _MouseDY); _ResizeElement(mouseDX, mouseDY);
//} //}
} }
else else
@@ -274,12 +266,48 @@ namespace VocaluxeLib.Menu
} }
#endregion MenuHandler #endregion MenuHandler
private IMenuElement _GetElement(CInteraction interaction)
{
switch (interaction.Type)
{
case EType.Background:
return _Backgrounds[interaction.Num];
case EType.Button:
return _Buttons[interaction.Num];
case EType.SelectSlide:
return _SelectSlides[interaction.Num];
case EType.Text:
return _Texts[interaction.Num];
case EType.Static:
return _Statics[interaction.Num];
case EType.SongMenu:
return _SongMenus[interaction.Num];
case EType.Lyric:
return _Lyrics[interaction.Num];
case EType.SingNote:
return _SingNotes[interaction.Num];
case EType.NameSelection:
return _NameSelections[interaction.Num];
case EType.Equalizer:
return _Equalizers[interaction.Num];
case EType.Playlist:
return _Playlists[interaction.Num];
case EType.ParticleEffect:
return _ParticleEffects[interaction.Num];
}
throw new ArgumentException("Invalid interaction type: " + interaction.Type);
}
private IMenuElement _GetElement(int interaction)
{
return (interaction >= 0 && interaction < _Interactions.Count) ? _GetElement(_Interactions[interaction]) : null;
}
#region Drawing #region Drawing
public virtual bool Draw() public virtual void Draw()
{ {
_DrawBG(); _DrawBG();
_DrawFG(); _DrawFG();
return true;
} }
protected void _DrawBG() protected void _DrawBG()
@@ -341,7 +369,7 @@ namespace VocaluxeLib.Menu
_AddInteraction(_Texts.Add(text, key), EType.Text); _AddInteraction(_Texts.Add(text, key), EType.Text);
} }
protected void _AddSongMenu(CSongMenu songmenu, String key = null) protected void _AddSongMenu(ISongMenu songmenu, String key = null)
{ {
_AddInteraction(_SongMenus.Add(songmenu, key), EType.SongMenu); _AddInteraction(_SongMenus.Add(songmenu, key), EType.SongMenu);
} }
@@ -375,11 +403,6 @@ namespace VocaluxeLib.Menu
{ {
_AddInteraction(_ParticleEffects.Add(pe, key), EType.ParticleEffect); _AddInteraction(_ParticleEffects.Add(pe, key), EType.ParticleEffect);
} }
protected void _AddScreenSetting(CScreenSetting se, String key = null)
{
_ScreenSettings.Add(se, key);
}
#endregion Element-Adding #endregion Element-Adding
#region InteractionHandling #region InteractionHandling
@@ -429,10 +452,10 @@ namespace VocaluxeLib.Menu
continue; continue;
if (_Buttons[_Interactions[i].Num] == button) if (_Buttons[_Interactions[i].Num] == button)
{ {
_UnsetSelected(); _GetElement(_Selection).Selected = false;
_UnsetHighlighted(_Selection); _GetElement(_Selection).Highlighted = false;
_Selection = i; _Selection = i;
_SetSelected(); _GetElement(_Selection).Selected = true;
return; return;
} }
} }
@@ -448,10 +471,10 @@ namespace VocaluxeLib.Menu
continue; continue;
if (_SelectSlides[_Interactions[i].Num] == slide) if (_SelectSlides[_Interactions[i].Num] == slide)
{ {
_UnsetSelected(); _GetElement(_Selection).Selected = false;
_UnsetHighlighted(_Selection); _GetElement(_Selection).Highlighted = false;
_Selection = i; _Selection = i;
_SetSelected(); _GetElement(_Selection).Selected = true;
return; return;
} }
} }
@@ -488,16 +511,17 @@ namespace VocaluxeLib.Menu
float z = CBase.Settings.GetZFar(); float z = CBase.Settings.GetZFar();
for (int i = 0; i < _Interactions.Count; i++) for (int i = 0; i < _Interactions.Count; i++)
{ {
if ((CBase.Settings.GetProgramState() != EProgramState.EditTheme) && (_Interactions[i].ThemeEditorOnly || !_IsVisible(i) || !_IsEnabled(i))) if ((CBase.Settings.GetProgramState() != EProgramState.EditTheme) && (_Interactions[i].ThemeEditorOnly || !_IsVisible(i) || !_IsSelectable(i)))
continue; continue;
if (!_IsMouseOverElement(x, y, _Interactions[i])) if (!_IsMouseOverElement(x, y, _Interactions[i]))
continue; continue;
if (_GetZValue(_Interactions[i]) > z) if (_GetZValue(_Interactions[i]) > z)
continue; continue;
z = _GetZValue(_Interactions[i]); z = _GetZValue(_Interactions[i]);
_UnsetSelected(); _GetElement(_Selection).Selected = false;
_Selection = i;
_GetElement(_Selection).Selected = true;
_Selection = i; _Selection = i;
_SetSelected();
} }
} }
@@ -529,30 +553,8 @@ namespace VocaluxeLib.Menu
private float _GetZValue(CInteraction interact) private float _GetZValue(CInteraction interact)
{ {
switch (interact.Type) IMenuElement el = _GetElement(interact);
{ return el != null ? el.Rect.Z : CBase.Settings.GetZFar();
case EType.Button:
return _Buttons[interact.Num].Rect.Z;
case EType.SelectSlide:
return _SelectSlides[interact.Num].Rect.Z;
case EType.Static:
return _Statics[interact.Num].Rect.Z;
case EType.SongMenu:
return _SongMenus[interact.Num].Rect.Z;
case EType.Text:
return _Texts[interact.Num].Z;
case EType.Lyric:
return _Lyrics[interact.Num].Rect.Z;
case EType.NameSelection:
return _NameSelections[interact.Num].Rect.Z;
case EType.Equalizer:
return _Equalizers[interact.Num].Rect.Z;
case EType.Playlist:
return _Playlists[interact.Num].Rect.Z;
case EType.ParticleEffect:
return _ParticleEffects[interact.Num].Rect.Z;
}
return CBase.Settings.GetZFar();
} }
private float _GetZValue(int interaction) private float _GetZValue(int interaction)
@@ -562,7 +564,7 @@ namespace VocaluxeLib.Menu
private void _NextInteraction() private void _NextInteraction()
{ {
_UnsetSelected(); _GetElement(_Selection).Selected = false;
if (CBase.Settings.GetProgramState() != EProgramState.EditTheme) if (CBase.Settings.GetProgramState() != EProgramState.EditTheme)
{ {
bool found = false; bool found = false;
@@ -573,7 +575,7 @@ namespace VocaluxeLib.Menu
if (start > _Interactions.Count - 1) if (start > _Interactions.Count - 1)
start = 0; start = 0;
if ((start == _Selection) || (!_Interactions[start].ThemeEditorOnly && _IsVisible(start) && _IsEnabled(start))) if ((start == _Selection) || (!_Interactions[start].ThemeEditorOnly && _IsVisible(start) && _IsSelectable(start)))
found = true; found = true;
} while (!found); } while (!found);
_Selection = start; _Selection = start;
@@ -584,12 +586,12 @@ namespace VocaluxeLib.Menu
if (_Selection > _Interactions.Count - 1) if (_Selection > _Interactions.Count - 1)
_Selection = 0; _Selection = 0;
} }
_SetSelected(); _GetElement(_Selection).Selected = true;
} }
private void _PrevInteraction() private void _PrevInteraction()
{ {
_UnsetSelected(); _GetElement(_Selection).Selected = false;
if (CBase.Settings.GetProgramState() != EProgramState.EditTheme) if (CBase.Settings.GetProgramState() != EProgramState.EditTheme)
{ {
bool found = false; bool found = false;
@@ -600,7 +602,7 @@ namespace VocaluxeLib.Menu
if (start < 0) if (start < 0)
start = _Interactions.Count - 1; start = _Interactions.Count - 1;
if ((start == _Selection) || (!_Interactions[start].ThemeEditorOnly && _IsVisible(start) && _IsEnabled(start))) if ((start == _Selection) || (!_Interactions[start].ThemeEditorOnly && _IsVisible(start) && _IsSelectable(start)))
found = true; found = true;
} while (!found); } while (!found);
_Selection = start; _Selection = start;
@@ -611,7 +613,7 @@ namespace VocaluxeLib.Menu
if (_Selection < 0) if (_Selection < 0)
_Selection = _Interactions.Count - 1; _Selection = _Interactions.Count - 1;
} }
_SetSelected(); _GetElement(_Selection).Selected = true;
} }
/// <summary> /// <summary>
@@ -673,12 +675,11 @@ namespace VocaluxeLib.Menu
// select the new element // select the new element
if (directions[direction].Key == key.Key) if (directions[direction].Key == key.Key)
{ {
_UnsetHighlighted(_Selection); _GetElement(_Selection).Selected = false;
_UnsetSelected(); _GetElement(_Selection).Highlighted = false;
_Selection = element; _Selection = element;
_SetSelected(); _GetElement(_Selection).Selected = true;
_SetHighlighted(_Selection); _GetElement(_Selection).Highlighted = true;
return true; return true;
} }
@@ -695,7 +696,7 @@ namespace VocaluxeLib.Menu
for (int i = 0; i < _Interactions.Count; i++) for (int i = 0; i < _Interactions.Count; i++)
{ {
if (i != _Selection && !_Interactions[i].ThemeEditorOnly && _IsVisible(i) && _IsEnabled(i)) if (i != _Selection && !_Interactions[i].ThemeEditorOnly && _IsVisible(i) && _IsSelectable(i))
{ {
SRectF targetRect = _GetRect(i); SRectF targetRect = _GetRect(i);
float dist = _GetDistanceDirect(key, actualRect, targetRect); float dist = _GetDistanceDirect(key, actualRect, targetRect);
@@ -712,7 +713,7 @@ namespace VocaluxeLib.Menu
{ {
for (int i = 0; i < _Interactions.Count; i++) for (int i = 0; i < _Interactions.Count; i++)
{ {
if (i != _Selection && !_Interactions[i].ThemeEditorOnly && _IsVisible(i) && _IsEnabled(i)) if (i != _Selection && !_Interactions[i].ThemeEditorOnly && _IsVisible(i) && _IsSelectable(i))
{ {
SRectF targetRect = _GetRect(i); SRectF targetRect = _GetRect(i);
float dist = _GetDistance180(key, actualRect, targetRect); float dist = _GetDistance180(key, actualRect, targetRect);
@@ -746,7 +747,7 @@ namespace VocaluxeLib.Menu
for (int i = 0; i < _Interactions.Count; i++) for (int i = 0; i < _Interactions.Count; i++)
{ {
if (i != _Selection && !_Interactions[i].ThemeEditorOnly && _IsVisible(i) && _IsEnabled(i)) if (i != _Selection && !_Interactions[i].ThemeEditorOnly && _IsVisible(i) && _IsSelectable(i))
{ {
SRectF targetRect = _GetRect(i); SRectF targetRect = _GetRect(i);
float dist = _GetDistance180(key, actualRect, targetRect); float dist = _GetDistance180(key, actualRect, targetRect);
@@ -762,7 +763,7 @@ namespace VocaluxeLib.Menu
return min; return min;
} }
private float _GetDistanceDirect(SKeyEvent key, SRectF actualRect, SRectF targetRect) private static float _GetDistanceDirect(SKeyEvent key, SRectF actualRect, SRectF targetRect)
{ {
var source = new PointF(actualRect.X + actualRect.W / 2f, actualRect.Y + actualRect.H / 2f); var source = new PointF(actualRect.X + actualRect.W / 2f, actualRect.Y + actualRect.H / 2f);
var dest = new PointF(targetRect.X + targetRect.W / 2f, targetRect.Y + targetRect.H / 2f); var dest = new PointF(targetRect.X + targetRect.W / 2f, targetRect.Y + targetRect.H / 2f);
@@ -795,7 +796,7 @@ namespace VocaluxeLib.Menu
return !inDirection ? float.MaxValue : distance; return !inDirection ? float.MaxValue : distance;
} }
private float _GetDistance180(SKeyEvent key, SRectF actualRect, SRectF targetRect) private static float _GetDistance180(SKeyEvent key, SRectF actualRect, SRectF targetRect)
{ {
var source = new PointF(actualRect.X + actualRect.W / 2f, actualRect.Y + actualRect.H / 2f); var source = new PointF(actualRect.X + actualRect.W / 2f, actualRect.Y + actualRect.H / 2f);
var dest = new PointF(targetRect.X + targetRect.W / 2f, targetRect.Y + targetRect.H / 2f); var dest = new PointF(targetRect.X + targetRect.W / 2f, targetRect.Y + targetRect.H / 2f);
@@ -854,267 +855,22 @@ namespace VocaluxeLib.Menu
return false; return false;
} }
private void _SetSelected()
{
switch (_Interactions[_Selection].Type)
{
case EType.Button:
_Buttons[_Interactions[_Selection].Num].Selected = true;
break;
case EType.SelectSlide:
_SelectSlides[_Interactions[_Selection].Num].Selected = true;
break;
case EType.Static:
_Statics[_Interactions[_Selection].Num].Selected = true;
break;
case EType.Text:
_Texts[_Interactions[_Selection].Num].Selected = true;
break;
case EType.SongMenu:
_SongMenus[_Interactions[_Selection].Num].Selected = true;
break;
case EType.Lyric:
_Lyrics[_Interactions[_Selection].Num].Selected = true;
break;
case EType.NameSelection:
_NameSelections[_Interactions[_Selection].Num].Selected = true;
break;
case EType.Equalizer:
_Equalizers[_Interactions[_Selection].Num].Selected = true;
break;
case EType.Playlist:
_Playlists[_Interactions[_Selection].Num].Selected = true;
break;
case EType.ParticleEffect:
_ParticleEffects[_Interactions[_Selection].Num].Selected = true;
break;
}
}
private void _UnsetSelected()
{
switch (_Interactions[_Selection].Type)
{
case EType.Button:
_Buttons[_Interactions[_Selection].Num].Selected = false;
break;
case EType.SelectSlide:
_SelectSlides[_Interactions[_Selection].Num].Selected = false;
break;
case EType.Static:
_Statics[_Interactions[_Selection].Num].Selected = false;
break;
case EType.Text:
_Texts[_Interactions[_Selection].Num].Selected = false;
break;
case EType.SongMenu:
_SongMenus[_Interactions[_Selection].Num].Selected = false;
break;
case EType.Lyric:
_Lyrics[_Interactions[_Selection].Num].Selected = false;
break;
case EType.NameSelection:
_NameSelections[_Interactions[_Selection].Num].Selected = false;
break;
case EType.Equalizer:
_Equalizers[_Interactions[_Selection].Num].Selected = false;
break;
case EType.Playlist:
_Playlists[_Interactions[_Selection].Num].Selected = false;
break;
case EType.ParticleEffect:
_ParticleEffects[_Interactions[_Selection].Num].Selected = false;
break;
}
}
private void _SetHighlighted(int selection)
{
if (selection >= _Interactions.Count || selection < 0)
return;
switch (_Interactions[selection].Type)
{
case EType.Button:
//_Buttons[_Interactions[selection].Num].Selected = true;
break;
case EType.SelectSlide:
_SelectSlides[_Interactions[selection].Num].Highlighted = true;
break;
case EType.Static:
//_Statics[_Interactions[selection].Num].Selected = true;
break;
case EType.Text:
//_Texts[_Interactions[selection].Num].Selected = true;
break;
case EType.SongMenu:
//_SongMenus[_Interactions[selection].Num].Selected = true;
break;
case EType.Lyric:
//_Lyrics[_Interactions[selection].Num].Selected = true;
break;
case EType.NameSelection:
//_NameSelections[_Interactions[selection].Num].Selected = true;
break;
case EType.Playlist:
//_Playlists[_Interactions[_Selection].Num].Selected = true;
break;
}
}
private void _UnsetHighlighted(int selection)
{
if (selection >= _Interactions.Count || selection < 0)
return;
switch (_Interactions[selection].Type)
{
case EType.Button:
//_Buttons[_Interactions[selection].Num].Selected = false;
break;
case EType.SelectSlide:
_SelectSlides[_Interactions[selection].Num].Highlighted = false;
break;
case EType.Static:
//_Statics[_Interactions[selection].Num].Selected = false;
break;
case EType.Text:
//_Texts[_Interactions[selection].Num].Selected = false;
break;
case EType.SongMenu:
//_SongMenus[_Interactions[selection].Num].Selected = false;
break;
case EType.Lyric:
//_Lyrics[_Interactions[selection].Num].Selected = false;
break;
case EType.NameSelection:
//_NameSelections[_Interactions[selection].Num].Selected = false;
break;
case EType.Playlist:
//_Playlists[_Interactions[_Selection].Num].Selected = true;
break;
}
}
private bool _IsVisible(int interaction) private bool _IsVisible(int interaction)
{ {
if (_Selection >= _Interactions.Count || _Selection < 0) IMenuElement el = _GetElement(interaction);
return false; return el != null && el.Visible;
switch (_Interactions[interaction].Type)
{
case EType.Button:
return _Buttons[_Interactions[interaction].Num].Visible;
case EType.SelectSlide:
return _SelectSlides[_Interactions[interaction].Num].Visible;
case EType.Static:
return _Statics[_Interactions[interaction].Num].Visible;
case EType.Text:
return _Texts[_Interactions[interaction].Num].Visible;
case EType.SongMenu:
return _SongMenus[_Interactions[interaction].Num].Visible;
case EType.Lyric:
return _Lyrics[_Interactions[interaction].Num].Visible;
case EType.NameSelection:
return _NameSelections[_Interactions[interaction].Num].Visible;
case EType.Equalizer:
return _Equalizers[_Interactions[interaction].Num].Visible;
case EType.Playlist:
return _Playlists[_Interactions[interaction].Num].Visible;
case EType.ParticleEffect:
return _ParticleEffects[_Interactions[interaction].Num].Visible;
}
return false;
} }
private bool _IsEnabled(int interaction) private bool _IsSelectable(int interaction)
{ {
if (_Selection >= _Interactions.Count || _Selection < 0) IMenuElement el = _GetElement(interaction);
return false; return el != null && el.Selectable;
switch (_Interactions[interaction].Type)
{
case EType.Button:
return _Buttons[_Interactions[interaction].Num].Enabled;
case EType.SelectSlide:
return _SelectSlides[_Interactions[interaction].Num].Visible;
case EType.Static:
return false; //_Statics[_Interactions[interaction].Num].Visible;
case EType.Text:
return false; //_Texts[_Interactions[interaction].Num].Visible;
case EType.SongMenu:
return _SongMenus[_Interactions[interaction].Num].Visible;
case EType.Lyric:
return false; //_Lyrics[_Interactions[interaction].Num].Visible;
case EType.NameSelection:
return _NameSelections[_Interactions[interaction].Num].Visible;
case EType.Equalizer:
return false; //_Equalizers[_Interactions[interaction].Num].Visible;
case EType.Playlist:
return _Playlists[_Interactions[interaction].Num].Visible;
case EType.ParticleEffect:
return false; //_ParticleEffects[_Interactions[interaction].Num].Visible;
}
return false;
} }
private SRectF _GetRect(CInteraction interaction) private SRectF _GetRect(CInteraction interaction)
{ {
var result = new SRectF(); IMenuElement el = _GetElement(interaction);
switch (interaction.Type) return el.Rect;
{
case EType.Button:
return _Buttons[interaction.Num].Rect;
case EType.SelectSlide:
return _SelectSlides[interaction.Num].Rect;
case EType.Static:
return _Statics[interaction.Num].Rect;
case EType.Text:
return _Texts[interaction.Num].Rect;
case EType.SongMenu:
return _SongMenus[interaction.Num].Rect;
case EType.Lyric:
return _Lyrics[interaction.Num].Rect;
case EType.NameSelection:
return _NameSelections[interaction.Num].Rect;
case EType.Equalizer:
return _Equalizers[interaction.Num].Rect;
case EType.Playlist:
return _Playlists[interaction.Num].Rect;
case EType.ParticleEffect:
return _ParticleEffects[interaction.Num].Rect;
}
return result;
} }
private SRectF _GetRect(int interaction) private SRectF _GetRect(int interaction)
@@ -1126,153 +882,31 @@ namespace VocaluxeLib.Menu
{ {
_Interactions.Add(new CInteraction(num, type)); _Interactions.Add(new CInteraction(num, type));
if (!_Interactions[_Selection].ThemeEditorOnly) if (!_Interactions[_Selection].ThemeEditorOnly)
_SetSelected(); _GetElement(_Selection).Selected = true;
else else
_NextInteraction(); _NextInteraction();
} }
private void _DrawInteraction(int interaction) private void _DrawInteraction(int interaction)
{ {
switch (_Interactions[interaction].Type) IMenuElement el = _GetElement(interaction);
{ el.Draw();
case EType.Button:
_Buttons[_Interactions[interaction].Num].Draw();
break;
case EType.SelectSlide:
_SelectSlides[_Interactions[interaction].Num].Draw();
break;
case EType.Static:
_Statics[_Interactions[interaction].Num].Draw();
break;
case EType.Text:
_Texts[_Interactions[interaction].Num].Draw();
break;
case EType.SongMenu:
_SongMenus[_Interactions[interaction].Num].Draw();
break;
case EType.NameSelection:
_NameSelections[_Interactions[interaction].Num].Draw();
break;
case EType.Equalizer:
_Equalizers[_Interactions[interaction].Num].Draw();
break;
case EType.Playlist:
_Playlists[_Interactions[interaction].Num].Draw();
break;
case EType.ParticleEffect:
_ParticleEffects[_Interactions[interaction].Num].Draw();
break;
case EType.Lyric:
_Lyrics[_Interactions[interaction].Num].Draw();
break;
}
} }
#endregion InteractionHandling #endregion InteractionHandling
#region Theme Handling #region Theme Handling
private void _MoveElement(int stepX, int stepY) private void _MoveElement(int stepX, int stepY)
{ {
if (_Interactions.Count <= 0) IMenuElement el = _GetElement(_Selection);
return; if (el != null)
switch (_Interactions[_Selection].Type) el.MoveElement(stepX, stepY);
{
case EType.Button:
_Buttons[_Interactions[_Selection].Num].MoveElement(stepX, stepY);
break;
case EType.SelectSlide:
_SelectSlides[_Interactions[_Selection].Num].MoveElement(stepX, stepY);
break;
case EType.Static:
_Statics[_Interactions[_Selection].Num].MoveElement(stepX, stepY);
break;
case EType.Text:
_Texts[_Interactions[_Selection].Num].MoveElement(stepX, stepY);
break;
case EType.SongMenu:
_SongMenus[_Interactions[_Selection].Num].MoveElement(stepX, stepY);
break;
case EType.Lyric:
_Lyrics[_Interactions[_Selection].Num].MoveElement(stepX, stepY);
break;
case EType.NameSelection:
_NameSelections[_Interactions[_Selection].Num].MoveElement(stepX, stepY);
break;
case EType.Equalizer:
_Equalizers[_Interactions[_Selection].Num].MoveElement(stepX, stepY);
break;
case EType.Playlist:
_Playlists[_Interactions[_Selection].Num].MoveElement(stepX, stepY);
break;
case EType.ParticleEffect:
_ParticleEffects[_Interactions[_Selection].Num].MoveElement(stepX, stepY);
break;
}
} }
private void _ResizeElement(int stepW, int stepH) private void _ResizeElement(int stepW, int stepH)
{ {
if (_Interactions.Count <= 0) IMenuElement el = _GetElement(_Selection);
return; if (el != null)
switch (_Interactions[_Selection].Type) el.ResizeElement(stepW, stepH);
{
case EType.Button:
_Buttons[_Interactions[_Selection].Num].ResizeElement(stepW, stepH);
break;
case EType.SelectSlide:
_SelectSlides[_Interactions[_Selection].Num].ResizeElement(stepW, stepH);
break;
case EType.Static:
_Statics[_Interactions[_Selection].Num].ResizeElement(stepW, stepH);
break;
case EType.Text:
_Texts[_Interactions[_Selection].Num].ResizeElement(stepW, stepH);
break;
case EType.SongMenu:
_SongMenus[_Interactions[_Selection].Num].ResizeElement(stepW, stepH);
break;
case EType.Lyric:
_Lyrics[_Interactions[_Selection].Num].ResizeElement(stepW, stepH);
break;
case EType.NameSelection:
_NameSelections[_Interactions[_Selection].Num].ResizeElement(stepW, stepH);
break;
case EType.Equalizer:
_Equalizers[_Interactions[_Selection].Num].ResizeElement(stepW, stepH);
break;
case EType.Playlist:
_Playlists[_Interactions[_Selection].Num].ResizeElement(stepW, stepH);
break;
case EType.ParticleEffect:
_ParticleEffects[_Interactions[_Selection].Num].ResizeElement(stepW, stepH);
break;
}
} }
#endregion Theme Handling #endregion Theme Handling
} }
-344
View File
@@ -16,36 +16,11 @@
#endregion #endregion
using System; using System;
using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Xml.Serialization;
using VocaluxeLib.Draw; using VocaluxeLib.Draw;
using VocaluxeLib.Xml;
namespace VocaluxeLib.Menu namespace VocaluxeLib.Menu
{ {
[XmlType("ParticleEffect")]
public struct SThemeParticleEffect
{
[XmlAttribute(AttributeName = "Name")] public string Name;
public string Skin;
public SRectF Rect;
public SThemeColor Color;
public EParticleType Type;
public float Size;
public int MaxNumber;
}
public enum EParticleType
{
Twinkle,
Star,
Snow,
Flare,
PerfNoteStar
}
class CParticle class CParticle
{ {
#region private vars #region private vars
@@ -300,323 +275,4 @@ namespace VocaluxeLib.Menu
CBase.Drawing.DrawTexture(_Texture, _Rect, new SColorF(_Color.R, _Color.G, _Color.B, _Color.A * Alpha2 * _Alpha)); CBase.Drawing.DrawTexture(_Texture, _Rect, new SColorF(_Color.R, _Color.G, _Color.B, _Color.A * Alpha2 * _Alpha));
} }
} }
public class CParticleEffect : IMenuElement
{
private readonly int _PartyModeID;
private SThemeParticleEffect _Theme;
private bool _ThemeLoaded;
public CTextureRef Texture;
public SColorF Color;
public SRectF Rect;
public bool Selected;
public bool Visible;
private readonly List<CParticle> _Stars;
private readonly Stopwatch _SpawnTimer;
private float _NextSpawnTime;
public float Alpha = 1f;
public string GetThemeName()
{
return _Theme.Name;
}
public bool ThemeLoaded
{
get { return _ThemeLoaded; }
}
public bool IsAlive
{
get { return _Stars.Count > 0 || !_SpawnTimer.IsRunning; }
}
public CParticleEffect(int partyModeID)
{
_PartyModeID = partyModeID;
_Theme = new SThemeParticleEffect();
_Stars = new List<CParticle>();
_SpawnTimer = new Stopwatch();
_NextSpawnTime = 0f;
Visible = true;
}
public CParticleEffect(int partyModeID, int maxNumber, SColorF color, SRectF rect, string skin, float size, EParticleType type)
{
_PartyModeID = partyModeID;
_Theme = new SThemeParticleEffect();
_Stars = new List<CParticle>();
Rect = rect;
Color = color;
_Theme.Skin = skin;
_Theme.MaxNumber = maxNumber;
_Theme.Size = size;
_Theme.Type = type;
_SpawnTimer = new Stopwatch();
_NextSpawnTime = 0f;
Visible = true;
}
public CParticleEffect(int partyModeID, int maxNumber, SColorF color, SRectF rect, CTextureRef texture, float size, EParticleType type)
{
_PartyModeID = partyModeID;
_Theme = new SThemeParticleEffect();
_Stars = new List<CParticle>();
Rect = rect;
Color = color;
_Theme.Skin = String.Empty;
Texture = texture;
_Theme.MaxNumber = maxNumber;
_Theme.Size = size;
_Theme.Type = type;
_SpawnTimer = new Stopwatch();
_NextSpawnTime = 0f;
Visible = true;
}
public CParticleEffect(SThemeParticleEffect theme, int partyModeID)
{
_PartyModeID = partyModeID;
_Theme = theme;
_Stars = new List<CParticle>();
_SpawnTimer = new Stopwatch();
_NextSpawnTime = 0f;
Visible = true;
LoadSkin();
}
public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader)
{
string item = xmlPath + "/" + elementName;
_ThemeLoaded = true;
_ThemeLoaded &= xmlReader.GetValue(item + "/Skin", out _Theme.Skin, String.Empty);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/X", ref _Theme.Rect.X);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Y", ref _Theme.Rect.Y);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Z", ref _Theme.Rect.Z);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref _Theme.Rect.W);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref _Theme.Rect.H);
if (xmlReader.GetValue(item + "/Color", out _Theme.Color.Name, String.Empty))
_ThemeLoaded &= _Theme.Color.Get(_PartyModeID, out Color);
else
{
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref Color.R);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/G", ref Color.G);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/B", ref Color.B);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref Color.A);
}
_ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Type", ref _Theme.Type);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Size", ref _Theme.Size);
_ThemeLoaded &= xmlReader.TryGetIntValue(item + "/MaxNumber", ref _Theme.MaxNumber);
if (_ThemeLoaded)
{
_Theme.Name = elementName;
_Theme.Color.Color = Color;
LoadSkin();
}
return _ThemeLoaded;
}
public void Update()
{
bool doSpawn = false;
if (!_SpawnTimer.IsRunning)
{
_SpawnTimer.Start();
_NextSpawnTime = 0f;
doSpawn = true;
}
if (_SpawnTimer.ElapsedMilliseconds / 1000f > _NextSpawnTime && _NextSpawnTime >= 0f)
{
doSpawn = true;
_SpawnTimer.Reset();
_SpawnTimer.Start();
}
while (_Stars.Count < _Theme.MaxNumber && doSpawn)
{
float size = CBase.Game.GetRandom((int)_Theme.Size / 2) + _Theme.Size / 2;
float lifetime = 0f;
float vx = 0f;
float vy = 0f;
float vr = 0f;
float vsize = 0f;
_NextSpawnTime = 0f;
switch (_Theme.Type)
{
case EParticleType.Twinkle:
size = CBase.Game.GetRandom((int)_Theme.Size / 2) + _Theme.Size / 2;
lifetime = CBase.Game.GetRandom(500) / 1000f + 0.5f;
vx = -CBase.Game.GetRandom(10000) / 50f + 100f;
vy = -CBase.Game.GetRandom(10000) / 50f + 100f;
vr = -CBase.Game.GetRandom(500) / 100f + 2.5f;
vsize = lifetime * 2f;
break;
case EParticleType.Star:
size = CBase.Game.GetRandom((int)_Theme.Size / 2) + _Theme.Size / 2;
lifetime = CBase.Game.GetRandom(1000) / 500f + 0.2f;
vx = -CBase.Game.GetRandom(1000) / 50f + 10f;
vy = -CBase.Game.GetRandom(1000) / 50f + 10f;
vr = -CBase.Game.GetRandom(500) / 100f + 2.5f;
vsize = lifetime * 2f;
break;
case EParticleType.Snow:
size = CBase.Game.GetRandom((int)_Theme.Size / 2) + _Theme.Size / 2;
lifetime = CBase.Game.GetRandom(5000) / 50f + 10f;
vx = -CBase.Game.GetRandom(1000) / 50f + 10f;
vy = CBase.Game.GetRandom(1000) / 50f + Math.Abs(vx) + 10f;
vr = -CBase.Game.GetRandom(200) / 50f + 2f;
vsize = lifetime * 2f;
_NextSpawnTime = lifetime / _Theme.MaxNumber;
doSpawn = false;
break;
case EParticleType.Flare:
size = CBase.Game.GetRandom((int)_Theme.Size / 2) + _Theme.Size / 2;
lifetime = CBase.Game.GetRandom(500) / 1000f + 0.1f;
vx = -CBase.Game.GetRandom(2000) / 50f;
vy = -CBase.Game.GetRandom(2000) / 50f + 20f;
vr = -CBase.Game.GetRandom(2000) / 50f + 20f;
vsize = lifetime * 2f;
break;
case EParticleType.PerfNoteStar:
size = CBase.Game.GetRandom((int)_Theme.Size / 2) + _Theme.Size / 2;
lifetime = CBase.Game.GetRandom(1000) / 500f + 1.2f;
vx = 0f;
vy = 0f;
vr = CBase.Game.GetRandom(500) / 50f + 10f;
vsize = lifetime * 2f;
break;
}
var w = (int)(Rect.W - size / 4f);
var h = (int)(Rect.H - size / 4f);
if (w < 0)
w = 0;
if (h < 0)
h = 0;
CParticle star;
if (!String.IsNullOrEmpty(_Theme.Skin))
{
star = new CParticle(_PartyModeID, _Theme.Skin, Color,
CBase.Game.GetRandom(w) + Rect.X - size / 4f,
CBase.Game.GetRandom(h) + Rect.Y - size / 4f,
size, lifetime, Rect.Z, vx, vy, vr, vsize, _Theme.Type);
}
else
{
star = new CParticle(_PartyModeID, Texture, Color,
CBase.Game.GetRandom(w) + Rect.X - size / 4f,
CBase.Game.GetRandom(h) + Rect.Y - size / 4f,
size, lifetime, Rect.Z, vx, vy, vr, vsize, _Theme.Type);
}
_Stars.Add(star);
}
if (_Theme.Type == EParticleType.Flare || _Theme.Type == EParticleType.PerfNoteStar || _Theme.Type == EParticleType.Twinkle)
_NextSpawnTime = -1f;
int i = 0;
while (i < _Stars.Count)
{
_Stars[i].Update();
if (!_Stars[i].IsAlive)
_Stars.RemoveAt(i);
else
i++;
}
}
public void Pause()
{
foreach (CParticle star in _Stars)
star.Pause();
}
public void Resume()
{
foreach (CParticle star in _Stars)
star.Resume();
}
public void Draw()
{
Update();
foreach (CParticle star in _Stars)
{
star.Alpha2 = Alpha;
star.Draw();
}
}
public void UnloadSkin()
{
Texture = null;
}
public void LoadSkin()
{
_Theme.Color.Get(_PartyModeID, out Color);
if (!String.IsNullOrEmpty(_Theme.Skin))
Texture = CBase.Themes.GetSkinTexture(_Theme.Skin, _PartyModeID);
Rect = _Theme.Rect;
}
public void ReloadSkin()
{
UnloadSkin();
LoadSkin();
}
public SThemeParticleEffect GetTheme()
{
return _Theme;
}
#region ThemeEdit
public void MoveElement(int stepX, int stepY)
{
Rect.X += stepX;
Rect.Y += stepY;
_Theme.Rect.X += stepX;
_Theme.Rect.Y += stepY;
}
public void ResizeElement(int stepW, int stepH)
{
Rect.W += stepW;
if (Rect.W <= 0)
Rect.W = 1;
Rect.H += stepH;
if (Rect.H <= 0)
Rect.H = 1;
_Theme.Rect.W = Rect.W;
_Theme.Rect.H = Rect.H;
}
#endregion ThemeEdit
}
} }
+351
View File
@@ -0,0 +1,351 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Xml.Serialization;
using VocaluxeLib.Draw;
using VocaluxeLib.Xml;
namespace VocaluxeLib.Menu
{
[XmlType("ParticleEffect")]
public struct SThemeParticleEffect
{
[XmlAttribute(AttributeName = "Name")] public string Name;
public string Skin;
public SRectF Rect;
public SThemeColor Color;
public EParticleType Type;
public float Size;
public int MaxNumber;
}
public enum EParticleType
{
Twinkle,
Star,
Snow,
Flare,
PerfNoteStar
}
public sealed class CParticleEffect : CMenuElementBase, IMenuElement, IThemeable
{
private readonly int _PartyModeID;
private SThemeParticleEffect _Theme;
private bool _ThemeLoaded;
public CTextureRef Texture;
public SColorF Color;
private readonly List<CParticle> _Stars;
private readonly Stopwatch _SpawnTimer;
private float _NextSpawnTime;
public float Alpha = 1f;
public string GetThemeName()
{
return _Theme.Name;
}
public bool ThemeLoaded
{
get { return _ThemeLoaded; }
}
public bool IsAlive
{
get { return _Stars.Count > 0 || !_SpawnTimer.IsRunning; }
}
public CParticleEffect(int partyModeID)
{
_PartyModeID = partyModeID;
_Theme = new SThemeParticleEffect();
_Stars = new List<CParticle>();
_SpawnTimer = new Stopwatch();
_NextSpawnTime = 0f;
Visible = true;
}
public CParticleEffect(int partyModeID, int maxNumber, SColorF color, SRectF rect, string skin, float size, EParticleType type)
{
_PartyModeID = partyModeID;
_Theme = new SThemeParticleEffect();
_Stars = new List<CParticle>();
MaxRect = rect;
Color = color;
_Theme.Skin = skin;
_Theme.MaxNumber = maxNumber;
_Theme.Size = size;
_Theme.Type = type;
_SpawnTimer = new Stopwatch();
_NextSpawnTime = 0f;
Visible = true;
}
public CParticleEffect(int partyModeID, int maxNumber, SColorF color, SRectF rect, CTextureRef texture, float size, EParticleType type)
{
_PartyModeID = partyModeID;
_Theme = new SThemeParticleEffect();
_Stars = new List<CParticle>();
MaxRect = rect;
Color = color;
_Theme.Skin = String.Empty;
Texture = texture;
_Theme.MaxNumber = maxNumber;
_Theme.Size = size;
_Theme.Type = type;
_SpawnTimer = new Stopwatch();
_NextSpawnTime = 0f;
Visible = true;
}
public CParticleEffect(SThemeParticleEffect theme, int partyModeID)
{
_PartyModeID = partyModeID;
_Theme = theme;
_Stars = new List<CParticle>();
_SpawnTimer = new Stopwatch();
_NextSpawnTime = 0f;
Visible = true;
LoadSkin();
}
public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader)
{
string item = xmlPath + "/" + elementName;
_ThemeLoaded = true;
_ThemeLoaded &= xmlReader.GetValue(item + "/Skin", out _Theme.Skin, String.Empty);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/X", ref _Theme.Rect.X);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Y", ref _Theme.Rect.Y);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Z", ref _Theme.Rect.Z);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref _Theme.Rect.W);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref _Theme.Rect.H);
if (xmlReader.GetValue(item + "/Color", out _Theme.Color.Name, String.Empty))
_ThemeLoaded &= _Theme.Color.Get(_PartyModeID, out Color);
else
{
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref Color.R);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/G", ref Color.G);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/B", ref Color.B);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref Color.A);
}
_ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Type", ref _Theme.Type);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Size", ref _Theme.Size);
_ThemeLoaded &= xmlReader.TryGetIntValue(item + "/MaxNumber", ref _Theme.MaxNumber);
if (_ThemeLoaded)
{
_Theme.Name = elementName;
_Theme.Color.Color = Color;
LoadSkin();
}
return _ThemeLoaded;
}
public void Update()
{
bool doSpawn = false;
if (!_SpawnTimer.IsRunning)
{
_SpawnTimer.Start();
_NextSpawnTime = 0f;
doSpawn = true;
}
if (_SpawnTimer.ElapsedMilliseconds / 1000f > _NextSpawnTime && _NextSpawnTime >= 0f)
{
doSpawn = true;
_SpawnTimer.Reset();
_SpawnTimer.Start();
}
while (_Stars.Count < _Theme.MaxNumber && doSpawn)
{
float size = CBase.Game.GetRandom((int)_Theme.Size / 2) + _Theme.Size / 2;
float lifetime = 0f;
float vx = 0f;
float vy = 0f;
float vr = 0f;
float vsize = 0f;
_NextSpawnTime = 0f;
switch (_Theme.Type)
{
case EParticleType.Twinkle:
size = CBase.Game.GetRandom((int)_Theme.Size / 2) + _Theme.Size / 2;
lifetime = CBase.Game.GetRandom(500) / 1000f + 0.5f;
vx = -CBase.Game.GetRandom(10000) / 50f + 100f;
vy = -CBase.Game.GetRandom(10000) / 50f + 100f;
vr = -CBase.Game.GetRandom(500) / 100f + 2.5f;
vsize = lifetime * 2f;
break;
case EParticleType.Star:
size = CBase.Game.GetRandom((int)_Theme.Size / 2) + _Theme.Size / 2;
lifetime = CBase.Game.GetRandom(1000) / 500f + 0.2f;
vx = -CBase.Game.GetRandom(1000) / 50f + 10f;
vy = -CBase.Game.GetRandom(1000) / 50f + 10f;
vr = -CBase.Game.GetRandom(500) / 100f + 2.5f;
vsize = lifetime * 2f;
break;
case EParticleType.Snow:
size = CBase.Game.GetRandom((int)_Theme.Size / 2) + _Theme.Size / 2;
lifetime = CBase.Game.GetRandom(5000) / 50f + 10f;
vx = -CBase.Game.GetRandom(1000) / 50f + 10f;
vy = CBase.Game.GetRandom(1000) / 50f + Math.Abs(vx) + 10f;
vr = -CBase.Game.GetRandom(200) / 50f + 2f;
vsize = lifetime * 2f;
_NextSpawnTime = lifetime / _Theme.MaxNumber;
doSpawn = false;
break;
case EParticleType.Flare:
size = CBase.Game.GetRandom((int)_Theme.Size / 2) + _Theme.Size / 2;
lifetime = CBase.Game.GetRandom(500) / 1000f + 0.1f;
vx = -CBase.Game.GetRandom(2000) / 50f;
vy = -CBase.Game.GetRandom(2000) / 50f + 20f;
vr = -CBase.Game.GetRandom(2000) / 50f + 20f;
vsize = lifetime * 2f;
break;
case EParticleType.PerfNoteStar:
size = CBase.Game.GetRandom((int)_Theme.Size / 2) + _Theme.Size / 2;
lifetime = CBase.Game.GetRandom(1000) / 500f + 1.2f;
vx = 0f;
vy = 0f;
vr = CBase.Game.GetRandom(500) / 50f + 10f;
vsize = lifetime * 2f;
break;
}
var w = (int)(Rect.W - size / 4f);
var h = (int)(Rect.H - size / 4f);
if (w < 0)
w = 0;
if (h < 0)
h = 0;
CParticle star;
if (!String.IsNullOrEmpty(_Theme.Skin))
{
star = new CParticle(_PartyModeID, _Theme.Skin, Color,
CBase.Game.GetRandom(w) + Rect.X - size / 4f,
CBase.Game.GetRandom(h) + Rect.Y - size / 4f,
size, lifetime, Rect.Z, vx, vy, vr, vsize, _Theme.Type);
}
else
{
star = new CParticle(_PartyModeID, Texture, Color,
CBase.Game.GetRandom(w) + Rect.X - size / 4f,
CBase.Game.GetRandom(h) + Rect.Y - size / 4f,
size, lifetime, Rect.Z, vx, vy, vr, vsize, _Theme.Type);
}
_Stars.Add(star);
}
if (_Theme.Type == EParticleType.Flare || _Theme.Type == EParticleType.PerfNoteStar || _Theme.Type == EParticleType.Twinkle)
_NextSpawnTime = -1f;
int i = 0;
while (i < _Stars.Count)
{
_Stars[i].Update();
if (!_Stars[i].IsAlive)
_Stars.RemoveAt(i);
else
i++;
}
}
public void Pause()
{
foreach (CParticle star in _Stars)
star.Pause();
}
public void Resume()
{
foreach (CParticle star in _Stars)
star.Resume();
}
public void Draw()
{
Update();
foreach (CParticle star in _Stars)
{
star.Alpha2 = Alpha;
star.Draw();
}
}
public void UnloadSkin()
{
Texture = null;
}
public void LoadSkin()
{
_Theme.Color.Get(_PartyModeID, out Color);
if (!String.IsNullOrEmpty(_Theme.Skin))
Texture = CBase.Themes.GetSkinTexture(_Theme.Skin, _PartyModeID);
MaxRect = _Theme.Rect;
}
public void ReloadSkin()
{
UnloadSkin();
LoadSkin();
}
public SThemeParticleEffect GetTheme()
{
return _Theme;
}
#region ThemeEdit
public bool Selectable
{
get { return false; }
}
public void MoveElement(int stepX, int stepY)
{
X += stepX;
Y += stepY;
_Theme.Rect.X += stepX;
_Theme.Rect.Y += stepY;
}
public void ResizeElement(int stepW, int stepH)
{
W += stepW;
if (W <= 0)
W = 1;
H += stepH;
if (H <= 0)
H = 1;
_Theme.Rect.W = Rect.W;
_Theme.Rect.H = Rect.H;
}
#endregion ThemeEdit
}
}
+47 -41
View File
@@ -79,7 +79,7 @@ namespace VocaluxeLib.Menu
} }
//TODO: Refactor this class, it is almost unreadable and may not work in some occasions //TODO: Refactor this class, it is almost unreadable and may not work in some occasions
public class CPlaylist : CObjectInteractions, IMenuElement public class CPlaylist : CObjectInteractions, IMenuElement, IThemeable
{ {
private class CPlaylistElementContent private class CPlaylistElementContent
{ {
@@ -120,20 +120,14 @@ namespace VocaluxeLib.Menu
int diffX = posX - oldPosX; int diffX = posX - oldPosX;
int diffY = posY - oldPosY; int diffY = posY - oldPosY;
Cover.Rect.X += diffX; Cover.X += diffX;
Cover.Rect.Y += diffY; Cover.Y += diffY;
Background.Rect.X += diffX; Background.X += diffX;
Background.Rect.Y += diffY; Background.Y += diffY;
SelectSlide.Rect.X += diffX; SelectSlide.X += diffX;
SelectSlide.Rect.Y += diffY; SelectSlide.Y += diffY;
SelectSlide.RectArrowLeft.X += diffX;
SelectSlide.RectArrowLeft.Y += diffY;
SelectSlide.RectArrowRight.X += diffX;
SelectSlide.RectArrowRight.Y += diffY;
Text1.X += diffX; Text1.X += diffX;
Text1.Y += diffY; Text1.Y += diffY;
@@ -158,7 +152,6 @@ namespace VocaluxeLib.Menu
private readonly List<CPlaylistElementContent> _PlaylistElementContents = new List<CPlaylistElementContent>(); private readonly List<CPlaylistElementContent> _PlaylistElementContents = new List<CPlaylistElementContent>();
private SRectF _CompleteRect; private SRectF _CompleteRect;
public SRectF Rect;
private SColorF _BackgroundColor; private SColorF _BackgroundColor;
private SColorF _BackgroundSelColor; private SColorF _BackgroundSelColor;
@@ -172,9 +165,18 @@ namespace VocaluxeLib.Menu
private readonly CStatic _StaticPlaylistHeader; private readonly CStatic _StaticPlaylistHeader;
private readonly CStatic _StaticPlaylistFooter; private readonly CStatic _StaticPlaylistFooter;
public bool Visible;
private bool _Selected; private bool _Selected;
public SRectF Rect
{
get { return MaxRect; }
}
public SRectF MaxRect { get; set; }
public bool Selectable
{
get { return Visible; }
}
public bool Visible { get; set; }
public bool Highlighted { get; set; }
public bool Selected public bool Selected
{ {
get { return _Selected; } get { return _Selected; }
@@ -329,13 +331,14 @@ namespace VocaluxeLib.Menu
return _ThemeLoaded; return _ThemeLoaded;
} }
public override bool Draw() public override void Draw()
{ {
if (_PlaylistElements.Count <= 0) if (_PlaylistElements.Count <= 0)
LoadPlaylist(0); LoadPlaylist(0);
if (!Visible && CBase.Settings.GetProgramState() != EProgramState.EditTheme) if (!Visible && CBase.Settings.GetProgramState() != EProgramState.EditTheme)
return true; return;
base.Draw();
for (int i = 0; i < _PlaylistElements.Count; i++) for (int i = 0; i < _PlaylistElements.Count; i++)
{ {
if (i == _CurrentPlaylistElement && _Selected) if (i == _CurrentPlaylistElement && _Selected)
@@ -352,7 +355,6 @@ namespace VocaluxeLib.Menu
if (_ChangeOrderElement != null) if (_ChangeOrderElement != null)
_ChangeOrderElement.Draw(); _ChangeOrderElement.Draw();
return base.Draw();
} }
public bool IsMouseOver(SMouseEvent mouseEvent) public bool IsMouseOver(SMouseEvent mouseEvent)
@@ -381,7 +383,7 @@ namespace VocaluxeLib.Menu
_Theme.ColorBackground.Get(_PartyModeID, out _BackgroundColor); _Theme.ColorBackground.Get(_PartyModeID, out _BackgroundColor);
_Theme.SelColorBackground.Get(_PartyModeID, out _BackgroundSelColor); _Theme.SelColorBackground.Get(_PartyModeID, out _BackgroundSelColor);
Rect = _Theme.Rect; MaxRect = _Theme.Rect;
_Text1.LoadSkin(); _Text1.LoadSkin();
_ButtonPlaylistClose.LoadSkin(); _ButtonPlaylistClose.LoadSkin();
@@ -871,11 +873,9 @@ namespace VocaluxeLib.Menu
return true; return true;
_ChangeOrderElement = new CPlaylistElement(_PlaylistElements[_CurrentPlaylistElement]); _ChangeOrderElement = new CPlaylistElement(_PlaylistElements[_CurrentPlaylistElement]);
_ChangeOrderElement.Background.Rect.Z = CBase.Settings.GetZNear(); _ChangeOrderElement.Background.Z = CBase.Settings.GetZNear();
_ChangeOrderElement.Cover.Rect.Z = CBase.Settings.GetZNear(); _ChangeOrderElement.Cover.Z = CBase.Settings.GetZNear();
_ChangeOrderElement.SelectSlide.Rect.Z = CBase.Settings.GetZNear(); _ChangeOrderElement.SelectSlide.Z = CBase.Settings.GetZNear();
_ChangeOrderElement.SelectSlide.RectArrowLeft.Z = CBase.Settings.GetZNear();
_ChangeOrderElement.SelectSlide.RectArrowRight.Z = CBase.Settings.GetZNear();
_ChangeOrderElement.Text1.Z = CBase.Settings.GetZNear(); _ChangeOrderElement.Text1.Z = CBase.Settings.GetZNear();
_ChangeOrderElement.Background.Texture = CBase.Themes.GetSkinTexture(_Theme.SkinBackground, _PartyModeID); _ChangeOrderElement.Background.Texture = CBase.Themes.GetSkinTexture(_Theme.SkinBackground, _PartyModeID);
@@ -1026,20 +1026,16 @@ namespace VocaluxeLib.Menu
Cover = new CStatic(_Theme.StaticCover, _PartyModeID) Cover = new CStatic(_Theme.StaticCover, _PartyModeID)
}; };
en.Cover.Rect.Y += Rect.Y + (i * _Theme.EntryHeight); en.Cover.Y += Rect.Y + (i * _Theme.EntryHeight);
en.Cover.Rect.X += Rect.X; en.Cover.X += Rect.X;
en.Text1 = new CText(_Text1); en.Text1 = new CText(_Text1);
en.Text1.X += Rect.X; en.Text1.X += Rect.X;
en.Text1.Y += Rect.Y + (i * _Theme.EntryHeight); en.Text1.Y += Rect.Y + (i * _Theme.EntryHeight);
en.SelectSlide = new CSelectSlide(_SelectSlideGameMode); en.SelectSlide = new CSelectSlide(_SelectSlideGameMode);
en.SelectSlide.Rect.X += Rect.X; en.SelectSlide.X += Rect.X;
en.SelectSlide.Rect.Y += Rect.Y + (i * _Theme.EntryHeight); en.SelectSlide.Y += Rect.Y + (i * _Theme.EntryHeight);
en.SelectSlide.RectArrowLeft.X += Rect.X;
en.SelectSlide.RectArrowLeft.Y += Rect.Y + (i * _Theme.EntryHeight);
en.SelectSlide.RectArrowRight.X += Rect.X;
en.SelectSlide.RectArrowRight.Y += Rect.Y + (i * _Theme.EntryHeight);
en.Content = -1; en.Content = -1;
@@ -1215,19 +1211,29 @@ namespace VocaluxeLib.Menu
#region ThemeEdit #region ThemeEdit
public void MoveElement(int stepX, int stepY) public void MoveElement(int stepX, int stepY)
{ {
Rect.X += stepX; SRectF rect = MaxRect;
Rect.Y += stepY; rect.X += stepX;
rect.Y += stepY;
MaxRect = rect;
_Theme.Rect.X += stepX;
_Theme.Rect.Y += stepY;
} }
public void ResizeElement(int stepW, int stepH) public void ResizeElement(int stepW, int stepH)
{ {
Rect.W += stepW; SRectF rect = MaxRect;
if (Rect.W <= 0) rect.W += stepW;
Rect.W = 1; if (rect.W <= 0)
rect.W = 1;
Rect.H += stepH; rect.H += stepH;
if (Rect.H <= 0) if (rect.H <= 0)
Rect.H = 1; rect.H = 1;
MaxRect = rect;
_Theme.Rect.W = Rect.W;
_Theme.Rect.H = Rect.H;
} }
#endregion ThemeEdit #endregion ThemeEdit
} }
+16 -22
View File
@@ -40,7 +40,7 @@ namespace VocaluxeLib.Menu
// ReSharper disable ClassNeverInstantiated.Global // ReSharper disable ClassNeverInstantiated.Global
//Instantiated by reflection //Instantiated by reflection
public class CScreenSetting : IMenuElement public class CScreenSetting : IThemeable
// ReSharper restore ClassNeverInstantiated.Global // ReSharper restore ClassNeverInstantiated.Global
{ {
private readonly int _PartyModeID; private readonly int _PartyModeID;
@@ -89,38 +89,31 @@ namespace VocaluxeLib.Menu
switch (_Theme.Type) switch (_Theme.Type)
{ {
case ESettingType.Int: case ESettingType.Int:
return _GetIntValue(_Theme.Value); return _GetIntValue();
case ESettingType.String: case ESettingType.String:
return _Theme.Value; return _Theme.Value;
case ESettingType.Color: case ESettingType.Color:
return _GetColorValue(_Theme.Value); return _GetColorValue();
case ESettingType.Texture: case ESettingType.Texture:
return _GetTextureValue(_Theme.Value); return _GetTextureValue();
} }
return null; return null;
} }
public void UnloadSkin() {}
public void LoadSkin() {}
public void ReloadSkin() {}
public SScreenSetting GetTheme() public SScreenSetting GetTheme()
{ {
return _Theme; return _Theme;
} }
#region Private private int _GetIntValue()
private int _GetIntValue(string value)
{ {
try try
{ {
return Convert.ToInt32(value); return Convert.ToInt32(_Theme.Value);
} }
catch (Exception) catch (Exception)
{ {
@@ -128,23 +121,24 @@ namespace VocaluxeLib.Menu
} }
} }
private CTextureRef _GetTextureValue(string value) private CTextureRef _GetTextureValue()
{ {
return CBase.Themes.GetSkinTexture(value, _PartyModeID); return CBase.Themes.GetSkinTexture(_Theme.Value, _PartyModeID);
} }
private SColorF _GetColorValue(string value) private SColorF _GetColorValue()
{ {
SColorF color; SColorF color;
CBase.Themes.GetColor(value, _PartyModeID, out color); CBase.Themes.GetColor(_Theme.Value, _PartyModeID, out color);
return color; return color;
} }
#endregion Private
#region ThemeEdit #region Dummy methods for interface
public void MoveElement(int stepX, int stepY) {} public void UnloadSkin() {}
public void ResizeElement(int stepW, int stepH) {} public void LoadSkin() {}
#endregion ThemeEdit
public void ReloadSkin() {}
#endregion
} }
} }
+60 -46
View File
@@ -64,7 +64,7 @@ namespace VocaluxeLib.Menu
public int NumVisible; public int NumVisible;
} }
public class CSelectSlide : IMenuElement, ICloneable public sealed class CSelectSlide : CMenuElementBase, IMenuElement, ICloneable, IThemeable
{ {
private readonly int _PartyModeID; private readonly int _PartyModeID;
private SThemeSelectSlide _Theme; private SThemeSelectSlide _Theme;
@@ -80,7 +80,6 @@ namespace VocaluxeLib.Menu
get { return _ThemeLoaded; } get { return _ThemeLoaded; }
} }
public SRectF Rect;
public SRectF RectArrowLeft; public SRectF RectArrowLeft;
public SRectF RectArrowRight; public SRectF RectArrowRight;
@@ -99,13 +98,46 @@ namespace VocaluxeLib.Menu
public float TextH; public float TextH;
public float MaxW; public float MaxW;
private bool _Selected; public bool Selectable
public bool Selected {
get { return Visible; }
}
public override float X
{ {
get { return _Selected; }
set set
{ {
_Selected = value; float delta = value - X;
RectArrowLeft.X += delta;
RectArrowRight.X += delta;
base.X = value;
}
}
public override float Y
{
set
{
float delta = value - Y;
RectArrowLeft.Y += delta;
RectArrowRight.Y += delta;
base.Y = value;
}
}
public override float Z
{
set
{
float delta = value - Z;
RectArrowLeft.Z += delta;
RectArrowRight.Z += delta;
base.Z = value;
}
}
public override bool Selected
{
set
{
base.Selected = value;
if (!value) if (!value)
{ {
@@ -116,12 +148,9 @@ namespace VocaluxeLib.Menu
} }
public bool ValueSelected public bool ValueSelected
{ {
get { return _Selected && !_ArrowLeftSelected && !_ArrowRightSelected; } get { return Selected && !_ArrowLeftSelected && !_ArrowRightSelected; }
} }
public bool Visible = true;
public bool Highlighted;
public bool SelectionByHover; public bool SelectionByHover;
private bool _ArrowLeftSelected; private bool _ArrowLeftSelected;
@@ -179,25 +208,10 @@ namespace VocaluxeLib.Menu
public CSelectSlide(int partyModeID) public CSelectSlide(int partyModeID)
{ {
_PartyModeID = partyModeID; _PartyModeID = partyModeID;
_Theme = new SThemeSelectSlide();
_ThemeLoaded = false; _ThemeLoaded = false;
Rect = new SRectF();
RectArrowLeft = new SRectF();
RectArrowRight = new SRectF();
Color = new SColorF();
SelColor = new SColorF();
ColorArrow = new SColorF();
SelColorArrow = new SColorF();
TextColor = new SColorF();
SelTextColor = new SColorF();
TextH = 1f; TextH = 1f;
MaxW = 0f; MaxW = 0f;
_Selected = false;
_Textures = new List<CTextureRef>(); _Textures = new List<CTextureRef>();
_ValueIndexes = new List<int>(); _ValueIndexes = new List<int>();
_ValueNames = new List<string>(); _ValueNames = new List<string>();
@@ -228,7 +242,7 @@ namespace VocaluxeLib.Menu
_ThemeLoaded = false; _ThemeLoaded = false;
Rect = slide.Rect; MaxRect = slide.MaxRect;
RectArrowLeft = slide.RectArrowLeft; RectArrowLeft = slide.RectArrowLeft;
RectArrowRight = slide.RectArrowRight; RectArrowRight = slide.RectArrowRight;
@@ -245,7 +259,6 @@ namespace VocaluxeLib.Menu
TextRelativeY = slide.TextRelativeY; TextRelativeY = slide.TextRelativeY;
MaxW = slide.MaxW; MaxW = slide.MaxW;
_Selected = slide._Selected;
_Textures = new List<CTextureRef>(slide._Textures); _Textures = new List<CTextureRef>(slide._Textures);
_ValueIndexes = new List<int>(slide._ValueIndexes); _ValueIndexes = new List<int>(slide._ValueIndexes);
_ValueNames = new List<string>(slide._ValueNames); _ValueNames = new List<string>(slide._ValueNames);
@@ -263,7 +276,6 @@ namespace VocaluxeLib.Menu
_PartyModeID = partyModeID; _PartyModeID = partyModeID;
_Theme = theme; _Theme = theme;
_Selected = false;
_Textures = new List<CTextureRef>(); _Textures = new List<CTextureRef>();
_ValueIndexes = new List<int>(); _ValueIndexes = new List<int>();
_ValueNames = new List<string>(); _ValueNames = new List<string>();
@@ -703,7 +715,7 @@ namespace VocaluxeLib.Menu
_Theme.TextColor.Get(_PartyModeID, out TextColor); _Theme.TextColor.Get(_PartyModeID, out TextColor);
_Theme.TextSColor.Get(_PartyModeID, out SelTextColor); _Theme.TextSColor.Get(_PartyModeID, out SelTextColor);
Rect = _Theme.Rect; MaxRect = _Theme.Rect;
RectArrowLeft = _Theme.RectArrowLeft; RectArrowLeft = _Theme.RectArrowLeft;
RectArrowRight = _Theme.RectArrowRight; RectArrowRight = _Theme.RectArrowRight;
@@ -729,15 +741,6 @@ namespace VocaluxeLib.Menu
#region ThemeEdit #region ThemeEdit
public void MoveElement(int stepX, int stepY) public void MoveElement(int stepX, int stepY)
{ {
if (!_ArrowLeftSelected && !_ArrowRightSelected)
{
Rect.X += stepX;
Rect.Y += stepY;
_Theme.Rect.X += stepX;
_Theme.Rect.Y += stepY;
}
if (_ArrowLeftSelected) if (_ArrowLeftSelected)
{ {
RectArrowLeft.X += stepX; RectArrowLeft.X += stepX;
@@ -746,8 +749,7 @@ namespace VocaluxeLib.Menu
_Theme.RectArrowLeft.X += stepX; _Theme.RectArrowLeft.X += stepX;
_Theme.RectArrowLeft.Y += stepY; _Theme.RectArrowLeft.Y += stepY;
} }
else if (_ArrowRightSelected)
if (_ArrowRightSelected)
{ {
RectArrowRight.X += stepX; RectArrowRight.X += stepX;
RectArrowRight.Y += stepY; RectArrowRight.Y += stepY;
@@ -755,19 +757,31 @@ namespace VocaluxeLib.Menu
_Theme.RectArrowRight.X += stepX; _Theme.RectArrowRight.X += stepX;
_Theme.RectArrowRight.Y += stepY; _Theme.RectArrowRight.Y += stepY;
} }
else
{
X += stepX;
Y += stepY;
_Theme.Rect.X += stepX;
_Theme.Rect.Y += stepY;
_Theme.RectArrowLeft.X += stepX;
_Theme.RectArrowLeft.Y += stepY;
_Theme.RectArrowRight.X += stepX;
_Theme.RectArrowRight.Y += stepY;
}
} }
public void ResizeElement(int stepW, int stepH) public void ResizeElement(int stepW, int stepH)
{ {
if (!_ArrowLeftSelected && !_ArrowRightSelected) if (!_ArrowLeftSelected && !_ArrowRightSelected)
{ {
Rect.W += stepW; W += stepW;
if (Rect.W <= 0) if (W <= 0)
Rect.W = 1; W = 1;
Rect.H += stepH; H += stepH;
if (Rect.H <= 0) if (H <= 0)
Rect.H = 1; H = 1;
_Theme.Rect.W = Rect.W; _Theme.Rect.W = Rect.W;
_Theme.Rect.H = Rect.H; _Theme.Rect.H = Rect.H;
+26 -20
View File
@@ -32,7 +32,7 @@ namespace VocaluxeLib.Menu
public SReflection Reflection; public SReflection Reflection;
} }
public class CStatic : IMenuElement public sealed class CStatic : CMenuElementBase, IMenuElement, IThemeable
{ {
private readonly int _PartyModeID; private readonly int _PartyModeID;
@@ -49,6 +49,11 @@ namespace VocaluxeLib.Menu
get { return _ThemeLoaded; } get { return _ThemeLoaded; }
} }
public bool Selectable
{
get { return false; }
}
private CTextureRef _Texture; private CTextureRef _Texture;
public CTextureRef Texture public CTextureRef Texture
{ {
@@ -58,15 +63,11 @@ namespace VocaluxeLib.Menu
} }
public SColorF Color; public SColorF Color;
public SRectF Rect;
public bool Reflection; public bool Reflection;
public float ReflectionSpace; public float ReflectionSpace;
public float ReflectionHeight; public float ReflectionHeight;
public bool Selected;
public bool Visible = true;
public float Alpha = 1; public float Alpha = 1;
public EAspect Aspect = EAspect.Stretch; public EAspect Aspect = EAspect.Stretch;
@@ -82,12 +83,11 @@ namespace VocaluxeLib.Menu
_Texture = s.Texture; _Texture = s.Texture;
Color = s.Color; Color = s.Color;
Rect = s.Rect; MaxRect = s.MaxRect;
Reflection = s.Reflection; Reflection = s.Reflection;
ReflectionSpace = s.ReflectionHeight; ReflectionSpace = s.ReflectionHeight;
ReflectionHeight = s.ReflectionSpace; ReflectionHeight = s.ReflectionSpace;
Selected = s.Selected;
Alpha = s.Alpha; Alpha = s.Alpha;
Visible = s.Visible; Visible = s.Visible;
} }
@@ -98,7 +98,7 @@ namespace VocaluxeLib.Menu
_Texture = texture; _Texture = texture;
Color = color; Color = color;
Rect = rect; MaxRect = rect;
} }
public CStatic(int partyModeID, string textureSkinName, SColorF color, SRectF rect) public CStatic(int partyModeID, string textureSkinName, SColorF color, SRectF rect)
@@ -106,7 +106,7 @@ namespace VocaluxeLib.Menu
_PartyModeID = partyModeID; _PartyModeID = partyModeID;
_Theme.Skin = textureSkinName; _Theme.Skin = textureSkinName;
Color = color; Color = color;
Rect = rect; MaxRect = rect;
} }
public CStatic(SThemeStatic theme, int partyModeID) public CStatic(SThemeStatic theme, int partyModeID)
@@ -163,9 +163,9 @@ namespace VocaluxeLib.Menu
return _ThemeLoaded; return _ThemeLoaded;
} }
public void Draw(bool forceDraw = false) public void Draw()
{ {
Draw(Aspect, 1f, 0f, forceDraw); Draw(Aspect);
} }
public void Draw(EAspect aspect, float scale = 1f, float zModify = 0f, bool forceDraw = false) public void Draw(EAspect aspect, float scale = 1f, float zModify = 0f, bool forceDraw = false)
@@ -197,7 +197,7 @@ namespace VocaluxeLib.Menu
{ {
_Theme.Color.Get(_PartyModeID, out Color); _Theme.Color.Get(_PartyModeID, out Color);
Rect = _Theme.Rect; MaxRect = _Theme.Rect;
Reflection = _Theme.Reflection.Enabled; Reflection = _Theme.Reflection.Enabled;
if (Reflection) if (Reflection)
{ {
@@ -220,19 +220,25 @@ namespace VocaluxeLib.Menu
#region ThemeEdit #region ThemeEdit
public void MoveElement(int stepX, int stepY) public void MoveElement(int stepX, int stepY)
{ {
Rect.X += stepX; X += stepX;
Rect.Y += stepY; Y += stepY;
_Theme.Rect.X += stepX;
_Theme.Rect.Y += stepY;
} }
public void ResizeElement(int stepW, int stepH) public void ResizeElement(int stepW, int stepH)
{ {
Rect.W += stepW; W += stepW;
if (Rect.W <= 0) if (W <= 0)
Rect.W = 1; W = 1;
Rect.H += stepH; H += stepH;
if (Rect.H <= 0) if (H <= 0)
Rect.H = 1; H = 1;
_Theme.Rect.W = Rect.W;
_Theme.Rect.H = Rect.H;
} }
#endregion ThemeEdit #endregion ThemeEdit
} }
+49 -67
View File
@@ -42,7 +42,7 @@ namespace VocaluxeLib.Menu
public SReflection Reflection; public SReflection Reflection;
} }
public class CText : IMenuElement, IFontObserver public sealed class CText : CMenuElementBase, IMenuElement, IThemeable, IFontObserver
{ {
private SThemeText _Theme; private SThemeText _Theme;
private bool _ThemeLoaded; private bool _ThemeLoaded;
@@ -62,52 +62,37 @@ namespace VocaluxeLib.Menu
private bool _ButtonText; private bool _ButtonText;
private bool _PositionNeedsUpdate = true; private bool _PositionNeedsUpdate = true;
private float _X; public override float X
public float X
{ {
//left
get { return _X; }
set set
{ {
if (Math.Abs(_X - value) > 0.01) if (Math.Abs(X - value) > 0.01)
{ {
_X = value; base.X = value;
_PositionNeedsUpdate = true; _PositionNeedsUpdate = true;
} }
} }
} }
private float _Y; public override float Y
public float Y
{ {
//higher
get { return _Y; }
set set
{ {
if (Math.Abs(_Y - value) > 0.01) if (Math.Abs(Y - value) > 0.01)
{ {
_Y = value; base.Y = value;
_PositionNeedsUpdate = true; _PositionNeedsUpdate = true;
} }
} }
} }
private float _Z; public override float W
public float Z
{ {
get { return _Z; }
set { _Z = value; }
}
private float _MaxWidth;
public float MaxWidth
{
get { return _MaxWidth; }
set set
{ {
if (Math.Abs(_MaxWidth - value) > 0.01) if (Math.Abs(W - value) > 0.01)
{ {
_MaxWidth = value; base.W = value;
_PositionNeedsUpdate = true; _PositionNeedsUpdate = true;
} }
} }
@@ -158,19 +143,23 @@ namespace VocaluxeLib.Menu
} }
/// <summary> /// <summary>
/// Do NOT read/write this anywhere but in _UpdateTextPosition! /// Gets set in _UpdateTextPosition!
/// </summary> /// </summary>
private SRectF _Rect; private SRectF _Rect;
public SRectF Rect public override SRectF Rect
{ {
get get
{ {
if (_PositionNeedsUpdate) _UpdateTextPosition();
_UpdateTextPosition();
return _Rect; return _Rect;
} }
} }
public bool Selectable
{
get { return false; }
}
public SColorF Color; //normal Color public SColorF Color; //normal Color
public SColorF SelColor; //selected Color for Buttons public SColorF SelColor; //selected Color for Buttons
@@ -199,11 +188,6 @@ namespace VocaluxeLib.Menu
get { return _Text; } get { return _Text; }
} }
public int PartyModeID
{
get { return _PartyModeID; }
}
public int TranslationID public int TranslationID
{ {
get { return _TranslationID; } get { return _TranslationID; }
@@ -218,8 +202,6 @@ namespace VocaluxeLib.Menu
} }
} }
public bool Selected;
public bool Visible = true;
private bool _EditMode; private bool _EditMode;
public bool EditMode public bool EditMode
{ {
@@ -260,10 +242,9 @@ namespace VocaluxeLib.Menu
_PartyModeID = text._PartyModeID; _PartyModeID = text._PartyModeID;
_TranslationID = text._TranslationID; _TranslationID = text._TranslationID;
_X = text._X; MaxRect = text.MaxRect;
_Y = text._Y; _Rect = text._Rect;
_Z = text._Z; _PositionNeedsUpdate = false;
_MaxWidth = text._MaxWidth;
_Align = text._Align; _Align = text._Align;
_ResizeAlign = text._ResizeAlign; _ResizeAlign = text._ResizeAlign;
Font = new CFont(text.Font); //Use setter to set observer Font = new CFont(text.Font); //Use setter to set observer
@@ -274,7 +255,6 @@ namespace VocaluxeLib.Menu
ReflectionHeight = text.ReflectionHeight; ReflectionHeight = text.ReflectionHeight;
Text = text.Text; Text = text.Text;
Selected = text.Selected;
Visible = text.Visible; Visible = text.Visible;
Alpha = text.Alpha; Alpha = text.Alpha;
@@ -289,10 +269,7 @@ namespace VocaluxeLib.Menu
_ThemeLoaded = false; _ThemeLoaded = false;
_ButtonText = false; _ButtonText = false;
X = x; MaxRect = new SRectF(x, y, mw, h, z);
Y = y;
Z = z;
MaxWidth = mw;
Align = align; Align = align;
ResizeAlign = EHAlignment.Center; ResizeAlign = EHAlignment.Center;
_Font.Name = fontFamily; _Font.Name = fontFamily;
@@ -331,13 +308,13 @@ namespace VocaluxeLib.Menu
string item = xmlPath + "/" + elementName; string item = xmlPath + "/" + elementName;
_ThemeLoaded = true; _ThemeLoaded = true;
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/X", ref _X); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/X", ref _Theme.X);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Y", ref _Y); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Y", ref _Theme.Y);
if (!buttonText) if (!buttonText)
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Z", ref _Z); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Z", ref _Theme.Z);
xmlReader.TryGetFloatValue(item + "/MaxW", ref _MaxWidth); xmlReader.TryGetFloatValue(item + "/MaxW", ref _Theme.MaxWidth);
if (xmlReader.GetValue(item + "/Color", out _Theme.Color.Name, String.Empty)) if (xmlReader.GetValue(item + "/Color", out _Theme.Color.Name, String.Empty))
_ThemeLoaded &= _Theme.Color.Get(_PartyModeID, out Color); _ThemeLoaded &= _Theme.Color.Get(_PartyModeID, out Color);
@@ -367,7 +344,7 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Style", ref _Theme.FontStyle); _ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Style", ref _Theme.FontStyle);
_ThemeLoaded &= xmlReader.GetValue(item + "/Font", out _Theme.FontFamily); _ThemeLoaded &= xmlReader.GetValue(item + "/Font", out _Theme.FontFamily);
_ThemeLoaded &= xmlReader.GetValue(item + "/Text", out _Theme.Text, String.Empty); _ThemeLoaded &= xmlReader.GetValue(item + "/Text", out _Theme.Text);
if (xmlReader.ItemExists(item + "/Reflection") && !buttonText) if (xmlReader.ItemExists(item + "/Reflection") && !buttonText)
{ {
@@ -378,16 +355,13 @@ namespace VocaluxeLib.Menu
else else
_Theme.Reflection = new SReflection(false, 0f, 0f); _Theme.Reflection = new SReflection(false, 0f, 0f);
// Set values // Set values
_Theme.Name = elementName; _Theme.Name = elementName;
_Theme.Align = _Align; _Theme.Align = _Align;
_Theme.Color.Color = Color; _Theme.Color.Color = Color;
_Theme.ResizeAlign = _ResizeAlign; _Theme.ResizeAlign = _ResizeAlign;
_Theme.SColor.Color = SelColor; _Theme.SColor.Color = SelColor;
_Theme.MaxWidth = _MaxWidth;
_Theme.X = _X;
_Theme.Y = _Y;
_Theme.Z = _Z;
_ButtonText = buttonText; _ButtonText = buttonText;
_PositionNeedsUpdate = true; _PositionNeedsUpdate = true;
@@ -397,9 +371,14 @@ namespace VocaluxeLib.Menu
return _ThemeLoaded; return _ThemeLoaded;
} }
public void Draw(bool forceDraw = false) public void Draw()
{ {
if (!forceDraw && !Visible && CBase.Settings.GetProgramState() != EProgramState.EditTheme) _Draw(false);
}
private void _Draw(bool force)
{
if (!force && !Visible && CBase.Settings.GetProgramState() != EProgramState.EditTheme)
return; return;
// Update Text // Update Text
@@ -446,7 +425,7 @@ namespace VocaluxeLib.Menu
ReflectionHeight = 0; ReflectionHeight = 0;
X += rx; X += rx;
Y += ry; Y += ry;
Draw(true); _Draw(true);
ReflectionSpace = oldReflectionSpace; ReflectionSpace = oldReflectionSpace;
ReflectionHeight = oldReflectionHeight; ReflectionHeight = oldReflectionHeight;
X -= rx; X -= rx;
@@ -460,10 +439,12 @@ namespace VocaluxeLib.Menu
_Theme.Color.Get(_PartyModeID, out Color); _Theme.Color.Get(_PartyModeID, out Color);
_Theme.SColor.Get(_PartyModeID, out SelColor); _Theme.SColor.Get(_PartyModeID, out SelColor);
_X = _Theme.X; X = _Theme.X;
_Y = _Theme.Y; Y = _Theme.Y;
_Z = _Theme.Z; if (!_ButtonText)
_MaxWidth = _Theme.MaxWidth; Z = _Theme.Z;
W = _Theme.MaxWidth;
H = _Theme.FontHeight;
_Align = _Theme.Align; _Align = _Theme.Align;
_ResizeAlign = _Theme.ResizeAlign; _ResizeAlign = _Theme.ResizeAlign;
Font = new CFont(_Theme.FontFamily, _Theme.FontStyle, _Theme.FontHeight); Font = new CFont(_Theme.FontFamily, _Theme.FontStyle, _Theme.FontHeight);
@@ -512,7 +493,11 @@ namespace VocaluxeLib.Menu
private void _UpdateTextPosition() private void _UpdateTextPosition()
{ {
if (!_PositionNeedsUpdate)
return;
_CalculatedFont = new CFont(Font); _CalculatedFont = new CFont(Font);
_Rect = MaxRect;
_PositionNeedsUpdate = false; _PositionNeedsUpdate = false;
if (_Text == "") if (_Text == "")
@@ -522,9 +507,9 @@ namespace VocaluxeLib.Menu
float y = Y; float y = Y;
RectangleF bounds = CBase.Fonts.GetTextBounds(this); RectangleF bounds = CBase.Fonts.GetTextBounds(this);
if (MaxWidth > 0f && bounds.Width > MaxWidth && bounds.Width > 0f) if (W > 0f && bounds.Width > W && bounds.Width > 0f)
{ {
float factor = MaxWidth / bounds.Width; float factor = W / bounds.Width;
float step = h * (1 - factor); float step = h * (1 - factor);
h *= factor; h *= factor;
switch (ResizeAlign) switch (ResizeAlign)
@@ -554,10 +539,7 @@ namespace VocaluxeLib.Menu
break; break;
} }
_Rect.X = x; _Rect = new SRectF(x, y, bounds.Width, bounds.Height, Z);
_Rect.Y = y;
_Rect.W = bounds.Width;
_Rect.H = bounds.Height;
} }
public void FontChanged() public void FontChanged()
+1 -1
View File
@@ -35,12 +35,12 @@ namespace VocaluxeLib.Menu
bool HandleMouseThemeEditor(SMouseEvent mouseEvent); bool HandleMouseThemeEditor(SMouseEvent mouseEvent);
bool UpdateGame(); bool UpdateGame();
void Draw();
void ApplyVolume(); void ApplyVolume();
void OnShow(); void OnShow();
void OnShowFinish(); void OnShowFinish();
void OnClose(); void OnClose();
bool Draw();
SRectF ScreenArea { get; } SRectF ScreenArea { get; }
void NextInteraction(); void NextInteraction();
+15 -11
View File
@@ -15,21 +15,25 @@
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>. // along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
#endregion #endregion
using VocaluxeLib.Xml;
namespace VocaluxeLib.Menu namespace VocaluxeLib.Menu
{ {
interface IMenuElement public interface IMenuElement
{ {
string GetThemeName(); /// <summary>
/// Current extend of the element. Smaller or equal then MaxRect
bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader); /// </summary>
SRectF Rect { get; }
void UnloadSkin(); /// <summary>
void LoadSkin(); /// Maximum extend of the element. Equal to Rect in most cases
void ReloadSkin(); /// </summary>
SRectF MaxRect { get; set; }
bool Selectable { get; }
bool Visible { get; set; }
bool Highlighted { get; set; }
bool Selected { get; set; }
void MoveElement(int stepX, int stepY); void MoveElement(int stepX, int stepY);
void ResizeElement(int stepW, int stepH); void ResizeElement(int stepW, int stepH);
void Draw();
} }
} }
@@ -15,30 +15,18 @@
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>. // along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
#endregion #endregion
using VocaluxeLib.PartyModes; using VocaluxeLib.Xml;
namespace VocaluxeLib.Menu.SongMenu namespace VocaluxeLib.Menu
{ {
class CSongMenuList : CSongMenuFramework public interface IThemeable
{ {
public CSongMenuList(int partyModeID) string GetThemeName();
: base(partyModeID) {}
public override float SelectedTileZoomFactor bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader);
{
get { return 1.2f; }
}
public override bool HandleInput(ref SKeyEvent keyEvent, SScreenSongOptions options) void UnloadSkin();
{ void LoadSkin();
return false; void ReloadSkin();
}
public override bool HandleMouse(ref SMouseEvent mouseEvent, SScreenSongOptions songOptions) { return false; }
public override CStatic GetSelectedSongCover()
{
return null;
}
} }
} }
+11 -1
View File
@@ -68,7 +68,7 @@ namespace VocaluxeLib.Menu.SingNotes
[XmlArray("BarPositions")] public SBarPosition[] BarPos; [XmlArray("BarPositions")] public SBarPosition[] BarPos;
} }
public abstract class CSingNotes : IMenuElement public abstract class CSingNotes : CMenuElementBase, IMenuElement,IThemeable
{ {
private readonly int _PartyModeID; private readonly int _PartyModeID;
private SThemeSingBar _Theme; private SThemeSingBar _Theme;
@@ -77,6 +77,11 @@ namespace VocaluxeLib.Menu.SingNotes
private readonly List<SPlayerNotes> _PlayerNotes; private readonly List<SPlayerNotes> _PlayerNotes;
private int _ActID; private int _ActID;
public bool Selectable
{
get { return false; }
}
/// <summary> /// <summary>
/// Player bar positions /// Player bar positions
/// </summary> /// </summary>
@@ -239,6 +244,11 @@ namespace VocaluxeLib.Menu.SingNotes
return _PlayerNotes[n].Alpha; return _PlayerNotes[n].Alpha;
} }
public void Draw()
{
throw new NotImplementedException();
}
public void Draw(int id, List<CSungLine> sungLines, int player) public void Draw(int id, List<CSungLine> sungLines, int player)
{ {
int n = _FindPlayerNotes(id); int n = _FindPlayerNotes(id);
-220
View File
@@ -1,220 +0,0 @@
#region license
// This file is part of Vocaluxe.
//
// Vocaluxe is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Vocaluxe is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
#endregion
using VocaluxeLib.PartyModes;
using VocaluxeLib.Xml;
namespace VocaluxeLib.Menu.SongMenu
{
public class CSongMenu : ISongMenu
{
private readonly int _PartyModeID;
private ISongMenu _SongMenu;
private ESongMenu _Type;
public CSongMenu(int partyModeID)
{
_PartyModeID = partyModeID;
_CreateSongMenu(new SThemeSongMenu());
}
public CSongMenu(SThemeSongMenu theme, int partyModeID)
{
_PartyModeID = partyModeID;
_CreateSongMenu(theme);
}
#region ISongMenu
public bool Selected
{
get { return _SongMenu.Selected; }
set { _SongMenu.Selected = value; }
}
public bool Visible
{
get { return _SongMenu.Visible; }
set { _SongMenu.Visible = value; }
}
public bool Active
{
get { return _SongMenu.Active; }
set { _SongMenu.Active = value; }
}
public bool SmallView
{
get { return _SongMenu.SmallView; }
set { _SongMenu.SmallView = value; }
}
public SRectF Rect
{
get { return _SongMenu.Rect; }
}
public bool ThemeLoaded
{
get { return _SongMenu.ThemeLoaded; }
}
public void Update(SScreenSongOptions songOptions)
{
_SongMenu.Update(songOptions);
}
public void OnShow()
{
_SongMenu.OnShow();
}
public void OnHide()
{
_SongMenu.OnHide();
}
public bool HandleInput(ref SKeyEvent keyEvent, SScreenSongOptions options)
{
return _SongMenu.HandleInput(ref keyEvent, options);
}
public bool HandleMouse(ref SMouseEvent mouseEvent, SScreenSongOptions songOptions)
{
return _SongMenu.HandleMouse(ref mouseEvent, songOptions);
}
public void Draw()
{
_SongMenu.Draw();
}
public bool IsMouseOverSelectedSong(SMouseEvent mEvent)
{
return _SongMenu.IsMouseOverSelectedSong(mEvent);
}
public int GetPreviewSongNr()
{
return _SongMenu.GetPreviewSongNr();
}
public int GetSelectedSongNr()
{
return _SongMenu.GetSelectedSongNr();
}
public CStatic GetSelectedSongCover()
{
return _SongMenu.GetSelectedSongCover();
}
public void SetSelectedSong(int visibleSongNr)
{
_SongMenu.SetSelectedSong(visibleSongNr);
}
public int GetSelectedCategory()
{
return _SongMenu.GetSelectedCategory();
}
public void SetSelectedCategory(int categoryNr)
{
_SongMenu.SetSelectedCategory(categoryNr);
}
public bool EnterSelectedCategory()
{
return _SongMenu.EnterSelectedCategory();
}
public int GetPreviewSong()
{
return _SongMenu.GetPreviewSong();
}
#endregion ISongMenu
#region IMenuElement
public string GetThemeName()
{
return _SongMenu.GetThemeName();
}
public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader)
{
return _SongMenu.LoadTheme(xmlPath, elementName, xmlReader);
}
public void UnloadSkin()
{
_SongMenu.UnloadSkin();
}
public void LoadSkin()
{
_SongMenu.LoadSkin();
}
public void ReloadSkin()
{
_SongMenu.ReloadSkin();
}
public void MoveElement(int stepX, int stepY)
{
_SongMenu.MoveElement(stepX, stepY);
}
public void ResizeElement(int stepW, int stepH)
{
_SongMenu.ResizeElement(stepW, stepH);
}
public SThemeSongMenu GetTheme()
{
return _SongMenu.GetTheme();
}
#endregion IMenuElement
private void _CreateSongMenu(SThemeSongMenu theme)
{
if (_SongMenu != null)
_SongMenu.OnHide();
_Type = CBase.Config.GetSongMenuType();
switch (_Type)
{
//case ESongMenu.TR_CONFIG_LIST:
// _SongMenu = new CSongMenuList();
// break;
//case ESongMenu.TR_CONFIG_DREIDEL:
// _SongMenu = new CSongMenuDreidel();
// break;
case ESongMenu.TR_CONFIG_TILE_BOARD:
_SongMenu = new CSongMenuTileBoard(theme, _PartyModeID);
break;
//case ESongMenu.TR_CONFIG_BOOK:
// _SongMenu = new CSongMenuBook();
// break;
}
}
}
}
@@ -1,47 +0,0 @@
#region license
// This file is part of Vocaluxe.
//
// Vocaluxe is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Vocaluxe is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
#endregion
using VocaluxeLib.PartyModes;
namespace VocaluxeLib.Menu.SongMenu
{
class CSongMenuBook : CSongMenuFramework
{
public CSongMenuBook(int partyModeID)
: base(partyModeID) {}
public override float SelectedTileZoomFactor
{
get { return 1.2f; }
}
public override bool HandleInput(ref SKeyEvent keyEvent, SScreenSongOptions options)
{
return false;
}
public override bool HandleMouse(ref SMouseEvent mouseEvent, SScreenSongOptions songOptions)
{
return false;
}
public override CStatic GetSelectedSongCover()
{
return null;
}
}
}
@@ -1,78 +0,0 @@
#region license
// This file is part of Vocaluxe.
//
// Vocaluxe is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Vocaluxe is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
#endregion
using VocaluxeLib.PartyModes;
namespace VocaluxeLib.Menu.SongMenu
{
class CSongMenuDreidel : CSongMenuFramework
{
/*
private SRectF _ScrollRect;
private CStatic _CoverBig;
private CStatic _TextBG;
private CStatic _DuetIcon;
private CStatic _VideoIcon;
private CText _Artist;
private CText _Title;
private CText _SongLength;
*/
public CSongMenuDreidel(int partyModeID)
: base(partyModeID) {}
// ReSharper disable RedundantOverridenMember
public override void Init()
{
base.Init();
/**
_CoverBig = _Theme.songMenuDreidel.StaticCoverBig;
_TextBG = _Theme.songMenuDreidel.StaticTextBG;
_DuetIcon = _Theme.songMenuDreidel.StaticDuetIcon;
_VideoIcon = _Theme.songMenuDreidel.StaticVideoIcon;
_Artist = _Theme.songMenuDreidel.TextArtist;
_Title = _Theme.songMenuDreidel.TextTitle;
_SongLength = _Theme.songMenuDreidel.TextSongLength;
**/
}
// ReSharper restore RedundantOverridenMember
public override float SelectedTileZoomFactor
{
get { return 1.2f; }
}
public override bool HandleInput(ref SKeyEvent keyEvent, SScreenSongOptions options)
{
return false;
}
public override bool HandleMouse(ref SMouseEvent mouseEvent, SScreenSongOptions songOptions)
{
return false;
}
public override CStatic GetSelectedSongCover()
{
return null;
}
}
}
@@ -0,0 +1,71 @@
#region license
// This file is part of Vocaluxe.
//
// Vocaluxe is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Vocaluxe is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
#endregion
using System;
namespace VocaluxeLib.Menu.SongMenu
{
public static class CSongMenuFactory
{
public static ISongMenu GetSongMenu(SThemeSongMenu theme, int partyModeID)
{
switch (CBase.Config.GetSongMenuType())
{
//case ESongMenu.TR_CONFIG_LIST:
// _SongMenu = new CSongMenuList();
// break;
//case ESongMenu.TR_CONFIG_DREIDEL:
// _SongMenu = new CSongMenuDreidel();
// break;
case ESongMenu.TR_CONFIG_TILE_BOARD:
return new CSongMenuTileBoard(theme, partyModeID);
//case ESongMenu.TR_CONFIG_BOOK:
// _SongMenu = new CSongMenuBook();
// break;
}
throw new ArgumentException("Invalid songmenu type: " + CBase.Config.GetSongMenuType());
}
/// <summary>
/// Deprecated! Only used for old theme loading.
/// </summary>
/// <param name="partyModeID"></param>
/// <returns></returns>
public static ISongMenu GetSongMenu(int partyModeID)
{
switch (CBase.Config.GetSongMenuType())
{
//case ESongMenu.TR_CONFIG_LIST:
// _SongMenu = new CSongMenuList();
// break;
//case ESongMenu.TR_CONFIG_DREIDEL:
// _SongMenu = new CSongMenuDreidel();
// break;
case ESongMenu.TR_CONFIG_TILE_BOARD:
return new CSongMenuTileBoard(partyModeID);
//case ESongMenu.TR_CONFIG_BOOK:
// _SongMenu = new CSongMenuBook();
// break;
}
throw new ArgumentException("Invalid songmenu type: " + CBase.Config.GetSongMenuType());
}
}
}
+18 -39
View File
@@ -90,7 +90,7 @@ namespace VocaluxeLib.Menu.SongMenu
public SThemeStatic StaticMedleyTagIcon; public SThemeStatic StaticMedleyTagIcon;
} }
abstract class CSongMenuFramework : ISongMenu public abstract class CSongMenuFramework : CMenuElementBase, ISongMenu
{ {
protected readonly int _PartyModeID; protected readonly int _PartyModeID;
protected SThemeSongMenu _Theme; protected SThemeSongMenu _Theme;
@@ -101,6 +101,11 @@ namespace VocaluxeLib.Menu.SongMenu
get { return _ThemeLoaded; } get { return _ThemeLoaded; }
} }
public bool Selectable
{
get { return Visible; }
}
protected bool _Initialized; protected bool _Initialized;
private int _PreviewNrInternal = -1; private int _PreviewNrInternal = -1;
@@ -138,19 +143,6 @@ namespace VocaluxeLib.Menu.SongMenu
return _PreviewNr; return _PreviewNr;
} }
public SRectF Rect { get; protected set; }
public bool Active { get; set; }
private bool _Selected;
public bool Selected
{
get { return _Selected; }
set
{
_Selected = value;
Active = value;
}
}
public bool Visible { get; set; }
public virtual bool SmallView { get; set; } public virtual bool SmallView { get; set; }
public abstract float SelectedTileZoomFactor { get; } public abstract float SelectedTileZoomFactor { get; }
// This is the nr of the current selection (song or category) // This is the nr of the current selection (song or category)
@@ -245,13 +237,9 @@ namespace VocaluxeLib.Menu.SongMenu
_Initialized = true; _Initialized = true;
} }
public virtual void Update(SScreenSongOptions songOptions) public abstract void Update(SScreenSongOptions songOptions);
{
if (!_Initialized)
return;
}
public virtual void OnShow() {} public abstract void OnShow();
public virtual void OnHide() public virtual void OnHide()
{ {
@@ -398,33 +386,24 @@ namespace VocaluxeLib.Menu.SongMenu
} }
#region ThemeEdit #region ThemeEdit
private void _UpdateRect(SRectF rect)
{
Rect = rect;
Init();
}
public void MoveElement(int stepX, int stepY) public void MoveElement(int stepX, int stepY)
{ {
SRectF rect = Rect; X += stepX;
rect.X += stepX; Y += stepY;
rect.Y += stepY; Init();
_UpdateRect(rect);
} }
public void ResizeElement(int stepW, int stepH) public void ResizeElement(int stepW, int stepH)
{ {
SRectF rect = Rect; W += stepW;
if (W < 100)
W = 100;
rect.W += stepW; H += stepH;
if (rect.W < 100) if (H < 100)
rect.W = 100; H = 100;
rect.H += stepH; Init();
if (rect.H < 100)
rect.H = 100;
_UpdateRect(rect);
} }
#endregion ThemeEdit #endregion ThemeEdit
} }
@@ -174,13 +174,13 @@ namespace VocaluxeLib.Menu.SongMenu
{ {
_NumH = _Theme.SongMenuTileBoard.NumHsmall; _NumH = _Theme.SongMenuTileBoard.NumHsmall;
_NumW = _Theme.SongMenuTileBoard.NumWsmall; _NumW = _Theme.SongMenuTileBoard.NumWsmall;
Rect = _Theme.SongMenuTileBoard.TileRectSmall; MaxRect = _Theme.SongMenuTileBoard.TileRectSmall;
} }
else else
{ {
_NumH = _Theme.SongMenuTileBoard.NumH; _NumH = _Theme.SongMenuTileBoard.NumH;
_NumW = _Theme.SongMenuTileBoard.NumW; _NumW = _Theme.SongMenuTileBoard.NumW;
Rect = _Theme.SongMenuTileBoard.TileRect; MaxRect = _Theme.SongMenuTileBoard.TileRect;
} }
_TileW = (int)((Rect.W - _Theme.SongMenuTileBoard.SpaceW * (_NumW - 1)) / _NumW); _TileW = (int)((Rect.W - _Theme.SongMenuTileBoard.SpaceW * (_NumW - 1)) / _NumW);
@@ -204,8 +204,6 @@ namespace VocaluxeLib.Menu.SongMenu
public override void Update(SScreenSongOptions songOptions) public override void Update(SScreenSongOptions songOptions)
{ {
base.Update(songOptions);
if (songOptions.Selection.RandomOnly) if (songOptions.Selection.RandomOnly)
_PreviewNr = _SelectionNr; _PreviewNr = _SelectionNr;
@@ -482,7 +480,7 @@ namespace VocaluxeLib.Menu.SongMenu
{ {
foreach (CStatic tile in _Tiles) foreach (CStatic tile in _Tiles)
{ {
if (tile.Selected && Active) if (tile.Selected && Selected)
tile.Draw(EAspect.Crop, SelectedTileZoomFactor, -0.1f); tile.Draw(EAspect.Crop, SelectedTileZoomFactor, -0.1f);
else else
{ {
+1 -6
View File
@@ -19,7 +19,7 @@ using VocaluxeLib.PartyModes;
namespace VocaluxeLib.Menu.SongMenu namespace VocaluxeLib.Menu.SongMenu
{ {
interface ISongMenu : IMenuElement public interface ISongMenu : IMenuElement,IThemeable
{ {
void Update(SScreenSongOptions songOptions); void Update(SScreenSongOptions songOptions);
void OnShow(); void OnShow();
@@ -27,7 +27,6 @@ namespace VocaluxeLib.Menu.SongMenu
bool HandleInput(ref SKeyEvent keyEvent, SScreenSongOptions options); bool HandleInput(ref SKeyEvent keyEvent, SScreenSongOptions options);
bool HandleMouse(ref SMouseEvent mouseEvent, SScreenSongOptions songOptions); bool HandleMouse(ref SMouseEvent mouseEvent, SScreenSongOptions songOptions);
void Draw();
// The selected song is the song, where the mouse is hovering over // The selected song is the song, where the mouse is hovering over
// The number is refering to the index in the visible songs array // The number is refering to the index in the visible songs array
@@ -45,10 +44,6 @@ namespace VocaluxeLib.Menu.SongMenu
// The song that is currently playing (set e.g. by clicking on a song) // The song that is currently playing (set e.g. by clicking on a song)
int GetPreviewSong(); int GetPreviewSong();
SRectF Rect { get; }
bool Active { get; set; }
bool Selected { get; set; }
bool Visible { get; set; }
bool SmallView { get; set; } bool SmallView { get; set; }
bool ThemeLoaded { get; } bool ThemeLoaded { get; }
@@ -83,11 +83,5 @@ namespace VocaluxeLib.PartyModes
{ {
return true; return true;
} }
public override bool Draw()
{
base.Draw();
return true;
}
} }
} }
+5 -5
View File
@@ -91,19 +91,22 @@
<Compile Include="Menu\CInteraction.cs" /> <Compile Include="Menu\CInteraction.cs" />
<Compile Include="Menu\CLyric.cs" /> <Compile Include="Menu\CLyric.cs" />
<Compile Include="Menu\CMenu.cs" /> <Compile Include="Menu\CMenu.cs" />
<Compile Include="Menu\CMenuElementBase.cs" />
<Compile Include="Menu\CMenuParty.cs" /> <Compile Include="Menu\CMenuParty.cs" />
<Compile Include="Menu\CMenuPartyNameSelection.cs" /> <Compile Include="Menu\CMenuPartyNameSelection.cs" />
<Compile Include="Menu\CNameSelection.cs" /> <Compile Include="Menu\CNameSelection.cs" />
<Compile Include="Menu\CObjectInteractions.cs" /> <Compile Include="Menu\CObjectInteractions.cs" />
<Compile Include="Menu\COrderedDictionaryLite.cs" /> <Compile Include="Menu\COrderedDictionaryLite.cs" />
<Compile Include="Menu\CParticle.cs" /> <Compile Include="Menu\CParticle.cs" />
<Compile Include="Menu\CParticleEffect.cs" />
<Compile Include="Menu\CPlaylist.cs" /> <Compile Include="Menu\CPlaylist.cs" />
<Compile Include="Game\CPoints.cs" /> <Compile Include="Game\CPoints.cs" />
<Compile Include="Menu\CScreenSetting.cs" />
<Compile Include="Menu\CSelectSlide.cs" /> <Compile Include="Menu\CSelectSlide.cs" />
<Compile Include="Menu\CStatic.cs" /> <Compile Include="Menu\CStatic.cs" />
<Compile Include="Menu\CText.cs" /> <Compile Include="Menu\CText.cs" />
<Compile Include="Menu\CScreenSetting.cs" />
<Compile Include="Draw\CTextureRef.cs" /> <Compile Include="Draw\CTextureRef.cs" />
<Compile Include="Menu\IThemeable.cs" />
<Compile Include="Xml\CXmlDeserializer.cs" /> <Compile Include="Xml\CXmlDeserializer.cs" />
<Compile Include="Xml\CXMLReader.cs" /> <Compile Include="Xml\CXMLReader.cs" />
<Compile Include="Enums.cs" /> <Compile Include="Enums.cs" />
@@ -120,11 +123,8 @@
<Compile Include="Menu\SingNotes\CSingNotesClassic.cs" /> <Compile Include="Menu\SingNotes\CSingNotesClassic.cs" />
<Compile Include="Songs\CCategory.cs" /> <Compile Include="Songs\CCategory.cs" />
<Compile Include="Songs\CSong.cs" /> <Compile Include="Songs\CSong.cs" />
<Compile Include="Menu\SongMenu\CSongMenu.cs" /> <Compile Include="Menu\SongMenu\CSongMenuFactory.cs" />
<Compile Include="Menu\SongMenu\CSongMenuBook.cs" />
<Compile Include="Menu\SongMenu\CSongMenuDreidel.cs" />
<Compile Include="Menu\SongMenu\CSongMenuFramework.cs" /> <Compile Include="Menu\SongMenu\CSongMenuFramework.cs" />
<Compile Include="Menu\SongMenu\CSongMenuList.cs" />
<Compile Include="Menu\SongMenu\CSongMenuTileBoard.cs" /> <Compile Include="Menu\SongMenu\CSongMenuTileBoard.cs" />
<Compile Include="Menu\SongMenu\ISongMenu.cs" /> <Compile Include="Menu\SongMenu\ISongMenu.cs" />
<Compile Include="Songs\CSongWriter.cs" /> <Compile Include="Songs\CSongWriter.cs" />