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;
}
public override bool Draw()
{
base.Draw();
return true;
}
private void _RebuildSlides()
{
// build num player slide (min player ... max player);
@@ -310,12 +310,6 @@ namespace VocaluxeLib.PartyModes.Challenge
return true;
}
public override bool Draw()
{
base.Draw();
return true;
}
private void _NextRound()
{
_Data.ScreenMain.FadeToNameSelection = false;
@@ -356,8 +350,8 @@ namespace VocaluxeLib.PartyModes.Challenge
for (int i = 0; i < _GameState.NumPlayerAtOnce; i++)
{
//static
_NextPlayerStatics[i].Rect.X = x;
_NextPlayerStatics[i].Rect.Y = staticY;
_NextPlayerStatics[i].X = x;
_NextPlayerStatics[i].Y = staticY;
_NextPlayerStatics[i].Visible = true;
//text
_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;
roundRow.TextPlayer[column].X = x;
roundRow.TextPlayer[column].Y = numberY;
roundRow.TextPlayer[column].MaxWidth = maxw;
roundRow.TextPlayer[column].W = maxw;
//Score
roundRow.TextScores[column].X = x;
roundRow.TextScores[column].Y = numberY + delta;
roundRow.TextScores[column].MaxWidth = maxw;
roundRow.TextScores[column].W = maxw;
}
numberY = numberY + 2 * delta;
}
@@ -144,12 +144,6 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
return true;
}
public override bool Draw()
{
base.Draw();
return true;
}
private void _RebuildSlides()
{
// build num player slide (min player ... max player);
@@ -310,12 +310,6 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
return true;
}
public override bool Draw()
{
base.Draw();
return true;
}
private void _NextRound()
{
_Data.ScreenMain.FadeToNameSelection = false;
@@ -356,8 +350,8 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
for (int i = 0; i < _GameState.NumPlayerAtOnce; i++)
{
//static
_NextPlayerStatics[i].Rect.X = x;
_NextPlayerStatics[i].Rect.Y = staticY;
_NextPlayerStatics[i].X = x;
_NextPlayerStatics[i].Y = staticY;
_NextPlayerStatics[i].Visible = true;
//text
_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;
roundRow.TextPlayer[column].X = x;
roundRow.TextPlayer[column].Y = numberY;
roundRow.TextPlayer[column].MaxWidth = maxw;
roundRow.TextPlayer[column].W = maxw;
//Score
roundRow.TextScores[column].X = x;
roundRow.TextScores[column].Y = numberY + delta;
roundRow.TextScores[column].MaxWidth = maxw;
roundRow.TextScores[column].W = maxw;
}
numberY = numberY + delta + delta;
}
@@ -158,12 +158,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe
return true;
}
public override bool Draw()
{
base.Draw();
return true;
}
private void _FillSlides()
{
_SelectSlides[_SelectSlideNumFields].Clear();
@@ -369,12 +369,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe
return true;
}
public override bool Draw()
{
base.Draw();
return true;
}
public override void OnClose()
{
base.OnClose();
@@ -410,12 +404,12 @@ namespace VocaluxeLib.PartyModes.TicTacToe
{
if (i < _GameData.NumFields)
{
_Fields[i].Button.Rect.W = _FieldSize;
_Fields[i].Button.Rect.H = _FieldSize;
_Fields[i].Button.Rect.X = x;
_Fields[i].Button.Rect.Y = y;
_Fields[i].Button.W = _FieldSize;
_Fields[i].Button.H = _FieldSize;
_Fields[i].Button.X = x;
_Fields[i].Button.Y = y;
_Fields[i].Button.Visible = true;
_Fields[i].Button.Enabled = true;
_Fields[i].Button.Selectable = true;
column++;
if ((i + 1) >= numOneRow * (row + 1))
{
@@ -430,7 +424,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
else
{
_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++)
{
_Fields[i].Button.Enabled = true;
_Fields[i].Button.Selectable = true;
_Fields[i].Button.Texture = _Buttons[_ButtonField].Texture;
_Fields[i].Button.Color = _Buttons[_ButtonField].Color;
_Fields[i].Button.SelColor = _Buttons[_ButtonField].SelColor;
_Fields[i].Content = _GameData.Rounds[i];
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.Color = 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.Color = 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)
{
_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)
_Fields[i].Button.Enabled = false;
_Fields[i].Button.Selectable = false;
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[_ButtonJokerRandomT1].Text.Text = _GameData.NumJokerRandom[0].ToString();
_Buttons[_ButtonJokerRandomT2].Text.Text = _GameData.NumJokerRandom[1].ToString();
_Buttons[_ButtonJokerRandomT1].Enabled = _GameData.NumJokerRandom[0] > 0;
_Buttons[_ButtonJokerRandomT2].Enabled = _GameData.NumJokerRandom[1] > 0;
_Buttons[_ButtonJokerRandomT1].Selectable = _GameData.NumJokerRandom[0] > 0;
_Buttons[_ButtonJokerRandomT2].Selectable = _GameData.NumJokerRandom[1] > 0;
_Buttons[_ButtonJokerRetryT1].Visible = true;
_Buttons[_ButtonJokerRetryT2].Visible = true;
_Buttons[_ButtonJokerRetryT1].Text.Text = _GameData.NumJokerRetry[0].ToString();
_Buttons[_ButtonJokerRetryT2].Text.Text = _GameData.NumJokerRetry[1].ToString();
_Buttons[_ButtonJokerRetryT1].Enabled = _GameData.NumJokerRetry[0] > 0;
_Buttons[_ButtonJokerRetryT2].Enabled = _GameData.NumJokerRetry[1] > 0;
_Buttons[_ButtonJokerRetryT1].Selectable = _GameData.NumJokerRetry[0] > 0;
_Buttons[_ButtonJokerRetryT2].Selectable = _GameData.NumJokerRetry[1] > 0;
}
private void _NextRound()
@@ -666,7 +660,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
_PartyMode.DataFromScreen(ThemeName, _Data);
}
private int _BuildWinnerPossibilities()
private void _BuildWinnerPossibilities()
{
var numOneRow = (int)Math.Sqrt(_GameData.NumFields);
_Possibilities = new int[(numOneRow * 2) + 2,numOneRow];
@@ -693,7 +687,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe
_Possibilities[i, c] = (numOneRow - 1) * c + (numOneRow - 1);
}
}
return 0;
}
private int _GetWinner()
@@ -186,18 +186,17 @@ namespace Vocaluxe.Screens
return true;
}
public override bool Draw()
public override void Draw()
{
if (!_Active)
return false;
return;
base.Draw();
_Statics[_StaticCover].Texture = CBackgroundMusic.Cover;
if (CBackgroundMusic.VideoEnabled && _VideoPreview && CBackgroundMusic.SongHasVideo)
CDraw.DrawTexture(CBackgroundMusic.GetVideoTexture(), _Statics[_StaticCover].Rect, EAspect.Crop);
_Buttons[_ButtonPause].Visible = CBackgroundMusic.IsPlaying;
_Buttons[_ButtonPlay].Visible = !CBackgroundMusic.IsPlaying;
_Texts[_TextCurrentSong].Text = CBackgroundMusic.ArtistAndTitle;
return base.Draw();
}
private void _StartSong(int songNr)
+3 -5
View File
@@ -101,12 +101,10 @@ namespace Vocaluxe.Screens
return true;
}
public override bool Draw()
public override void Draw()
{
if (!_Active)
return false;
return base.Draw();
if (_Active)
base.Draw();
}
private void _GenerateQRs()
@@ -100,12 +100,10 @@ namespace Vocaluxe.Screens
return true;
}
public override bool Draw()
public override void Draw()
{
if (!_Active)
return false;
return base.Draw();
if (_Active)
base.Draw();
}
private void _SaveConfig()
+12 -13
View File
@@ -57,12 +57,12 @@ namespace Vocaluxe.Screens
public float X
{
get { return _Image.Rect.X; }
get { return _Image.X; }
set
{
_Image.Rect.X = value;
_ImgDot.Rect.X = value + _ParticleOffsetX;
_Particle.Rect.X = value + _ParticleOffsetX;
_Image.X = value;
_ImgDot.X = value + _ParticleOffsetX;
_Particle.X = value + _ParticleOffsetX;
}
}
public float Y
@@ -70,9 +70,9 @@ namespace Vocaluxe.Screens
get { return _Image.Rect.Y; }
set
{
_Image.Rect.Y = value;
_ImgDot.Rect.Y = value + _ParticleOffsetY;
_Particle.Rect.Y = value + _ParticleOffsetY;
_Image.Y = value;
_ImgDot.Y = value + _ParticleOffsetY;
_Particle.Y = value + _ParticleOffsetY;
}
}
@@ -142,7 +142,7 @@ namespace Vocaluxe.Screens
private CTextureRef _TexNamePantero;
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()
{
@@ -358,7 +358,7 @@ namespace Vocaluxe.Screens
_LogoTimer.Start();
}
public override bool Draw()
public override void Draw()
{
base.Draw();
@@ -381,7 +381,6 @@ namespace Vocaluxe.Screens
foreach (CText text in _ParagraphTexts)
text.Draw();
}
return true;
}
private bool _Animation()
@@ -391,9 +390,9 @@ namespace Vocaluxe.Screens
{
active = true;
_Logo.Rect.Y = -270 + (270f / 3000f) * _LogoTimer.ElapsedMilliseconds;
_StarsRed.Rect.Y = _Logo.Rect.Y;
_StarsBlue.Rect.Y = _Logo.Rect.Y;
_Logo.Y = -270 + (270f / 3000f) * _LogoTimer.ElapsedMilliseconds;
_StarsRed.Y = _Logo.Y;
_StarsBlue.Y = _Logo.Y;
if (_LogoTimer.ElapsedMilliseconds >= 2000 && !_CreditsTimer.IsRunning)
_CreditsTimer.Start();
if (_LogoTimer.ElapsedMilliseconds >= 3000)
+2 -5
View File
@@ -161,15 +161,12 @@ namespace Vocaluxe.Screens
return true;
}
public override bool Draw()
public override void Draw()
{
_DrawBG();
if (_CurrentIntroVideo >= 0 && _CurrentIntroVideo < _Intros.Length)
_Intros[_CurrentIntroVideo].Draw();
_DrawFG();
return true;
base.Draw();
}
public override void OnClose()
+2 -38
View File
@@ -140,50 +140,14 @@ namespace Vocaluxe.Screens
return true;
}
// ReSharper disable RedundantOverridenMember
public override void OnShow()
{
base.OnShow();
//if (Snowflakes != null)
// Snowflakes.Resume();
}
// ReSharper restore RedundantOverridenMember
public override bool UpdateGame()
{
bool profileOK = CProfiles.NumProfiles > 0;
_Statics[_StaticWarningProfiles].Visible = !profileOK;
_Texts[_TextWarningProfiles].Visible = !profileOK;
_Buttons[_ButtonSing].Enabled = profileOK;
_Buttons[_ButtonParty].Enabled = profileOK;
_Buttons[_ButtonSing].Selectable = profileOK;
_Buttons[_ButtonParty].Selectable = profileOK;
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.Visible = false;
_ChooseAvatarStatic.Aspect = EAspect.Crop;
_AddStatic(_ChooseAvatarStatic);
CProfiles.AddProfileChangedCallback(_OnProfileChanged);
}
@@ -358,8 +359,8 @@ namespace Vocaluxe.Screens
//Update of Drag/Drop-Texture
CStatic selectedPlayer = _NameSelections[_NameSelection].TilePlayerAvatar(mouseEvent);
_ChooseAvatarStatic.Visible = true;
_ChooseAvatarStatic.Rect = selectedPlayer.Rect;
_ChooseAvatarStatic.Rect.Z = CSettings.ZNear;
_ChooseAvatarStatic.MaxRect = selectedPlayer.Rect;
_ChooseAvatarStatic.Z = CSettings.ZNear;
_ChooseAvatarStatic.Color = new SColorF(1, 1, 1, 1);
_ChooseAvatarStatic.Texture = selectedPlayer.Texture;
}
@@ -375,8 +376,8 @@ namespace Vocaluxe.Screens
//Update of Drag/Drop-Texture
CStatic selectedPlayer = _Statics[_StaticPlayerAvatar[i]];
_ChooseAvatarStatic.Visible = true;
_ChooseAvatarStatic.Rect = selectedPlayer.Rect;
_ChooseAvatarStatic.Rect.Z = CSettings.ZNear;
_ChooseAvatarStatic.MaxRect = selectedPlayer.Rect;
_ChooseAvatarStatic.Z = CSettings.ZNear;
_ChooseAvatarStatic.Color = new SColorF(1, 1, 1, 1);
_ChooseAvatarStatic.Texture = selectedPlayer.Texture;
break;
@@ -389,8 +390,8 @@ namespace Vocaluxe.Screens
if (mouseEvent.LBH && _SelectedProfileID >= 0 && !_SelectingFast)
{
//Update coords for Drag/Drop-Texture
_ChooseAvatarStatic.Rect.X += mouseEvent.X - _OldMouseX;
_ChooseAvatarStatic.Rect.Y += mouseEvent.Y - _OldMouseY;
_ChooseAvatarStatic.X += mouseEvent.X - _OldMouseX;
_ChooseAvatarStatic.Y += mouseEvent.Y - _OldMouseY;
_OldMouseX = mouseEvent.X;
_OldMouseY = mouseEvent.Y;
}
@@ -564,15 +565,6 @@ namespace Vocaluxe.Screens
base.OnClose();
CRecord.Stop();
}
public override bool Draw()
{
base.Draw();
if (_ChooseAvatarStatic.Visible)
_ChooseAvatarStatic.Draw();
return true;
}
#endregion public methods
#region private methods
-6
View File
@@ -122,11 +122,5 @@ namespace Vocaluxe.Screens
{
return true;
}
public override bool Draw()
{
base.Draw();
return true;
}
}
}
-6
View File
@@ -131,12 +131,6 @@ namespace Vocaluxe.Screens
return true;
}
public override bool Draw()
{
base.Draw();
return true;
}
private void _SaveConfig()
{
CLanguage.LanguageId = _SelectSlides[_SelectSlideLanguage].Selection;
-6
View File
@@ -113,12 +113,6 @@ namespace Vocaluxe.Screens
return true;
}
public override bool Draw()
{
base.Draw();
return true;
}
private void _SaveConfig()
{
CConfig.LyricsPosition = (ELyricsPosition)_SelectSlides[_SelectSlideLyricsPosition].Selection;
+6 -17
View File
@@ -253,6 +253,10 @@ namespace Vocaluxe.Screens
_Equalizers[_EqualizerChannel2].Reset();
}
bool showWarning = !_CheckMicConfig();
_Statics[_StaticWarning].Visible = showWarning;
_Texts[_TextWarning].Visible = showWarning;
return true;
}
@@ -297,20 +301,9 @@ namespace Vocaluxe.Screens
CBackgroundMusic.Disabled = true;
}
public override bool Draw()
public override void Draw()
{
_DrawBG();
if (!_CheckMicConfig())
{
_Statics[_StaticWarning].Visible = true;
_Texts[_TextWarning].Visible = true;
}
else
{
_Statics[_StaticWarning].Visible = false;
_Texts[_TextWarning].Visible = false;
}
base.Draw();
for (int i = 0; i < _StaticEnergyChannel.Length; i++)
{
@@ -326,10 +319,6 @@ namespace Vocaluxe.Screens
new SColorF(1f, 1f, 1f, 1f), rect);
}
}
_DrawFG();
return true;
}
public override void OnClose()
-6
View File
@@ -131,12 +131,6 @@ namespace Vocaluxe.Screens
return true;
}
public override bool Draw()
{
base.Draw();
return true;
}
public override void OnShow()
{
base.OnShow();
-7
View File
@@ -164,13 +164,6 @@ namespace Vocaluxe.Screens
return true;
}
public override bool Draw()
{
base.Draw();
return true;
}
public override void OnClose()
{
base.OnClose();
-7
View File
@@ -127,13 +127,6 @@ namespace Vocaluxe.Screens
return true;
}
public override bool Draw()
{
base.Draw();
return true;
}
private void _UpdateSelection()
{
if (_PartyModeInfos.Count == 0)
+21 -31
View File
@@ -56,7 +56,6 @@ namespace Vocaluxe.Screens
private int _Round;
private CPoints _Points;
private Stopwatch _Timer;
private bool _SlideShowBGAvailable;
public override void Init()
{
@@ -78,6 +77,7 @@ namespace Vocaluxe.Screens
_StaticPointsBarDrawnPoints = new double[CSettings.MaxNumPlayer];
_SlideShowBG = GetNewBackground();
_AddBackground(_SlideShowBG);
}
public override bool HandleInput(SKeyEvent keyEvent)
@@ -134,7 +134,7 @@ namespace Vocaluxe.Screens
_SetVisibility();
_UpdateRatings();
_SlideShowBGAvailable = _UpdateBackground();
_SlideShowBG.Visible = _UpdateBackground();
}
public override bool UpdateGame()
@@ -167,16 +167,16 @@ namespace Vocaluxe.Screens
var direction = (string)_ScreenSettings[_ScreenSettingAnimationDirection].GetValue();
if (direction.ToLower() == "vertical")
{
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.W = ((float)_StaticPointsBarDrawnPoints[p]) *
(_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.W / CSettings.MaxScore);
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].W = ((float)_StaticPointsBarDrawnPoints[p]) *
(_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].W / CSettings.MaxScore);
}
else
{
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H = ((float)_StaticPointsBarDrawnPoints[p]) *
(_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H / CSettings.MaxScore);
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.Y = _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H +
_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.Y -
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H;
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].H = ((float)_StaticPointsBarDrawnPoints[p]) *
(_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].H / CSettings.MaxScore);
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Y = _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].H +
_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Y -
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].H;
}
}
}
@@ -184,16 +184,6 @@ namespace Vocaluxe.Screens
return true;
}
public override bool Draw()
{
if (_SlideShowBGAvailable)
_SlideShowBG.Draw();
else
_DrawBG();
_DrawFG();
return true;
}
private static string _GetRating(double points)
{
string rating = String.Empty;
@@ -337,13 +327,13 @@ namespace Vocaluxe.Screens
_StaticPointsBarDrawnPoints[p] = 0.0;
if (pointAnimDirection.ToLower() == "vertical")
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.W = 0;
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].W = 0;
else
{
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H = 0;
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.Y = _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H +
_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.Y -
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H;
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].H = 0;
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Y = _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].H +
_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Y -
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].H;
}
if (CProfiles.IsProfileIDValid(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")
{
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.W = ((float)players[p].Points) *
(_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.W / CSettings.MaxScore);
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].W = ((float)players[p].Points) *
(_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].W / CSettings.MaxScore);
}
else
{
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H = ((float)players[p].Points) *
(_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H / CSettings.MaxScore);
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.Y = _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H +
_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.Y -
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H;
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].H = ((float)players[p].Points) *
(_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].H / CSettings.MaxScore);
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Y = _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].H +
_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Y -
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].H;
}
_StaticPointsBarDrawnPoints[p] = players[p].Points;
}
+3 -5
View File
@@ -456,7 +456,7 @@ namespace Vocaluxe.Screens
_LoadNextSong();
}
public override bool Draw()
public override void Draw()
{
if (_Active)
{
@@ -501,8 +501,6 @@ namespace Vocaluxe.Screens
_SingNotes[_SingBars].Draw(_NoteLines[i], CGame.Players[i].SungLines, i);
_DrawLyricHelper();
return true;
}
public override void OnClose()
@@ -1314,7 +1312,7 @@ namespace Vocaluxe.Screens
_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;
}
}
@@ -1325,7 +1323,7 @@ namespace Vocaluxe.Screens
switch (CConfig.TimerLook)
{
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;
break;
+10 -12
View File
@@ -92,7 +92,7 @@ namespace Vocaluxe.Screens
private int _SelectedSongID;
private int _SelectedCategoryIndex;
private CSongMenu _SongMenu;
private ISongMenu _SongMenu;
private CPlaylist _Playlist;
public CScreenSong()
@@ -229,7 +229,7 @@ namespace Vocaluxe.Screens
{
_PlaylistActive = !_PlaylistActive;
_Playlist.Selected = _PlaylistActive;
_SongMenu.Active = !_PlaylistActive;
_SongMenu.Selected = !_PlaylistActive;
}
break;
@@ -400,8 +400,8 @@ namespace Vocaluxe.Screens
if (_DragAndDropActive)
{
_DragAndDropCover.Rect.X += mouseEvent.X - _OldMousePosX;
_DragAndDropCover.Rect.Y += mouseEvent.Y - _OldMousePosY;
_DragAndDropCover.X += mouseEvent.X - _OldMousePosX;
_DragAndDropCover.Y += mouseEvent.Y - _OldMousePosY;
}
_OldMousePosX = mouseEvent.X;
_OldMousePosY = mouseEvent.Y;
@@ -410,14 +410,14 @@ namespace Vocaluxe.Screens
{
_PlaylistActive = true;
_Playlist.Selected = _PlaylistActive;
_SongMenu.Active = !_PlaylistActive;
_SongMenu.Selected = !_PlaylistActive;
_ToggleSongOptions(ESongOptionsView.None);
}
else if (CHelper.IsInBounds(_SongMenu.Rect, mouseEvent))
{
_PlaylistActive = false;
_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)
{
_DragAndDropCover = _SongMenu.GetSelectedSongCover();
_DragAndDropCover.Rect.Z = CSettings.ZNear;
_DragAndDropCover.Z = CSettings.ZNear;
_Playlist.DragAndDropSongID = CSongs.VisibleSongs[_SongMenu.GetSelectedSongNr()].ID;
_DragAndDropActive = true;
return true;
@@ -641,7 +641,7 @@ namespace Vocaluxe.Screens
if (_Sso.Selection.PartyMode)
_ToggleSongOptions(ESongOptionsView.None);
_SongMenu.Active = !_PlaylistActive;
_SongMenu.Selected = !_PlaylistActive;
_SongMenu.SmallView = _Playlist.Visible;
if (_Playlist.ActivePlaylistID != -1)
@@ -698,14 +698,12 @@ namespace Vocaluxe.Screens
return true;
}
public override bool Draw()
public override void Draw()
{
base.Draw();
if (_DragAndDropActive)
_DragAndDropCover.Draw();
return true;
}
public override void OnClose()
@@ -1279,7 +1277,7 @@ namespace Vocaluxe.Screens
_SongMenu.SmallView = false;
_PlaylistActive = false;
_Playlist.Selected = _PlaylistActive;
_SongMenu.Active = !_PlaylistActive;
_SongMenu.Selected = !_PlaylistActive;
_Playlist.ClosePlaylist();
}
}
+6 -1
View File
@@ -44,7 +44,7 @@ namespace VocaluxeLib.Menu
public SThemeColor Color;
}
public class CBackground : IMenuElement
public class CBackground : CMenuElementBase, IMenuElement, IThemeable
{
private readonly int _PartyModeID;
private SThemeBackground _Theme;
@@ -56,6 +56,11 @@ namespace VocaluxeLib.Menu
private CVideoStream _VideoStream;
public bool Selectable
{
get { return false; }
}
public SColorF Color;
public bool ThemeLoaded
{
+23 -27
View File
@@ -39,7 +39,7 @@ namespace VocaluxeLib.Menu
public SReflection SelReflection;
}
public class CButton : IMenuElement
public sealed class CButton : CMenuElementBase, IMenuElement, IThemeable
{
private SThemeButton _Theme;
private bool _ThemeLoaded;
@@ -47,7 +47,6 @@ namespace VocaluxeLib.Menu
public CTextureRef Texture;
public CTextureRef SelTexture;
public SRectF Rect;
public SColorF Color;
public SColorF SelColor;
@@ -75,27 +74,24 @@ namespace VocaluxeLib.Menu
}
}
private bool _Selected;
public bool Selected
public override bool Selected
{
get { return _Selected; }
set
{
_Selected = value;
base.Selected = value;
Text.Selected = value;
}
}
public bool Visible = true;
private bool _Enabled = true;
private bool _Selectable = true;
public bool Enabled
public bool Selectable
{
get { return _Enabled; }
get { return _Selectable; }
set
{
_Enabled = value;
if (!_Enabled)
_Selected = false;
_Selectable = value;
if (!_Selectable)
Selected = false;
}
}
@@ -141,7 +137,7 @@ namespace VocaluxeLib.Menu
SkinSelected = button._Theme.SkinSelected
};
Rect = button.Rect;
MaxRect = button.MaxRect;
Color = button.Color;
SelColor = button.Color;
Texture = button.Texture;
@@ -151,7 +147,7 @@ namespace VocaluxeLib.Menu
_SelText = _SelText == null ? null : new CText(button._SelText);
Selected = false;
EditMode = false;
_Enabled = button._Enabled;
_Selectable = button._Selectable;
_Reflection = button._Reflection;
_ReflectionHeight = button._ReflectionHeight;
@@ -248,14 +244,14 @@ namespace VocaluxeLib.Menu
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;
CTextureRef texture;
if (!Selected && !Pressed || !_Enabled)
if (!Selected && !Pressed || !_Selectable)
{
texture = Texture ?? CBase.Themes.GetSkinTexture(_Theme.Skin, _PartyModeID);
@@ -323,7 +319,7 @@ namespace VocaluxeLib.Menu
_Theme.Color.Get(_PartyModeID, out Color);
_Theme.SelColor.Get(_PartyModeID, out SelColor);
Rect = _Theme.Rect;
MaxRect = _Theme.Rect;
_Reflection = _Theme.Reflection.Enabled;
if (_Reflection)
@@ -357,8 +353,8 @@ namespace VocaluxeLib.Menu
#region ThemeEdit
public void MoveElement(int stepX, int stepY)
{
Rect.X += stepX;
Rect.Y += stepY;
X += stepX;
Y += stepY;
_Theme.Rect.X += stepX;
_Theme.Rect.Y += stepY;
@@ -366,13 +362,13 @@ namespace VocaluxeLib.Menu
public void ResizeElement(int stepW, int stepH)
{
Rect.W += stepW;
if (Rect.W <= 0)
Rect.W = 1;
W += stepW;
if (W <= 0)
W = 1;
Rect.H += stepH;
if (Rect.H <= 0)
Rect.H = 1;
H += stepH;
if (H <= 0)
H = 1;
_Theme.Rect.W = Rect.W;
_Theme.Rect.H = Rect.H;
+15 -20
View File
@@ -45,13 +45,12 @@ namespace VocaluxeLib.Menu
public SReflection Reflection;
}
public class CEqualizer : IMenuElement
public class CEqualizer : CMenuElementBase, IMenuElement, IThemeable
{
private readonly int _PartyModeID;
private SThemeEqualizer _Theme;
private bool _ThemeLoaded;
public SRectF Rect;
public SColorF Color;
public SColorF MaxColor;
public float Space;
@@ -60,9 +59,6 @@ namespace VocaluxeLib.Menu
public float ReflectionSpace;
public float ReflectionHeight;
public bool Selected;
public bool Visible;
public string GetThemeName()
{
return _Theme.Name;
@@ -77,19 +73,20 @@ namespace VocaluxeLib.Menu
private int _MaxBar;
private float _MaxVolume;
public bool Selectable
{
get { return false; }
}
public CEqualizer(int partyModeID)
{
_PartyModeID = partyModeID;
_Theme = new SThemeEqualizer();
_ThemeLoaded = false;
Rect = new SRectF();
Color = new SColorF();
MaxColor = new SColorF();
Selected = false;
Visible = true;
Reflection = false;
ReflectionSpace = 0f;
ReflectionHeight = 0f;
@@ -100,8 +97,6 @@ namespace VocaluxeLib.Menu
_PartyModeID = partyModeID;
_Theme = theme;
Visible = true;
LoadSkin();
}
@@ -247,7 +242,7 @@ namespace VocaluxeLib.Menu
_Theme.Color.Get(_PartyModeID, out Color);
_Theme.MaxColor.Get(_PartyModeID, out MaxColor);
Rect = _Theme.Rect;
MaxRect = _Theme.Rect;
Space = _Theme.Space;
Reflection = _Theme.Reflection.Enabled;
if (Reflection)
@@ -275,8 +270,8 @@ namespace VocaluxeLib.Menu
#region ThemeEdit
public void MoveElement(int stepX, int stepY)
{
Rect.X += stepX;
Rect.Y += stepY;
X += stepX;
Y += stepY;
_Theme.Rect.X += stepX;
_Theme.Rect.Y += stepY;
@@ -284,15 +279,15 @@ namespace VocaluxeLib.Menu
public void ResizeElement(int stepW, int stepH)
{
Rect.W += stepW;
if (Rect.W <= 0)
Rect.W = 1;
W += stepW;
if (W <= 0)
W = 1;
_Theme.Rect.W = Rect.W;
Rect.H += stepH;
if (Rect.H <= 0)
Rect.H = 1;
H += stepH;
if (H <= 0)
H = 1;
_Theme.Rect.H = Rect.H;
}
+25 -51
View File
@@ -33,7 +33,7 @@ namespace VocaluxeLib.Menu
public SThemeColor SColor;
}
public class CLyric : IMenuElement
public class CLyric : CMenuElementBase, IMenuElement, IThemeable
{
private readonly int _PartyModeID;
private SThemeLyrics _Theme;
@@ -45,18 +45,17 @@ namespace VocaluxeLib.Menu
private CSongLine _Line;
private CText _Text;
private float _X;
private float _Y;
private float _MaxW;
private float _Z;
private float _H;
private float _Width;
private float _Alpha = 1f;
private float _CurrentBeat = -1;
public bool Selectable
{
get { return false; }
}
public string GetThemeName()
{
return _Theme.Name;
@@ -67,25 +66,9 @@ namespace VocaluxeLib.Menu
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 _ColorProcessed;
public bool Selected;
public bool Visible = true;
public float Alpha
{
get { return _Alpha; }
@@ -106,12 +89,6 @@ namespace VocaluxeLib.Menu
_Color = new SColorF();
_ColorProcessed = new SColorF();
_X = 0f;
_Y = 0f;
_Z = 0f;
_MaxW = 1f;
_H = 1f;
_Width = 1f;
_Line = new CSongLine();
_Text = new CText(_PartyModeID);
@@ -169,7 +146,6 @@ namespace VocaluxeLib.Menu
_Theme.Color.Color = _Color;
_Theme.SColor.Color = _ColorProcessed;
LoadSkin();
_Text = new CText(_X, _Y, _Z, _H, _MaxW, EAlignment.Left, EStyle.Bold, "Normal", _Color, String.Empty);
}
return _ThemeLoaded;
}
@@ -198,7 +174,7 @@ namespace VocaluxeLib.Menu
public float GetCurrentLyricPosX()
{
return _X - _Width / 2;
return X - _Width / 2;
}
public void Update(float currentBeat)
@@ -234,7 +210,7 @@ namespace VocaluxeLib.Menu
private void _DrawSlide()
{
float x = _X - _Width / 2;
float x = X - _Width / 2;
foreach (CSongNote note in _Line.Notes)
{
@@ -275,7 +251,7 @@ namespace VocaluxeLib.Menu
private void _DrawZoom()
{
float x = _X - _Width / 2; // most left position
float x = X - _Width / 2; // most left position
//find last active note
int lastNote = _Line.FindPreviousNote((int)_CurrentBeat);
@@ -356,7 +332,7 @@ namespace VocaluxeLib.Menu
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)
{
@@ -381,7 +357,7 @@ namespace VocaluxeLib.Menu
private void _DrawJump()
{
float x = _X - _Width / 2; // most left position
float x = X - _Width / 2; // most left position
//find last active note
int lastNote = _Line.FindPreviousNote((int)_CurrentBeat);
@@ -455,8 +431,8 @@ namespace VocaluxeLib.Menu
_Theme.Color.Get(_PartyModeID, out _Color);
_Theme.SColor.Get(_PartyModeID, out _ColorProcessed);
Rect = _Theme.Rect;
_Text = new CText(_X, _Y, _Z, _H, _MaxW, EAlignment.Left, EStyle.Bold, "Normal", _Color, String.Empty);
MaxRect = _Theme.Rect;
_Text = new CText(X, Y, Z, H, W, EAlignment.Left, EStyle.Bold, "Normal", _Color, String.Empty);
}
public void ReloadSkin()
@@ -473,26 +449,24 @@ namespace VocaluxeLib.Menu
#region ThemeEdit
public void MoveElement(int stepX, int stepY)
{
SRectF rect = Rect;
rect.X += stepX;
rect.Y += stepY;
Rect = rect;
_Theme.Rect = rect;
X += stepX;
Y += stepY;
_Theme.Rect.X += stepX;
_Theme.Rect.Y += stepY;
}
public void ResizeElement(int stepW, int stepH)
{
SRectF rect = Rect;
rect.W += stepW;
if (rect.W <= 0)
rect.W = 1;
W += stepW;
if (W <= 0)
W = 1;
rect.H += stepH;
if (rect.H <= 0)
rect.H = 1;
H += stepH;
if (H <= 0)
H = 1;
Rect = rect;
_Theme.Rect = rect;
_Theme.Rect.W = Rect.W;
_Theme.Rect.H = Rect.H;
}
#endregion ThemeEdit
}
+27 -18
View File
@@ -81,6 +81,7 @@ namespace VocaluxeLib.Menu
protected string[] _ThemePlaylists;
protected string[] _ThemeParticleEffects;
protected string[] _ThemeScreenSettings;
protected readonly Dictionary<string, CScreenSetting> _ScreenSettings = new Dictionary<string, CScreenSetting>();
// ReSharper restore MemberCanBePrivate.Global
@@ -117,9 +118,15 @@ namespace VocaluxeLib.Menu
}
#region ThemeHandler
protected override void _ClearElements()
{
base._ClearElements();
_ScreenSettings.Clear();
}
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)
{
@@ -198,7 +205,7 @@ namespace VocaluxeLib.Menu
_AddSingNote(new CSingNotesClassic(sb, PartyModeID), sb.Name);
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)
_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)
{
string file = Path.Combine(xmlPath, ThemeName + ".xml");
@@ -247,7 +259,15 @@ namespace VocaluxeLib.Menu
_LoadThemeElement<CText>(_ThemeTexts, _AddText, xmlReader);
_LoadThemeElement<CButton>(_ThemeButtons, _AddButton, 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<CSingNotesClassic>(_ThemeSingNotes, _AddSingNote, xmlReader);
_LoadThemeElement<CNameSelection>(_ThemeNameSelections, _AddNameSelection, xmlReader);
@@ -293,7 +313,7 @@ namespace VocaluxeLib.Menu
Theme.ParticleEffects.Add(el.GetTheme());
foreach (CPlaylist el in _Playlists)
Theme.Playlists.Add(el.GetTheme());
foreach (CScreenSetting el in _ScreenSettings)
foreach (CScreenSetting el in _ScreenSettings.Values)
Theme.ScreenSettings.Add(el.GetTheme());
foreach (CSelectSlide el in _SelectSlides)
Theme.SelectSlides.Add(el.GetTheme());
@@ -301,7 +321,7 @@ namespace VocaluxeLib.Menu
Theme.Statics.Add(el.GetTheme());
foreach (CText el in _Texts)
Theme.Texts.Add(el.GetTheme());
foreach (CSongMenu el in _SongMenus)
foreach (CSongMenuFramework el in _SongMenus)
Theme.SongMenus.Add(el.GetTheme());
foreach (CSingNotes el in _SingNotes)
Theme.SingNotes.Add(el.GetTheme());
@@ -342,7 +362,7 @@ namespace VocaluxeLib.Menu
foreach (CSelectSlide slide in _SelectSlides)
slide.ReloadSkin();
foreach (CSongMenu sm in _SongMenus)
foreach (CSongMenuFramework sm in _SongMenus)
sm.ReloadSkin();
foreach (CLyric lyric in _Lyrics)
@@ -362,9 +382,6 @@ namespace VocaluxeLib.Menu
foreach (CParticleEffect pe in _ParticleEffects)
pe.ReloadSkin();
foreach (CScreenSetting se in _ScreenSettings)
se.ReloadSkin();
}
public virtual void UnloadSkin()
@@ -384,7 +401,7 @@ namespace VocaluxeLib.Menu
foreach (CSelectSlide slide in _SelectSlides)
slide.UnloadSkin();
foreach (CSongMenu sm in _SongMenus)
foreach (CSongMenuFramework sm in _SongMenus)
sm.UnloadSkin();
foreach (CLyric lyric in _Lyrics)
@@ -404,9 +421,6 @@ namespace VocaluxeLib.Menu
foreach (CParticleEffect pe in _ParticleEffects)
pe.UnloadSkin();
foreach (CScreenSetting se in _ScreenSettings)
se.UnloadSkin();
}
public virtual void ReloadTheme(string xmlPath)
@@ -478,11 +492,6 @@ namespace VocaluxeLib.Menu
return new CSelectSlide(slide);
}
public CSongMenu GetNewSongMenu()
{
return new CSongMenu(PartyModeID);
}
public CLyric GetNewLyric()
{
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.Visible = false;
_ChooseAvatarStatic.Aspect = EAspect.Crop;
_AddStatic(_ChooseAvatarStatic);
CBase.Profiles.AddProfileChangedCallback(_OnProfileChanged);
}
@@ -379,8 +380,8 @@ namespace VocaluxeLib.Menu
//Update of Drag/Drop-Texture
CStatic selectedPlayer = _NameSelections[_NameSelection].TilePlayerAvatar(mouseEvent);
_ChooseAvatarStatic.Visible = true;
_ChooseAvatarStatic.Rect = selectedPlayer.Rect;
_ChooseAvatarStatic.Rect.Z = CBase.Settings.GetZNear();
_ChooseAvatarStatic.MaxRect = selectedPlayer.Rect;
_ChooseAvatarStatic.Z = CBase.Settings.GetZNear();
_ChooseAvatarStatic.Color = new SColorF(1, 1, 1, 1);
_ChooseAvatarStatic.Texture = selectedPlayer.Texture;
}
@@ -390,8 +391,8 @@ namespace VocaluxeLib.Menu
if (mouseEvent.LBH && _SelectedProfileID >= 0 && !_SelectingFast)
{
//Update coords for Drag/Drop-Texture
_ChooseAvatarStatic.Rect.X += mouseEvent.X - _OldMouseX;
_ChooseAvatarStatic.Rect.Y += mouseEvent.Y - _OldMouseY;
_ChooseAvatarStatic.X += mouseEvent.X - _OldMouseX;
_ChooseAvatarStatic.Y += mouseEvent.Y - _OldMouseY;
_OldMouseX = mouseEvent.X;
_OldMouseY = mouseEvent.Y;
}
@@ -554,16 +555,6 @@ namespace VocaluxeLib.Menu
_UpdateButtonState();
}
public override bool Draw()
{
base.Draw();
if (_ChooseAvatarStatic.Visible)
_ChooseAvatarStatic.Draw();
return true;
}
public abstract void Back();
public abstract void Next();
@@ -711,17 +702,17 @@ namespace VocaluxeLib.Menu
private void _UpdateButtonState()
{
_Buttons[_ButtonIncreaseTeams].Enabled = _NumTeams < _PartyMode.GetMaxTeams();
_Buttons[_ButtonDecreaseTeams].Enabled = _NumTeams > _PartyMode.GetMinTeams();
_Buttons[_ButtonIncreaseTeams].Selectable = _NumTeams < _PartyMode.GetMaxTeams();
_Buttons[_ButtonDecreaseTeams].Selectable = _NumTeams > _PartyMode.GetMinTeams();
if (_NumPlayerTeams != null && _NumPlayerTeams.Length > _CurrentTeam)
{
_Buttons[_ButtonIncreasePlayer].Enabled = _NumPlayerTeams[_CurrentTeam] < _PartyMode.GetMaxPlayerPerTeam();
_Buttons[_ButtonDecreasePlayer].Enabled = _NumPlayerTeams[_CurrentTeam] > _PartyMode.GetMinPlayerPerTeam();
_Buttons[_ButtonIncreasePlayer].Selectable = _NumPlayerTeams[_CurrentTeam] < _PartyMode.GetMaxPlayerPerTeam();
_Buttons[_ButtonDecreasePlayer].Selectable = _NumPlayerTeams[_CurrentTeam] > _PartyMode.GetMinPlayerPerTeam();
}
else
{
_Buttons[_ButtonIncreasePlayer].Enabled = false;
_Buttons[_ButtonDecreasePlayer].Enabled = false;
_Buttons[_ButtonIncreasePlayer].Selectable = false;
_Buttons[_ButtonDecreasePlayer].Selectable = false;
}
}
+22 -27
View File
@@ -56,7 +56,7 @@ namespace VocaluxeLib.Menu
public SThemeColor Color;
}
public class CNameSelection : IMenuElement
public class CNameSelection : CMenuElementBase, IMenuElement, IThemeable
{
private class CTile
{
@@ -86,10 +86,6 @@ namespace VocaluxeLib.Menu
get { return _ThemeLoaded; }
}
public bool Selected;
public bool Visible = true;
public SRectF Rect;
private readonly List<CTile> _Tiles;
private CTextureRef _TextureEmptyTile;
@@ -113,12 +109,15 @@ namespace VocaluxeLib.Menu
private CStatic _PlayerSelector;
public bool Selectable
{
get { return Visible; }
}
public CNameSelection(int partyModeID)
{
_PartyModeID = partyModeID;
_Theme = new SThemeNameSelection();
_Theme.Tiles = new SThemeNameSelectionTiles();
_Theme.Tiles.Name = new SThemeNameSelectionName();
_Theme = new SThemeNameSelection {Tiles = new SThemeNameSelectionTiles {Name = new SThemeNameSelectionName()}};
_Tiles = new List<CTile>();
_VisibleProfiles = new List<int>();
@@ -141,12 +140,8 @@ namespace VocaluxeLib.Menu
{
_PrepareTiles();
_PlayerSelector = new CStatic(_PartyModeID)
{
Texture = _TextureTileSelected,
Rect = new SRectF(0, 0, _Theme.Tiles.W + 6, _Theme.Tiles.H + 6, Rect.Z - 0.5f),
Visible = false
};
_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;
_UpdateVisibleProfiles();
@@ -224,8 +219,8 @@ namespace VocaluxeLib.Menu
//Update PlayerSelector-Coords
if (_Player > -1 && _ActualSelection == i)
{
_PlayerSelector.Rect.X = tile.Avatar.Rect.X - 3;
_PlayerSelector.Rect.Y = tile.Avatar.Rect.Y - 3;
_PlayerSelector.X = tile.Avatar.Rect.X - 3;
_PlayerSelector.Y = tile.Avatar.Rect.Y - 3;
}
}
@@ -432,7 +427,7 @@ namespace VocaluxeLib.Menu
_Theme.ColorEmptyTile.Get(_PartyModeID, out _ColorEmptyTile);
_Theme.Tiles.Name.Color.Get(_PartyModeID, out _ColorNameTile);
Rect = _Theme.Rect;
MaxRect = _Theme.Rect;
}
public void ReloadSkin()
@@ -529,8 +524,8 @@ namespace VocaluxeLib.Menu
#region ThemeEdit
public void MoveElement(int stepX, int stepY)
{
Rect.X += stepX;
Rect.Y += stepY;
X += stepX;
Y += stepY;
_Theme.Rect.X += stepX;
_Theme.Rect.Y += stepY;
@@ -538,16 +533,16 @@ namespace VocaluxeLib.Menu
public void ResizeElement(int stepW, int stepH)
{
Rect.W += stepW;
if (Rect.W <= 0)
Rect.W = 1;
W += stepW;
if (W <= 0)
W = 1;
Rect.H += stepH;
if (Rect.H <= 0)
Rect.H = 1;
H += stepH;
if (H <= 0)
H = 1;
_Theme.Rect.W = Rect.W;
_Theme.Rect.H = Rect.H;
_Theme.Rect.W = W;
_Theme.Rect.H = H;
}
#endregion ThemeEdit
}
+96 -462
View File
@@ -32,9 +32,6 @@ namespace VocaluxeLib.Menu
private int _PrevMouseX;
private int _PrevMouseY;
protected int _MouseDX;
protected int _MouseDY;
protected bool _Active;
protected readonly COrderedDictionaryLite<CButton> _Buttons;
@@ -42,30 +39,28 @@ namespace VocaluxeLib.Menu
protected readonly COrderedDictionaryLite<CBackground> _Backgrounds;
protected readonly COrderedDictionaryLite<CStatic> _Statics;
protected readonly COrderedDictionaryLite<CSelectSlide> _SelectSlides;
protected readonly COrderedDictionaryLite<CSongMenu> _SongMenus;
protected readonly COrderedDictionaryLite<ISongMenu> _SongMenus;
protected readonly COrderedDictionaryLite<CLyric> _Lyrics;
protected readonly COrderedDictionaryLite<CSingNotes> _SingNotes;
protected readonly COrderedDictionaryLite<CNameSelection> _NameSelections;
protected readonly COrderedDictionaryLite<CEqualizer> _Equalizers;
protected readonly COrderedDictionaryLite<CPlaylist> _Playlists;
protected readonly COrderedDictionaryLite<CParticleEffect> _ParticleEffects;
protected readonly COrderedDictionaryLite<CScreenSetting> _ScreenSettings;
public CObjectInteractions()
protected CObjectInteractions()
{
_Backgrounds = new COrderedDictionaryLite<CBackground>(this);
_Buttons = new COrderedDictionaryLite<CButton>(this);
_Texts = new COrderedDictionaryLite<CText>(this);
_Statics = new COrderedDictionaryLite<CStatic>(this);
_SelectSlides = new COrderedDictionaryLite<CSelectSlide>(this);
_SongMenus = new COrderedDictionaryLite<CSongMenu>(this);
_SongMenus = new COrderedDictionaryLite<ISongMenu>(this);
_Lyrics = new COrderedDictionaryLite<CLyric>(this);
_SingNotes = new COrderedDictionaryLite<CSingNotes>(this);
_NameSelections = new COrderedDictionaryLite<CNameSelection>(this);
_Equalizers = new COrderedDictionaryLite<CEqualizer>(this);
_Playlists = new COrderedDictionaryLite<CPlaylist>(this);
_ParticleEffects = new COrderedDictionaryLite<CParticleEffect>(this);
_ScreenSettings = new COrderedDictionaryLite<CScreenSetting>(this);
}
public virtual void Init()
@@ -75,13 +70,11 @@ namespace VocaluxeLib.Menu
_PrevMouseX = 0;
_PrevMouseY = 0;
_MouseDX = 0;
_MouseDY = 0;
_Active = false;
}
protected void _ClearElements()
protected virtual void _ClearElements()
{
_Interactions.Clear();
_Backgrounds.Clear();
@@ -96,7 +89,6 @@ namespace VocaluxeLib.Menu
_Equalizers.Clear();
_Playlists.Clear();
_ParticleEffects.Clear();
_ScreenSettings.Clear();
}
#region MenuHandler
@@ -149,8 +141,8 @@ namespace VocaluxeLib.Menu
ProcessMouseMove(mouseEvent.X, mouseEvent.Y);
if (selection != _Selection)
{
_UnsetHighlighted(selection);
_SetHighlighted(_Selection);
_GetElement(selection).Highlighted = false;
_GetElement(_Selection).Highlighted = true;
}
if (mouseEvent.LB)
@@ -164,7 +156,7 @@ namespace VocaluxeLib.Menu
public virtual bool HandleInputThemeEditor(SKeyEvent keyEvent)
{
_UnsetHighlighted(_Selection);
_GetElement(_Selection).Highlighted = false;
if (!keyEvent.KeyPressed)
{
switch (keyEvent.Key)
@@ -213,9 +205,9 @@ namespace VocaluxeLib.Menu
public virtual bool HandleMouseThemeEditor(SMouseEvent mouseEvent)
{
_UnsetHighlighted(_Selection);
_MouseDX = mouseEvent.X - _PrevMouseX;
_MouseDY = mouseEvent.Y - _PrevMouseY;
_GetElement(_Selection).Highlighted = false;
int mouseDX = mouseEvent.X - _PrevMouseX;
int mouseDY = mouseEvent.Y - _PrevMouseY;
int stepX = 0;
int stepY = 0;
@@ -235,7 +227,7 @@ namespace VocaluxeLib.Menu
if (mouseEvent.X - _PrevMouseX <= -5)
stepX -= 5;
_PrevMouseX = mouseEvent.X - (_MouseDX - stepX);
_PrevMouseX = mouseEvent.X - (mouseDX - stepX);
}
while (Math.Abs(mouseEvent.Y - _PrevMouseY) >= 5)
@@ -246,7 +238,7 @@ namespace VocaluxeLib.Menu
if (mouseEvent.Y - _PrevMouseY <= -5)
stepY -= 5;
_PrevMouseY = mouseEvent.Y - (_MouseDY - stepY);
_PrevMouseY = mouseEvent.Y - (mouseDY - stepY);
}
}
@@ -258,13 +250,13 @@ namespace VocaluxeLib.Menu
_MoveElement(stepX, stepY);
if (mouseEvent.Mod == EModifier.Ctrl)
_MoveElement(_MouseDX, _MouseDY);
_MoveElement(mouseDX, mouseDY);
if (mouseEvent.Mod == EModifier.Shift)
_ResizeElement(stepX, stepY);
if (mouseEvent.Mod == (EModifier.Shift | EModifier.Ctrl))
_ResizeElement(_MouseDX, _MouseDY);
_ResizeElement(mouseDX, mouseDY);
//}
}
else
@@ -274,12 +266,48 @@ namespace VocaluxeLib.Menu
}
#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
public virtual bool Draw()
public virtual void Draw()
{
_DrawBG();
_DrawFG();
return true;
}
protected void _DrawBG()
@@ -341,7 +369,7 @@ namespace VocaluxeLib.Menu
_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);
}
@@ -375,11 +403,6 @@ namespace VocaluxeLib.Menu
{
_AddInteraction(_ParticleEffects.Add(pe, key), EType.ParticleEffect);
}
protected void _AddScreenSetting(CScreenSetting se, String key = null)
{
_ScreenSettings.Add(se, key);
}
#endregion Element-Adding
#region InteractionHandling
@@ -429,10 +452,10 @@ namespace VocaluxeLib.Menu
continue;
if (_Buttons[_Interactions[i].Num] == button)
{
_UnsetSelected();
_UnsetHighlighted(_Selection);
_GetElement(_Selection).Selected = false;
_GetElement(_Selection).Highlighted = false;
_Selection = i;
_SetSelected();
_GetElement(_Selection).Selected = true;
return;
}
}
@@ -448,10 +471,10 @@ namespace VocaluxeLib.Menu
continue;
if (_SelectSlides[_Interactions[i].Num] == slide)
{
_UnsetSelected();
_UnsetHighlighted(_Selection);
_GetElement(_Selection).Selected = false;
_GetElement(_Selection).Highlighted = false;
_Selection = i;
_SetSelected();
_GetElement(_Selection).Selected = true;
return;
}
}
@@ -488,16 +511,17 @@ namespace VocaluxeLib.Menu
float z = CBase.Settings.GetZFar();
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;
if (!_IsMouseOverElement(x, y, _Interactions[i]))
continue;
if (_GetZValue(_Interactions[i]) > z)
continue;
z = _GetZValue(_Interactions[i]);
_UnsetSelected();
_GetElement(_Selection).Selected = false;
_Selection = i;
_GetElement(_Selection).Selected = true;
_Selection = i;
_SetSelected();
}
}
@@ -529,30 +553,8 @@ namespace VocaluxeLib.Menu
private float _GetZValue(CInteraction interact)
{
switch (interact.Type)
{
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();
IMenuElement el = _GetElement(interact);
return el != null ? el.Rect.Z : CBase.Settings.GetZFar();
}
private float _GetZValue(int interaction)
@@ -562,7 +564,7 @@ namespace VocaluxeLib.Menu
private void _NextInteraction()
{
_UnsetSelected();
_GetElement(_Selection).Selected = false;
if (CBase.Settings.GetProgramState() != EProgramState.EditTheme)
{
bool found = false;
@@ -573,7 +575,7 @@ namespace VocaluxeLib.Menu
if (start > _Interactions.Count - 1)
start = 0;
if ((start == _Selection) || (!_Interactions[start].ThemeEditorOnly && _IsVisible(start) && _IsEnabled(start)))
if ((start == _Selection) || (!_Interactions[start].ThemeEditorOnly && _IsVisible(start) && _IsSelectable(start)))
found = true;
} while (!found);
_Selection = start;
@@ -584,12 +586,12 @@ namespace VocaluxeLib.Menu
if (_Selection > _Interactions.Count - 1)
_Selection = 0;
}
_SetSelected();
_GetElement(_Selection).Selected = true;
}
private void _PrevInteraction()
{
_UnsetSelected();
_GetElement(_Selection).Selected = false;
if (CBase.Settings.GetProgramState() != EProgramState.EditTheme)
{
bool found = false;
@@ -600,7 +602,7 @@ namespace VocaluxeLib.Menu
if (start < 0)
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;
} while (!found);
_Selection = start;
@@ -611,7 +613,7 @@ namespace VocaluxeLib.Menu
if (_Selection < 0)
_Selection = _Interactions.Count - 1;
}
_SetSelected();
_GetElement(_Selection).Selected = true;
}
/// <summary>
@@ -673,12 +675,11 @@ namespace VocaluxeLib.Menu
// select the new element
if (directions[direction].Key == key.Key)
{
_UnsetHighlighted(_Selection);
_UnsetSelected();
_GetElement(_Selection).Selected = false;
_GetElement(_Selection).Highlighted = false;
_Selection = element;
_SetSelected();
_SetHighlighted(_Selection);
_GetElement(_Selection).Selected = true;
_GetElement(_Selection).Highlighted = true;
return true;
}
@@ -695,7 +696,7 @@ namespace VocaluxeLib.Menu
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);
float dist = _GetDistanceDirect(key, actualRect, targetRect);
@@ -712,7 +713,7 @@ namespace VocaluxeLib.Menu
{
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);
float dist = _GetDistance180(key, actualRect, targetRect);
@@ -746,7 +747,7 @@ namespace VocaluxeLib.Menu
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);
float dist = _GetDistance180(key, actualRect, targetRect);
@@ -762,7 +763,7 @@ namespace VocaluxeLib.Menu
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 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;
}
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 dest = new PointF(targetRect.X + targetRect.W / 2f, targetRect.Y + targetRect.H / 2f);
@@ -854,267 +855,22 @@ namespace VocaluxeLib.Menu
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)
{
if (_Selection >= _Interactions.Count || _Selection < 0)
return false;
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;
IMenuElement el = _GetElement(interaction);
return el != null && el.Visible;
}
private bool _IsEnabled(int interaction)
private bool _IsSelectable(int interaction)
{
if (_Selection >= _Interactions.Count || _Selection < 0)
return false;
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;
IMenuElement el = _GetElement(interaction);
return el != null && el.Selectable;
}
private SRectF _GetRect(CInteraction interaction)
{
var result = new SRectF();
switch (interaction.Type)
{
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;
IMenuElement el = _GetElement(interaction);
return el.Rect;
}
private SRectF _GetRect(int interaction)
@@ -1126,153 +882,31 @@ namespace VocaluxeLib.Menu
{
_Interactions.Add(new CInteraction(num, type));
if (!_Interactions[_Selection].ThemeEditorOnly)
_SetSelected();
_GetElement(_Selection).Selected = true;
else
_NextInteraction();
}
private void _DrawInteraction(int interaction)
{
switch (_Interactions[interaction].Type)
{
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;
}
IMenuElement el = _GetElement(interaction);
el.Draw();
}
#endregion InteractionHandling
#region Theme Handling
private void _MoveElement(int stepX, int stepY)
{
if (_Interactions.Count <= 0)
return;
switch (_Interactions[_Selection].Type)
{
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;
}
IMenuElement el = _GetElement(_Selection);
if (el != null)
el.MoveElement(stepX, stepY);
}
private void _ResizeElement(int stepW, int stepH)
{
if (_Interactions.Count <= 0)
return;
switch (_Interactions[_Selection].Type)
{
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;
}
IMenuElement el = _GetElement(_Selection);
if (el != null)
el.ResizeElement(stepW, stepH);
}
#endregion Theme Handling
}
-344
View File
@@ -16,36 +16,11 @@
#endregion
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
}
class CParticle
{
#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));
}
}
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
public class CPlaylist : CObjectInteractions, IMenuElement
public class CPlaylist : CObjectInteractions, IMenuElement, IThemeable
{
private class CPlaylistElementContent
{
@@ -120,20 +120,14 @@ namespace VocaluxeLib.Menu
int diffX = posX - oldPosX;
int diffY = posY - oldPosY;
Cover.Rect.X += diffX;
Cover.Rect.Y += diffY;
Cover.X += diffX;
Cover.Y += diffY;
Background.Rect.X += diffX;
Background.Rect.Y += diffY;
Background.X += diffX;
Background.Y += diffY;
SelectSlide.Rect.X += diffX;
SelectSlide.Rect.Y += diffY;
SelectSlide.RectArrowLeft.X += diffX;
SelectSlide.RectArrowLeft.Y += diffY;
SelectSlide.RectArrowRight.X += diffX;
SelectSlide.RectArrowRight.Y += diffY;
SelectSlide.X += diffX;
SelectSlide.Y += diffY;
Text1.X += diffX;
Text1.Y += diffY;
@@ -158,7 +152,6 @@ namespace VocaluxeLib.Menu
private readonly List<CPlaylistElementContent> _PlaylistElementContents = new List<CPlaylistElementContent>();
private SRectF _CompleteRect;
public SRectF Rect;
private SColorF _BackgroundColor;
private SColorF _BackgroundSelColor;
@@ -172,9 +165,18 @@ namespace VocaluxeLib.Menu
private readonly CStatic _StaticPlaylistHeader;
private readonly CStatic _StaticPlaylistFooter;
public bool Visible;
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
{
get { return _Selected; }
@@ -329,13 +331,14 @@ namespace VocaluxeLib.Menu
return _ThemeLoaded;
}
public override bool Draw()
public override void Draw()
{
if (_PlaylistElements.Count <= 0)
LoadPlaylist(0);
if (!Visible && CBase.Settings.GetProgramState() != EProgramState.EditTheme)
return true;
return;
base.Draw();
for (int i = 0; i < _PlaylistElements.Count; i++)
{
if (i == _CurrentPlaylistElement && _Selected)
@@ -352,7 +355,6 @@ namespace VocaluxeLib.Menu
if (_ChangeOrderElement != null)
_ChangeOrderElement.Draw();
return base.Draw();
}
public bool IsMouseOver(SMouseEvent mouseEvent)
@@ -381,7 +383,7 @@ namespace VocaluxeLib.Menu
_Theme.ColorBackground.Get(_PartyModeID, out _BackgroundColor);
_Theme.SelColorBackground.Get(_PartyModeID, out _BackgroundSelColor);
Rect = _Theme.Rect;
MaxRect = _Theme.Rect;
_Text1.LoadSkin();
_ButtonPlaylistClose.LoadSkin();
@@ -871,11 +873,9 @@ namespace VocaluxeLib.Menu
return true;
_ChangeOrderElement = new CPlaylistElement(_PlaylistElements[_CurrentPlaylistElement]);
_ChangeOrderElement.Background.Rect.Z = CBase.Settings.GetZNear();
_ChangeOrderElement.Cover.Rect.Z = CBase.Settings.GetZNear();
_ChangeOrderElement.SelectSlide.Rect.Z = CBase.Settings.GetZNear();
_ChangeOrderElement.SelectSlide.RectArrowLeft.Z = CBase.Settings.GetZNear();
_ChangeOrderElement.SelectSlide.RectArrowRight.Z = CBase.Settings.GetZNear();
_ChangeOrderElement.Background.Z = CBase.Settings.GetZNear();
_ChangeOrderElement.Cover.Z = CBase.Settings.GetZNear();
_ChangeOrderElement.SelectSlide.Z = CBase.Settings.GetZNear();
_ChangeOrderElement.Text1.Z = CBase.Settings.GetZNear();
_ChangeOrderElement.Background.Texture = CBase.Themes.GetSkinTexture(_Theme.SkinBackground, _PartyModeID);
@@ -1026,20 +1026,16 @@ namespace VocaluxeLib.Menu
Cover = new CStatic(_Theme.StaticCover, _PartyModeID)
};
en.Cover.Rect.Y += Rect.Y + (i * _Theme.EntryHeight);
en.Cover.Rect.X += Rect.X;
en.Cover.Y += Rect.Y + (i * _Theme.EntryHeight);
en.Cover.X += Rect.X;
en.Text1 = new CText(_Text1);
en.Text1.X += Rect.X;
en.Text1.Y += Rect.Y + (i * _Theme.EntryHeight);
en.SelectSlide = new CSelectSlide(_SelectSlideGameMode);
en.SelectSlide.Rect.X += Rect.X;
en.SelectSlide.Rect.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.SelectSlide.X += Rect.X;
en.SelectSlide.Y += Rect.Y + (i * _Theme.EntryHeight);
en.Content = -1;
@@ -1215,19 +1211,29 @@ namespace VocaluxeLib.Menu
#region ThemeEdit
public void MoveElement(int stepX, int stepY)
{
Rect.X += stepX;
Rect.Y += stepY;
SRectF rect = MaxRect;
rect.X += stepX;
rect.Y += stepY;
MaxRect = rect;
_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;
SRectF rect = MaxRect;
rect.W += stepW;
if (rect.W <= 0)
rect.W = 1;
Rect.H += stepH;
if (Rect.H <= 0)
Rect.H = 1;
rect.H += stepH;
if (rect.H <= 0)
rect.H = 1;
MaxRect = rect;
_Theme.Rect.W = Rect.W;
_Theme.Rect.H = Rect.H;
}
#endregion ThemeEdit
}
+16 -22
View File
@@ -40,7 +40,7 @@ namespace VocaluxeLib.Menu
// ReSharper disable ClassNeverInstantiated.Global
//Instantiated by reflection
public class CScreenSetting : IMenuElement
public class CScreenSetting : IThemeable
// ReSharper restore ClassNeverInstantiated.Global
{
private readonly int _PartyModeID;
@@ -89,38 +89,31 @@ namespace VocaluxeLib.Menu
switch (_Theme.Type)
{
case ESettingType.Int:
return _GetIntValue(_Theme.Value);
return _GetIntValue();
case ESettingType.String:
return _Theme.Value;
case ESettingType.Color:
return _GetColorValue(_Theme.Value);
return _GetColorValue();
case ESettingType.Texture:
return _GetTextureValue(_Theme.Value);
return _GetTextureValue();
}
return null;
}
public void UnloadSkin() {}
public void LoadSkin() {}
public void ReloadSkin() {}
public SScreenSetting GetTheme()
{
return _Theme;
}
#region Private
private int _GetIntValue(string value)
private int _GetIntValue()
{
try
{
return Convert.ToInt32(value);
return Convert.ToInt32(_Theme.Value);
}
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;
CBase.Themes.GetColor(value, _PartyModeID, out color);
CBase.Themes.GetColor(_Theme.Value, _PartyModeID, out color);
return color;
}
#endregion Private
#region ThemeEdit
public void MoveElement(int stepX, int stepY) {}
#region Dummy methods for interface
public void UnloadSkin() {}
public void ResizeElement(int stepW, int stepH) {}
#endregion ThemeEdit
public void LoadSkin() {}
public void ReloadSkin() {}
#endregion
}
}
+60 -46
View File
@@ -64,7 +64,7 @@ namespace VocaluxeLib.Menu
public int NumVisible;
}
public class CSelectSlide : IMenuElement, ICloneable
public sealed class CSelectSlide : CMenuElementBase, IMenuElement, ICloneable, IThemeable
{
private readonly int _PartyModeID;
private SThemeSelectSlide _Theme;
@@ -80,7 +80,6 @@ namespace VocaluxeLib.Menu
get { return _ThemeLoaded; }
}
public SRectF Rect;
public SRectF RectArrowLeft;
public SRectF RectArrowRight;
@@ -99,13 +98,46 @@ namespace VocaluxeLib.Menu
public float TextH;
public float MaxW;
private bool _Selected;
public bool Selected
public bool Selectable
{
get { return Visible; }
}
public override float X
{
get { return _Selected; }
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)
{
@@ -116,12 +148,9 @@ namespace VocaluxeLib.Menu
}
public bool ValueSelected
{
get { return _Selected && !_ArrowLeftSelected && !_ArrowRightSelected; }
get { return Selected && !_ArrowLeftSelected && !_ArrowRightSelected; }
}
public bool Visible = true;
public bool Highlighted;
public bool SelectionByHover;
private bool _ArrowLeftSelected;
@@ -179,25 +208,10 @@ namespace VocaluxeLib.Menu
public CSelectSlide(int partyModeID)
{
_PartyModeID = partyModeID;
_Theme = new SThemeSelectSlide();
_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;
MaxW = 0f;
_Selected = false;
_Textures = new List<CTextureRef>();
_ValueIndexes = new List<int>();
_ValueNames = new List<string>();
@@ -228,7 +242,7 @@ namespace VocaluxeLib.Menu
_ThemeLoaded = false;
Rect = slide.Rect;
MaxRect = slide.MaxRect;
RectArrowLeft = slide.RectArrowLeft;
RectArrowRight = slide.RectArrowRight;
@@ -245,7 +259,6 @@ namespace VocaluxeLib.Menu
TextRelativeY = slide.TextRelativeY;
MaxW = slide.MaxW;
_Selected = slide._Selected;
_Textures = new List<CTextureRef>(slide._Textures);
_ValueIndexes = new List<int>(slide._ValueIndexes);
_ValueNames = new List<string>(slide._ValueNames);
@@ -263,7 +276,6 @@ namespace VocaluxeLib.Menu
_PartyModeID = partyModeID;
_Theme = theme;
_Selected = false;
_Textures = new List<CTextureRef>();
_ValueIndexes = new List<int>();
_ValueNames = new List<string>();
@@ -703,7 +715,7 @@ namespace VocaluxeLib.Menu
_Theme.TextColor.Get(_PartyModeID, out TextColor);
_Theme.TextSColor.Get(_PartyModeID, out SelTextColor);
Rect = _Theme.Rect;
MaxRect = _Theme.Rect;
RectArrowLeft = _Theme.RectArrowLeft;
RectArrowRight = _Theme.RectArrowRight;
@@ -729,15 +741,6 @@ namespace VocaluxeLib.Menu
#region ThemeEdit
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)
{
RectArrowLeft.X += stepX;
@@ -746,8 +749,7 @@ namespace VocaluxeLib.Menu
_Theme.RectArrowLeft.X += stepX;
_Theme.RectArrowLeft.Y += stepY;
}
if (_ArrowRightSelected)
else if (_ArrowRightSelected)
{
RectArrowRight.X += stepX;
RectArrowRight.Y += stepY;
@@ -755,19 +757,31 @@ namespace VocaluxeLib.Menu
_Theme.RectArrowRight.X += stepX;
_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)
{
if (!_ArrowLeftSelected && !_ArrowRightSelected)
{
Rect.W += stepW;
if (Rect.W <= 0)
Rect.W = 1;
W += stepW;
if (W <= 0)
W = 1;
Rect.H += stepH;
if (Rect.H <= 0)
Rect.H = 1;
H += stepH;
if (H <= 0)
H = 1;
_Theme.Rect.W = Rect.W;
_Theme.Rect.H = Rect.H;
+26 -20
View File
@@ -32,7 +32,7 @@ namespace VocaluxeLib.Menu
public SReflection Reflection;
}
public class CStatic : IMenuElement
public sealed class CStatic : CMenuElementBase, IMenuElement, IThemeable
{
private readonly int _PartyModeID;
@@ -49,6 +49,11 @@ namespace VocaluxeLib.Menu
get { return _ThemeLoaded; }
}
public bool Selectable
{
get { return false; }
}
private CTextureRef _Texture;
public CTextureRef Texture
{
@@ -58,15 +63,11 @@ namespace VocaluxeLib.Menu
}
public SColorF Color;
public SRectF Rect;
public bool Reflection;
public float ReflectionSpace;
public float ReflectionHeight;
public bool Selected;
public bool Visible = true;
public float Alpha = 1;
public EAspect Aspect = EAspect.Stretch;
@@ -82,12 +83,11 @@ namespace VocaluxeLib.Menu
_Texture = s.Texture;
Color = s.Color;
Rect = s.Rect;
MaxRect = s.MaxRect;
Reflection = s.Reflection;
ReflectionSpace = s.ReflectionHeight;
ReflectionHeight = s.ReflectionSpace;
Selected = s.Selected;
Alpha = s.Alpha;
Visible = s.Visible;
}
@@ -98,7 +98,7 @@ namespace VocaluxeLib.Menu
_Texture = texture;
Color = color;
Rect = rect;
MaxRect = rect;
}
public CStatic(int partyModeID, string textureSkinName, SColorF color, SRectF rect)
@@ -106,7 +106,7 @@ namespace VocaluxeLib.Menu
_PartyModeID = partyModeID;
_Theme.Skin = textureSkinName;
Color = color;
Rect = rect;
MaxRect = rect;
}
public CStatic(SThemeStatic theme, int partyModeID)
@@ -163,9 +163,9 @@ namespace VocaluxeLib.Menu
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)
@@ -197,7 +197,7 @@ namespace VocaluxeLib.Menu
{
_Theme.Color.Get(_PartyModeID, out Color);
Rect = _Theme.Rect;
MaxRect = _Theme.Rect;
Reflection = _Theme.Reflection.Enabled;
if (Reflection)
{
@@ -220,19 +220,25 @@ namespace VocaluxeLib.Menu
#region ThemeEdit
public void MoveElement(int stepX, int stepY)
{
Rect.X += stepX;
Rect.Y += stepY;
X += stepX;
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;
W += stepW;
if (W <= 0)
W = 1;
Rect.H += stepH;
if (Rect.H <= 0)
Rect.H = 1;
H += stepH;
if (H <= 0)
H = 1;
_Theme.Rect.W = Rect.W;
_Theme.Rect.H = Rect.H;
}
#endregion ThemeEdit
}
+49 -67
View File
@@ -42,7 +42,7 @@ namespace VocaluxeLib.Menu
public SReflection Reflection;
}
public class CText : IMenuElement, IFontObserver
public sealed class CText : CMenuElementBase, IMenuElement, IThemeable, IFontObserver
{
private SThemeText _Theme;
private bool _ThemeLoaded;
@@ -62,52 +62,37 @@ namespace VocaluxeLib.Menu
private bool _ButtonText;
private bool _PositionNeedsUpdate = true;
private float _X;
public float X
public override float X
{
//left
get { return _X; }
set
{
if (Math.Abs(_X - value) > 0.01)
if (Math.Abs(X - value) > 0.01)
{
_X = value;
base.X = value;
_PositionNeedsUpdate = true;
}
}
}
private float _Y;
public float Y
public override float Y
{
//higher
get { return _Y; }
set
{
if (Math.Abs(_Y - value) > 0.01)
if (Math.Abs(Y - value) > 0.01)
{
_Y = value;
base.Y = value;
_PositionNeedsUpdate = true;
}
}
}
private float _Z;
public float Z
public override float W
{
get { return _Z; }
set { _Z = value; }
}
private float _MaxWidth;
public float MaxWidth
{
get { return _MaxWidth; }
set
{
if (Math.Abs(_MaxWidth - value) > 0.01)
if (Math.Abs(W - value) > 0.01)
{
_MaxWidth = value;
base.W = value;
_PositionNeedsUpdate = true;
}
}
@@ -158,19 +143,23 @@ namespace VocaluxeLib.Menu
}
/// <summary>
/// Do NOT read/write this anywhere but in _UpdateTextPosition!
/// Gets set in _UpdateTextPosition!
/// </summary>
private SRectF _Rect;
public SRectF Rect
public override SRectF Rect
{
get
{
if (_PositionNeedsUpdate)
_UpdateTextPosition();
_UpdateTextPosition();
return _Rect;
}
}
public bool Selectable
{
get { return false; }
}
public SColorF Color; //normal Color
public SColorF SelColor; //selected Color for Buttons
@@ -199,11 +188,6 @@ namespace VocaluxeLib.Menu
get { return _Text; }
}
public int PartyModeID
{
get { return _PartyModeID; }
}
public int TranslationID
{
get { return _TranslationID; }
@@ -218,8 +202,6 @@ namespace VocaluxeLib.Menu
}
}
public bool Selected;
public bool Visible = true;
private bool _EditMode;
public bool EditMode
{
@@ -260,10 +242,9 @@ namespace VocaluxeLib.Menu
_PartyModeID = text._PartyModeID;
_TranslationID = text._TranslationID;
_X = text._X;
_Y = text._Y;
_Z = text._Z;
_MaxWidth = text._MaxWidth;
MaxRect = text.MaxRect;
_Rect = text._Rect;
_PositionNeedsUpdate = false;
_Align = text._Align;
_ResizeAlign = text._ResizeAlign;
Font = new CFont(text.Font); //Use setter to set observer
@@ -274,7 +255,6 @@ namespace VocaluxeLib.Menu
ReflectionHeight = text.ReflectionHeight;
Text = text.Text;
Selected = text.Selected;
Visible = text.Visible;
Alpha = text.Alpha;
@@ -289,10 +269,7 @@ namespace VocaluxeLib.Menu
_ThemeLoaded = false;
_ButtonText = false;
X = x;
Y = y;
Z = z;
MaxWidth = mw;
MaxRect = new SRectF(x, y, mw, h, z);
Align = align;
ResizeAlign = EHAlignment.Center;
_Font.Name = fontFamily;
@@ -331,13 +308,13 @@ namespace VocaluxeLib.Menu
string item = xmlPath + "/" + elementName;
_ThemeLoaded = true;
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/X", ref _X);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Y", ref _Y);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/X", ref _Theme.X);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Y", ref _Theme.Y);
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))
_ThemeLoaded &= _Theme.Color.Get(_PartyModeID, out Color);
@@ -367,7 +344,7 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Style", ref _Theme.FontStyle);
_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)
{
@@ -378,16 +355,13 @@ namespace VocaluxeLib.Menu
else
_Theme.Reflection = new SReflection(false, 0f, 0f);
// Set values
_Theme.Name = elementName;
_Theme.Align = _Align;
_Theme.Color.Color = Color;
_Theme.ResizeAlign = _ResizeAlign;
_Theme.SColor.Color = SelColor;
_Theme.MaxWidth = _MaxWidth;
_Theme.X = _X;
_Theme.Y = _Y;
_Theme.Z = _Z;
_ButtonText = buttonText;
_PositionNeedsUpdate = true;
@@ -397,9 +371,14 @@ namespace VocaluxeLib.Menu
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;
// Update Text
@@ -446,7 +425,7 @@ namespace VocaluxeLib.Menu
ReflectionHeight = 0;
X += rx;
Y += ry;
Draw(true);
_Draw(true);
ReflectionSpace = oldReflectionSpace;
ReflectionHeight = oldReflectionHeight;
X -= rx;
@@ -460,10 +439,12 @@ namespace VocaluxeLib.Menu
_Theme.Color.Get(_PartyModeID, out Color);
_Theme.SColor.Get(_PartyModeID, out SelColor);
_X = _Theme.X;
_Y = _Theme.Y;
_Z = _Theme.Z;
_MaxWidth = _Theme.MaxWidth;
X = _Theme.X;
Y = _Theme.Y;
if (!_ButtonText)
Z = _Theme.Z;
W = _Theme.MaxWidth;
H = _Theme.FontHeight;
_Align = _Theme.Align;
_ResizeAlign = _Theme.ResizeAlign;
Font = new CFont(_Theme.FontFamily, _Theme.FontStyle, _Theme.FontHeight);
@@ -512,7 +493,11 @@ namespace VocaluxeLib.Menu
private void _UpdateTextPosition()
{
if (!_PositionNeedsUpdate)
return;
_CalculatedFont = new CFont(Font);
_Rect = MaxRect;
_PositionNeedsUpdate = false;
if (_Text == "")
@@ -522,9 +507,9 @@ namespace VocaluxeLib.Menu
float y = Y;
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);
h *= factor;
switch (ResizeAlign)
@@ -554,10 +539,7 @@ namespace VocaluxeLib.Menu
break;
}
_Rect.X = x;
_Rect.Y = y;
_Rect.W = bounds.Width;
_Rect.H = bounds.Height;
_Rect = new SRectF(x, y, bounds.Width, bounds.Height, Z);
}
public void FontChanged()
+1 -1
View File
@@ -35,12 +35,12 @@ namespace VocaluxeLib.Menu
bool HandleMouseThemeEditor(SMouseEvent mouseEvent);
bool UpdateGame();
void Draw();
void ApplyVolume();
void OnShow();
void OnShowFinish();
void OnClose();
bool Draw();
SRectF ScreenArea { get; }
void NextInteraction();
+15 -11
View File
@@ -15,21 +15,25 @@
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
#endregion
using VocaluxeLib.Xml;
namespace VocaluxeLib.Menu
{
interface IMenuElement
public interface IMenuElement
{
string GetThemeName();
bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader);
void UnloadSkin();
void LoadSkin();
void ReloadSkin();
/// <summary>
/// Current extend of the element. Smaller or equal then MaxRect
/// </summary>
SRectF Rect { get; }
/// <summary>
/// Maximum extend of the element. Equal to Rect in most cases
/// </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 ResizeElement(int stepW, int stepH);
void Draw();
}
}
@@ -15,30 +15,18 @@
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
#endregion
using VocaluxeLib.PartyModes;
using VocaluxeLib.Xml;
namespace VocaluxeLib.Menu.SongMenu
namespace VocaluxeLib.Menu
{
class CSongMenuList : CSongMenuFramework
public interface IThemeable
{
public CSongMenuList(int partyModeID)
: base(partyModeID) {}
string GetThemeName();
public override float SelectedTileZoomFactor
{
get { return 1.2f; }
}
bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader);
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;
}
void UnloadSkin();
void LoadSkin();
void ReloadSkin();
}
}
+11 -1
View File
@@ -68,7 +68,7 @@ namespace VocaluxeLib.Menu.SingNotes
[XmlArray("BarPositions")] public SBarPosition[] BarPos;
}
public abstract class CSingNotes : IMenuElement
public abstract class CSingNotes : CMenuElementBase, IMenuElement,IThemeable
{
private readonly int _PartyModeID;
private SThemeSingBar _Theme;
@@ -77,6 +77,11 @@ namespace VocaluxeLib.Menu.SingNotes
private readonly List<SPlayerNotes> _PlayerNotes;
private int _ActID;
public bool Selectable
{
get { return false; }
}
/// <summary>
/// Player bar positions
/// </summary>
@@ -239,6 +244,11 @@ namespace VocaluxeLib.Menu.SingNotes
return _PlayerNotes[n].Alpha;
}
public void Draw()
{
throw new NotImplementedException();
}
public void Draw(int id, List<CSungLine> sungLines, int player)
{
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;
}
abstract class CSongMenuFramework : ISongMenu
public abstract class CSongMenuFramework : CMenuElementBase, ISongMenu
{
protected readonly int _PartyModeID;
protected SThemeSongMenu _Theme;
@@ -101,6 +101,11 @@ namespace VocaluxeLib.Menu.SongMenu
get { return _ThemeLoaded; }
}
public bool Selectable
{
get { return Visible; }
}
protected bool _Initialized;
private int _PreviewNrInternal = -1;
@@ -138,19 +143,6 @@ namespace VocaluxeLib.Menu.SongMenu
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 abstract float SelectedTileZoomFactor { get; }
// This is the nr of the current selection (song or category)
@@ -245,13 +237,9 @@ namespace VocaluxeLib.Menu.SongMenu
_Initialized = true;
}
public virtual void Update(SScreenSongOptions songOptions)
{
if (!_Initialized)
return;
}
public abstract void Update(SScreenSongOptions songOptions);
public virtual void OnShow() {}
public abstract void OnShow();
public virtual void OnHide()
{
@@ -398,33 +386,24 @@ namespace VocaluxeLib.Menu.SongMenu
}
#region ThemeEdit
private void _UpdateRect(SRectF rect)
{
Rect = rect;
Init();
}
public void MoveElement(int stepX, int stepY)
{
SRectF rect = Rect;
rect.X += stepX;
rect.Y += stepY;
_UpdateRect(rect);
X += stepX;
Y += stepY;
Init();
}
public void ResizeElement(int stepW, int stepH)
{
SRectF rect = Rect;
W += stepW;
if (W < 100)
W = 100;
rect.W += stepW;
if (rect.W < 100)
rect.W = 100;
H += stepH;
if (H < 100)
H = 100;
rect.H += stepH;
if (rect.H < 100)
rect.H = 100;
_UpdateRect(rect);
Init();
}
#endregion ThemeEdit
}
@@ -174,13 +174,13 @@ namespace VocaluxeLib.Menu.SongMenu
{
_NumH = _Theme.SongMenuTileBoard.NumHsmall;
_NumW = _Theme.SongMenuTileBoard.NumWsmall;
Rect = _Theme.SongMenuTileBoard.TileRectSmall;
MaxRect = _Theme.SongMenuTileBoard.TileRectSmall;
}
else
{
_NumH = _Theme.SongMenuTileBoard.NumH;
_NumW = _Theme.SongMenuTileBoard.NumW;
Rect = _Theme.SongMenuTileBoard.TileRect;
MaxRect = _Theme.SongMenuTileBoard.TileRect;
}
_TileW = (int)((Rect.W - _Theme.SongMenuTileBoard.SpaceW * (_NumW - 1)) / _NumW);
@@ -204,8 +204,6 @@ namespace VocaluxeLib.Menu.SongMenu
public override void Update(SScreenSongOptions songOptions)
{
base.Update(songOptions);
if (songOptions.Selection.RandomOnly)
_PreviewNr = _SelectionNr;
@@ -482,7 +480,7 @@ namespace VocaluxeLib.Menu.SongMenu
{
foreach (CStatic tile in _Tiles)
{
if (tile.Selected && Active)
if (tile.Selected && Selected)
tile.Draw(EAspect.Crop, SelectedTileZoomFactor, -0.1f);
else
{
+1 -6
View File
@@ -19,7 +19,7 @@ using VocaluxeLib.PartyModes;
namespace VocaluxeLib.Menu.SongMenu
{
interface ISongMenu : IMenuElement
public interface ISongMenu : IMenuElement,IThemeable
{
void Update(SScreenSongOptions songOptions);
void OnShow();
@@ -27,7 +27,6 @@ namespace VocaluxeLib.Menu.SongMenu
bool HandleInput(ref SKeyEvent keyEvent, SScreenSongOptions options);
bool HandleMouse(ref SMouseEvent mouseEvent, SScreenSongOptions songOptions);
void Draw();
// The selected song is the song, where the mouse is hovering over
// 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)
int GetPreviewSong();
SRectF Rect { get; }
bool Active { get; set; }
bool Selected { get; set; }
bool Visible { get; set; }
bool SmallView { get; set; }
bool ThemeLoaded { get; }
@@ -83,11 +83,5 @@ namespace VocaluxeLib.PartyModes
{
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\CLyric.cs" />
<Compile Include="Menu\CMenu.cs" />
<Compile Include="Menu\CMenuElementBase.cs" />
<Compile Include="Menu\CMenuParty.cs" />
<Compile Include="Menu\CMenuPartyNameSelection.cs" />
<Compile Include="Menu\CNameSelection.cs" />
<Compile Include="Menu\CObjectInteractions.cs" />
<Compile Include="Menu\COrderedDictionaryLite.cs" />
<Compile Include="Menu\CParticle.cs" />
<Compile Include="Menu\CParticleEffect.cs" />
<Compile Include="Menu\CPlaylist.cs" />
<Compile Include="Game\CPoints.cs" />
<Compile Include="Menu\CScreenSetting.cs" />
<Compile Include="Menu\CSelectSlide.cs" />
<Compile Include="Menu\CStatic.cs" />
<Compile Include="Menu\CText.cs" />
<Compile Include="Menu\CScreenSetting.cs" />
<Compile Include="Draw\CTextureRef.cs" />
<Compile Include="Menu\IThemeable.cs" />
<Compile Include="Xml\CXmlDeserializer.cs" />
<Compile Include="Xml\CXMLReader.cs" />
<Compile Include="Enums.cs" />
@@ -120,11 +123,8 @@
<Compile Include="Menu\SingNotes\CSingNotesClassic.cs" />
<Compile Include="Songs\CCategory.cs" />
<Compile Include="Songs\CSong.cs" />
<Compile Include="Menu\SongMenu\CSongMenu.cs" />
<Compile Include="Menu\SongMenu\CSongMenuBook.cs" />
<Compile Include="Menu\SongMenu\CSongMenuDreidel.cs" />
<Compile Include="Menu\SongMenu\CSongMenuFactory.cs" />
<Compile Include="Menu\SongMenu\CSongMenuFramework.cs" />
<Compile Include="Menu\SongMenu\CSongMenuList.cs" />
<Compile Include="Menu\SongMenu\CSongMenuTileBoard.cs" />
<Compile Include="Menu\SongMenu\ISongMenu.cs" />
<Compile Include="Songs\CSongWriter.cs" />