Many cleanups according to ReSharper suggestions (Mostly redundant code)

Minor Bug fixes
This commit is contained in:
Flamefire committed 2013-04-20 02:19:56 +02:00
1 parent 9aa81b7ba2
commit dcbbc5caf3
96 files changed
+2702 -3322

No files matched your search

+1
View File
@@ -13,6 +13,7 @@
<string name="TR_DEBUG_MAX_VOLUME">Max Volume</string> <string name="TR_DEBUG_MAX_VOLUME">Max Volume</string>
<string name="TR_DEBUG_SONGS">Loaded songs</string> <string name="TR_DEBUG_SONGS">Loaded songs</string>
<string name="TR_DEBUG_MOUSE">Mouse</string> <string name="TR_DEBUG_MOUSE">Mouse</string>
<string name="TR_DEBUG_MEMORY">Memory usage</string>
<string name="TR_GAMEMODE_NORMAL">Normal</string> <string name="TR_GAMEMODE_NORMAL">Normal</string>
<string name="TR_GAMEMODE_DUET">Duet</string> <string name="TR_GAMEMODE_DUET">Duet</string>
<string name="TR_GAMEMODE_MEDLEY">Medley</string> <string name="TR_GAMEMODE_MEDLEY">Medley</string>
+1
View File
@@ -13,6 +13,7 @@
<string name="TR_DEBUG_MAX_VOLUME">Max. Volume</string> <string name="TR_DEBUG_MAX_VOLUME">Max. Volume</string>
<string name="TR_DEBUG_SONGS">Geladene Songs</string> <string name="TR_DEBUG_SONGS">Geladene Songs</string>
<string name="TR_DEBUG_MOUSE">Maus</string> <string name="TR_DEBUG_MOUSE">Maus</string>
<string name="TR_DEBUG_MEMORY">Speicherverbrauch</string>
<string name="TR_GAMEMODE_NORMAL">Normal</string> <string name="TR_GAMEMODE_NORMAL">Normal</string>
<string name="TR_GAMEMODE_DUET">Duett</string> <string name="TR_GAMEMODE_DUET">Duett</string>
<string name="TR_GAMEMODE_MEDLEY">Medley</string> <string name="TR_GAMEMODE_MEDLEY">Medley</string>
@@ -211,7 +211,7 @@ namespace VocaluxeLib.PartyModes.Challenge
public override void DataFromScreen(string screenName, Object data) public override void DataFromScreen(string screenName, Object data)
{ {
SDataFromScreen dataFrom = new SDataFromScreen(); SDataFromScreen dataFrom;
switch (screenName) switch (screenName)
{ {
case "PartyScreenChallengeConfig": case "PartyScreenChallengeConfig":
@@ -371,10 +371,11 @@ namespace VocaluxeLib.PartyModes.Challenge
return _ScreenSongOptions; return _ScreenSongOptions;
} }
// ReSharper disable RedundantAssignment
public override void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions) public override void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions)
// ReSharper restore RedundantAssignment
{ {
if (_ScreenSongOptions.Selection.SongIndex != -1) _ScreenSongOptions.Selection.SongIndex = -1;
_ScreenSongOptions.Selection.SongIndex = -1;
if (_ScreenSongOptions.Selection.SelectNextRandomSong && songIndex != -1) if (_ScreenSongOptions.Selection.SelectNextRandomSong && songIndex != -1)
{ {
@@ -391,7 +392,9 @@ namespace VocaluxeLib.PartyModes.Challenge
screenSongOptions = _ScreenSongOptions; screenSongOptions = _ScreenSongOptions;
} }
// ReSharper disable RedundantAssignment
public override void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions) public override void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions)
// ReSharper restore RedundantAssignment
{ {
if (_GameData.CatSongIndices != null && categoryIndex != -1) if (_GameData.CatSongIndices != null && categoryIndex != -1)
{ {
@@ -60,11 +60,9 @@ namespace VocaluxeLib.PartyModes.Challenge
public override void DataToScreen(object receivedData) public override void DataToScreen(object receivedData)
{ {
SDataToScreenConfig config = new SDataToScreenConfig();
try try
{ {
config = (SDataToScreenConfig)receivedData; SDataToScreenConfig config = (SDataToScreenConfig)receivedData;
_Data.ScreenConfig.NumPlayer = config.NumPlayer; _Data.ScreenConfig.NumPlayer = config.NumPlayer;
_Data.ScreenConfig.NumPlayerAtOnce = config.NumPlayerAtOnce; _Data.ScreenConfig.NumPlayerAtOnce = config.NumPlayerAtOnce;
_Data.ScreenConfig.NumRounds = config.NumRounds; _Data.ScreenConfig.NumRounds = config.NumRounds;
@@ -92,10 +90,10 @@ namespace VocaluxeLib.PartyModes.Challenge
case Keys.Enter: case Keys.Enter:
_UpdateSlides(); _UpdateSlides();
if (Buttons[_ButtonBack].Selected) if (_Buttons[_ButtonBack].Selected)
_Back(); _Back();
if (Buttons[_ButtonNext].Selected) if (_Buttons[_ButtonNext].Selected)
_Next(); _Next();
break; break;
@@ -115,13 +113,13 @@ namespace VocaluxeLib.PartyModes.Challenge
{ {
base.HandleMouse(mouseEvent); base.HandleMouse(mouseEvent);
if (mouseEvent.LB && IsMouseOver(mouseEvent)) if (mouseEvent.LB && _IsMouseOver(mouseEvent))
{ {
_UpdateSlides(); _UpdateSlides();
if (Buttons[_ButtonBack].Selected) if (_Buttons[_ButtonBack].Selected)
_Back(); _Back();
if (Buttons[_ButtonNext].Selected) if (_Buttons[_ButtonNext].Selected)
_Next(); _Next();
} }
@@ -158,10 +156,10 @@ namespace VocaluxeLib.PartyModes.Challenge
private void _RebuildSlides() private void _RebuildSlides()
{ {
// build num player slide (min player ... max player); // build num player slide (min player ... max player);
SelectSlides[_SelectSlideNumPlayers].Clear(); _SelectSlides[_SelectSlideNumPlayers].Clear();
for (int i = _PartyMode.GetMinPlayer(); i <= _PartyMode.GetMaxPlayer(); i++) for (int i = _PartyMode.GetMinPlayer(); i <= _PartyMode.GetMaxPlayer(); i++)
SelectSlides[_SelectSlideNumPlayers].AddValue(i.ToString()); _SelectSlides[_SelectSlideNumPlayers].AddValue(i.ToString());
SelectSlides[_SelectSlideNumPlayers].Selection = _Data.ScreenConfig.NumPlayer - _PartyMode.GetMinPlayer(); _SelectSlides[_SelectSlideNumPlayers].Selection = _Data.ScreenConfig.NumPlayer - _PartyMode.GetMinPlayer();
_UpdateMicsAtOnce(); _UpdateMicsAtOnce();
_SetRoundSteps(); _SetRoundSteps();
@@ -172,9 +170,9 @@ namespace VocaluxeLib.PartyModes.Challenge
{ {
int player = _Data.ScreenConfig.NumPlayer; int player = _Data.ScreenConfig.NumPlayer;
int mics = _Data.ScreenConfig.NumPlayerAtOnce; int mics = _Data.ScreenConfig.NumPlayerAtOnce;
_Data.ScreenConfig.NumPlayer = SelectSlides[_SelectSlideNumPlayers].Selection + _PartyMode.GetMinPlayer(); _Data.ScreenConfig.NumPlayer = _SelectSlides[_SelectSlideNumPlayers].Selection + _PartyMode.GetMinPlayer();
_Data.ScreenConfig.NumPlayerAtOnce = SelectSlides[_SelectSlideNumMics].Selection + _PartyMode.GetMinPlayer(); _Data.ScreenConfig.NumPlayerAtOnce = _SelectSlides[_SelectSlideNumMics].Selection + _PartyMode.GetMinPlayer();
_Data.ScreenConfig.NumRounds = (SelectSlides[_SelectSlideNumRounds].Selection + 1) * _RoundSteps; _Data.ScreenConfig.NumRounds = (_SelectSlides[_SelectSlideNumRounds].Selection + 1) * _RoundSteps;
_UpdateMicsAtOnce(); _UpdateMicsAtOnce();
_SetRoundSteps(); _SetRoundSteps();
@@ -201,19 +199,19 @@ namespace VocaluxeLib.PartyModes.Challenge
_Data.ScreenConfig.NumPlayerAtOnce = maxNum; _Data.ScreenConfig.NumPlayerAtOnce = maxNum;
// build mics at once slide // build mics at once slide
SelectSlides[_SelectSlideNumMics].Clear(); _SelectSlides[_SelectSlideNumMics].Clear();
for (int i = 1; i <= maxNum; i++) for (int i = 1; i <= maxNum; i++)
SelectSlides[_SelectSlideNumMics].AddValue(i.ToString()); _SelectSlides[_SelectSlideNumMics].AddValue(i.ToString());
SelectSlides[_SelectSlideNumMics].Selection = _Data.ScreenConfig.NumPlayerAtOnce - _PartyMode.GetMinPlayer(); _SelectSlides[_SelectSlideNumMics].Selection = _Data.ScreenConfig.NumPlayerAtOnce - _PartyMode.GetMinPlayer();
} }
private void _UpdateSlideRounds() private void _UpdateSlideRounds()
{ {
// build num rounds slide // build num rounds slide
SelectSlides[_SelectSlideNumRounds].Clear(); _SelectSlides[_SelectSlideNumRounds].Clear();
for (int i = _RoundSteps; i <= _MaxNumRounds; i += _RoundSteps) for (int i = _RoundSteps; i <= _MaxNumRounds; i += _RoundSteps)
SelectSlides[_SelectSlideNumRounds].AddValue(i.ToString()); _SelectSlides[_SelectSlideNumRounds].AddValue(i.ToString());
SelectSlides[_SelectSlideNumRounds].Selection = _Data.ScreenConfig.NumRounds / _RoundSteps - 1; _SelectSlides[_SelectSlideNumRounds].Selection = _Data.ScreenConfig.NumRounds / _RoundSteps - 1;
} }
private void _SetRoundSteps() private void _SetRoundSteps()
@@ -130,20 +130,18 @@ namespace VocaluxeLib.PartyModes.Challenge
for (int i = 0; i < _PartyMode.GetMaxPlayer(); i++) for (int i = 0; i < _PartyMode.GetMaxPlayer(); i++)
{ {
_NextPlayerTexts.Add(GetNewText(Texts[_TextNextPlayer])); _NextPlayerTexts.Add(GetNewText(_Texts[_TextNextPlayer]));
AddText(_NextPlayerTexts[_NextPlayerTexts.Count - 1]); _AddText(_NextPlayerTexts[_NextPlayerTexts.Count - 1]);
_NextPlayerStatics.Add(GetNewStatic(Statics[_StaticNextPlayer])); _NextPlayerStatics.Add(GetNewStatic(_Statics[_StaticNextPlayer]));
AddStatic(_NextPlayerStatics[_NextPlayerStatics.Count - 1]); _AddStatic(_NextPlayerStatics[_NextPlayerStatics.Count - 1]);
} }
} }
public override void DataToScreen(object receivedData) public override void DataToScreen(object receivedData)
{ {
SDataToScreenMain data = new SDataToScreenMain();
try try
{ {
data = (SDataToScreenMain)receivedData; SDataToScreenMain data = (SDataToScreenMain)receivedData;
_GameState = data; _GameState = data;
} }
catch (Exception e) catch (Exception e)
@@ -177,26 +175,26 @@ namespace VocaluxeLib.PartyModes.Challenge
case Keys.Enter: case Keys.Enter:
if (!_ExitPopupVisible) if (!_ExitPopupVisible)
{ {
if (Buttons[_ButtonNextRound].Selected) if (_Buttons[_ButtonNextRound].Selected)
_NextRound(); _NextRound();
if (Buttons[_ButtonBack].Selected && _GameState.CurrentRoundNr == 1) if (_Buttons[_ButtonBack].Selected && _GameState.CurrentRoundNr == 1)
_Back(); _Back();
if (Buttons[_ButtonExit].Selected && _GameState.CurrentRoundNr > 1) if (_Buttons[_ButtonExit].Selected && _GameState.CurrentRoundNr > 1)
_ShowPopup(true); _ShowPopup(true);
if (Buttons[_ButtonPlayerScrollUp].Selected) if (_Buttons[_ButtonPlayerScrollUp].Selected)
_ScrollPlayerTable(-1); _ScrollPlayerTable(-1);
if (Buttons[_ButtonPlayerScrollDown].Selected) if (_Buttons[_ButtonPlayerScrollDown].Selected)
_ScrollPlayerTable(1); _ScrollPlayerTable(1);
if (Buttons[_ButtonRoundsScrollUp].Selected) if (_Buttons[_ButtonRoundsScrollUp].Selected)
_ScrollRoundsTable(-1); _ScrollRoundsTable(-1);
if (Buttons[_ButtonRoundsScrollDown].Selected) if (_Buttons[_ButtonRoundsScrollDown].Selected)
_ScrollRoundsTable(1); _ScrollRoundsTable(1);
} }
else else
{ {
if (Buttons[_ButtonPopupYes].Selected) if (_Buttons[_ButtonPopupYes].Selected)
_EndParty(); _EndParty();
if (Buttons[_ButtonPopupNo].Selected) if (_Buttons[_ButtonPopupNo].Selected)
_ShowPopup(false); _ShowPopup(false);
} }
break; break;
@@ -209,30 +207,30 @@ namespace VocaluxeLib.PartyModes.Challenge
{ {
base.HandleMouse(mouseEvent); base.HandleMouse(mouseEvent);
if (mouseEvent.LB && IsMouseOver(mouseEvent)) if (mouseEvent.LB && _IsMouseOver(mouseEvent))
{ {
if (!_ExitPopupVisible) if (!_ExitPopupVisible)
{ {
if (Buttons[_ButtonNextRound].Selected) if (_Buttons[_ButtonNextRound].Selected)
_NextRound(); _NextRound();
if (Buttons[_ButtonBack].Selected && _GameState.CurrentRoundNr == 1) if (_Buttons[_ButtonBack].Selected && _GameState.CurrentRoundNr == 1)
_Back(); _Back();
if (Buttons[_ButtonExit].Selected && _GameState.CurrentRoundNr > 1) if (_Buttons[_ButtonExit].Selected && _GameState.CurrentRoundNr > 1)
_ShowPopup(true); _ShowPopup(true);
if (Buttons[_ButtonPlayerScrollUp].Selected) if (_Buttons[_ButtonPlayerScrollUp].Selected)
_ScrollPlayerTable(-1); _ScrollPlayerTable(-1);
if (Buttons[_ButtonPlayerScrollDown].Selected) if (_Buttons[_ButtonPlayerScrollDown].Selected)
_ScrollPlayerTable(1); _ScrollPlayerTable(1);
if (Buttons[_ButtonRoundsScrollUp].Selected) if (_Buttons[_ButtonRoundsScrollUp].Selected)
_ScrollRoundsTable(-1); _ScrollRoundsTable(-1);
if (Buttons[_ButtonRoundsScrollDown].Selected) if (_Buttons[_ButtonRoundsScrollDown].Selected)
_ScrollRoundsTable(1); _ScrollRoundsTable(1);
} }
else else
{ {
if (Buttons[_ButtonPopupYes].Selected) if (_Buttons[_ButtonPopupYes].Selected)
_EndParty(); _EndParty();
if (Buttons[_ButtonPopupNo].Selected) if (_Buttons[_ButtonPopupNo].Selected)
_ShowPopup(false); _ShowPopup(false);
} }
} }
@@ -279,29 +277,29 @@ namespace VocaluxeLib.PartyModes.Challenge
if (_GameState.CurrentRoundNr == 1) if (_GameState.CurrentRoundNr == 1)
{ {
Buttons[_ButtonBack].Visible = true; _Buttons[_ButtonBack].Visible = true;
Buttons[_ButtonExit].Visible = false; _Buttons[_ButtonExit].Visible = false;
} }
else else
{ {
Buttons[_ButtonBack].Visible = false; _Buttons[_ButtonBack].Visible = false;
Buttons[_ButtonExit].Visible = true; _Buttons[_ButtonExit].Visible = true;
} }
if (_GameState.CurrentRoundNr <= _GameState.Combs.Count) if (_GameState.CurrentRoundNr <= _GameState.Combs.Count)
{ {
Buttons[_ButtonNextRound].Visible = true; _Buttons[_ButtonNextRound].Visible = true;
Texts[_TextFinishMessage].Visible = false; _Texts[_TextFinishMessage].Visible = false;
Texts[_TextFinishPlayerWin].Visible = false; _Texts[_TextFinishPlayerWin].Visible = false;
SetInteractionToButton(Buttons[_ButtonNextRound]); _SetInteractionToButton(_Buttons[_ButtonNextRound]);
} }
else else
{ {
Buttons[_ButtonNextRound].Visible = false; _Buttons[_ButtonNextRound].Visible = false;
Texts[_TextFinishMessage].Visible = true; _Texts[_TextFinishMessage].Visible = true;
Texts[_TextFinishPlayerWin].Visible = true; _Texts[_TextFinishPlayerWin].Visible = true;
Texts[_TextFinishPlayerWin].Text = _GetPlayerWinString(); _Texts[_TextFinishPlayerWin].Text = _GetPlayerWinString();
SetInteractionToButton(Buttons[_ButtonExit]); _SetInteractionToButton(_Buttons[_ButtonExit]);
} }
_ShowPopup(false); _ShowPopup(false);
@@ -334,13 +332,13 @@ namespace VocaluxeLib.PartyModes.Challenge
{ {
_ExitPopupVisible = visible; _ExitPopupVisible = visible;
Statics[_StaticPopupBG].Visible = _ExitPopupVisible; _Statics[_StaticPopupBG].Visible = _ExitPopupVisible;
Texts[_TextPopupReallyExit].Visible = _ExitPopupVisible; _Texts[_TextPopupReallyExit].Visible = _ExitPopupVisible;
Buttons[_ButtonPopupYes].Visible = _ExitPopupVisible; _Buttons[_ButtonPopupYes].Visible = _ExitPopupVisible;
Buttons[_ButtonPopupNo].Visible = _ExitPopupVisible; _Buttons[_ButtonPopupNo].Visible = _ExitPopupVisible;
if (_ExitPopupVisible) if (_ExitPopupVisible)
SetInteractionToButton(Buttons[_ButtonPopupNo]); _SetInteractionToButton(_Buttons[_ButtonPopupNo]);
} }
private void _Back() private void _Back()
@@ -352,7 +350,7 @@ namespace VocaluxeLib.PartyModes.Challenge
private void _UpdateNextPlayerPositions() private void _UpdateNextPlayerPositions()
{ {
float x = CBase.Settings.GetRenderW() / 2 - ((_GameState.NumPlayerAtOnce * Statics[_StaticNextPlayer].Rect.W) + ((_GameState.NumPlayerAtOnce - 1) * 15)) / 2; float x = CBase.Settings.GetRenderW() / 2 - ((_GameState.NumPlayerAtOnce * _Statics[_StaticNextPlayer].Rect.W) + ((_GameState.NumPlayerAtOnce - 1) * 15)) / 2;
float staticY = 590; float staticY = 590;
float textY = 550; float textY = 550;
for (int i = 0; i < _GameState.NumPlayerAtOnce; i++) for (int i = 0; i < _GameState.NumPlayerAtOnce; i++)
@@ -362,11 +360,11 @@ namespace VocaluxeLib.PartyModes.Challenge
_NextPlayerStatics[i].Rect.Y = staticY; _NextPlayerStatics[i].Rect.Y = staticY;
_NextPlayerStatics[i].Visible = true; _NextPlayerStatics[i].Visible = true;
//text //text
_NextPlayerTexts[i].X = x + Statics[_StaticNextPlayer].Rect.W / 2; _NextPlayerTexts[i].X = x + _Statics[_StaticNextPlayer].Rect.W / 2;
_NextPlayerTexts[i].Y = textY; _NextPlayerTexts[i].Y = textY;
_NextPlayerTexts[i].Visible = true; _NextPlayerTexts[i].Visible = true;
x += Statics[_StaticNextPlayer].Rect.W + 15; x += _Statics[_StaticNextPlayer].Rect.W + 15;
} }
for (int i = _GameState.NumPlayerAtOnce; i < _PartyMode.GetMaxPlayer(); i++) for (int i = _GameState.NumPlayerAtOnce; i < _PartyMode.GetMaxPlayer(); i++)
{ {
@@ -379,7 +377,7 @@ namespace VocaluxeLib.PartyModes.Challenge
{ {
if (_GameState.CurrentRoundNr <= _GameState.Combs.Count) if (_GameState.CurrentRoundNr <= _GameState.Combs.Count)
{ {
Texts[_TextNextPlayerMessage].Visible = true; _Texts[_TextNextPlayerMessage].Visible = true;
SProfile[] profiles = CBase.Profiles.GetProfiles(); SProfile[] profiles = CBase.Profiles.GetProfiles();
for (int i = 0; i < _GameState.NumPlayerAtOnce; i++) for (int i = 0; i < _GameState.NumPlayerAtOnce; i++)
{ {
@@ -391,7 +389,7 @@ namespace VocaluxeLib.PartyModes.Challenge
} }
else else
{ {
Texts[_TextNextPlayerMessage].Visible = false; _Texts[_TextNextPlayerMessage].Visible = false;
for (int i = 0; i < _GameState.NumPlayerAtOnce; i++) for (int i = 0; i < _GameState.NumPlayerAtOnce; i++)
{ {
_NextPlayerStatics[i].Visible = false; _NextPlayerStatics[i].Visible = false;
@@ -415,20 +413,20 @@ namespace VocaluxeLib.PartyModes.Challenge
for (int round = 0; round < _RoundsTable.Count; round++) for (int round = 0; round < _RoundsTable.Count; round++)
{ {
//Round-number //Round-number
CText text = GetNewText(Texts[_TextRoundNumber]); CText text = GetNewText(_Texts[_TextRoundNumber]);
AddText(text); _AddText(text);
_RoundsTable[round].Number = text; _RoundsTable[round].Number = text;
for (int row = 0; row < 2; row++) for (int row = 0; row < 2; row++)
{ {
for (int column = 0; column < 3; column++) for (int column = 0; column < 3; column++)
{ {
//Player //Player
text = GetNewText(Texts[_TextRoundPlayer]); text = GetNewText(_Texts[_TextRoundPlayer]);
AddText(text); _AddText(text);
_RoundsTable[round].TextPlayer.Add(text); _RoundsTable[round].TextPlayer.Add(text);
//Score //Score
text = GetNewText(Texts[_TextRoundScore]); text = GetNewText(_Texts[_TextRoundScore]);
AddText(text); _AddText(text);
_RoundsTable[round].TextScores.Add(text); _RoundsTable[round].TextScores.Add(text);
} }
} }
@@ -448,14 +446,14 @@ namespace VocaluxeLib.PartyModes.Challenge
if (_NumRoundsVisible > _GameState.Combs.Count) if (_NumRoundsVisible > _GameState.Combs.Count)
_NumRoundsVisible = _GameState.Combs.Count; _NumRoundsVisible = _GameState.Combs.Count;
float numberX = Texts[_TextRoundNumber].X; float numberX = _Texts[_TextRoundNumber].X;
float numberY = Texts[_TextRoundNumber].Y; float numberY = _Texts[_TextRoundNumber].Y;
_RoundsTableScrollArea.X = numberX; _RoundsTableScrollArea.X = numberX;
_RoundsTableScrollArea.Y = numberY; _RoundsTableScrollArea.Y = numberY;
_RoundsTableScrollArea.W = CBase.Settings.GetRenderW() - Texts[_TextRoundNumber].X - 20; _RoundsTableScrollArea.W = CBase.Settings.GetRenderW() - _Texts[_TextRoundNumber].X - 20;
float delta = Texts[_TextRoundNumber].Height; float delta = _Texts[_TextRoundNumber].Height;
//Update statics and texts for rounds //Update statics and texts for rounds
for (int round = 0; round < _RoundsTable.Count; round++) for (int round = 0; round < _RoundsTable.Count; round++)
@@ -476,9 +474,9 @@ namespace VocaluxeLib.PartyModes.Challenge
for (int column = row * numPlayerInOneRow; column < num; column++) for (int column = row * numPlayerInOneRow; column < num; column++)
{ {
//Player //Player
float x = numberX + 15 + (CBase.Settings.GetRenderW() - Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow * (column - row * numPlayerInOneRow) + float x = numberX + 15 + (CBase.Settings.GetRenderW() - _Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow * (column - row * numPlayerInOneRow) +
((CBase.Settings.GetRenderW() - Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow) / 2; ((CBase.Settings.GetRenderW() - _Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow) / 2;
float maxw = ((CBase.Settings.GetRenderW() - Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow) / 2 - 5; float maxw = ((CBase.Settings.GetRenderW() - _Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow) / 2 - 5;
_RoundsTable[round].TextPlayer[column].X = x; _RoundsTable[round].TextPlayer[column].X = x;
_RoundsTable[round].TextPlayer[column].Y = numberY; _RoundsTable[round].TextPlayer[column].Y = numberY;
_RoundsTable[round].TextPlayer[column].MaxWidth = maxw; _RoundsTable[round].TextPlayer[column].MaxWidth = maxw;
@@ -507,7 +505,7 @@ namespace VocaluxeLib.PartyModes.Challenge
_RoundsTable[i].Number.Visible = true; _RoundsTable[i].Number.Visible = true;
_RoundsTable[i].TextPlayer[p].Visible = true; _RoundsTable[i].TextPlayer[p].Visible = true;
_RoundsTable[i].TextScores[p].Visible = true; _RoundsTable[i].TextScores[p].Visible = true;
_RoundsTable[i].Number.Text = (i + 1 + _RoundsTableOffset).ToString() + ")"; _RoundsTable[i].Number.Text = (i + 1 + _RoundsTableOffset) + ")";
int pID = _GameState.ProfileIDs[_GameState.Combs[i + _RoundsTableOffset].Player[p]]; int pID = _GameState.ProfileIDs[_GameState.Combs[i + _RoundsTableOffset].Player[p]];
_RoundsTable[i].TextPlayer[p].Text = profile[pID].PlayerName; _RoundsTable[i].TextPlayer[p].Text = profile[pID].PlayerName;
if ((_GameState.CurrentRoundNr - 1) > i + _RoundsTableOffset) if ((_GameState.CurrentRoundNr - 1) > i + _RoundsTableOffset)
@@ -532,19 +530,19 @@ namespace VocaluxeLib.PartyModes.Challenge
} }
} }
Buttons[_ButtonRoundsScrollUp].Visible = _RoundsTableOffset > 0; _Buttons[_ButtonRoundsScrollUp].Visible = _RoundsTableOffset > 0;
Buttons[_ButtonRoundsScrollDown].Visible = _GameState.Combs.Count - _NumRoundsVisible - _RoundsTableOffset > 0; _Buttons[_ButtonRoundsScrollDown].Visible = _GameState.Combs.Count - _NumRoundsVisible - _RoundsTableOffset > 0;
} }
private void _BuildPlayerTable() private void _BuildPlayerTable()
{ {
_PlayerTableScrollArea = new SRectF(); _PlayerTableScrollArea = new SRectF();
_PlayerTableScrollArea.X = Texts[_TextPosition].X; _PlayerTableScrollArea.X = _Texts[_TextPosition].X;
_PlayerTableScrollArea.Y = Texts[_TextPosition].Y; _PlayerTableScrollArea.Y = _Texts[_TextPosition].Y;
_PlayerTableScrollArea.W = Texts[_TextGamePoints].X - Texts[_TextPosition].X; _PlayerTableScrollArea.W = _Texts[_TextGamePoints].X - _Texts[_TextPosition].X;
_PlayerTable = new List<STableRow>(); _PlayerTable = new List<STableRow>();
float delta = Texts[_TextPosition].Height * 1.2f; float delta = _Texts[_TextPosition].Height * 1.2f;
float h = 0; float h = 0;
@@ -552,12 +550,12 @@ namespace VocaluxeLib.PartyModes.Challenge
{ {
STableRow row = new STableRow(); STableRow row = new STableRow();
row.Pos = GetNewText(Texts[_TextPosition]); row.Pos = GetNewText(_Texts[_TextPosition]);
row.Name = GetNewText(Texts[_TextPlayerName]); row.Name = GetNewText(_Texts[_TextPlayerName]);
row.Rounds = GetNewText(Texts[_TextNumPlayed]); row.Rounds = GetNewText(_Texts[_TextNumPlayed]);
row.Won = GetNewText(Texts[_TextWon]); row.Won = GetNewText(_Texts[_TextWon]);
row.SingPoints = GetNewText(Texts[_TextSingPoints]); row.SingPoints = GetNewText(_Texts[_TextSingPoints]);
row.GamePoints = GetNewText(Texts[_TextGamePoints]); row.GamePoints = GetNewText(_Texts[_TextGamePoints]);
row.Pos.Y += delta * (i + 1); row.Pos.Y += delta * (i + 1);
row.Name.Y += delta * (i + 1); row.Name.Y += delta * (i + 1);
@@ -566,7 +564,7 @@ namespace VocaluxeLib.PartyModes.Challenge
row.SingPoints.Y += delta * (i + 1); row.SingPoints.Y += delta * (i + 1);
row.GamePoints.Y += delta * (i + 1); row.GamePoints.Y += delta * (i + 1);
row.Pos.Text = (i + 1).ToString() + "."; row.Pos.Text = (i + 1) + ".";
row.Pos.Visible = false; row.Pos.Visible = false;
row.Name.Visible = false; row.Name.Visible = false;
@@ -575,12 +573,12 @@ namespace VocaluxeLib.PartyModes.Challenge
row.SingPoints.Visible = false; row.SingPoints.Visible = false;
row.GamePoints.Visible = false; row.GamePoints.Visible = false;
AddText(row.Pos); _AddText(row.Pos);
AddText(row.Name); _AddText(row.Name);
AddText(row.Rounds); _AddText(row.Rounds);
AddText(row.Won); _AddText(row.Won);
AddText(row.SingPoints); _AddText(row.SingPoints);
AddText(row.GamePoints); _AddText(row.GamePoints);
_PlayerTable.Add(row); _PlayerTable.Add(row);
@@ -606,7 +604,7 @@ namespace VocaluxeLib.PartyModes.Challenge
row.SingPoints.Visible = true; row.SingPoints.Visible = true;
row.GamePoints.Visible = true; row.GamePoints.Visible = true;
row.Pos.Text = _GameState.ResultTable[i + _PlayerTableOffset].Position.ToString() + "."; row.Pos.Text = _GameState.ResultTable[i + _PlayerTableOffset].Position + ".";
row.Name.Text = profiles[_GameState.ResultTable[i + _PlayerTableOffset].PlayerID].PlayerName; row.Name.Text = profiles[_GameState.ResultTable[i + _PlayerTableOffset].PlayerID].PlayerName;
row.Rounds.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumRounds.ToString(); row.Rounds.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumRounds.ToString();
row.Won.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumWon.ToString(); row.Won.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumWon.ToString();
@@ -624,8 +622,8 @@ namespace VocaluxeLib.PartyModes.Challenge
} }
} }
Buttons[_ButtonPlayerScrollUp].Visible = _PlayerTableOffset > 0; _Buttons[_ButtonPlayerScrollUp].Visible = _PlayerTableOffset > 0;
Buttons[_ButtonPlayerScrollDown].Visible = _GameState.ProfileIDs.Count - _NumPlayerVisible - _PlayerTableOffset > 0; _Buttons[_ButtonPlayerScrollDown].Visible = _GameState.ProfileIDs.Count - _NumPlayerVisible - _PlayerTableOffset > 0;
} }
private void _ScrollPlayerTable(int offset) private void _ScrollPlayerTable(int offset)
@@ -19,12 +19,15 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms; using System.Windows.Forms;
using VocaluxeLib.Menu; using VocaluxeLib.Menu;
namespace VocaluxeLib.PartyModes.Challenge namespace VocaluxeLib.PartyModes.Challenge
{ {
// ReSharper disable UnusedMember.Global
public class CPartyScreenChallengeNames : CMenuParty public class CPartyScreenChallengeNames : CMenuParty
// ReSharper restore UnusedMember.Global
{ {
// Version number for theme files. Increment it, if you've changed something on the theme files! // Version number for theme files. Increment it, if you've changed something on the theme files!
protected override int _ScreenVersion protected override int _ScreenVersion
@@ -41,7 +44,6 @@ namespace VocaluxeLib.PartyModes.Challenge
private List<CButton> _PlayerDestinationButtons; private List<CButton> _PlayerDestinationButtons;
//PlayerDestinationButtons-Option //PlayerDestinationButtons-Option
private const int _PlayerDestinationButtonsNumH = 3; private const int _PlayerDestinationButtonsNumH = 3;
private const int _PlayerDestinationButtonsNumW = 4;
private const int _PlayerDestinationButtonsFirstX = 900; private const int _PlayerDestinationButtonsFirstX = 900;
private const int _PlayerDestinationButtonsFirstY = 105; private const int _PlayerDestinationButtonsFirstY = 105;
private const int _PlayerDestinationButtonsSpaceH = 15; private const int _PlayerDestinationButtonsSpaceH = 15;
@@ -54,7 +56,7 @@ namespace VocaluxeLib.PartyModes.Challenge
private const int _PlayerChooseButtonsFirstY = 105; private const int _PlayerChooseButtonsFirstY = 105;
private const int _PlayerChooseButtonsSpaceH = 15; private const int _PlayerChooseButtonsSpaceH = 15;
private const int _PlayerChooseButtonsSpaceW = 25; private const int _PlayerChooseButtonsSpaceW = 25;
private int _PlayerChooseButtonsOffset = 0; private const int _PlayerChooseButtonsOffset = 0;
private CStatic _ChooseAvatarStatic; private CStatic _ChooseAvatarStatic;
private bool _SelectingMouseActive; private bool _SelectingMouseActive;
@@ -84,27 +86,19 @@ namespace VocaluxeLib.PartyModes.Challenge
_Data.ScreenNames.ProfileIDs = new List<int>(); _Data.ScreenNames.ProfileIDs = new List<int>();
List<string> buttons = new List<string>();
_ThemeButtons = new string[] {_ButtonBack, _ButtonNext, _ButtonPlayerDestination, _ButtonPlayerChoose}; _ThemeButtons = new string[] {_ButtonBack, _ButtonNext, _ButtonPlayerDestination, _ButtonPlayerChoose};
_Data = new SDataFromScreen(); _Data = new SDataFromScreen();
SFromScreenNames names = new SFromScreenNames(); SFromScreenNames names = new SFromScreenNames {FadeToConfig = false, FadeToMain = false, ProfileIDs = new List<int>()};
names.FadeToConfig = false;
names.FadeToMain = false;
names.ProfileIDs = new List<int>();
_Data.ScreenNames = names; _Data.ScreenNames = names;
} }
public override void DataToScreen(object receivedData) public override void DataToScreen(object receivedData)
{ {
SDataToScreenNames config = new SDataToScreenNames();
try try
{ {
config = (SDataToScreenNames)receivedData; SDataToScreenNames config = (SDataToScreenNames)receivedData;
_Data.ScreenNames.ProfileIDs = config.ProfileIDs; _Data.ScreenNames.ProfileIDs = config.ProfileIDs ?? new List<int>();
if (_Data.ScreenNames.ProfileIDs == null)
_Data.ScreenNames.ProfileIDs = new List<int>();
_NumPlayer = config.NumPlayer; _NumPlayer = config.NumPlayer;
@@ -132,10 +126,10 @@ namespace VocaluxeLib.PartyModes.Challenge
break; break;
case Keys.Enter: case Keys.Enter:
if (Buttons[_ButtonBack].Selected) if (_Buttons[_ButtonBack].Selected)
_Back(); _Back();
if (Buttons[_ButtonNext].Selected) if (_Buttons[_ButtonNext].Selected)
_Next(); _Next();
if (!_OnAdd()) if (!_OnAdd())
@@ -237,12 +231,12 @@ namespace VocaluxeLib.PartyModes.Challenge
_ChooseAvatarStatic.Visible = false; _ChooseAvatarStatic.Visible = false;
} }
if (mouseEvent.LB && IsMouseOver(mouseEvent)) if (mouseEvent.LB && _IsMouseOver(mouseEvent))
{ {
if (Buttons[_ButtonBack].Selected) if (_Buttons[_ButtonBack].Selected)
_Back(); _Back();
if (Buttons[_ButtonNext].Selected) if (_Buttons[_ButtonNext].Selected)
_Next(); _Next();
if (!_OnAdd()) if (!_OnAdd())
@@ -287,13 +281,13 @@ namespace VocaluxeLib.PartyModes.Challenge
private void _AddButtonPlayerDestination() private void _AddButtonPlayerDestination()
{ {
Buttons[_ButtonPlayerDestination].Visible = false; _Buttons[_ButtonPlayerDestination].Visible = false;
_PlayerDestinationButtons = new List<CButton>(); _PlayerDestinationButtons = new List<CButton>();
int row = 0; int row = 0;
int column = 0; int column = 0;
for (int i = 1; i <= _PartyMode.GetMaxPlayer(); i++) for (int i = 1; i <= _PartyMode.GetMaxPlayer(); i++)
{ {
CButton b = GetNewButton(Buttons[_ButtonPlayerDestination]); CButton b = GetNewButton(_Buttons[_ButtonPlayerDestination]);
b.Rect.X = _PlayerDestinationButtonsFirstX + column * (b.Rect.W + _PlayerDestinationButtonsSpaceH); b.Rect.X = _PlayerDestinationButtonsFirstX + column * (b.Rect.W + _PlayerDestinationButtonsSpaceH);
b.Rect.Y = _PlayerDestinationButtonsFirstY + row * (b.Rect.H + _PlayerDestinationButtonsSpaceW); b.Rect.Y = _PlayerDestinationButtonsFirstY + row * (b.Rect.H + _PlayerDestinationButtonsSpaceW);
_PlayerDestinationButtons.Add(b); _PlayerDestinationButtons.Add(b);
@@ -305,24 +299,22 @@ namespace VocaluxeLib.PartyModes.Challenge
} }
b.Visible = true; b.Visible = true;
b.Enabled = false; b.Enabled = false;
AddButton(b); _AddButton(b);
} }
} }
private void _AddButtonPlayerChoose() private void _AddButtonPlayerChoose()
{ {
Buttons[_ButtonPlayerChoose].Visible = false; _Buttons[_ButtonPlayerChoose].Visible = false;
_PlayerChooseButtons = new List<CPlayerChooseButton>(); _PlayerChooseButtons = new List<CPlayerChooseButton>();
int row = 0; int row = 0;
int column = 0; int column = 0;
for (int i = 1; i <= _PlayerChooseButtonsNumH * _PlayerChooseButtonsNumW; i++) for (int i = 1; i <= _PlayerChooseButtonsNumH * _PlayerChooseButtonsNumW; i++)
{ {
CButton b = GetNewButton(Buttons[_ButtonPlayerChoose]); CButton b = GetNewButton(_Buttons[_ButtonPlayerChoose]);
b.Rect.X = _PlayerChooseButtonsFirstX + column * (b.Rect.W + _PlayerChooseButtonsSpaceH); b.Rect.X = _PlayerChooseButtonsFirstX + column * (b.Rect.W + _PlayerChooseButtonsSpaceH);
b.Rect.Y = _PlayerChooseButtonsFirstY + row * (b.Rect.H + _PlayerChooseButtonsSpaceW); b.Rect.Y = _PlayerChooseButtonsFirstY + row * (b.Rect.H + _PlayerChooseButtonsSpaceW);
CPlayerChooseButton pcb = new CPlayerChooseButton(); CPlayerChooseButton pcb = new CPlayerChooseButton {Button = b, ProfileID = -1};
pcb.Button = b;
pcb.ProfileID = -1;
_PlayerChooseButtons.Add(pcb); _PlayerChooseButtons.Add(pcb);
column++; column++;
if (column >= _PlayerChooseButtonsNumH) if (column >= _PlayerChooseButtonsNumH)
@@ -332,7 +324,7 @@ namespace VocaluxeLib.PartyModes.Challenge
} }
b.Visible = true; b.Visible = true;
b.Enabled = false; b.Enabled = false;
AddButton(b); _AddButton(b);
} }
} }
@@ -348,7 +340,7 @@ namespace VocaluxeLib.PartyModes.Challenge
private void _UpdateButtonPlayerChoose(int offset) private void _UpdateButtonPlayerChoose(int offset)
{ {
int numButtonPlayerChoose = _PlayerChooseButtonsNumW * _PlayerChooseButtonsNumH; const int numButtonPlayerChoose = _PlayerChooseButtonsNumW * _PlayerChooseButtonsNumH;
if (offset < 0) if (offset < 0)
offset = 0; offset = 0;
@@ -372,10 +364,10 @@ namespace VocaluxeLib.PartyModes.Challenge
{ {
_PlayerChooseButtons[i].ProfileID = -1; _PlayerChooseButtons[i].ProfileID = -1;
_PlayerChooseButtons[i].Button.Text.Text = String.Empty; _PlayerChooseButtons[i].Button.Text.Text = String.Empty;
_PlayerChooseButtons[i].Button.Texture = Buttons[_ButtonPlayerChoose].Texture; _PlayerChooseButtons[i].Button.Texture = _Buttons[_ButtonPlayerChoose].Texture;
_PlayerChooseButtons[i].Button.SelTexture = Buttons[_ButtonPlayerChoose].SelTexture; _PlayerChooseButtons[i].Button.SelTexture = _Buttons[_ButtonPlayerChoose].SelTexture;
_PlayerChooseButtons[i].Button.Color = Buttons[_ButtonPlayerChoose].Color; _PlayerChooseButtons[i].Button.Color = _Buttons[_ButtonPlayerChoose].Color;
_PlayerChooseButtons[i].Button.SelColor = Buttons[_ButtonPlayerChoose].SelColor; _PlayerChooseButtons[i].Button.SelColor = _Buttons[_ButtonPlayerChoose].SelColor;
_PlayerChooseButtons[i].Button.Enabled = false; _PlayerChooseButtons[i].Button.Enabled = false;
} }
} }
@@ -391,17 +383,7 @@ namespace VocaluxeLib.PartyModes.Challenge
//Show profile only if active //Show profile only if active
if (CBase.Profiles.GetProfiles()[i].Active == EOffOn.TR_CONFIG_ON) if (CBase.Profiles.GetProfiles()[i].Active == EOffOn.TR_CONFIG_ON)
{ {
visible = true; visible = _Data.ScreenNames.ProfileIDs.All(profileID => profileID != i);
for (int p = 0; p < _Data.ScreenNames.ProfileIDs.Count; p++)
{
//Don't show profile if is selected
if (_Data.ScreenNames.ProfileIDs[p] == i)
{
visible = false;
break;
}
}
} }
if (visible) if (visible)
_PlayerChooseButtonsVisibleProfiles.Add(i); _PlayerChooseButtonsVisibleProfiles.Add(i);
@@ -439,10 +421,10 @@ namespace VocaluxeLib.PartyModes.Challenge
} }
else else
{ {
_PlayerDestinationButtons[i].Color = Buttons[_ButtonPlayerDestination].Color; _PlayerDestinationButtons[i].Color = _Buttons[_ButtonPlayerDestination].Color;
_PlayerDestinationButtons[i].SelColor = Buttons[_ButtonPlayerDestination].SelColor; _PlayerDestinationButtons[i].SelColor = _Buttons[_ButtonPlayerDestination].SelColor;
_PlayerDestinationButtons[i].Texture = Buttons[_ButtonPlayerDestination].Texture; _PlayerDestinationButtons[i].Texture = _Buttons[_ButtonPlayerDestination].Texture;
_PlayerDestinationButtons[i].SelTexture = Buttons[_ButtonPlayerDestination].SelTexture; _PlayerDestinationButtons[i].SelTexture = _Buttons[_ButtonPlayerDestination].SelTexture;
_PlayerDestinationButtons[i].Text.Text = String.Empty; _PlayerDestinationButtons[i].Text.Text = String.Empty;
_PlayerDestinationButtons[i].Enabled = false; _PlayerDestinationButtons[i].Enabled = false;
} }
@@ -453,59 +435,52 @@ namespace VocaluxeLib.PartyModes.Challenge
{ {
if (_Data.ScreenNames.ProfileIDs.Count == _NumPlayer) if (_Data.ScreenNames.ProfileIDs.Count == _NumPlayer)
{ {
Buttons[_ButtonNext].Visible = true; _Buttons[_ButtonNext].Visible = true;
SetInteractionToButton(Buttons[_ButtonNext]); _SetInteractionToButton(_Buttons[_ButtonNext]);
} }
else else
Buttons[_ButtonNext].Visible = false; _Buttons[_ButtonNext].Visible = false;
} }
private bool _OnAdd() private bool _OnAdd()
{ {
for (int i = 0; i < _PlayerChooseButtons.Count; i++) foreach (CPlayerChooseButton button in _PlayerChooseButtons)
{ {
if (_PlayerChooseButtons[i].Button.Selected && _PlayerChooseButtons[i].ProfileID != -1) if (!button.Button.Selected || button.ProfileID == -1 || _Data.ScreenNames.ProfileIDs.Count >= _NumPlayer)
{ continue;
if (_Data.ScreenNames.ProfileIDs.Count < _NumPlayer) _Data.ScreenNames.ProfileIDs.Add(button.ProfileID);
{ int added = _Data.ScreenNames.ProfileIDs.Count - 1;
_Data.ScreenNames.ProfileIDs.Add(_PlayerChooseButtons[i].ProfileID); _UpdateButtonNext();
int added = _Data.ScreenNames.ProfileIDs.Count - 1; //Update texture and name
_UpdateButtonNext(); _PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f);
//Update texture and name _PlayerDestinationButtons[added].SelColor = new SColorF(1, 1, 1, 1);
_PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f); _PlayerDestinationButtons[added].Texture = CBase.Profiles.GetProfiles()[button.ProfileID].Avatar.Texture;
_PlayerDestinationButtons[added].SelColor = new SColorF(1, 1, 1, 1); _PlayerDestinationButtons[added].SelTexture = CBase.Profiles.GetProfiles()[button.ProfileID].Avatar.Texture;
_PlayerDestinationButtons[added].Texture = CBase.Profiles.GetProfiles()[_PlayerChooseButtons[i].ProfileID].Avatar.Texture; _PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[button.ProfileID].PlayerName;
_PlayerDestinationButtons[added].SelTexture = CBase.Profiles.GetProfiles()[_PlayerChooseButtons[i].ProfileID].Avatar.Texture; _PlayerDestinationButtons[added].Enabled = true;
_PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[_PlayerChooseButtons[i].ProfileID].PlayerName; //Update Tiles-List
_PlayerDestinationButtons[added].Enabled = true; _UpdateButtonPlayerChoose();
//Update Tiles-List _CheckInteraction();
_UpdateButtonPlayerChoose(); return true;
CheckInteraction();
return true;
}
}
} }
return false; return false;
} }
private bool _OnRemove() private void _OnRemove()
{ {
for (int i = 0; i < _PlayerDestinationButtons.Count; i++) for (int i = 0; i < _PlayerDestinationButtons.Count; i++)
{ {
if (_PlayerDestinationButtons[i].Selected) if (!_PlayerDestinationButtons[i].Selected)
{ continue;
if ((i + 1) <= _Data.ScreenNames.ProfileIDs.Count) if ((i + 1) > _Data.ScreenNames.ProfileIDs.Count)
{ continue;
_Data.ScreenNames.ProfileIDs.RemoveAt(i); _Data.ScreenNames.ProfileIDs.RemoveAt(i);
_UpdateButtonNext(); _UpdateButtonNext();
_UpdateButtonPlayerDestination(); _UpdateButtonPlayerDestination();
_UpdateButtonPlayerChoose(); _UpdateButtonPlayerChoose();
CheckInteraction(); _CheckInteraction();
return true; return;
}
}
} }
return false;
} }
private void _Back() private void _Back()
@@ -216,7 +216,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
public override void DataFromScreen(string screenName, Object data) public override void DataFromScreen(string screenName, Object data)
{ {
SDataFromScreen dataFrom = new SDataFromScreen(); SDataFromScreen dataFrom;
switch (screenName) switch (screenName)
{ {
case "PartyScreenChallengeMedleyConfig": case "PartyScreenChallengeMedleyConfig":
@@ -376,10 +376,11 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
return _ScreenSongOptions; return _ScreenSongOptions;
} }
// ReSharper disable RedundantAssignment
public override void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions) public override void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions)
// ReSharper restore RedundantAssignment
{ {
if (_ScreenSongOptions.Selection.SongIndex != -1) _ScreenSongOptions.Selection.SongIndex = -1;
_ScreenSongOptions.Selection.SongIndex = -1;
if (_ScreenSongOptions.Selection.SelectNextRandomSong && songIndex != -1) if (_ScreenSongOptions.Selection.SelectNextRandomSong && songIndex != -1)
{ {
@@ -396,7 +397,9 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
screenSongOptions = _ScreenSongOptions; screenSongOptions = _ScreenSongOptions;
} }
// ReSharper disable RedundantAssignment
public override void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions) public override void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions)
// ReSharper restore RedundantAssignment
{ {
if (_GameData.CatSongIndices != null && categoryIndex != -1) if (_GameData.CatSongIndices != null && categoryIndex != -1)
{ {
@@ -60,11 +60,9 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
public override void DataToScreen(object receivedData) public override void DataToScreen(object receivedData)
{ {
SDataToScreenConfig config = new SDataToScreenConfig();
try try
{ {
config = (SDataToScreenConfig)receivedData; SDataToScreenConfig config = (SDataToScreenConfig)receivedData;
_Data.ScreenConfig.NumPlayer = config.NumPlayer; _Data.ScreenConfig.NumPlayer = config.NumPlayer;
_Data.ScreenConfig.NumPlayerAtOnce = config.NumPlayerAtOnce; _Data.ScreenConfig.NumPlayerAtOnce = config.NumPlayerAtOnce;
_Data.ScreenConfig.NumRounds = config.NumRounds; _Data.ScreenConfig.NumRounds = config.NumRounds;
@@ -92,10 +90,10 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
case Keys.Enter: case Keys.Enter:
_UpdateSlides(); _UpdateSlides();
if (Buttons[_ButtonBack].Selected) if (_Buttons[_ButtonBack].Selected)
_Back(); _Back();
if (Buttons[_ButtonNext].Selected) if (_Buttons[_ButtonNext].Selected)
_Next(); _Next();
break; break;
@@ -115,13 +113,13 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
{ {
base.HandleMouse(mouseEvent); base.HandleMouse(mouseEvent);
if (mouseEvent.LB && IsMouseOver(mouseEvent)) if (mouseEvent.LB && _IsMouseOver(mouseEvent))
{ {
_UpdateSlides(); _UpdateSlides();
if (Buttons[_ButtonBack].Selected) if (_Buttons[_ButtonBack].Selected)
_Back(); _Back();
if (Buttons[_ButtonNext].Selected) if (_Buttons[_ButtonNext].Selected)
_Next(); _Next();
} }
@@ -158,10 +156,10 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
private void _RebuildSlides() private void _RebuildSlides()
{ {
// build num player slide (min player ... max player); // build num player slide (min player ... max player);
SelectSlides[_SelectSlideNumPlayers].Clear(); _SelectSlides[_SelectSlideNumPlayers].Clear();
for (int i = _PartyMode.GetMinPlayer(); i <= _PartyMode.GetMaxPlayer(); i++) for (int i = _PartyMode.GetMinPlayer(); i <= _PartyMode.GetMaxPlayer(); i++)
SelectSlides[_SelectSlideNumPlayers].AddValue(i.ToString()); _SelectSlides[_SelectSlideNumPlayers].AddValue(i.ToString());
SelectSlides[_SelectSlideNumPlayers].Selection = _Data.ScreenConfig.NumPlayer - _PartyMode.GetMinPlayer(); _SelectSlides[_SelectSlideNumPlayers].Selection = _Data.ScreenConfig.NumPlayer - _PartyMode.GetMinPlayer();
_UpdateMicsAtOnce(); _UpdateMicsAtOnce();
_SetRoundSteps(); _SetRoundSteps();
@@ -172,9 +170,9 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
{ {
int player = _Data.ScreenConfig.NumPlayer; int player = _Data.ScreenConfig.NumPlayer;
int mics = _Data.ScreenConfig.NumPlayerAtOnce; int mics = _Data.ScreenConfig.NumPlayerAtOnce;
_Data.ScreenConfig.NumPlayer = SelectSlides[_SelectSlideNumPlayers].Selection + _PartyMode.GetMinPlayer(); _Data.ScreenConfig.NumPlayer = _SelectSlides[_SelectSlideNumPlayers].Selection + _PartyMode.GetMinPlayer();
_Data.ScreenConfig.NumPlayerAtOnce = SelectSlides[_SelectSlideNumMics].Selection + _PartyMode.GetMinPlayer(); _Data.ScreenConfig.NumPlayerAtOnce = _SelectSlides[_SelectSlideNumMics].Selection + _PartyMode.GetMinPlayer();
_Data.ScreenConfig.NumRounds = (SelectSlides[_SelectSlideNumRounds].Selection + 1) * _RoundSteps; _Data.ScreenConfig.NumRounds = (_SelectSlides[_SelectSlideNumRounds].Selection + 1) * _RoundSteps;
_UpdateMicsAtOnce(); _UpdateMicsAtOnce();
_SetRoundSteps(); _SetRoundSteps();
@@ -201,19 +199,19 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
_Data.ScreenConfig.NumPlayerAtOnce = maxNum; _Data.ScreenConfig.NumPlayerAtOnce = maxNum;
// build mics at once slide // build mics at once slide
SelectSlides[_SelectSlideNumMics].Clear(); _SelectSlides[_SelectSlideNumMics].Clear();
for (int i = 1; i <= maxNum; i++) for (int i = 1; i <= maxNum; i++)
SelectSlides[_SelectSlideNumMics].AddValue(i.ToString()); _SelectSlides[_SelectSlideNumMics].AddValue(i.ToString());
SelectSlides[_SelectSlideNumMics].Selection = _Data.ScreenConfig.NumPlayerAtOnce - _PartyMode.GetMinPlayer(); _SelectSlides[_SelectSlideNumMics].Selection = _Data.ScreenConfig.NumPlayerAtOnce - _PartyMode.GetMinPlayer();
} }
private void _UpdateSlideRounds() private void _UpdateSlideRounds()
{ {
// build num rounds slide // build num rounds slide
SelectSlides[_SelectSlideNumRounds].Clear(); _SelectSlides[_SelectSlideNumRounds].Clear();
for (int i = _RoundSteps; i <= _MaxNumRounds; i += _RoundSteps) for (int i = _RoundSteps; i <= _MaxNumRounds; i += _RoundSteps)
SelectSlides[_SelectSlideNumRounds].AddValue(i.ToString()); _SelectSlides[_SelectSlideNumRounds].AddValue(i.ToString());
SelectSlides[_SelectSlideNumRounds].Selection = _Data.ScreenConfig.NumRounds / _RoundSteps - 1; _SelectSlides[_SelectSlideNumRounds].Selection = _Data.ScreenConfig.NumRounds / _RoundSteps - 1;
} }
private void _SetRoundSteps() private void _SetRoundSteps()
@@ -130,20 +130,18 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
for (int i = 0; i < _PartyMode.GetMaxPlayer(); i++) for (int i = 0; i < _PartyMode.GetMaxPlayer(); i++)
{ {
_NextPlayerTexts.Add(GetNewText(Texts[_TextNextPlayer])); _NextPlayerTexts.Add(GetNewText(_Texts[_TextNextPlayer]));
AddText(_NextPlayerTexts[_NextPlayerTexts.Count - 1]); _AddText(_NextPlayerTexts[_NextPlayerTexts.Count - 1]);
_NextPlayerStatics.Add(GetNewStatic(Statics[_StaticNextPlayer])); _NextPlayerStatics.Add(GetNewStatic(_Statics[_StaticNextPlayer]));
AddStatic(_NextPlayerStatics[_NextPlayerStatics.Count - 1]); _AddStatic(_NextPlayerStatics[_NextPlayerStatics.Count - 1]);
} }
} }
public override void DataToScreen(object receivedData) public override void DataToScreen(object receivedData)
{ {
SDataToScreenMain data = new SDataToScreenMain();
try try
{ {
data = (SDataToScreenMain)receivedData; SDataToScreenMain data = (SDataToScreenMain)receivedData;
_GameState = data; _GameState = data;
} }
catch (Exception e) catch (Exception e)
@@ -177,26 +175,26 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
case Keys.Enter: case Keys.Enter:
if (!_ExitPopupVisible) if (!_ExitPopupVisible)
{ {
if (Buttons[_ButtonNextRound].Selected) if (_Buttons[_ButtonNextRound].Selected)
_NextRound(); _NextRound();
if (Buttons[_ButtonBack].Selected && _GameState.CurrentRoundNr == 1) if (_Buttons[_ButtonBack].Selected && _GameState.CurrentRoundNr == 1)
_Back(); _Back();
if (Buttons[_ButtonExit].Selected && _GameState.CurrentRoundNr > 1) if (_Buttons[_ButtonExit].Selected && _GameState.CurrentRoundNr > 1)
_ShowPopup(true); _ShowPopup(true);
if (Buttons[_ButtonPlayerScrollUp].Selected) if (_Buttons[_ButtonPlayerScrollUp].Selected)
_ScrollPlayerTable(-1); _ScrollPlayerTable(-1);
if (Buttons[_ButtonPlayerScrollDown].Selected) if (_Buttons[_ButtonPlayerScrollDown].Selected)
_ScrollPlayerTable(1); _ScrollPlayerTable(1);
if (Buttons[_ButtonRoundsScrollUp].Selected) if (_Buttons[_ButtonRoundsScrollUp].Selected)
_ScrollRoundsTable(-1); _ScrollRoundsTable(-1);
if (Buttons[_ButtonRoundsScrollDown].Selected) if (_Buttons[_ButtonRoundsScrollDown].Selected)
_ScrollRoundsTable(1); _ScrollRoundsTable(1);
} }
else else
{ {
if (Buttons[_ButtonPopupYes].Selected) if (_Buttons[_ButtonPopupYes].Selected)
_EndParty(); _EndParty();
if (Buttons[_ButtonPopupNo].Selected) if (_Buttons[_ButtonPopupNo].Selected)
_ShowPopup(false); _ShowPopup(false);
} }
break; break;
@@ -209,30 +207,30 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
{ {
base.HandleMouse(mouseEvent); base.HandleMouse(mouseEvent);
if (mouseEvent.LB && IsMouseOver(mouseEvent)) if (mouseEvent.LB && _IsMouseOver(mouseEvent))
{ {
if (!_ExitPopupVisible) if (!_ExitPopupVisible)
{ {
if (Buttons[_ButtonNextRound].Selected) if (_Buttons[_ButtonNextRound].Selected)
_NextRound(); _NextRound();
if (Buttons[_ButtonBack].Selected && _GameState.CurrentRoundNr == 1) if (_Buttons[_ButtonBack].Selected && _GameState.CurrentRoundNr == 1)
_Back(); _Back();
if (Buttons[_ButtonExit].Selected && _GameState.CurrentRoundNr > 1) if (_Buttons[_ButtonExit].Selected && _GameState.CurrentRoundNr > 1)
_ShowPopup(true); _ShowPopup(true);
if (Buttons[_ButtonPlayerScrollUp].Selected) if (_Buttons[_ButtonPlayerScrollUp].Selected)
_ScrollPlayerTable(-1); _ScrollPlayerTable(-1);
if (Buttons[_ButtonPlayerScrollDown].Selected) if (_Buttons[_ButtonPlayerScrollDown].Selected)
_ScrollPlayerTable(1); _ScrollPlayerTable(1);
if (Buttons[_ButtonRoundsScrollUp].Selected) if (_Buttons[_ButtonRoundsScrollUp].Selected)
_ScrollRoundsTable(-1); _ScrollRoundsTable(-1);
if (Buttons[_ButtonRoundsScrollDown].Selected) if (_Buttons[_ButtonRoundsScrollDown].Selected)
_ScrollRoundsTable(1); _ScrollRoundsTable(1);
} }
else else
{ {
if (Buttons[_ButtonPopupYes].Selected) if (_Buttons[_ButtonPopupYes].Selected)
_EndParty(); _EndParty();
if (Buttons[_ButtonPopupNo].Selected) if (_Buttons[_ButtonPopupNo].Selected)
_ShowPopup(false); _ShowPopup(false);
} }
} }
@@ -279,29 +277,29 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
if (_GameState.CurrentRoundNr == 1) if (_GameState.CurrentRoundNr == 1)
{ {
Buttons[_ButtonBack].Visible = true; _Buttons[_ButtonBack].Visible = true;
Buttons[_ButtonExit].Visible = false; _Buttons[_ButtonExit].Visible = false;
} }
else else
{ {
Buttons[_ButtonBack].Visible = false; _Buttons[_ButtonBack].Visible = false;
Buttons[_ButtonExit].Visible = true; _Buttons[_ButtonExit].Visible = true;
} }
if (_GameState.CurrentRoundNr <= _GameState.Combs.Count) if (_GameState.CurrentRoundNr <= _GameState.Combs.Count)
{ {
Buttons[_ButtonNextRound].Visible = true; _Buttons[_ButtonNextRound].Visible = true;
Texts[_TextFinishMessage].Visible = false; _Texts[_TextFinishMessage].Visible = false;
Texts[_TextFinishPlayerWin].Visible = false; _Texts[_TextFinishPlayerWin].Visible = false;
SetInteractionToButton(Buttons[_ButtonNextRound]); _SetInteractionToButton(_Buttons[_ButtonNextRound]);
} }
else else
{ {
Buttons[_ButtonNextRound].Visible = false; _Buttons[_ButtonNextRound].Visible = false;
Texts[_TextFinishMessage].Visible = true; _Texts[_TextFinishMessage].Visible = true;
Texts[_TextFinishPlayerWin].Visible = true; _Texts[_TextFinishPlayerWin].Visible = true;
Texts[_TextFinishPlayerWin].Text = _GetPlayerWinString(); _Texts[_TextFinishPlayerWin].Text = _GetPlayerWinString();
SetInteractionToButton(Buttons[_ButtonExit]); _SetInteractionToButton(_Buttons[_ButtonExit]);
} }
_ShowPopup(false); _ShowPopup(false);
@@ -334,13 +332,13 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
{ {
_ExitPopupVisible = visible; _ExitPopupVisible = visible;
Statics[_StaticPopupBG].Visible = _ExitPopupVisible; _Statics[_StaticPopupBG].Visible = _ExitPopupVisible;
Texts[_TextPopupReallyExit].Visible = _ExitPopupVisible; _Texts[_TextPopupReallyExit].Visible = _ExitPopupVisible;
Buttons[_ButtonPopupYes].Visible = _ExitPopupVisible; _Buttons[_ButtonPopupYes].Visible = _ExitPopupVisible;
Buttons[_ButtonPopupNo].Visible = _ExitPopupVisible; _Buttons[_ButtonPopupNo].Visible = _ExitPopupVisible;
if (_ExitPopupVisible) if (_ExitPopupVisible)
SetInteractionToButton(Buttons[_ButtonPopupNo]); _SetInteractionToButton(_Buttons[_ButtonPopupNo]);
} }
private void _Back() private void _Back()
@@ -352,7 +350,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
private void _UpdateNextPlayerPositions() private void _UpdateNextPlayerPositions()
{ {
float x = CBase.Settings.GetRenderW() / 2 - ((_GameState.NumPlayerAtOnce * Statics[_StaticNextPlayer].Rect.W) + ((_GameState.NumPlayerAtOnce - 1) * 15)) / 2; float x = CBase.Settings.GetRenderW() / 2 - ((_GameState.NumPlayerAtOnce * _Statics[_StaticNextPlayer].Rect.W) + ((_GameState.NumPlayerAtOnce - 1) * 15)) / 2;
float staticY = 590; float staticY = 590;
float textY = 550; float textY = 550;
for (int i = 0; i < _GameState.NumPlayerAtOnce; i++) for (int i = 0; i < _GameState.NumPlayerAtOnce; i++)
@@ -362,11 +360,11 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
_NextPlayerStatics[i].Rect.Y = staticY; _NextPlayerStatics[i].Rect.Y = staticY;
_NextPlayerStatics[i].Visible = true; _NextPlayerStatics[i].Visible = true;
//text //text
_NextPlayerTexts[i].X = x + Statics[_StaticNextPlayer].Rect.W / 2; _NextPlayerTexts[i].X = x + _Statics[_StaticNextPlayer].Rect.W / 2;
_NextPlayerTexts[i].Y = textY; _NextPlayerTexts[i].Y = textY;
_NextPlayerTexts[i].Visible = true; _NextPlayerTexts[i].Visible = true;
x += Statics[_StaticNextPlayer].Rect.W + 15; x += _Statics[_StaticNextPlayer].Rect.W + 15;
} }
for (int i = _GameState.NumPlayerAtOnce; i < _PartyMode.GetMaxPlayer(); i++) for (int i = _GameState.NumPlayerAtOnce; i < _PartyMode.GetMaxPlayer(); i++)
{ {
@@ -379,7 +377,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
{ {
if (_GameState.CurrentRoundNr <= _GameState.Combs.Count) if (_GameState.CurrentRoundNr <= _GameState.Combs.Count)
{ {
Texts[_TextNextPlayerMessage].Visible = true; _Texts[_TextNextPlayerMessage].Visible = true;
SProfile[] profiles = CBase.Profiles.GetProfiles(); SProfile[] profiles = CBase.Profiles.GetProfiles();
for (int i = 0; i < _GameState.NumPlayerAtOnce; i++) for (int i = 0; i < _GameState.NumPlayerAtOnce; i++)
{ {
@@ -391,7 +389,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
} }
else else
{ {
Texts[_TextNextPlayerMessage].Visible = false; _Texts[_TextNextPlayerMessage].Visible = false;
for (int i = 0; i < _GameState.NumPlayerAtOnce; i++) for (int i = 0; i < _GameState.NumPlayerAtOnce; i++)
{ {
_NextPlayerStatics[i].Visible = false; _NextPlayerStatics[i].Visible = false;
@@ -415,20 +413,20 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
for (int round = 0; round < _RoundsTable.Count; round++) for (int round = 0; round < _RoundsTable.Count; round++)
{ {
//Round-number //Round-number
CText text = GetNewText(Texts[_TextRoundNumber]); CText text = GetNewText(_Texts[_TextRoundNumber]);
AddText(text); _AddText(text);
_RoundsTable[round].Number = text; _RoundsTable[round].Number = text;
for (int row = 0; row < 2; row++) for (int row = 0; row < 2; row++)
{ {
for (int column = 0; column < 3; column++) for (int column = 0; column < 3; column++)
{ {
//Player //Player
text = GetNewText(Texts[_TextRoundPlayer]); text = GetNewText(_Texts[_TextRoundPlayer]);
AddText(text); _AddText(text);
_RoundsTable[round].TextPlayer.Add(text); _RoundsTable[round].TextPlayer.Add(text);
//Score //Score
text = GetNewText(Texts[_TextRoundScore]); text = GetNewText(_Texts[_TextRoundScore]);
AddText(text); _AddText(text);
_RoundsTable[round].TextScores.Add(text); _RoundsTable[round].TextScores.Add(text);
} }
} }
@@ -448,14 +446,14 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
if (_NumRoundsVisible > _GameState.Combs.Count) if (_NumRoundsVisible > _GameState.Combs.Count)
_NumRoundsVisible = _GameState.Combs.Count; _NumRoundsVisible = _GameState.Combs.Count;
float numberX = Texts[_TextRoundNumber].X; float numberX = _Texts[_TextRoundNumber].X;
float numberY = Texts[_TextRoundNumber].Y; float numberY = _Texts[_TextRoundNumber].Y;
_RoundsTableScrollArea.X = numberX; _RoundsTableScrollArea.X = numberX;
_RoundsTableScrollArea.Y = numberY; _RoundsTableScrollArea.Y = numberY;
_RoundsTableScrollArea.W = CBase.Settings.GetRenderW() - Texts[_TextRoundNumber].X - 20; _RoundsTableScrollArea.W = CBase.Settings.GetRenderW() - _Texts[_TextRoundNumber].X - 20;
float delta = Texts[_TextRoundNumber].Height; float delta = _Texts[_TextRoundNumber].Height;
//Update statics and texts for rounds //Update statics and texts for rounds
for (int round = 0; round < _RoundsTable.Count; round++) for (int round = 0; round < _RoundsTable.Count; round++)
@@ -476,9 +474,9 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
for (int column = row * numPlayerInOneRow; column < num; column++) for (int column = row * numPlayerInOneRow; column < num; column++)
{ {
//Player //Player
float x = numberX + 15 + (CBase.Settings.GetRenderW() - Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow * (column - row * numPlayerInOneRow) + float x = numberX + 15 + (CBase.Settings.GetRenderW() - _Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow * (column - row * numPlayerInOneRow) +
((CBase.Settings.GetRenderW() - Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow) / 2; ((CBase.Settings.GetRenderW() - _Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow) / 2;
float maxw = ((CBase.Settings.GetRenderW() - Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow) / 2 - 5; float maxw = ((CBase.Settings.GetRenderW() - _Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow) / 2 - 5;
_RoundsTable[round].TextPlayer[column].X = x; _RoundsTable[round].TextPlayer[column].X = x;
_RoundsTable[round].TextPlayer[column].Y = numberY; _RoundsTable[round].TextPlayer[column].Y = numberY;
_RoundsTable[round].TextPlayer[column].MaxWidth = maxw; _RoundsTable[round].TextPlayer[column].MaxWidth = maxw;
@@ -507,7 +505,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
_RoundsTable[i].Number.Visible = true; _RoundsTable[i].Number.Visible = true;
_RoundsTable[i].TextPlayer[p].Visible = true; _RoundsTable[i].TextPlayer[p].Visible = true;
_RoundsTable[i].TextScores[p].Visible = true; _RoundsTable[i].TextScores[p].Visible = true;
_RoundsTable[i].Number.Text = (i + 1 + _RoundsTableOffset).ToString() + ")"; _RoundsTable[i].Number.Text = (i + 1 + _RoundsTableOffset) + ")";
int pID = _GameState.ProfileIDs[_GameState.Combs[i + _RoundsTableOffset].Player[p]]; int pID = _GameState.ProfileIDs[_GameState.Combs[i + _RoundsTableOffset].Player[p]];
_RoundsTable[i].TextPlayer[p].Text = profile[pID].PlayerName; _RoundsTable[i].TextPlayer[p].Text = profile[pID].PlayerName;
if ((_GameState.CurrentRoundNr - 1) > i + _RoundsTableOffset) if ((_GameState.CurrentRoundNr - 1) > i + _RoundsTableOffset)
@@ -532,19 +530,19 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
} }
} }
Buttons[_ButtonRoundsScrollUp].Visible = _RoundsTableOffset > 0; _Buttons[_ButtonRoundsScrollUp].Visible = _RoundsTableOffset > 0;
Buttons[_ButtonRoundsScrollDown].Visible = _GameState.Combs.Count - _NumRoundsVisible - _RoundsTableOffset > 0; _Buttons[_ButtonRoundsScrollDown].Visible = _GameState.Combs.Count - _NumRoundsVisible - _RoundsTableOffset > 0;
} }
private void _BuildPlayerTable() private void _BuildPlayerTable()
{ {
_PlayerTableScrollArea = new SRectF(); _PlayerTableScrollArea = new SRectF();
_PlayerTableScrollArea.X = Texts[_TextPosition].X; _PlayerTableScrollArea.X = _Texts[_TextPosition].X;
_PlayerTableScrollArea.Y = Texts[_TextPosition].Y; _PlayerTableScrollArea.Y = _Texts[_TextPosition].Y;
_PlayerTableScrollArea.W = Texts[_TextGamePoints].X - Texts[_TextPosition].X; _PlayerTableScrollArea.W = _Texts[_TextGamePoints].X - _Texts[_TextPosition].X;
_PlayerTable = new List<STableRow>(); _PlayerTable = new List<STableRow>();
float delta = Texts[_TextPosition].Height * 1.2f; float delta = _Texts[_TextPosition].Height * 1.2f;
float h = 0; float h = 0;
@@ -552,12 +550,12 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
{ {
STableRow row = new STableRow(); STableRow row = new STableRow();
row.Pos = GetNewText(Texts[_TextPosition]); row.Pos = GetNewText(_Texts[_TextPosition]);
row.Name = GetNewText(Texts[_TextPlayerName]); row.Name = GetNewText(_Texts[_TextPlayerName]);
row.Rounds = GetNewText(Texts[_TextNumPlayed]); row.Rounds = GetNewText(_Texts[_TextNumPlayed]);
row.Won = GetNewText(Texts[_TextWon]); row.Won = GetNewText(_Texts[_TextWon]);
row.SingPoints = GetNewText(Texts[_TextSingPoints]); row.SingPoints = GetNewText(_Texts[_TextSingPoints]);
row.GamePoints = GetNewText(Texts[_TextGamePoints]); row.GamePoints = GetNewText(_Texts[_TextGamePoints]);
row.Pos.Y += delta * (i + 1); row.Pos.Y += delta * (i + 1);
row.Name.Y += delta * (i + 1); row.Name.Y += delta * (i + 1);
@@ -566,7 +564,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
row.SingPoints.Y += delta * (i + 1); row.SingPoints.Y += delta * (i + 1);
row.GamePoints.Y += delta * (i + 1); row.GamePoints.Y += delta * (i + 1);
row.Pos.Text = (i + 1).ToString() + "."; row.Pos.Text = (i + 1) + ".";
row.Pos.Visible = false; row.Pos.Visible = false;
row.Name.Visible = false; row.Name.Visible = false;
@@ -575,12 +573,12 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
row.SingPoints.Visible = false; row.SingPoints.Visible = false;
row.GamePoints.Visible = false; row.GamePoints.Visible = false;
AddText(row.Pos); _AddText(row.Pos);
AddText(row.Name); _AddText(row.Name);
AddText(row.Rounds); _AddText(row.Rounds);
AddText(row.Won); _AddText(row.Won);
AddText(row.SingPoints); _AddText(row.SingPoints);
AddText(row.GamePoints); _AddText(row.GamePoints);
_PlayerTable.Add(row); _PlayerTable.Add(row);
@@ -606,7 +604,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
row.SingPoints.Visible = true; row.SingPoints.Visible = true;
row.GamePoints.Visible = true; row.GamePoints.Visible = true;
row.Pos.Text = _GameState.ResultTable[i + _PlayerTableOffset].Position.ToString() + "."; row.Pos.Text = _GameState.ResultTable[i + _PlayerTableOffset].Position + ".";
row.Name.Text = profiles[_GameState.ResultTable[i + _PlayerTableOffset].PlayerID].PlayerName; row.Name.Text = profiles[_GameState.ResultTable[i + _PlayerTableOffset].PlayerID].PlayerName;
row.Rounds.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumRounds.ToString(); row.Rounds.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumRounds.ToString();
row.Won.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumWon.ToString(); row.Won.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumWon.ToString();
@@ -624,8 +622,8 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
} }
} }
Buttons[_ButtonPlayerScrollUp].Visible = _PlayerTableOffset > 0; _Buttons[_ButtonPlayerScrollUp].Visible = _PlayerTableOffset > 0;
Buttons[_ButtonPlayerScrollDown].Visible = _GameState.ProfileIDs.Count - _NumPlayerVisible - _PlayerTableOffset > 0; _Buttons[_ButtonPlayerScrollDown].Visible = _GameState.ProfileIDs.Count - _NumPlayerVisible - _PlayerTableOffset > 0;
} }
private void _ScrollPlayerTable(int offset) private void _ScrollPlayerTable(int offset)
@@ -41,7 +41,6 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
private List<CButton> _PlayerDestinationButtons; private List<CButton> _PlayerDestinationButtons;
//PlayerDestinationButtons-Option //PlayerDestinationButtons-Option
private const int _PlayerDestinationButtonsNumH = 3; private const int _PlayerDestinationButtonsNumH = 3;
private const int _PlayerDestinationButtonsNumW = 4;
private const int _PlayerDestinationButtonsFirstX = 900; private const int _PlayerDestinationButtonsFirstX = 900;
private const int _PlayerDestinationButtonsFirstY = 105; private const int _PlayerDestinationButtonsFirstY = 105;
private const int _PlayerDestinationButtonsSpaceH = 15; private const int _PlayerDestinationButtonsSpaceH = 15;
@@ -97,14 +96,10 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
public override void DataToScreen(object receivedData) public override void DataToScreen(object receivedData)
{ {
SDataToScreenNames config = new SDataToScreenNames();
try try
{ {
config = (SDataToScreenNames)receivedData; SDataToScreenNames config = (SDataToScreenNames)receivedData;
_Data.ScreenNames.ProfileIDs = config.ProfileIDs; _Data.ScreenNames.ProfileIDs = config.ProfileIDs ?? new List<int>();
if (_Data.ScreenNames.ProfileIDs == null)
_Data.ScreenNames.ProfileIDs = new List<int>();
_NumPlayer = config.NumPlayer; _NumPlayer = config.NumPlayer;
@@ -132,10 +127,10 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
break; break;
case Keys.Enter: case Keys.Enter:
if (Buttons[_ButtonBack].Selected) if (_Buttons[_ButtonBack].Selected)
_Back(); _Back();
if (Buttons[_ButtonNext].Selected) if (_Buttons[_ButtonNext].Selected)
_Next(); _Next();
if (!_OnAdd()) if (!_OnAdd())
@@ -237,12 +232,12 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
_ChooseAvatarStatic.Visible = false; _ChooseAvatarStatic.Visible = false;
} }
if (mouseEvent.LB && IsMouseOver(mouseEvent)) if (mouseEvent.LB && _IsMouseOver(mouseEvent))
{ {
if (Buttons[_ButtonBack].Selected) if (_Buttons[_ButtonBack].Selected)
_Back(); _Back();
if (Buttons[_ButtonNext].Selected) if (_Buttons[_ButtonNext].Selected)
_Next(); _Next();
if (!_OnAdd()) if (!_OnAdd())
@@ -287,13 +282,13 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
private void _AddButtonPlayerDestination() private void _AddButtonPlayerDestination()
{ {
Buttons[_ButtonPlayerDestination].Visible = false; _Buttons[_ButtonPlayerDestination].Visible = false;
_PlayerDestinationButtons = new List<CButton>(); _PlayerDestinationButtons = new List<CButton>();
int row = 0; int row = 0;
int column = 0; int column = 0;
for (int i = 1; i <= _PartyMode.GetMaxPlayer(); i++) for (int i = 1; i <= _PartyMode.GetMaxPlayer(); i++)
{ {
CButton b = GetNewButton(Buttons[_ButtonPlayerDestination]); CButton b = GetNewButton(_Buttons[_ButtonPlayerDestination]);
b.Rect.X = _PlayerDestinationButtonsFirstX + column * (b.Rect.W + _PlayerDestinationButtonsSpaceH); b.Rect.X = _PlayerDestinationButtonsFirstX + column * (b.Rect.W + _PlayerDestinationButtonsSpaceH);
b.Rect.Y = _PlayerDestinationButtonsFirstY + row * (b.Rect.H + _PlayerDestinationButtonsSpaceW); b.Rect.Y = _PlayerDestinationButtonsFirstY + row * (b.Rect.H + _PlayerDestinationButtonsSpaceW);
_PlayerDestinationButtons.Add(b); _PlayerDestinationButtons.Add(b);
@@ -305,19 +300,19 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
} }
b.Visible = true; b.Visible = true;
b.Enabled = false; b.Enabled = false;
AddButton(b); _AddButton(b);
} }
} }
private void _AddButtonPlayerChoose() private void _AddButtonPlayerChoose()
{ {
Buttons[_ButtonPlayerChoose].Visible = false; _Buttons[_ButtonPlayerChoose].Visible = false;
_PlayerChooseButtons = new List<CPlayerChooseButton>(); _PlayerChooseButtons = new List<CPlayerChooseButton>();
int row = 0; int row = 0;
int column = 0; int column = 0;
for (int i = 1; i <= _PlayerChooseButtonsNumH * _PlayerChooseButtonsNumW; i++) for (int i = 1; i <= _PlayerChooseButtonsNumH * _PlayerChooseButtonsNumW; i++)
{ {
CButton b = GetNewButton(Buttons[_ButtonPlayerChoose]); CButton b = GetNewButton(_Buttons[_ButtonPlayerChoose]);
b.Rect.X = _PlayerChooseButtonsFirstX + column * (b.Rect.W + _PlayerChooseButtonsSpaceH); b.Rect.X = _PlayerChooseButtonsFirstX + column * (b.Rect.W + _PlayerChooseButtonsSpaceH);
b.Rect.Y = _PlayerChooseButtonsFirstY + row * (b.Rect.H + _PlayerChooseButtonsSpaceW); b.Rect.Y = _PlayerChooseButtonsFirstY + row * (b.Rect.H + _PlayerChooseButtonsSpaceW);
CPlayerChooseButton pcb = new CPlayerChooseButton(); CPlayerChooseButton pcb = new CPlayerChooseButton();
@@ -332,7 +327,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
} }
b.Visible = true; b.Visible = true;
b.Enabled = false; b.Enabled = false;
AddButton(b); _AddButton(b);
} }
} }
@@ -372,10 +367,10 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
{ {
_PlayerChooseButtons[i].ProfileID = -1; _PlayerChooseButtons[i].ProfileID = -1;
_PlayerChooseButtons[i].Button.Text.Text = String.Empty; _PlayerChooseButtons[i].Button.Text.Text = String.Empty;
_PlayerChooseButtons[i].Button.Texture = Buttons[_ButtonPlayerChoose].Texture; _PlayerChooseButtons[i].Button.Texture = _Buttons[_ButtonPlayerChoose].Texture;
_PlayerChooseButtons[i].Button.SelTexture = Buttons[_ButtonPlayerChoose].SelTexture; _PlayerChooseButtons[i].Button.SelTexture = _Buttons[_ButtonPlayerChoose].SelTexture;
_PlayerChooseButtons[i].Button.Color = Buttons[_ButtonPlayerChoose].Color; _PlayerChooseButtons[i].Button.Color = _Buttons[_ButtonPlayerChoose].Color;
_PlayerChooseButtons[i].Button.SelColor = Buttons[_ButtonPlayerChoose].SelColor; _PlayerChooseButtons[i].Button.SelColor = _Buttons[_ButtonPlayerChoose].SelColor;
_PlayerChooseButtons[i].Button.Enabled = false; _PlayerChooseButtons[i].Button.Enabled = false;
} }
} }
@@ -439,10 +434,10 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
} }
else else
{ {
_PlayerDestinationButtons[i].Color = Buttons[_ButtonPlayerDestination].Color; _PlayerDestinationButtons[i].Color = _Buttons[_ButtonPlayerDestination].Color;
_PlayerDestinationButtons[i].SelColor = Buttons[_ButtonPlayerDestination].SelColor; _PlayerDestinationButtons[i].SelColor = _Buttons[_ButtonPlayerDestination].SelColor;
_PlayerDestinationButtons[i].Texture = Buttons[_ButtonPlayerDestination].Texture; _PlayerDestinationButtons[i].Texture = _Buttons[_ButtonPlayerDestination].Texture;
_PlayerDestinationButtons[i].SelTexture = Buttons[_ButtonPlayerDestination].SelTexture; _PlayerDestinationButtons[i].SelTexture = _Buttons[_ButtonPlayerDestination].SelTexture;
_PlayerDestinationButtons[i].Text.Text = String.Empty; _PlayerDestinationButtons[i].Text.Text = String.Empty;
_PlayerDestinationButtons[i].Enabled = false; _PlayerDestinationButtons[i].Enabled = false;
} }
@@ -453,11 +448,11 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
{ {
if (_Data.ScreenNames.ProfileIDs.Count == _NumPlayer) if (_Data.ScreenNames.ProfileIDs.Count == _NumPlayer)
{ {
Buttons[_ButtonNext].Visible = true; _Buttons[_ButtonNext].Visible = true;
SetInteractionToButton(Buttons[_ButtonNext]); _SetInteractionToButton(_Buttons[_ButtonNext]);
} }
else else
Buttons[_ButtonNext].Visible = false; _Buttons[_ButtonNext].Visible = false;
} }
private bool _OnAdd() private bool _OnAdd()
@@ -480,7 +475,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
_PlayerDestinationButtons[added].Enabled = true; _PlayerDestinationButtons[added].Enabled = true;
//Update Tiles-List //Update Tiles-List
_UpdateButtonPlayerChoose(); _UpdateButtonPlayerChoose();
CheckInteraction(); _CheckInteraction();
return true; return true;
} }
} }
@@ -500,7 +495,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
_UpdateButtonNext(); _UpdateButtonNext();
_UpdateButtonPlayerDestination(); _UpdateButtonPlayerDestination();
_UpdateButtonPlayerChoose(); _UpdateButtonPlayerChoose();
CheckInteraction(); _CheckInteraction();
return true; return true;
} }
} }
@@ -52,7 +52,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
public int PointsTeam1; public int PointsTeam1;
public int PointsTeam2; public int PointsTeam2;
public int Winner; public int Winner;
public bool Finished = false; public bool Finished;
} }
#region Communication #region Communication
@@ -456,12 +456,16 @@ namespace VocaluxeLib.PartyModes.TicTacToe
return _ScreenSongOptions; return _ScreenSongOptions;
} }
// ReSharper disable RedundantAssignment
public override void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions) public override void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions)
// ReSharper restore RedundantAssignment
{ {
screenSongOptions = _ScreenSongOptions; screenSongOptions = _ScreenSongOptions;
} }
// ReSharper disable RedundantAssignment
public override void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions) public override void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions)
// ReSharper restore RedundantAssignment
{ {
screenSongOptions = _ScreenSongOptions; screenSongOptions = _ScreenSongOptions;
} }
@@ -541,99 +545,101 @@ namespace VocaluxeLib.PartyModes.TicTacToe
private void _PreparePlayerList(int team) private void _PreparePlayerList(int team)
{ {
if (team == 0) switch (team)
{ {
_GameData.PlayerTeam1 = new List<int>(); case 0:
_GameData.PlayerTeam2 = new List<int>(); {
_GameData.PlayerTeam1 = new List<int>();
_GameData.PlayerTeam2 = new List<int>();
//Prepare Player-IDs //Prepare Player-IDs
List<int> iDs1 = new List<int>(); List<int> ids1 = new List<int>();
List<int> iDs2 = new List<int>(); List<int> ids2 = new List<int>();
int num = 0; //Add IDs to team-list
int random = 0; while (_GameData.PlayerTeam1.Count < _GameData.NumFields + _GameData.NumJokerRetry[0] && ids1.Count == 0 &&
//Add IDs to team-list _GameData.PlayerTeam2.Count < _GameData.NumFields + _GameData.NumJokerRetry[1] && ids2.Count == 0)
while (_GameData.PlayerTeam1.Count < _GameData.NumFields + _GameData.NumJokerRetry[0] && iDs1.Count == 0 && {
_GameData.PlayerTeam2.Count < _GameData.NumFields + _GameData.NumJokerRetry[1] && iDs2.Count == 0) if (ids1.Count == 0)
{ {
if (iDs1.Count == 0) for (int i = 0; i < _GameData.NumPlayerTeam1; i++)
{ ids1.Add(i);
for (int i = 0; i < _GameData.NumPlayerTeam1; i++) }
iDs1.Add(i); if (ids2.Count == 0)
{
for (int i = 0; i < _GameData.NumPlayerTeam2; i++)
ids2.Add(i);
}
int num;
int random;
if (_GameData.PlayerTeam1.Count < _GameData.NumFields + _GameData.NumJokerRetry[0])
{
random = CBase.Game.GetRandom((ids1.Count - 1) * 10);
num = (int)Math.Round((double)random / 10);
if (num >= ids1.Count)
num = ids1.Count - 1;
_GameData.PlayerTeam1.Add(ids1[num]);
ids1.RemoveAt(num);
}
if (_GameData.PlayerTeam2.Count < _GameData.NumFields + _GameData.NumJokerRetry[1])
{
random = CBase.Game.GetRandom((ids2.Count - 1) * 20);
num = (int)Math.Round((double)random / 20);
if (num >= ids2.Count)
num = ids2.Count - 1;
_GameData.PlayerTeam2.Add(ids2[num]);
ids2.RemoveAt(num);
}
}
} }
if (iDs2.Count == 0) break;
case 1:
{ {
for (int i = 0; i < _GameData.NumPlayerTeam2; i++) //Prepare Player-IDs
iDs2.Add(i); List<int> iDs = new List<int>();
//Add IDs to team-list
while (_GameData.PlayerTeam1.Count < _GameData.NumFields + _GameData.NumJokerRetry[0] && iDs.Count == 0)
{
if (iDs.Count == 0)
{
for (int i = 0; i < _GameData.NumPlayerTeam1; i++)
iDs.Add(i);
}
if (_GameData.PlayerTeam1.Count < _GameData.NumFields + _GameData.NumJokerRetry[0])
{
int random = CBase.Game.GetRandom((iDs.Count - 1) * 10);
int num = (int)Math.Round((double)random / 10);
if (num >= iDs.Count)
num = iDs.Count - 1;
_GameData.PlayerTeam1.Add(iDs[num]);
iDs.RemoveAt(num);
}
}
} }
if (_GameData.PlayerTeam1.Count < _GameData.NumFields + _GameData.NumJokerRetry[0]) break;
case 2:
{ {
random = CBase.Game.GetRandom((iDs1.Count - 1) * 10); //Prepare Player-IDs
num = (int)Math.Round((double)random / 10); List<int> ids = new List<int>();
if (num >= iDs1.Count) //Add IDs to team-list
num = iDs1.Count - 1; while (_GameData.PlayerTeam2.Count < _GameData.NumFields + _GameData.NumJokerRetry[1] && ids.Count == 0)
_GameData.PlayerTeam1.Add(iDs1[num]); {
iDs1.RemoveAt(num); if (ids.Count == 0)
{
for (int i = 0; i < _GameData.NumPlayerTeam2; i++)
ids.Add(i);
}
if (_GameData.PlayerTeam2.Count < _GameData.NumFields + _GameData.NumJokerRetry[1])
{
int random = CBase.Game.GetRandom((ids.Count - 1) * 20);
int num = (int)Math.Round((double)random / 20);
if (num >= ids.Count)
num = ids.Count - 1;
_GameData.PlayerTeam2.Add(ids[num]);
ids.RemoveAt(num);
}
}
} }
if (_GameData.PlayerTeam2.Count < _GameData.NumFields + _GameData.NumJokerRetry[1]) break;
{
random = CBase.Game.GetRandom((iDs2.Count - 1) * 20);
num = (int)Math.Round((double)random / 20);
if (num >= iDs2.Count)
num = iDs2.Count - 1;
_GameData.PlayerTeam2.Add(iDs2[num]);
iDs2.RemoveAt(num);
}
}
}
else if (team == 1)
{
//Prepare Player-IDs
List<int> iDs = new List<int>();
int num = 0;
int random = 0;
//Add IDs to team-list
while (_GameData.PlayerTeam1.Count < _GameData.NumFields + _GameData.NumJokerRetry[0] && iDs.Count == 0)
{
if (iDs.Count == 0)
{
for (int i = 0; i < _GameData.NumPlayerTeam1; i++)
iDs.Add(i);
}
if (_GameData.PlayerTeam1.Count < _GameData.NumFields + _GameData.NumJokerRetry[0])
{
random = CBase.Game.GetRandom((iDs.Count - 1) * 10);
num = (int)Math.Round((double)random / 10);
if (num >= iDs.Count)
num = iDs.Count - 1;
_GameData.PlayerTeam1.Add(iDs[num]);
iDs.RemoveAt(num);
}
}
}
else if (team == 2)
{
//Prepare Player-IDs
List<int> iDs = new List<int>();
int num = 0;
int random = 0;
//Add IDs to team-list
while (_GameData.PlayerTeam2.Count < _GameData.NumFields + _GameData.NumJokerRetry[1] && iDs.Count == 0)
{
if (iDs.Count == 0)
{
for (int i = 0; i < _GameData.NumPlayerTeam2; i++)
iDs.Add(i);
}
if (_GameData.PlayerTeam2.Count < _GameData.NumFields + _GameData.NumJokerRetry[1])
{
random = CBase.Game.GetRandom((iDs.Count - 1) * 20);
num = (int)Math.Round((double)random / 20);
if (num >= iDs.Count)
num = iDs.Count - 1;
_GameData.PlayerTeam2.Add(iDs[num]);
iDs.RemoveAt(num);
}
}
} }
} }
@@ -766,8 +772,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe
} }
SongSelected(r.SongID); SongSelected(r.SongID);
} }
else
return;
} }
private void _SetNumJokers() private void _SetNumJokers()
@@ -70,11 +70,9 @@ namespace VocaluxeLib.PartyModes.TicTacToe
public override void DataToScreen(object receivedData) public override void DataToScreen(object receivedData)
{ {
SDataToScreenConfig config = new SDataToScreenConfig();
try try
{ {
config = (SDataToScreenConfig)receivedData; SDataToScreenConfig config = (SDataToScreenConfig)receivedData;
_Data.ScreenConfig.NumFields = config.NumFields; _Data.ScreenConfig.NumFields = config.NumFields;
_Data.ScreenConfig.NumPlayerTeam1 = config.NumPlayerTeam1; _Data.ScreenConfig.NumPlayerTeam1 = config.NumPlayerTeam1;
_Data.ScreenConfig.NumPlayerTeam2 = config.NumPlayerTeam2; _Data.ScreenConfig.NumPlayerTeam2 = config.NumPlayerTeam2;
@@ -106,10 +104,10 @@ namespace VocaluxeLib.PartyModes.TicTacToe
case Keys.Enter: case Keys.Enter:
_UpdateSlides(); _UpdateSlides();
if (Buttons[_ButtonBack].Selected) if (_Buttons[_ButtonBack].Selected)
_Back(); _Back();
if (Buttons[_ButtonNext].Selected) if (_Buttons[_ButtonNext].Selected)
_Next(); _Next();
break; break;
@@ -129,13 +127,13 @@ namespace VocaluxeLib.PartyModes.TicTacToe
{ {
base.HandleMouse(mouseEvent); base.HandleMouse(mouseEvent);
if (mouseEvent.LB && IsMouseOver(mouseEvent)) if (mouseEvent.LB && _IsMouseOver(mouseEvent))
{ {
_UpdateSlides(); _UpdateSlides();
if (Buttons[_ButtonBack].Selected) if (_Buttons[_ButtonBack].Selected)
_Back(); _Back();
if (Buttons[_ButtonNext].Selected) if (_Buttons[_ButtonNext].Selected)
_Next(); _Next();
} }
@@ -158,7 +156,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
public override bool UpdateGame() public override bool UpdateGame()
{ {
Buttons[_ButtonNext].Visible = _ConfigOk; _Buttons[_ButtonNext].Visible = _ConfigOk;
return true; return true;
} }
@@ -171,72 +169,72 @@ namespace VocaluxeLib.PartyModes.TicTacToe
private void _FillSlides() private void _FillSlides()
{ {
// build num player slide (min player ... max player); // build num player slide (min player ... max player);
SelectSlides[_SelectSlideNumPlayerTeam1].Clear(); _SelectSlides[_SelectSlideNumPlayerTeam1].Clear();
for (int i = _PartyMode.GetMinPlayer() / 2; i <= _PartyMode.GetMaxPlayer() / 2; i++) for (int i = _PartyMode.GetMinPlayer() / 2; i <= _PartyMode.GetMaxPlayer() / 2; i++)
SelectSlides[_SelectSlideNumPlayerTeam1].AddValue(i.ToString()); _SelectSlides[_SelectSlideNumPlayerTeam1].AddValue(i.ToString());
SelectSlides[_SelectSlideNumPlayerTeam1].Selection = _Data.ScreenConfig.NumPlayerTeam1 - (_PartyMode.GetMinPlayer() / 2); _SelectSlides[_SelectSlideNumPlayerTeam1].Selection = _Data.ScreenConfig.NumPlayerTeam1 - (_PartyMode.GetMinPlayer() / 2);
SelectSlides[_SelectSlideNumPlayerTeam2].Clear(); _SelectSlides[_SelectSlideNumPlayerTeam2].Clear();
for (int i = _PartyMode.GetMinPlayer() / 2; i <= _PartyMode.GetMaxPlayer() / 2; i++) for (int i = _PartyMode.GetMinPlayer() / 2; i <= _PartyMode.GetMaxPlayer() / 2; i++)
SelectSlides[_SelectSlideNumPlayerTeam2].AddValue(i.ToString()); _SelectSlides[_SelectSlideNumPlayerTeam2].AddValue(i.ToString());
SelectSlides[_SelectSlideNumPlayerTeam2].Selection = _Data.ScreenConfig.NumPlayerTeam2 - (_PartyMode.GetMinPlayer() / 2); _SelectSlides[_SelectSlideNumPlayerTeam2].Selection = _Data.ScreenConfig.NumPlayerTeam2 - (_PartyMode.GetMinPlayer() / 2);
SelectSlides[_SelectSlideNumFields].Clear(); _SelectSlides[_SelectSlideNumFields].Clear();
SelectSlides[_SelectSlideNumFields].AddValue("9"); _SelectSlides[_SelectSlideNumFields].AddValue("9");
SelectSlides[_SelectSlideNumFields].AddValue("16"); _SelectSlides[_SelectSlideNumFields].AddValue("16");
SelectSlides[_SelectSlideNumFields].AddValue("25"); _SelectSlides[_SelectSlideNumFields].AddValue("25");
if (_Data.ScreenConfig.NumFields == 9) if (_Data.ScreenConfig.NumFields == 9)
SelectSlides[_SelectSlideNumFields].Selection = 0; _SelectSlides[_SelectSlideNumFields].Selection = 0;
else if (_Data.ScreenConfig.NumFields == 16) else if (_Data.ScreenConfig.NumFields == 16)
SelectSlides[_SelectSlideNumFields].Selection = 1; _SelectSlides[_SelectSlideNumFields].Selection = 1;
else if (_Data.ScreenConfig.NumFields == 25) else if (_Data.ScreenConfig.NumFields == 25)
SelectSlides[_SelectSlideNumFields].Selection = 2; _SelectSlides[_SelectSlideNumFields].Selection = 2;
SelectSlides[_SelectSlideSongSource].Clear(); _SelectSlides[_SelectSlideSongSource].Clear();
SelectSlides[_SelectSlideSongSource].SetValues<ESongSource>((int)_Data.ScreenConfig.SongSource); _SelectSlides[_SelectSlideSongSource].SetValues<ESongSource>((int)_Data.ScreenConfig.SongSource);
string[] playlists = CBase.Playlist.GetPlaylistNames(); string[] playlists = CBase.Playlist.GetPlaylistNames();
SelectSlides[_SelectSlidePlaylist].Clear(); _SelectSlides[_SelectSlidePlaylist].Clear();
for (int i = 0; i < playlists.Length; i++) for (int i = 0; i < playlists.Length; i++)
{ {
string value = playlists[i] + " (" + CBase.Playlist.GetPlaylistSongCount(i) + " " + CBase.Language.Translate("TR_SONGS", _PartyModeID) + ")"; string value = playlists[i] + " (" + CBase.Playlist.GetPlaylistSongCount(i) + " " + CBase.Language.Translate("TR_SONGS", _PartyModeID) + ")";
SelectSlides[_SelectSlidePlaylist].AddValue(value); _SelectSlides[_SelectSlidePlaylist].AddValue(value);
} }
SelectSlides[_SelectSlidePlaylist].Selection = _Data.ScreenConfig.PlaylistID; _SelectSlides[_SelectSlidePlaylist].Selection = _Data.ScreenConfig.PlaylistID;
SelectSlides[_SelectSlidePlaylist].Visible = _Data.ScreenConfig.SongSource == ESongSource.TR_PLAYLIST; _SelectSlides[_SelectSlidePlaylist].Visible = _Data.ScreenConfig.SongSource == ESongSource.TR_PLAYLIST;
string[] categories = new string[CBase.Songs.GetNumCategories()]; string[] categories = new string[CBase.Songs.GetNumCategories()];
for (int i = 0; i < CBase.Songs.GetNumCategories(); i++) for (int i = 0; i < CBase.Songs.GetNumCategories(); i++)
categories[i] = CBase.Songs.GetCategory(i).Name; categories[i] = CBase.Songs.GetCategory(i).Name;
SelectSlides[_SelectSlideCategory].Clear(); _SelectSlides[_SelectSlideCategory].Clear();
for (int i = 0; i < categories.Length; i++) for (int i = 0; i < categories.Length; i++)
{ {
string value = categories[i] + " (" + CBase.Songs.NumSongsInCategory(i) + " " + CBase.Language.Translate("TR_SONGS", _PartyModeID) + ")"; string value = categories[i] + " (" + CBase.Songs.NumSongsInCategory(i) + " " + CBase.Language.Translate("TR_SONGS", _PartyModeID) + ")";
SelectSlides[_SelectSlideCategory].AddValue(value); _SelectSlides[_SelectSlideCategory].AddValue(value);
} }
SelectSlides[_SelectSlideCategory].Selection = _Data.ScreenConfig.CategoryID; _SelectSlides[_SelectSlideCategory].Selection = _Data.ScreenConfig.CategoryID;
SelectSlides[_SelectSlideCategory].Visible = _Data.ScreenConfig.SongSource == ESongSource.TR_CATEGORY; _SelectSlides[_SelectSlideCategory].Visible = _Data.ScreenConfig.SongSource == ESongSource.TR_CATEGORY;
SelectSlides[_SelectSlideGameMode].Visible = true; _SelectSlides[_SelectSlideGameMode].Visible = true;
SelectSlides[_SelectSlideGameMode].SetValues<EPartyGameMode>((int)_Data.ScreenConfig.GameMode); _SelectSlides[_SelectSlideGameMode].SetValues<EPartyGameMode>((int)_Data.ScreenConfig.GameMode);
} }
private void _UpdateSlides() private void _UpdateSlides()
{ {
_Data.ScreenConfig.NumPlayerTeam1 = SelectSlides[_SelectSlideNumPlayerTeam1].Selection + (_PartyMode.GetMinPlayer() / 2); _Data.ScreenConfig.NumPlayerTeam1 = _SelectSlides[_SelectSlideNumPlayerTeam1].Selection + (_PartyMode.GetMinPlayer() / 2);
_Data.ScreenConfig.NumPlayerTeam2 = SelectSlides[_SelectSlideNumPlayerTeam2].Selection + (_PartyMode.GetMinPlayer() / 2); _Data.ScreenConfig.NumPlayerTeam2 = _SelectSlides[_SelectSlideNumPlayerTeam2].Selection + (_PartyMode.GetMinPlayer() / 2);
if (SelectSlides[_SelectSlideNumFields].Selection == 0) if (_SelectSlides[_SelectSlideNumFields].Selection == 0)
_Data.ScreenConfig.NumFields = 9; _Data.ScreenConfig.NumFields = 9;
else if (SelectSlides[_SelectSlideNumFields].Selection == 1) else if (_SelectSlides[_SelectSlideNumFields].Selection == 1)
_Data.ScreenConfig.NumFields = 16; _Data.ScreenConfig.NumFields = 16;
else if (SelectSlides[_SelectSlideNumFields].Selection == 2) else if (_SelectSlides[_SelectSlideNumFields].Selection == 2)
_Data.ScreenConfig.NumFields = 25; _Data.ScreenConfig.NumFields = 25;
_Data.ScreenConfig.SongSource = (ESongSource)SelectSlides[_SelectSlideSongSource].Selection; _Data.ScreenConfig.SongSource = (ESongSource)_SelectSlides[_SelectSlideSongSource].Selection;
_Data.ScreenConfig.PlaylistID = SelectSlides[_SelectSlidePlaylist].Selection; _Data.ScreenConfig.PlaylistID = _SelectSlides[_SelectSlidePlaylist].Selection;
_Data.ScreenConfig.CategoryID = SelectSlides[_SelectSlideCategory].Selection; _Data.ScreenConfig.CategoryID = _SelectSlides[_SelectSlideCategory].Selection;
_Data.ScreenConfig.GameMode = (EPartyGameMode)SelectSlides[_SelectSlideGameMode].Selection; _Data.ScreenConfig.GameMode = (EPartyGameMode)_SelectSlides[_SelectSlideGameMode].Selection;
EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL; EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL;
@@ -333,8 +331,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe
else else
_ConfigOk = false; _ConfigOk = false;
} }
SelectSlides[_SelectSlideCategory].Visible = _Data.ScreenConfig.SongSource == ESongSource.TR_CATEGORY; _SelectSlides[_SelectSlideCategory].Visible = _Data.ScreenConfig.SongSource == ESongSource.TR_CATEGORY;
SelectSlides[_SelectSlidePlaylist].Visible = _Data.ScreenConfig.SongSource == ESongSource.TR_PLAYLIST; _SelectSlides[_SelectSlidePlaylist].Visible = _Data.ScreenConfig.SongSource == ESongSource.TR_PLAYLIST;
} }
private void _Back() private void _Back()
@@ -122,16 +122,14 @@ namespace VocaluxeLib.PartyModes.TicTacToe
base.LoadTheme(xmlPath); base.LoadTheme(xmlPath);
_CreateFields(); _CreateFields();
Buttons[_ButtonField].Visible = false; _Buttons[_ButtonField].Visible = false;
} }
public override void DataToScreen(object receivedData) public override void DataToScreen(object receivedData)
{ {
SDataToScreenMain config = new SDataToScreenMain();
try try
{ {
config = (SDataToScreenMain)receivedData; SDataToScreenMain config = (SDataToScreenMain)receivedData;
_GameData = config; _GameData = config;
} }
catch (Exception e) catch (Exception e)
@@ -167,11 +165,11 @@ namespace VocaluxeLib.PartyModes.TicTacToe
case Keys.Enter: case Keys.Enter:
if (!_ExitPopupVisible) if (!_ExitPopupVisible)
{ {
if (Buttons[_ButtonNextRound].Selected) if (_Buttons[_ButtonNextRound].Selected)
_NextRound(); _NextRound();
if (Buttons[_ButtonBack].Selected && _GameData.CurrentRoundNr == 1 && _Status != EStatus.FieldSelected) if (_Buttons[_ButtonBack].Selected && _GameData.CurrentRoundNr == 1 && _Status != EStatus.FieldSelected)
_Back(); _Back();
if (Buttons[_ButtonExit].Selected && (_GameData.CurrentRoundNr > 1 || _Status == EStatus.FieldSelected) && _Status != EStatus.None) if (_Buttons[_ButtonExit].Selected && (_GameData.CurrentRoundNr > 1 || _Status == EStatus.FieldSelected) && _Status != EStatus.None)
_ShowPopup(true); _ShowPopup(true);
else if (_Status == EStatus.None) else if (_Status == EStatus.None)
_EndParty(); _EndParty();
@@ -198,21 +196,21 @@ namespace VocaluxeLib.PartyModes.TicTacToe
} }
if (_Status == EStatus.FieldSelected) if (_Status == EStatus.FieldSelected)
{ {
if (Buttons[_ButtonJokerRandomT1].Selected) if (_Buttons[_ButtonJokerRandomT1].Selected)
_UseJoker(0, 0); _UseJoker(0, 0);
if (Buttons[_ButtonJokerRandomT2].Selected) if (_Buttons[_ButtonJokerRandomT2].Selected)
_UseJoker(1, 0); _UseJoker(1, 0);
if (Buttons[_ButtonJokerRetryT1].Selected) if (_Buttons[_ButtonJokerRetryT1].Selected)
_UseJoker(0, 1); _UseJoker(0, 1);
if (Buttons[_ButtonJokerRetryT2].Selected) if (_Buttons[_ButtonJokerRetryT2].Selected)
_UseJoker(1, 1); _UseJoker(1, 1);
} }
} }
else else
{ {
if (Buttons[_ButtonPopupYes].Selected) if (_Buttons[_ButtonPopupYes].Selected)
_EndParty(); _EndParty();
if (Buttons[_ButtonPopupNo].Selected) if (_Buttons[_ButtonPopupNo].Selected)
_ShowPopup(false); _ShowPopup(false);
} }
break; break;
@@ -225,15 +223,15 @@ namespace VocaluxeLib.PartyModes.TicTacToe
{ {
base.HandleMouse(mouseEvent); base.HandleMouse(mouseEvent);
if (mouseEvent.LB && IsMouseOver(mouseEvent)) if (mouseEvent.LB && _IsMouseOver(mouseEvent))
{ {
if (!_ExitPopupVisible) if (!_ExitPopupVisible)
{ {
if (Buttons[_ButtonNextRound].Selected) if (_Buttons[_ButtonNextRound].Selected)
_NextRound(); _NextRound();
if (Buttons[_ButtonBack].Selected) if (_Buttons[_ButtonBack].Selected)
_Back(); _Back();
if (Buttons[_ButtonExit].Selected) if (_Buttons[_ButtonExit].Selected)
{ {
if (_Status == EStatus.None) if (_Status == EStatus.None)
_EndParty(); _EndParty();
@@ -263,21 +261,21 @@ namespace VocaluxeLib.PartyModes.TicTacToe
} }
if (_Status == EStatus.FieldSelected) if (_Status == EStatus.FieldSelected)
{ {
if (Buttons[_ButtonJokerRandomT1].Selected) if (_Buttons[_ButtonJokerRandomT1].Selected)
_UseJoker(0, 0); _UseJoker(0, 0);
if (Buttons[_ButtonJokerRandomT2].Selected) if (_Buttons[_ButtonJokerRandomT2].Selected)
_UseJoker(1, 0); _UseJoker(1, 0);
if (Buttons[_ButtonJokerRetryT1].Selected) if (_Buttons[_ButtonJokerRetryT1].Selected)
_UseJoker(0, 1); _UseJoker(0, 1);
if (Buttons[_ButtonJokerRetryT2].Selected) if (_Buttons[_ButtonJokerRetryT2].Selected)
_UseJoker(1, 1); _UseJoker(1, 1);
} }
} }
else else
{ {
if (Buttons[_ButtonPopupYes].Selected) if (_Buttons[_ButtonPopupYes].Selected)
_EndParty(); _EndParty();
if (Buttons[_ButtonPopupNo].Selected) if (_Buttons[_ButtonPopupNo].Selected)
_ShowPopup(false); _ShowPopup(false);
} }
} }
@@ -312,15 +310,15 @@ namespace VocaluxeLib.PartyModes.TicTacToe
{ {
_BuildWinnerPossibilities(); _BuildWinnerPossibilities();
_SelectedField = -1; _SelectedField = -1;
Buttons[_ButtonBack].Visible = true; _Buttons[_ButtonBack].Visible = true;
Buttons[_ButtonExit].Visible = false; _Buttons[_ButtonExit].Visible = false;
SetInteractionToButton(Buttons[_ButtonBack]); _SetInteractionToButton(_Buttons[_ButtonBack]);
} }
else else
{ {
Buttons[_ButtonBack].Visible = false; _Buttons[_ButtonBack].Visible = false;
Buttons[_ButtonExit].Visible = true; _Buttons[_ButtonExit].Visible = true;
SetInteractionToButton(Buttons[_ButtonExit]); _SetInteractionToButton(_Buttons[_ButtonExit]);
} }
_Status = EStatus.FieldChoosing; _Status = EStatus.FieldChoosing;
@@ -332,37 +330,37 @@ namespace VocaluxeLib.PartyModes.TicTacToe
if (_GameData.CurrentRoundNr <= _GameData.NumFields && winner == 0) if (_GameData.CurrentRoundNr <= _GameData.NumFields && winner == 0)
{ {
_UpdateTeamChoosingMessage(); _UpdateTeamChoosingMessage();
Texts[_TextNextPlayerT1].Visible = false; _Texts[_TextNextPlayerT1].Visible = false;
Texts[_TextNextPlayerT2].Visible = false; _Texts[_TextNextPlayerT2].Visible = false;
Texts[_TextNextPlayerNameT1].Visible = false; _Texts[_TextNextPlayerNameT1].Visible = false;
Texts[_TextNextPlayerNameT2].Visible = false; _Texts[_TextNextPlayerNameT2].Visible = false;
Statics[_StaticAvatarT1].Visible = false; _Statics[_StaticAvatarT1].Visible = false;
Statics[_StaticAvatarT2].Visible = false; _Statics[_StaticAvatarT2].Visible = false;
Buttons[_ButtonJokerRandomT1].Visible = false; _Buttons[_ButtonJokerRandomT1].Visible = false;
Buttons[_ButtonJokerRandomT2].Visible = false; _Buttons[_ButtonJokerRandomT2].Visible = false;
Buttons[_ButtonJokerRetryT1].Visible = false; _Buttons[_ButtonJokerRetryT1].Visible = false;
Buttons[_ButtonJokerRetryT2].Visible = false; _Buttons[_ButtonJokerRetryT2].Visible = false;
Buttons[_ButtonNextRound].Visible = false; _Buttons[_ButtonNextRound].Visible = false;
Texts[_TextFinishMessage].Visible = false; _Texts[_TextFinishMessage].Visible = false;
} }
else else
{ {
_Status = EStatus.None; _Status = EStatus.None;
Buttons[_ButtonNextRound].Visible = false; _Buttons[_ButtonNextRound].Visible = false;
Texts[_TextFinishMessage].Visible = true; _Texts[_TextFinishMessage].Visible = true;
Texts[_TextTeamChoosing].Visible = false; _Texts[_TextTeamChoosing].Visible = false;
if (winner > 0) if (winner > 0)
{ {
Texts[_TextFinishMessage].Color = CBase.Theme.GetPlayerColor(winner); _Texts[_TextFinishMessage].Color = CBase.Theme.GetPlayerColor(winner);
Texts[_TextFinishMessage].Text = CBase.Language.Translate("TR_SCREENMAIN_WINNER", _PartyModeID) + " " + CBase.Language.Translate("TR_TEAM", _PartyModeID) + " " + _Texts[_TextFinishMessage].Text = CBase.Language.Translate("TR_SCREENMAIN_WINNER", _PartyModeID) + " " + CBase.Language.Translate("TR_TEAM", _PartyModeID) + " " +
winner; winner;
} }
else else
{ {
Texts[_TextFinishMessage].Color = new SColorF(1, 1, 1, 1); _Texts[_TextFinishMessage].Color = new SColorF(1, 1, 1, 1);
Texts[_TextFinishMessage].Text = CBase.Language.Translate("TR_SCREENMAIN_NOWINNER", _PartyModeID); _Texts[_TextFinishMessage].Text = CBase.Language.Translate("TR_SCREENMAIN_NOWINNER", _PartyModeID);
} }
SetInteractionToButton(Buttons[_ButtonExit]); _SetInteractionToButton(_Buttons[_ButtonExit]);
} }
_ShowPopup(false); _ShowPopup(false);
@@ -391,10 +389,10 @@ namespace VocaluxeLib.PartyModes.TicTacToe
for (int i = 0; i < 25; i++) for (int i = 0; i < 25; i++)
{ {
CField f = new CField(); CField f = new CField();
f.Button = GetNewButton(Buttons[_ButtonField]); f.Button = GetNewButton(_Buttons[_ButtonField]);
f.Button.Visible = false; f.Button.Visible = false;
f.Content = new CRound(); f.Content = new CRound();
AddButton(f.Button); _AddButton(f.Button);
_Fields.Add(f); _Fields.Add(f);
} }
} }
@@ -448,9 +446,9 @@ namespace VocaluxeLib.PartyModes.TicTacToe
for (int i = 0; i < _GameData.Rounds.Count; i++) for (int i = 0; i < _GameData.Rounds.Count; i++)
{ {
_Fields[i].Button.Enabled = true; _Fields[i].Button.Enabled = true;
_Fields[i].Button.Texture = Buttons[_ButtonField].Texture; _Fields[i].Button.Texture = _Buttons[_ButtonField].Texture;
_Fields[i].Button.Color = Buttons[_ButtonField].Color; _Fields[i].Button.Color = _Buttons[_ButtonField].Color;
_Fields[i].Button.SelColor = Buttons[_ButtonField].SelColor; _Fields[i].Button.SelColor = _Buttons[_ButtonField].SelColor;
_Fields[i].Content = _GameData.Rounds[i]; _Fields[i].Content = _GameData.Rounds[i];
if (_Fields[i].Content.Finished) if (_Fields[i].Content.Finished)
{ {
@@ -515,25 +513,25 @@ namespace VocaluxeLib.PartyModes.TicTacToe
_GameData.Rounds[_SelectedField].SingerTeam2 = singerTeam2; _GameData.Rounds[_SelectedField].SingerTeam2 = singerTeam2;
_UpdateFieldContents(); _UpdateFieldContents();
Texts[_TextNextPlayerT1].Visible = true; _Texts[_TextNextPlayerT1].Visible = true;
Texts[_TextNextPlayerT2].Visible = true; _Texts[_TextNextPlayerT2].Visible = true;
Texts[_TextNextPlayerNameT1].Visible = true; _Texts[_TextNextPlayerNameT1].Visible = true;
Texts[_TextNextPlayerNameT2].Visible = true; _Texts[_TextNextPlayerNameT2].Visible = true;
SProfile[] profiles = CBase.Profiles.GetProfiles(); SProfile[] profiles = CBase.Profiles.GetProfiles();
Texts[_TextNextPlayerNameT1].Text = profiles[_GameData.ProfileIDsTeam1[_GameData.Rounds[_SelectedField].SingerTeam1]].PlayerName; _Texts[_TextNextPlayerNameT1].Text = profiles[_GameData.ProfileIDsTeam1[_GameData.Rounds[_SelectedField].SingerTeam1]].PlayerName;
Texts[_TextNextPlayerNameT2].Text = profiles[_GameData.ProfileIDsTeam2[_GameData.Rounds[_SelectedField].SingerTeam2]].PlayerName; _Texts[_TextNextPlayerNameT2].Text = profiles[_GameData.ProfileIDsTeam2[_GameData.Rounds[_SelectedField].SingerTeam2]].PlayerName;
Statics[_StaticAvatarT1].Visible = true; _Statics[_StaticAvatarT1].Visible = true;
Statics[_StaticAvatarT2].Visible = true; _Statics[_StaticAvatarT2].Visible = true;
Statics[_StaticAvatarT1].Texture = profiles[_GameData.ProfileIDsTeam1[_GameData.Rounds[_SelectedField].SingerTeam1]].Avatar.Texture; _Statics[_StaticAvatarT1].Texture = profiles[_GameData.ProfileIDsTeam1[_GameData.Rounds[_SelectedField].SingerTeam1]].Avatar.Texture;
Statics[_StaticAvatarT2].Texture = profiles[_GameData.ProfileIDsTeam2[_GameData.Rounds[_SelectedField].SingerTeam2]].Avatar.Texture; _Statics[_StaticAvatarT2].Texture = profiles[_GameData.ProfileIDsTeam2[_GameData.Rounds[_SelectedField].SingerTeam2]].Avatar.Texture;
_UpdateJokerButtons(); _UpdateJokerButtons();
Buttons[_ButtonNextRound].Visible = true; _Buttons[_ButtonNextRound].Visible = true;
Buttons[_ButtonExit].Visible = true; _Buttons[_ButtonExit].Visible = true;
Buttons[_ButtonBack].Visible = false; _Buttons[_ButtonBack].Visible = false;
SetInteractionToButton(Buttons[_ButtonNextRound]); _SetInteractionToButton(_Buttons[_ButtonNextRound]);
} }
private void _FieldSelectedAgain() private void _FieldSelectedAgain()
@@ -554,25 +552,25 @@ namespace VocaluxeLib.PartyModes.TicTacToe
_GameData.Rounds[_SelectedField].SingerTeam2 = _GameData.Rounds[_OldSelectedField].SingerTeam2; _GameData.Rounds[_SelectedField].SingerTeam2 = _GameData.Rounds[_OldSelectedField].SingerTeam2;
_UpdateFieldContents(); _UpdateFieldContents();
Texts[_TextNextPlayerT1].Visible = true; _Texts[_TextNextPlayerT1].Visible = true;
Texts[_TextNextPlayerT2].Visible = true; _Texts[_TextNextPlayerT2].Visible = true;
Texts[_TextNextPlayerNameT1].Visible = true; _Texts[_TextNextPlayerNameT1].Visible = true;
Texts[_TextNextPlayerNameT2].Visible = true; _Texts[_TextNextPlayerNameT2].Visible = true;
SProfile[] profiles = CBase.Profiles.GetProfiles(); SProfile[] profiles = CBase.Profiles.GetProfiles();
Texts[_TextNextPlayerNameT1].Text = profiles[_GameData.ProfileIDsTeam1[_GameData.Rounds[_SelectedField].SingerTeam1]].PlayerName; _Texts[_TextNextPlayerNameT1].Text = profiles[_GameData.ProfileIDsTeam1[_GameData.Rounds[_SelectedField].SingerTeam1]].PlayerName;
Texts[_TextNextPlayerNameT2].Text = profiles[_GameData.ProfileIDsTeam2[_GameData.Rounds[_SelectedField].SingerTeam2]].PlayerName; _Texts[_TextNextPlayerNameT2].Text = profiles[_GameData.ProfileIDsTeam2[_GameData.Rounds[_SelectedField].SingerTeam2]].PlayerName;
Statics[_StaticAvatarT1].Visible = true; _Statics[_StaticAvatarT1].Visible = true;
Statics[_StaticAvatarT2].Visible = true; _Statics[_StaticAvatarT2].Visible = true;
Statics[_StaticAvatarT1].Texture = profiles[_GameData.ProfileIDsTeam1[_GameData.Rounds[_SelectedField].SingerTeam1]].Avatar.Texture; _Statics[_StaticAvatarT1].Texture = profiles[_GameData.ProfileIDsTeam1[_GameData.Rounds[_SelectedField].SingerTeam1]].Avatar.Texture;
Statics[_StaticAvatarT2].Texture = profiles[_GameData.ProfileIDsTeam2[_GameData.Rounds[_SelectedField].SingerTeam2]].Avatar.Texture; _Statics[_StaticAvatarT2].Texture = profiles[_GameData.ProfileIDsTeam2[_GameData.Rounds[_SelectedField].SingerTeam2]].Avatar.Texture;
_UpdateJokerButtons(); _UpdateJokerButtons();
Buttons[_ButtonNextRound].Visible = true; _Buttons[_ButtonNextRound].Visible = true;
Buttons[_ButtonExit].Visible = true; _Buttons[_ButtonExit].Visible = true;
Buttons[_ButtonBack].Visible = false; _Buttons[_ButtonBack].Visible = false;
SetInteractionToButton(Buttons[_ButtonNextRound]); _SetInteractionToButton(_Buttons[_ButtonNextRound]);
} }
private void _UseJoker(int teamNr, int jokerNum) private void _UseJoker(int teamNr, int jokerNum)
@@ -610,29 +608,29 @@ namespace VocaluxeLib.PartyModes.TicTacToe
private void _UpdateTeamChoosingMessage() private void _UpdateTeamChoosingMessage()
{ {
Texts[_TextTeamChoosing].Color = CBase.Theme.GetPlayerColor(_GameData.Team + 1); _Texts[_TextTeamChoosing].Color = CBase.Theme.GetPlayerColor(_GameData.Team + 1);
Texts[_TextTeamChoosing].Text = CBase.Language.Translate("TR_TEAM", _PartyModeID) + " " + (_GameData.Team + 1) + "! " + _Texts[_TextTeamChoosing].Text = CBase.Language.Translate("TR_TEAM", _PartyModeID) + " " + (_GameData.Team + 1) + "! " +
CBase.Language.Translate("TR_SCREENMAIN_TEAM_CHOOSE", _PartyModeID); CBase.Language.Translate("TR_SCREENMAIN_TEAM_CHOOSE", _PartyModeID);
if (_Status == EStatus.JokerRetry || _Status == EStatus.FieldChoosing) if (_Status == EStatus.JokerRetry || _Status == EStatus.FieldChoosing)
Texts[_TextTeamChoosing].Visible = true; _Texts[_TextTeamChoosing].Visible = true;
else else
Texts[_TextTeamChoosing].Visible = false; _Texts[_TextTeamChoosing].Visible = false;
} }
private void _UpdateJokerButtons() private void _UpdateJokerButtons()
{ {
Buttons[_ButtonJokerRandomT1].Visible = true; _Buttons[_ButtonJokerRandomT1].Visible = true;
Buttons[_ButtonJokerRandomT2].Visible = true; _Buttons[_ButtonJokerRandomT2].Visible = true;
Buttons[_ButtonJokerRandomT1].Text.Text = _GameData.NumJokerRandom[0].ToString(); _Buttons[_ButtonJokerRandomT1].Text.Text = _GameData.NumJokerRandom[0].ToString();
Buttons[_ButtonJokerRandomT2].Text.Text = _GameData.NumJokerRandom[1].ToString(); _Buttons[_ButtonJokerRandomT2].Text.Text = _GameData.NumJokerRandom[1].ToString();
Buttons[_ButtonJokerRandomT1].Enabled = _GameData.NumJokerRandom[0] > 0; _Buttons[_ButtonJokerRandomT1].Enabled = _GameData.NumJokerRandom[0] > 0;
Buttons[_ButtonJokerRandomT2].Enabled = _GameData.NumJokerRandom[1] > 0; _Buttons[_ButtonJokerRandomT2].Enabled = _GameData.NumJokerRandom[1] > 0;
Buttons[_ButtonJokerRetryT1].Visible = true; _Buttons[_ButtonJokerRetryT1].Visible = true;
Buttons[_ButtonJokerRetryT2].Visible = true; _Buttons[_ButtonJokerRetryT2].Visible = true;
Buttons[_ButtonJokerRetryT1].Text.Text = _GameData.NumJokerRetry[0].ToString(); _Buttons[_ButtonJokerRetryT1].Text.Text = _GameData.NumJokerRetry[0].ToString();
Buttons[_ButtonJokerRetryT2].Text.Text = _GameData.NumJokerRetry[1].ToString(); _Buttons[_ButtonJokerRetryT2].Text.Text = _GameData.NumJokerRetry[1].ToString();
Buttons[_ButtonJokerRetryT1].Enabled = _GameData.NumJokerRetry[0] > 0; _Buttons[_ButtonJokerRetryT1].Enabled = _GameData.NumJokerRetry[0] > 0;
Buttons[_ButtonJokerRetryT2].Enabled = _GameData.NumJokerRetry[1] > 0; _Buttons[_ButtonJokerRetryT2].Enabled = _GameData.NumJokerRetry[1] > 0;
} }
private void _NextRound() private void _NextRound()
@@ -658,13 +656,13 @@ namespace VocaluxeLib.PartyModes.TicTacToe
{ {
_ExitPopupVisible = visible; _ExitPopupVisible = visible;
Statics[_StaticPopupBG].Visible = _ExitPopupVisible; _Statics[_StaticPopupBG].Visible = _ExitPopupVisible;
Texts[_TextPopupReallyExit].Visible = _ExitPopupVisible; _Texts[_TextPopupReallyExit].Visible = _ExitPopupVisible;
Buttons[_ButtonPopupYes].Visible = _ExitPopupVisible; _Buttons[_ButtonPopupYes].Visible = _ExitPopupVisible;
Buttons[_ButtonPopupNo].Visible = _ExitPopupVisible; _Buttons[_ButtonPopupNo].Visible = _ExitPopupVisible;
if (_ExitPopupVisible) if (_ExitPopupVisible)
SetInteractionToButton(Buttons[_ButtonPopupNo]); _SetInteractionToButton(_Buttons[_ButtonPopupNo]);
} }
private void _Back() private void _Back()
@@ -43,7 +43,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe
private List<CButton> _PlayerDestinationButtons; private List<CButton> _PlayerDestinationButtons;
//PlayerDestinationButtons-Option //PlayerDestinationButtons-Option
private const int _PlayerDestinationButtonsNumH = 10; private const int _PlayerDestinationButtonsNumH = 10;
private const int _PlayerDestinationButtonsNumW = 2;
private const int _PlayerDestinationButtonsFirstX = 58; private const int _PlayerDestinationButtonsFirstX = 58;
private const int _PlayerDestinationButtonsFirstY = 380; private const int _PlayerDestinationButtonsFirstY = 380;
private const int _PlayerDestinationButtonsSpaceH = 15; private const int _PlayerDestinationButtonsSpaceH = 15;
@@ -102,11 +101,9 @@ namespace VocaluxeLib.PartyModes.TicTacToe
public override void DataToScreen(object receivedData) public override void DataToScreen(object receivedData)
{ {
SDataToScreenNames config = new SDataToScreenNames();
try try
{ {
config = (SDataToScreenNames)receivedData; SDataToScreenNames config = (SDataToScreenNames)receivedData;
_Data.ScreenNames.ProfileIDsTeam1 = config.ProfileIDsTeam1; _Data.ScreenNames.ProfileIDsTeam1 = config.ProfileIDsTeam1;
_Data.ScreenNames.ProfileIDsTeam2 = config.ProfileIDsTeam2; _Data.ScreenNames.ProfileIDsTeam2 = config.ProfileIDsTeam2;
if (_Data.ScreenNames.ProfileIDsTeam1 == null) if (_Data.ScreenNames.ProfileIDsTeam1 == null)
@@ -143,16 +140,16 @@ namespace VocaluxeLib.PartyModes.TicTacToe
break; break;
case Keys.Enter: case Keys.Enter:
if (Buttons[_ButtonBack].Selected) if (_Buttons[_ButtonBack].Selected)
_Back(); _Back();
if (Buttons[_ButtonNext].Selected) if (_Buttons[_ButtonNext].Selected)
_Next(); _Next();
if (Buttons[_ButtonPlayerChooseScrollUp].Selected) if (_Buttons[_ButtonPlayerChooseScrollUp].Selected)
_Scroll(-1); _Scroll(-1);
if (Buttons[_ButtonPlayerChooseScrollDown].Selected) if (_Buttons[_ButtonPlayerChooseScrollDown].Selected)
_Scroll(1); _Scroll(1);
if (!_OnAdd()) if (!_OnAdd())
@@ -274,22 +271,22 @@ namespace VocaluxeLib.PartyModes.TicTacToe
return true; return true;
} }
if (mouseEvent.LB && IsMouseOver(mouseEvent)) if (mouseEvent.LB && _IsMouseOver(mouseEvent))
{ {
if (Buttons[_ButtonBack].Selected) if (_Buttons[_ButtonBack].Selected)
_Back(); _Back();
if (Buttons[_ButtonNext].Selected) if (_Buttons[_ButtonNext].Selected)
_Next(); _Next();
if (Buttons[_ButtonPlayerChooseScrollUp].Selected) if (_Buttons[_ButtonPlayerChooseScrollUp].Selected)
_Scroll(-1); _Scroll(-1);
if (Buttons[_ButtonPlayerChooseScrollDown].Selected) if (_Buttons[_ButtonPlayerChooseScrollDown].Selected)
_Scroll(1); _Scroll(1);
} }
if (mouseEvent.LD && IsMouseOver(mouseEvent)) if (mouseEvent.LD && _IsMouseOver(mouseEvent))
{ {
if (!_OnAdd()) if (!_OnAdd())
_OnRemove(); _OnRemove();
@@ -347,13 +344,13 @@ namespace VocaluxeLib.PartyModes.TicTacToe
private void _AddButtonPlayerDestination() private void _AddButtonPlayerDestination()
{ {
Buttons[_ButtonPlayerDestination].Visible = false; _Buttons[_ButtonPlayerDestination].Visible = false;
_PlayerDestinationButtons = new List<CButton>(); _PlayerDestinationButtons = new List<CButton>();
int row = 0; int row = 0;
int column = 0; int column = 0;
for (int i = 1; i <= _PartyMode.GetMaxPlayer(); i++) for (int i = 1; i <= _PartyMode.GetMaxPlayer(); i++)
{ {
CButton b = GetNewButton(Buttons[_ButtonPlayerDestination]); CButton b = GetNewButton(_Buttons[_ButtonPlayerDestination]);
b.Rect.X = _PlayerDestinationButtonsFirstX + column * (b.Rect.W + _PlayerDestinationButtonsSpaceH); b.Rect.X = _PlayerDestinationButtonsFirstX + column * (b.Rect.W + _PlayerDestinationButtonsSpaceH);
b.Rect.Y = _PlayerDestinationButtonsFirstY + row * (b.Rect.H + _PlayerDestinationButtonsSpaceW); b.Rect.Y = _PlayerDestinationButtonsFirstY + row * (b.Rect.H + _PlayerDestinationButtonsSpaceW);
_PlayerDestinationButtons.Add(b); _PlayerDestinationButtons.Add(b);
@@ -365,19 +362,19 @@ namespace VocaluxeLib.PartyModes.TicTacToe
} }
b.Visible = true; b.Visible = true;
b.Enabled = false; b.Enabled = false;
AddButton(b); _AddButton(b);
} }
} }
private void _AddButtonPlayerChoose() private void _AddButtonPlayerChoose()
{ {
Buttons[_ButtonPlayerChoose].Visible = false; _Buttons[_ButtonPlayerChoose].Visible = false;
_PlayerChooseButtons = new List<CPlayerChooseButton>(); _PlayerChooseButtons = new List<CPlayerChooseButton>();
int row = 0; int row = 0;
int column = 0; int column = 0;
for (int i = 1; i <= _PlayerChooseButtonsNumH * _PlayerChooseButtonsNumW; i++) for (int i = 1; i <= _PlayerChooseButtonsNumH * _PlayerChooseButtonsNumW; i++)
{ {
CButton b = GetNewButton(Buttons[_ButtonPlayerChoose]); CButton b = GetNewButton(_Buttons[_ButtonPlayerChoose]);
b.Rect.X = _PlayerChooseButtonsFirstX + column * (b.Rect.W + _PlayerChooseButtonsSpaceH); b.Rect.X = _PlayerChooseButtonsFirstX + column * (b.Rect.W + _PlayerChooseButtonsSpaceH);
b.Rect.Y = _PlayerChooseButtonsFirstY + row * (b.Rect.H + _PlayerChooseButtonsSpaceW); b.Rect.Y = _PlayerChooseButtonsFirstY + row * (b.Rect.H + _PlayerChooseButtonsSpaceW);
CPlayerChooseButton pcb = new CPlayerChooseButton(); CPlayerChooseButton pcb = new CPlayerChooseButton();
@@ -392,7 +389,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
} }
b.Visible = true; b.Visible = true;
b.Enabled = false; b.Enabled = false;
AddButton(b); _AddButton(b);
} }
} }
@@ -404,8 +401,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe
_UpdateButtonPlayerChoose(_PlayerChooseButtonsOffset - 1); _UpdateButtonPlayerChoose(_PlayerChooseButtonsOffset - 1);
else else
_UpdateButtonPlayerChoose(_PlayerChooseButtonsOffset); _UpdateButtonPlayerChoose(_PlayerChooseButtonsOffset);
Buttons[_ButtonPlayerChooseScrollUp].Enabled = _PlayerChooseButtonsOffset > 0; _Buttons[_ButtonPlayerChooseScrollUp].Enabled = _PlayerChooseButtonsOffset > 0;
Buttons[_ButtonPlayerChooseScrollDown].Enabled = _PlayerChooseButtonsVisibleProfiles.Count > _Buttons[_ButtonPlayerChooseScrollDown].Enabled = _PlayerChooseButtonsVisibleProfiles.Count >
_PlayerChooseButtons.Count + _PlayerChooseButtonsOffset * _PlayerChooseButtonsNumH; _PlayerChooseButtons.Count + _PlayerChooseButtonsOffset * _PlayerChooseButtonsNumH;
} }
@@ -435,10 +432,10 @@ namespace VocaluxeLib.PartyModes.TicTacToe
{ {
_PlayerChooseButtons[i].ProfileID = -1; _PlayerChooseButtons[i].ProfileID = -1;
_PlayerChooseButtons[i].Button.Text.Text = String.Empty; _PlayerChooseButtons[i].Button.Text.Text = String.Empty;
_PlayerChooseButtons[i].Button.Texture = Buttons[_ButtonPlayerChoose].Texture; _PlayerChooseButtons[i].Button.Texture = _Buttons[_ButtonPlayerChoose].Texture;
_PlayerChooseButtons[i].Button.SelTexture = Buttons[_ButtonPlayerChoose].SelTexture; _PlayerChooseButtons[i].Button.SelTexture = _Buttons[_ButtonPlayerChoose].SelTexture;
_PlayerChooseButtons[i].Button.Color = Buttons[_ButtonPlayerChoose].Color; _PlayerChooseButtons[i].Button.Color = _Buttons[_ButtonPlayerChoose].Color;
_PlayerChooseButtons[i].Button.SelColor = Buttons[_ButtonPlayerChoose].SelColor; _PlayerChooseButtons[i].Button.SelColor = _Buttons[_ButtonPlayerChoose].SelColor;
_PlayerChooseButtons[i].Button.Enabled = false; _PlayerChooseButtons[i].Button.Enabled = false;
} }
} }
@@ -525,10 +522,10 @@ namespace VocaluxeLib.PartyModes.TicTacToe
} }
else else
{ {
_PlayerDestinationButtons[i].Color = Buttons[_ButtonPlayerDestination].Color; _PlayerDestinationButtons[i].Color = _Buttons[_ButtonPlayerDestination].Color;
_PlayerDestinationButtons[i].SelColor = Buttons[_ButtonPlayerDestination].SelColor; _PlayerDestinationButtons[i].SelColor = _Buttons[_ButtonPlayerDestination].SelColor;
_PlayerDestinationButtons[i].Texture = Buttons[_ButtonPlayerDestination].Texture; _PlayerDestinationButtons[i].Texture = _Buttons[_ButtonPlayerDestination].Texture;
_PlayerDestinationButtons[i].SelTexture = Buttons[_ButtonPlayerDestination].SelTexture; _PlayerDestinationButtons[i].SelTexture = _Buttons[_ButtonPlayerDestination].SelTexture;
_PlayerDestinationButtons[i].Text.Text = String.Empty; _PlayerDestinationButtons[i].Text.Text = String.Empty;
_PlayerDestinationButtons[i].Enabled = false; _PlayerDestinationButtons[i].Enabled = false;
} }
@@ -549,10 +546,10 @@ namespace VocaluxeLib.PartyModes.TicTacToe
} }
else else
{ {
_PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Color = Buttons[_ButtonPlayerDestination].Color; _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Color = _Buttons[_ButtonPlayerDestination].Color;
_PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].SelColor = Buttons[_ButtonPlayerDestination].SelColor; _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].SelColor = _Buttons[_ButtonPlayerDestination].SelColor;
_PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Texture = Buttons[_ButtonPlayerDestination].Texture; _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Texture = _Buttons[_ButtonPlayerDestination].Texture;
_PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].SelTexture = Buttons[_ButtonPlayerDestination].SelTexture; _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].SelTexture = _Buttons[_ButtonPlayerDestination].SelTexture;
_PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Text.Text = String.Empty; _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Text.Text = String.Empty;
_PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Enabled = false; _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Enabled = false;
} }
@@ -563,11 +560,11 @@ namespace VocaluxeLib.PartyModes.TicTacToe
{ {
if (_Data.ScreenNames.ProfileIDsTeam1.Count == _NumPlayerTeam1 && _Data.ScreenNames.ProfileIDsTeam2.Count == _NumPlayerTeam2) if (_Data.ScreenNames.ProfileIDsTeam1.Count == _NumPlayerTeam1 && _Data.ScreenNames.ProfileIDsTeam2.Count == _NumPlayerTeam2)
{ {
Buttons[_ButtonNext].Visible = true; _Buttons[_ButtonNext].Visible = true;
SetInteractionToButton(Buttons[_ButtonNext]); _SetInteractionToButton(_Buttons[_ButtonNext]);
} }
else else
Buttons[_ButtonNext].Visible = false; _Buttons[_ButtonNext].Visible = false;
} }
private bool _OnAdd() private bool _OnAdd()
@@ -590,7 +587,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
_PlayerDestinationButtons[added].Enabled = true; _PlayerDestinationButtons[added].Enabled = true;
//Update Tiles-List //Update Tiles-List
_UpdateButtonPlayerChoose(); _UpdateButtonPlayerChoose();
CheckInteraction(); _CheckInteraction();
return true; return true;
} }
else if (_Data.ScreenNames.ProfileIDsTeam2.Count < _NumPlayerTeam2) else if (_Data.ScreenNames.ProfileIDsTeam2.Count < _NumPlayerTeam2)
@@ -607,7 +604,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
_PlayerDestinationButtons[added].Enabled = true; _PlayerDestinationButtons[added].Enabled = true;
//Update Tiles-List //Update Tiles-List
_UpdateButtonPlayerChoose(); _UpdateButtonPlayerChoose();
CheckInteraction(); _CheckInteraction();
return true; return true;
} }
} }
@@ -627,7 +624,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
_UpdateButtonNext(); _UpdateButtonNext();
_UpdateButtonPlayerDestination(); _UpdateButtonPlayerDestination();
_UpdateButtonPlayerChoose(); _UpdateButtonPlayerChoose();
CheckInteraction(); _CheckInteraction();
return true; return true;
} }
} }
@@ -642,7 +639,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
_UpdateButtonNext(); _UpdateButtonNext();
_UpdateButtonPlayerDestination(); _UpdateButtonPlayerDestination();
_UpdateButtonPlayerChoose(); _UpdateButtonPlayerChoose();
CheckInteraction(); _CheckInteraction();
return true; return true;
} }
} }
+2 -3
View File
@@ -460,7 +460,6 @@ namespace Vocaluxe.Base
CVideo.VdClose(_Video); CVideo.VdClose(_Video);
CDraw.RemoveTexture(ref _CurrentVideoTexture); CDraw.RemoveTexture(ref _CurrentVideoTexture);
_Video = -1; _Video = -1;
return;
} }
} }
else else
@@ -471,8 +470,8 @@ namespace Vocaluxe.Base
{ {
if (_Video != -1) if (_Video != -1)
{ {
float vtime = 0f; float vtime;
CVideo.VdGetFrame(_Video, ref _CurrentVideoTexture, CSound.GetPosition(_CurrentMusicStream), ref vtime); CVideo.VdGetFrame(_Video, ref _CurrentVideoTexture, CSound.GetPosition(_CurrentMusicStream), out vtime);
if (_FadeTimer.ElapsedMilliseconds <= 3000L) if (_FadeTimer.ElapsedMilliseconds <= 3000L)
_CurrentVideoTexture.Color.A = _FadeTimer.ElapsedMilliseconds / 3000f; _CurrentVideoTexture.Color.A = _FadeTimer.ElapsedMilliseconds / 3000f;
else else
+21 -21
View File
@@ -52,7 +52,7 @@ namespace Vocaluxe.Base
public static int ScreenH = 576; public static int ScreenH = 576;
public static EAntiAliasingModes AAMode = EAntiAliasingModes.X0; public static EAntiAliasingModes AAMode = EAntiAliasingModes.X0;
public static EColorDeep Colors = EColorDeep.Bit32; public static EColorDepth ColorDepth = EColorDepth.Bit32;
public static EOffOn VSync = EOffOn.TR_CONFIG_ON; public static EOffOn VSync = EOffOn.TR_CONFIG_ON;
public static EOffOn FullScreen = EOffOn.TR_CONFIG_ON; public static EOffOn FullScreen = EOffOn.TR_CONFIG_ON;
@@ -152,7 +152,7 @@ namespace Vocaluxe.Base
xmlReader.TryGetIntValue("//root/Graphics/ScreenW", ref ScreenW); xmlReader.TryGetIntValue("//root/Graphics/ScreenW", ref ScreenW);
xmlReader.TryGetIntValue("//root/Graphics/ScreenH", ref ScreenH); xmlReader.TryGetIntValue("//root/Graphics/ScreenH", ref ScreenH);
xmlReader.TryGetEnumValue("//root/Graphics/AAMode", ref AAMode); xmlReader.TryGetEnumValue("//root/Graphics/AAMode", ref AAMode);
xmlReader.TryGetEnumValue("//root/Graphics/Colors", ref Colors); xmlReader.TryGetEnumValue("//root/Graphics/Colors", ref ColorDepth);
xmlReader.TryGetFloatValue("//root/Graphics/MaxFPS", ref MaxFPS); xmlReader.TryGetFloatValue("//root/Graphics/MaxFPS", ref MaxFPS);
xmlReader.TryGetEnumValue("//root/Graphics/VSync", ref VSync); xmlReader.TryGetEnumValue("//root/Graphics/VSync", ref VSync);
xmlReader.TryGetEnumValue("//root/Graphics/FullScreen", ref FullScreen); xmlReader.TryGetEnumValue("//root/Graphics/FullScreen", ref FullScreen);
@@ -160,9 +160,9 @@ namespace Vocaluxe.Base
#endregion Graphics #endregion Graphics
#region Theme #region Theme
xmlReader.GetValue("//root/Theme/Name", ref Theme, Theme); xmlReader.GetValue("//root/Theme/Name", out Theme, Theme);
xmlReader.GetValue("//root/Theme/Skin", ref Skin, Skin); xmlReader.GetValue("//root/Theme/Skin", out Skin, Skin);
xmlReader.GetValue("//root/Theme/Cover", ref CoverTheme, CoverTheme); xmlReader.GetValue("//root/Theme/Cover", out CoverTheme, CoverTheme);
xmlReader.TryGetEnumValue("//root/Theme/DrawNoteLines", ref DrawNoteLines); xmlReader.TryGetEnumValue("//root/Theme/DrawNoteLines", ref DrawNoteLines);
xmlReader.TryGetEnumValue("//root/Theme/DrawToneHelper", ref DrawToneHelper); xmlReader.TryGetEnumValue("//root/Theme/DrawToneHelper", ref DrawToneHelper);
xmlReader.TryGetEnumValue("//root/Theme/TimerLook", ref TimerLook); xmlReader.TryGetEnumValue("//root/Theme/TimerLook", ref TimerLook);
@@ -191,7 +191,7 @@ namespace Vocaluxe.Base
// Songfolder // Songfolder
string value = string.Empty; string value = string.Empty;
int i = 1; int i = 1;
while (xmlReader.GetValue("//root/Game/SongFolder" + i.ToString(), ref value, value)) while (xmlReader.GetValue("//root/Game/SongFolder" + i, out value, value))
{ {
if (i == 1) if (i == 1)
SongFolder.Clear(); SongFolder.Clear();
@@ -208,7 +208,7 @@ namespace Vocaluxe.Base
xmlReader.TryGetEnumValue("//root/Game/TimerMode", ref TimerMode); xmlReader.TryGetEnumValue("//root/Game/TimerMode", ref TimerMode);
xmlReader.TryGetIntValue("//root/Game/NumPlayer", ref NumPlayer); xmlReader.TryGetIntValue("//root/Game/NumPlayer", ref NumPlayer);
xmlReader.TryGetEnumValue("//root/Game/Tabs", ref Tabs); xmlReader.TryGetEnumValue("//root/Game/Tabs", ref Tabs);
xmlReader.GetValue("//root/Game/Language", ref Language, Language); xmlReader.GetValue("//root/Game/Language", out Language, Language);
xmlReader.TryGetEnumValue("//root/Game/LyricsOnTop", ref LyricsOnTop); xmlReader.TryGetEnumValue("//root/Game/LyricsOnTop", ref LyricsOnTop);
xmlReader.TryGetFloatValue("//root/Game/MinLineBreakTime", ref MinLineBreakTime); xmlReader.TryGetFloatValue("//root/Game/MinLineBreakTime", ref MinLineBreakTime);
@@ -229,7 +229,7 @@ namespace Vocaluxe.Base
//Read players from config //Read players from config
for (i = 1; i <= CSettings.MaxNumPlayer; i++) for (i = 1; i <= CSettings.MaxNumPlayer; i++)
xmlReader.GetValue("//root/Game/Players/Player" + i.ToString(), ref Players[i - 1], string.Empty); xmlReader.GetValue("//root/Game/Players/Player" + i, out Players[i - 1], string.Empty);
#endregion Game #endregion Game
#region Video #region Video
@@ -241,7 +241,7 @@ namespace Vocaluxe.Base
xmlReader.TryGetEnumValue("//root/Video/WebcamLib", ref WebcamLib); xmlReader.TryGetEnumValue("//root/Video/WebcamLib", ref WebcamLib);
WebcamConfig = new SWebcamConfig(); WebcamConfig = new SWebcamConfig();
xmlReader.GetValue("//root/Video/WebcamConfig/MonikerString", ref WebcamConfig.MonikerString, String.Empty); xmlReader.GetValue("//root/Video/WebcamConfig/MonikerString", out WebcamConfig.MonikerString, String.Empty);
xmlReader.TryGetIntValue("//root/Video/WebcamConfig/Framerate", ref WebcamConfig.Framerate); xmlReader.TryGetIntValue("//root/Video/WebcamConfig/Framerate", ref WebcamConfig.Framerate);
xmlReader.TryGetIntValue("//root/Video/WebcamConfig/Width", ref WebcamConfig.Width); xmlReader.TryGetIntValue("//root/Video/WebcamConfig/Width", ref WebcamConfig.Width);
xmlReader.TryGetIntValue("//root/Video/WebcamConfig/Height", ref WebcamConfig.Height); xmlReader.TryGetIntValue("//root/Video/WebcamConfig/Height", ref WebcamConfig.Height);
@@ -252,10 +252,10 @@ namespace Vocaluxe.Base
for (int p = 1; p <= CSettings.MaxNumPlayer; p++) for (int p = 1; p <= CSettings.MaxNumPlayer; p++)
{ {
MicConfig[p - 1] = new SMicConfig(0); MicConfig[p - 1] = new SMicConfig(0);
xmlReader.GetValue("//root/Record/MicConfig" + p.ToString() + "/DeviceName", ref MicConfig[p - 1].DeviceName, String.Empty); xmlReader.GetValue("//root/Record/MicConfig" + p + "/DeviceName", out MicConfig[p - 1].DeviceName, String.Empty);
xmlReader.GetValue("//root/Record/MicConfig" + p.ToString() + "/DeviceDriver", ref MicConfig[p - 1].DeviceDriver, String.Empty); xmlReader.GetValue("//root/Record/MicConfig" + p + "/DeviceDriver", out MicConfig[p - 1].DeviceDriver, String.Empty);
xmlReader.GetValue("//root/Record/MicConfig" + p.ToString() + "/InputName", ref MicConfig[p - 1].InputName, String.Empty); xmlReader.GetValue("//root/Record/MicConfig" + p + "/InputName", out MicConfig[p - 1].InputName, String.Empty);
xmlReader.TryGetIntValue("//root/Record/MicConfig" + p.ToString() + "/Channel", ref MicConfig[p - 1].Channel); xmlReader.TryGetIntValue("//root/Record/MicConfig" + p + "/Channel", ref MicConfig[p - 1].Channel);
} }
xmlReader.TryGetIntValueRange("//root/Record/MicDelay", ref MicDelay, 0, 500); xmlReader.TryGetIntValueRange("//root/Record/MicDelay", ref MicDelay, 0, 500);
@@ -316,8 +316,8 @@ namespace Vocaluxe.Base
writer.WriteComment("AAMode: " + CHelper.ListStrings(Enum.GetNames(typeof(EAntiAliasingModes)))); writer.WriteComment("AAMode: " + CHelper.ListStrings(Enum.GetNames(typeof(EAntiAliasingModes))));
writer.WriteElementString("AAMode", Enum.GetName(typeof(EAntiAliasingModes), AAMode)); writer.WriteElementString("AAMode", Enum.GetName(typeof(EAntiAliasingModes), AAMode));
writer.WriteComment("Colors: " + CHelper.ListStrings(Enum.GetNames(typeof(EColorDeep)))); writer.WriteComment("Colors: " + CHelper.ListStrings(Enum.GetNames(typeof(EColorDepth))));
writer.WriteElementString("Colors", Enum.GetName(typeof(EColorDeep), Colors)); writer.WriteElementString("Colors", Enum.GetName(typeof(EColorDepth), ColorDepth));
writer.WriteComment("MaxFPS should be between 1..200"); writer.WriteComment("MaxFPS should be between 1..200");
writer.WriteElementString("MaxFPS", MaxFPS.ToString("#")); writer.WriteElementString("MaxFPS", MaxFPS.ToString("#"));
@@ -421,14 +421,14 @@ namespace Vocaluxe.Base
//Write "old" song-folders to config. //Write "old" song-folders to config.
writer.WriteComment("SongFolder: SongFolder1, SongFolder2, SongFolder3, ..."); writer.WriteComment("SongFolder: SongFolder1, SongFolder2, SongFolder3, ...");
for (int i = 0; i < _SongFolderOld.Count; i++) for (int i = 0; i < _SongFolderOld.Count; i++)
writer.WriteElementString("SongFolder" + (i + 1).ToString(), _SongFolderOld[i]); writer.WriteElementString("SongFolder" + (i + 1), _SongFolderOld[i]);
} }
else else
{ {
//Write "normal" song-folders to config. //Write "normal" song-folders to config.
writer.WriteComment("SongFolder: SongFolder1, SongFolder2, SongFolder3, ..."); writer.WriteComment("SongFolder: SongFolder1, SongFolder2, SongFolder3, ...");
for (int i = 0; i < SongFolder.Count; i++) for (int i = 0; i < SongFolder.Count; i++)
writer.WriteElementString("SongFolder" + (i + 1).ToString(), SongFolder[i]); writer.WriteElementString("SongFolder" + (i + 1), SongFolder[i]);
} }
writer.WriteComment("SongMenu: " + CHelper.ListStrings(Enum.GetNames(typeof(ESongMenu)))); writer.WriteComment("SongMenu: " + CHelper.ListStrings(Enum.GetNames(typeof(ESongMenu))));
@@ -446,7 +446,7 @@ namespace Vocaluxe.Base
writer.WriteComment("TimerMode: " + CHelper.ListStrings(Enum.GetNames(typeof(ETimerMode)))); writer.WriteComment("TimerMode: " + CHelper.ListStrings(Enum.GetNames(typeof(ETimerMode))));
writer.WriteElementString("TimerMode", Enum.GetName(typeof(ETimerMode), TimerMode)); writer.WriteElementString("TimerMode", Enum.GetName(typeof(ETimerMode), TimerMode));
writer.WriteComment("NumPlayer: 1.." + CSettings.MaxNumPlayer.ToString()); writer.WriteComment("NumPlayer: 1.." + CSettings.MaxNumPlayer);
writer.WriteElementString("NumPlayer", NumPlayer.ToString()); writer.WriteElementString("NumPlayer", NumPlayer.ToString());
writer.WriteComment("Order songs in tabs: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)))); writer.WriteComment("Order songs in tabs: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))));
@@ -458,10 +458,10 @@ namespace Vocaluxe.Base
writer.WriteComment("MinLineBreakTime: Value >= 0 in s. Minimum time the text is shown before it is to be sung"); writer.WriteComment("MinLineBreakTime: Value >= 0 in s. Minimum time the text is shown before it is to be sung");
writer.WriteElementString("MinLineBreakTime", MinLineBreakTime.ToString()); writer.WriteElementString("MinLineBreakTime", MinLineBreakTime.ToString());
writer.WriteComment("Default profile for players 1..." + CSettings.MaxNumPlayer.ToString() + ":"); writer.WriteComment("Default profile for players 1..." + CSettings.MaxNumPlayer + ":");
writer.WriteStartElement("Players"); writer.WriteStartElement("Players");
for (int i = 1; i <= CSettings.MaxNumPlayer; i++) for (int i = 1; i <= CSettings.MaxNumPlayer; i++)
writer.WriteElementString("Player" + i.ToString(), Path.GetFileName(Players[i - 1])); writer.WriteElementString("Player" + i, Path.GetFileName(Players[i - 1]));
writer.WriteEndElement(); writer.WriteEndElement();
writer.WriteEndElement(); writer.WriteEndElement();
@@ -507,7 +507,7 @@ namespace Vocaluxe.Base
{ {
if (MicConfig[p - 1].DeviceName.Length > 0 && MicConfig[p - 1].InputName.Length > 0 && MicConfig[p - 1].Channel > 0) if (MicConfig[p - 1].DeviceName.Length > 0 && MicConfig[p - 1].InputName.Length > 0 && MicConfig[p - 1].Channel > 0)
{ {
writer.WriteStartElement("MicConfig" + p.ToString()); writer.WriteStartElement("MicConfig" + p);
writer.WriteElementString("DeviceName", MicConfig[p - 1].DeviceName); writer.WriteElementString("DeviceName", MicConfig[p - 1].DeviceName);
writer.WriteElementString("DeviceDriver", MicConfig[p - 1].DeviceDriver); writer.WriteElementString("DeviceDriver", MicConfig[p - 1].DeviceDriver);
+49 -62
View File
@@ -20,6 +20,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Text; using System.Text;
using System.Xml; using System.Xml;
using VocaluxeLib.Menu; using VocaluxeLib.Menu;
@@ -116,18 +117,12 @@ namespace Vocaluxe.Base
/// <summary> /// <summary>
/// Returns true if a cover with the given name exists. /// Returns true if a cover with the given name exists.
/// </summary> /// </summary>
public static bool CoverExists(string name) private static bool _CoverExists(string name)
{ {
STexture cov = _NoCover;
lock (_MutexCover) lock (_MutexCover)
{ {
foreach (SCover cover in _Cover) return _Cover.Any(cover => cover.Name == name);
{
if (cover.Name == name)
return true;
}
} }
return false;
} }
/// <summary> /// <summary>
@@ -168,7 +163,7 @@ namespace Vocaluxe.Base
{ {
_CoverThemes.Clear(); _CoverThemes.Clear();
string path = CSettings.FolderCover; const string path = CSettings.FolderCover;
List<string> files = CHelper.ListFiles(path, "*.xml", false); List<string> files = CHelper.ListFiles(path, "*.xml", false);
foreach (string file in files) foreach (string file in files)
@@ -179,8 +174,8 @@ namespace Vocaluxe.Base
{ {
SCoverTheme coverTheme = new SCoverTheme(); SCoverTheme coverTheme = new SCoverTheme();
xmlReader.GetValue("//root/Info/Name", ref coverTheme.Name, String.Empty); xmlReader.GetValue("//root/Info/Name", out coverTheme.Name, String.Empty);
xmlReader.GetValue("//root/Info/Folder", ref coverTheme.Folder, String.Empty); xmlReader.GetValue("//root/Info/Folder", out coverTheme.Folder, String.Empty);
if (coverTheme.Folder.Length > 0 && coverTheme.Name.Length > 0) if (coverTheme.Folder.Length > 0 && coverTheme.Name.Length > 0)
{ {
@@ -197,69 +192,61 @@ namespace Vocaluxe.Base
/// </summary> /// </summary>
private static void _LoadCover(string coverThemeName) private static void _LoadCover(string coverThemeName)
{ {
SCoverTheme coverTheme = new SCoverTheme(); SCoverTheme coverTheme = _CoverTheme(coverThemeName);
coverTheme = _CoverTheme(coverThemeName); if (coverTheme.Name == "")
return;
CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(CSettings.FolderCover, coverTheme.File));
if (coverTheme.Name.Length > 0) if (xmlReader != null)
{ {
CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(CSettings.FolderCover, coverTheme.File)); lock (_MutexCover)
if (xmlReader != null)
{ {
lock (_MutexCover) _Cover.Clear();
{ List<string> cover = xmlReader.GetValues("Cover");
_Cover.Clear(); foreach (string coverName in cover)
List<string> cover = xmlReader.GetValues("Cover");
for (int i = 0; i < cover.Count; i++)
{
SCover sk = new SCover();
string name = String.Empty;
string value = String.Empty;
xmlReader.GetValue("//root/Cover/" + cover[i] + "/Name", ref name, String.Empty);
xmlReader.GetValue("//root/Cover/" + cover[i] + "/Path", ref value, String.Empty);
sk.Name = name;
sk.Value = Path.Combine(coverTheme.Folder, value);
if (File.Exists(Path.Combine(CSettings.FolderCover, Path.Combine(coverTheme.Folder, value))))
sk.Texture = CDraw.AddTexture(Path.Combine(CSettings.FolderCover, Path.Combine(coverTheme.Folder, value)));
else
sk.Texture = _NoCover;
_Cover.Add(sk);
if (sk.Name == "NoCover")
_NoCover = sk.Texture;
}
}
}
List<string> files = new List<string>();
files.AddRange(CHelper.ListFiles(Path.Combine(CSettings.FolderCover, coverTheme.Folder), "*.png", true, true));
files.AddRange(CHelper.ListFiles(Path.Combine(CSettings.FolderCover, coverTheme.Folder), "*.jpg", true, true));
files.AddRange(CHelper.ListFiles(Path.Combine(CSettings.FolderCover, coverTheme.Folder), "*.jpeg", true, true));
files.AddRange(CHelper.ListFiles(Path.Combine(CSettings.FolderCover, coverTheme.Folder), "*.bmp", true, true));
foreach (string file in files)
{
string name = Path.GetFileNameWithoutExtension(file);
if (!CoverExists(name))
{ {
SCover sk = new SCover(); SCover sk = new SCover();
string name;
string value = String.Empty; string value;
xmlReader.GetValue("//root/Cover/" + coverName + "/Name", out name, String.Empty);
xmlReader.GetValue("//root/Cover/" + coverName + "/Path", out value, String.Empty);
sk.Name = name; sk.Name = name;
sk.Value = Path.Combine(coverTheme.Folder, Path.GetFileName(file)); sk.Value = Path.Combine(coverTheme.Folder, value);
sk.Texture = File.Exists(Path.Combine(CSettings.FolderCover, sk.Value))
sk.Texture = CDraw.AddTexture(Path.Combine(CSettings.FolderCover, sk.Value)); ? CDraw.AddTexture(Path.Combine(CSettings.FolderCover, Path.Combine(coverTheme.Folder, value))) : _NoCover;
_Cover.Add(sk); _Cover.Add(sk);
if (sk.Name == "NoCover")
_NoCover = sk.Texture;
} }
} }
} }
List<string> files = new List<string>();
string path = Path.Combine(CSettings.FolderCover, coverTheme.Folder);
files.AddRange(CHelper.ListFiles(path, "*.png", true, true));
files.AddRange(CHelper.ListFiles(path, "*.jpg", true, true));
files.AddRange(CHelper.ListFiles(path, "*.jpeg", true, true));
files.AddRange(CHelper.ListFiles(path, "*.bmp", true, true));
foreach (string file in files)
{
string name = Path.GetFileNameWithoutExtension(file);
if (_CoverExists(name))
continue;
// ReSharper disable AssignNullToNotNullAttribute
SCover sk = new SCover {Name = name, Value = Path.Combine(coverTheme.Folder, Path.GetFileName(file))};
// ReSharper restore AssignNullToNotNullAttribute
sk.Texture = CDraw.AddTexture(Path.Combine(CSettings.FolderCover, sk.Value));
_Cover.Add(sk);
}
} }
} }
} }
+4 -17
View File
@@ -176,7 +176,6 @@ namespace Vocaluxe.Base
if (reader != null) if (reader != null)
{ {
reader.Dispose(); reader.Dispose();
reader = null;
} }
command.CommandText = "INSERT INTO Scores (SongID, PlayerName, Score, LineNr, Date, Medley, Duet, ShortSong, Difficulty) " + command.CommandText = "INSERT INTO Scores (SongID, PlayerName, Score, LineNr, Date, Medley, Duet, ShortSong, Difficulty) " +
@@ -208,7 +207,7 @@ namespace Vocaluxe.Base
return lastInsertID; return lastInsertID;
} }
public static void LoadScore(ref List<SScores> scores, SPlayer player) public static void LoadScore(out List<SScores> scores, SPlayer player)
{ {
using (SQLiteConnection connection = new SQLiteConnection()) using (SQLiteConnection connection = new SQLiteConnection())
{ {
@@ -344,9 +343,6 @@ namespace Vocaluxe.Base
} }
} }
if (reader != null)
reader.Dispose();
return -1; return -1;
} }
@@ -374,7 +370,7 @@ namespace Vocaluxe.Base
command.CommandText = "SELECT Artist, Title, NumPlayed FROM Songs WHERE [id] = @id"; command.CommandText = "SELECT Artist, Title, NumPlayed FROM Songs WHERE [id] = @id";
command.Parameters.Add("@id", DbType.String, 0).Value = songID; command.Parameters.Add("@id", DbType.String, 0).Value = songID;
SQLiteDataReader reader = null; SQLiteDataReader reader;
try try
{ {
reader = command.ExecuteReader(); reader = command.ExecuteReader();
@@ -516,11 +512,10 @@ namespace Vocaluxe.Base
return false; return false;
} }
SQLiteDataReader reader = null;
using (SQLiteCommand command = new SQLiteCommand(connection)) using (SQLiteCommand command = new SQLiteCommand(connection))
{ {
command.CommandText = "PRAGMA user_version"; command.CommandText = "PRAGMA user_version";
reader = command.ExecuteReader(); SQLiteDataReader reader = command.ExecuteReader();
reader.Read(); reader.Read();
int version = reader.GetInt32(0); int version = reader.GetInt32(0);
@@ -636,16 +631,8 @@ namespace Vocaluxe.Base
List<SData> scores = new List<SData>(); List<SData> scores = new List<SData>();
List<SData> songs = new List<SData>(); List<SData> songs = new List<SData>();
SQLiteDataReader reader = null;
command.CommandText = "SELECT id, PlayerName, Date FROM Scores"; command.CommandText = "SELECT id, PlayerName, Date FROM Scores";
try SQLiteDataReader reader = command.ExecuteReader();
{
reader = command.ExecuteReader();
}
catch (Exception)
{
throw;
}
if (reader != null && reader.HasRows) if (reader != null && reader.HasRows)
{ {
+1 -1
View File
@@ -274,7 +274,7 @@ namespace Vocaluxe.Base
if (rect.Height <= 0f) if (rect.Height <= 0f)
return; return;
CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, aspect); CHelper.SetRect(bounds, out rect, rect.Width / rect.Height, aspect);
DrawTexture(texture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, staticBounds.Rect.Z), DrawTexture(texture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, staticBounds.Rect.Z),
texture.Color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f), false); texture.Color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f), false);
} }
+17 -35
View File
@@ -341,37 +341,19 @@ namespace Vocaluxe.Base
public static float Height public static float Height
{ {
get { return _Height; } get { return _Height; }
set set {
{ _Height = value < 0f ? 0f : value;
if (value < 0f)
_Height = 0f;
else
_Height = value;
} }
} }
public static float Outline public static float Outline
{ {
get { return _Fonts[_CurrentFont].Outline; } get { return _Fonts[_CurrentFont].Outline; }
set
{
SFont font = _Fonts[_CurrentFont];
font.Outline = value;
if (font.Outline < 0f)
font.Outline = 0f;
if (font.Outline > 1f)
font.Outline = 1f;
}
} }
public static SColorF OutlineColor public static SColorF OutlineColor
{ {
get { return _Fonts[_CurrentFont].OutlineColor; } get { return _Fonts[_CurrentFont].OutlineColor; }
set
{
SFont font = _Fonts[_CurrentFont];
font.OutlineColor = value;
}
} }
public static void Init() public static void Init()
@@ -525,7 +507,7 @@ namespace Vocaluxe.Base
public static void SetFont(string fontName) public static void SetFont(string fontName)
{ {
int index = -1; int index;
if (PartyModeID != -1) if (PartyModeID != -1)
{ {
@@ -595,7 +577,7 @@ namespace Vocaluxe.Base
{ {
string value = string.Empty; string value = string.Empty;
int i = 1; int i = 1;
while (xmlReader.GetValue("//root/Fonts/Font" + i.ToString() + "/Folder", ref value, value)) while (xmlReader.GetValue("//root/Fonts/Font" + i + "/Folder", out value, value))
{ {
SFont sf = new SFont(); SFont sf = new SFont();
sf.Folder = value; sf.Folder = value;
@@ -605,42 +587,42 @@ namespace Vocaluxe.Base
bool ok = true; bool ok = true;
string name = String.Empty; string name;
ok &= xmlReader.GetValue("//root/Fonts/Font" + i.ToString() + "/Name", ref name, value); ok &= xmlReader.GetValue("//root/Fonts/Font" + i + "/Name", out name, value);
sf.Name = name; sf.Name = name;
ok &= xmlReader.GetValue("//root/Fonts/Font" + i.ToString() + "/FileNormal", ref value, value); ok &= xmlReader.GetValue("//root/Fonts/Font" + i + "/FileNormal", out value, value);
sf.FileNormal = value; sf.FileNormal = value;
value = Path.Combine(fontFolder, Path.Combine(sf.Folder, value)); value = Path.Combine(fontFolder, Path.Combine(sf.Folder, value));
CFont f = new CFont(value); CFont f = new CFont(value);
sf.Normal = f; sf.Normal = f;
ok &= xmlReader.GetValue("//root/Fonts/Font" + i.ToString() + "/FileItalic", ref value, value); ok &= xmlReader.GetValue("//root/Fonts/Font" + i + "/FileItalic", out value, value);
sf.FileItalic = value; sf.FileItalic = value;
value = Path.Combine(fontFolder, Path.Combine(sf.Folder, value)); value = Path.Combine(fontFolder, Path.Combine(sf.Folder, value));
f = new CFont(value); f = new CFont(value);
sf.Italic = f; sf.Italic = f;
ok &= xmlReader.GetValue("//root/Fonts/Font" + i.ToString() + "/FileBold", ref value, value); ok &= xmlReader.GetValue("//root/Fonts/Font" + i + "/FileBold", out value, value);
sf.FileBold = value; sf.FileBold = value;
value = Path.Combine(fontFolder, Path.Combine(sf.Folder, value)); value = Path.Combine(fontFolder, Path.Combine(sf.Folder, value));
f = new CFont(value); f = new CFont(value);
sf.Bold = f; sf.Bold = f;
ok &= xmlReader.GetValue("//root/Fonts/Font" + i.ToString() + "/FileBoldItalic", ref value, value); ok &= xmlReader.GetValue("//root/Fonts/Font" + i + "/FileBoldItalic", out value, value);
sf.FileBoldItalic = value; sf.FileBoldItalic = value;
value = Path.Combine(fontFolder, Path.Combine(sf.Folder, value)); value = Path.Combine(fontFolder, Path.Combine(sf.Folder, value));
f = new CFont(value); f = new CFont(value);
sf.BoldItalic = f; sf.BoldItalic = f;
sf.Outline = 0f; sf.Outline = 0f;
ok &= xmlReader.TryGetFloatValue("//root/Fonts/Font" + i.ToString() + "/Outline", ref sf.Outline); ok &= xmlReader.TryGetFloatValue("//root/Fonts/Font" + i + "/Outline", ref sf.Outline);
sf.OutlineColor = new SColorF(0f, 0f, 0f, 1f); sf.OutlineColor = new SColorF(0f, 0f, 0f, 1f);
ok &= xmlReader.TryGetFloatValue("//root/Fonts/Font" + i.ToString() + "/OutlineColorR", ref sf.OutlineColor.R); ok &= xmlReader.TryGetFloatValue("//root/Fonts/Font" + i + "/OutlineColorR", ref sf.OutlineColor.R);
ok &= xmlReader.TryGetFloatValue("//root/Fonts/Font" + i.ToString() + "/OutlineColorG", ref sf.OutlineColor.G); ok &= xmlReader.TryGetFloatValue("//root/Fonts/Font" + i + "/OutlineColorG", ref sf.OutlineColor.G);
ok &= xmlReader.TryGetFloatValue("//root/Fonts/Font" + i.ToString() + "/OutlineColorB", ref sf.OutlineColor.B); ok &= xmlReader.TryGetFloatValue("//root/Fonts/Font" + i + "/OutlineColorB", ref sf.OutlineColor.B);
ok &= xmlReader.TryGetFloatValue("//root/Fonts/Font" + i.ToString() + "/OutlineColorA", ref sf.OutlineColor.A); ok &= xmlReader.TryGetFloatValue("//root/Fonts/Font" + i + "/OutlineColorA", ref sf.OutlineColor.A);
if (ok) if (ok)
_Fonts.Add(sf); _Fonts.Add(sf);
@@ -653,7 +635,7 @@ namespace Vocaluxe.Base
fontTypes = "theme fonts for theme \"" + themeName + "\""; fontTypes = "theme fonts for theme \"" + themeName + "\"";
else else
fontTypes = "basic fonts"; fontTypes = "basic fonts";
CLog.LogError("Error loading " + fontTypes + ": Error in Font" + i.ToString()); CLog.LogError("Error loading " + fontTypes + ": Error in Font" + i);
} }
i++; i++;
} }
@@ -715,7 +697,7 @@ namespace Vocaluxe.Base
setStart = true; setStart = true;
} }
writer.WriteStartElement("Font" + fontNr.ToString()); writer.WriteStartElement("Font" + fontNr);
writer.WriteElementString("Name", _Fonts[index].Name); writer.WriteElementString("Name", _Fonts[index].Name);
writer.WriteElementString("Folder", _Fonts[index].Folder); writer.WriteElementString("Folder", _Fonts[index].Folder);
+127 -154
View File
@@ -29,14 +29,8 @@ namespace Vocaluxe.Base
static class CGame static class CGame
{ {
private static IGameMode _GameMode; private static IGameMode _GameMode;
private static SPlayer[] _Player;
private static int _NumPlayer = CConfig.NumPlayer; private static int _NumPlayer = CConfig.NumPlayer;
private static float _Beat;
private static int _CurrentBeat;
private static float _MidBeatD;
private static int _CurrentBeatD;
private static int _OldBeatD; private static int _OldBeatD;
private static readonly Random _Rand = new Random(); private static readonly Random _Rand = new Random();
@@ -58,36 +52,21 @@ namespace Vocaluxe.Base
return 0f; return 0f;
} }
public static int CurrentBeat public static int CurrentBeat { get; private set; }
{
get { return _CurrentBeat; }
}
public static float Beat public static float Beat { get; private set; }
{
get { return _Beat; }
}
public static float MidBeatD public static float MidBeatD { get; private set; }
{
get { return _MidBeatD; }
}
public static int ActBeatD public static int ActBeatD { get; private set; }
{
get { return _CurrentBeatD; }
}
public static SPlayer[] Player public static SPlayer[] Player { get; private set; }
{
get { return _Player; }
}
public static void Init() public static void Init()
{ {
_GameMode = new CGameModeNormal(); _GameMode = new CGameModeNormal();
_GameMode.Init(); _GameMode.Init();
_Player = new SPlayer[CSettings.MaxNumPlayer]; Player = new SPlayer[CSettings.MaxNumPlayer];
ResetPlayer(); ResetPlayer();
CConfig.UsePlayers(); CConfig.UsePlayers();
@@ -136,12 +115,12 @@ namespace Vocaluxe.Base
public static void Start() public static void Start()
{ {
_GameMode.Start(_Player); _GameMode.Start(Player);
} }
public static void NextRound() public static void NextRound()
{ {
_GameMode.NextRound(_Player); _GameMode.NextRound(Player);
} }
public static bool IsFinished() public static bool IsFinished()
@@ -196,63 +175,61 @@ namespace Vocaluxe.Base
public static void ResetPlayer() public static void ResetPlayer()
{ {
for (int i = 0; i < _Player.Length; i++) for (int i = 0; i < Player.Length; i++)
{ {
_Player[i].Points = 0f; Player[i].Points = 0f;
_Player[i].PointsLineBonus = 0f; Player[i].PointsLineBonus = 0f;
_Player[i].PointsGoldenNotes = 0f; Player[i].PointsGoldenNotes = 0f;
_Player[i].LineNr = 0; Player[i].LineNr = 0;
_Player[i].NoteDiff = 0; Player[i].NoteDiff = 0;
_Player[i].SingLine = new List<CLine>(); Player[i].SingLine = new List<CLine>();
_Player[i].CurrentLine = -1; Player[i].CurrentLine = -1;
_Player[i].CurrentNote = -1; Player[i].CurrentNote = -1;
_Player[i].SongID = -1; Player[i].SongID = -1;
_Player[i].Medley = false; Player[i].Medley = false;
_Player[i].Duet = false; Player[i].Duet = false;
_Player[i].ShortSong = false; Player[i].ShortSong = false;
_Player[i].DateTicks = DateTime.Now.Ticks; Player[i].DateTicks = DateTime.Now.Ticks;
_Player[i].SongFinished = false; Player[i].SongFinished = false;
} }
_OldBeatD = -100; _OldBeatD = -100;
_Beat = -100; Beat = -100;
_CurrentBeat = -100; CurrentBeat = -100;
_CurrentBeatD = -100; ActBeatD = -100;
} }
public static void UpdatePoints(float time) public static void UpdatePoints(float time)
{ {
bool debugHit = false;
CSong song = _GameMode.GetSong(); CSong song = _GameMode.GetSong();
if (song == null) if (song == null)
return; return;
float b = GetBeatFromTime(time, song.BPM, song.Gap); float b = GetBeatFromTime(time, song.BPM, song.Gap);
if (b <= _Beat) if (b <= Beat)
return; return;
_Beat = b; Beat = b;
_CurrentBeat = (int)Math.Floor(_Beat); CurrentBeat = (int)Math.Floor(Beat);
_MidBeatD = -0.5f + GetBeatFromTime(time, song.BPM, song.Gap + CConfig.MicDelay / 1000f); MidBeatD = -0.5f + GetBeatFromTime(time, song.BPM, song.Gap + CConfig.MicDelay / 1000f);
_CurrentBeatD = (int)Math.Floor(_MidBeatD); ActBeatD = (int)Math.Floor(MidBeatD);
for (int p = 0; p < _NumPlayer; p++) for (int p = 0; p < _NumPlayer; p++)
CSound.AnalyzeBuffer(p); CSound.AnalyzeBuffer(p);
if (_OldBeatD >= _CurrentBeatD) if (_OldBeatD >= ActBeatD)
return; return;
for (int p = 0; p < _NumPlayer; p++) for (int p = 0; p < _NumPlayer; p++)
{ {
for (int beat = _OldBeatD + 1; beat <= _CurrentBeatD; beat++) for (int beat = _OldBeatD + 1; beat <= ActBeatD; beat++)
{ {
if ((_GameMode.GetCurrentGameMode() == EGameMode.TR_GAMEMODE_MEDLEY && song.Medley.EndBeat == beat) || if ((_GameMode.GetCurrentGameMode() == EGameMode.TR_GAMEMODE_MEDLEY && song.Medley.EndBeat == beat) ||
(_GameMode.GetCurrentGameMode() == EGameMode.TR_GAMEMODE_SHORTSONG && song.ShortEnd == beat)) (_GameMode.GetCurrentGameMode() == EGameMode.TR_GAMEMODE_SHORTSONG && song.ShortEnd == beat))
_Player[p].SongFinished = true; Player[p].SongFinished = true;
CLine[] lines = song.Notes.GetLines(_Player[p].LineNr).Line; CLine[] lines = song.Notes.GetLines(Player[p].LineNr).Line;
int line = -1; int line = -1;
for (int j = 0; j < lines.Length; j++) for (int j = 0; j < lines.Length; j++)
@@ -264,125 +241,121 @@ namespace Vocaluxe.Base
} }
} }
if (line >= 0) if (line < 0)
continue;
if (line != Player[p].CurrentLine)
Player[p].CurrentNote = -1;
Player[p].CurrentLine = line;
while (Player[p].SingLine.Count <= line)
Player[p].SingLine.Add(new CLine());
CNote[] notes = lines[line].Notes;
int note = -1;
for (int j = 0; j < notes.Length; j++)
{ {
if (line != _Player[p].CurrentLine) if (beat >= notes[j].StartBeat && beat <= notes[j].EndBeat)
_Player[p].CurrentNote = -1;
_Player[p].CurrentLine = line;
while (_Player[p].SingLine.Count <= line)
_Player[p].SingLine.Add(new CLine());
CNote[] notes = lines[line].Notes;
int note = -1;
for (int j = 0; j < notes.Length; j++)
{ {
if (beat >= notes[j].StartBeat && beat <= notes[j].EndBeat) note = j;
break;
}
}
if (note >= 0)
{
Player[p].CurrentNote = note;
if (line == lines.Length - 1)
{
if (note == lines[line].NoteCount - 1)
{ {
note = j; if (notes[note].EndBeat == beat)
break; Player[p].SongFinished = true;
} }
} }
if (note >= 0) if (notes[note].PointsForBeat > 0 && CSound.RecordToneValid(p))
{ {
_Player[p].CurrentNote = note; int tone = notes[note].Tone;
int tonePlayer = CSound.RecordGetTone(p);
if (line == lines.Length - 1) while (tonePlayer - tone > 6)
tonePlayer -= 12;
while (tonePlayer - tone < -6)
tonePlayer += 12;
Player[p].NoteDiff = Math.Abs(tone - tonePlayer);
bool hit = Player[p].NoteDiff <= (2 - (int)Player[p].Difficulty);
if (hit)
{ {
if (note == lines[line].NoteCount - 1) // valid
//CSound.RecordSetTone(p, Tone);
double points = (CSettings.MaxScore - CSettings.LinebonusScore) * (double)notes[note].PointsForBeat /
song.Notes.GetLines(Player[p].LineNr).Points;
if (notes[note].NoteType == ENoteType.Golden)
Player[p].PointsGoldenNotes += points;
Player[p].Points += points;
// update player notes (sung notes)
if (Player[p].SingLine[line].NoteCount > 0)
{ {
if (notes[note].EndBeat == beat) CNote nt = Player[p].SingLine[line].LastNote;
_Player[p].SongFinished = true; if (notes[note].StartBeat == beat || nt.EndBeat + 1 != beat || nt.Tone != tone || !nt.Hit)
} Player[p].SingLine[line].AddNote(new CNote(beat, 1, tone, String.Empty, true, notes[note].NoteType));
}
if (notes[note].PointsForBeat > 0 && (CSound.RecordToneValid(p) || debugHit))
{
int tone = notes[note].Tone;
int tonePlayer = CSound.RecordGetTone(p);
while (tonePlayer - tone > 6)
tonePlayer -= 12;
while (tonePlayer - tone < -6)
tonePlayer += 12;
if (debugHit)
tonePlayer = tone;
_Player[p].NoteDiff = Math.Abs(tone - tonePlayer);
bool hit = _Player[p].NoteDiff <= (2 - (int)_Player[p].Difficulty);
if (hit)
{
// valid
//CSound.RecordSetTone(p, Tone);
double points = (CSettings.MaxScore - CSettings.LinebonusScore) * (double)notes[note].PointsForBeat /
song.Notes.GetLines(_Player[p].LineNr).Points;
if (notes[note].NoteType == ENoteType.Golden)
_Player[p].PointsGoldenNotes += points;
_Player[p].Points += points;
// update player notes (sung notes)
if (_Player[p].SingLine[line].NoteCount > 0)
{
CNote nt = _Player[p].SingLine[line].LastNote;
if (notes[note].StartBeat == beat || nt.EndBeat + 1 != beat || nt.Tone != tone || !nt.Hit)
_Player[p].SingLine[line].AddNote(new CNote(beat, 1, tone, String.Empty, true, notes[note].NoteType));
else
_Player[p].SingLine[line].IncLastNoteLength();
}
else else
_Player[p].SingLine[line].AddNote(new CNote(beat, 1, tone, String.Empty, true, notes[note].NoteType)); Player[p].SingLine[line].IncLastNoteLength();
_Player[p].SingLine[line].LastNote.IsPerfect(notes[note]);
_Player[p].SingLine[line].IsPerfect(lines[line]);
} }
else else
{ Player[p].SingLine[line].AddNote(new CNote(beat, 1, tone, String.Empty, true, notes[note].NoteType));
if (_Player[p].SingLine[line].NoteCount > 0)
{ Player[p].SingLine[line].LastNote.IsPerfect(notes[note]);
CNote nt = _Player[p].SingLine[line].LastNote; Player[p].SingLine[line].IsPerfect(lines[line]);
if (nt.Tone == tonePlayer && nt.EndBeat + 1 == beat && !nt.Hit)
_Player[p].SingLine[line].IncLastNoteLength();
else
_Player[p].SingLine[line].AddNote(new CNote(beat, 1, tonePlayer, String.Empty, false, ENoteType.Freestyle));
}
else
_Player[p].SingLine[line].AddNote(new CNote(beat, 1, tonePlayer, String.Empty, false, ENoteType.Freestyle));
}
} }
else
// Line Bonus
int numLinesWithPoints = song.Notes.GetNumLinesWithPoints(_Player[p].LineNr);
if (note == lines[line].NoteCount - 1 && numLinesWithPoints > 0)
{ {
if (notes[note].EndBeat == beat && lines[line].Points > 0f) if (Player[p].SingLine[line].NoteCount > 0)
{ {
double factor = _Player[p].SingLine[line].Points / (double)lines[line].Points; CNote nt = Player[p].SingLine[line].LastNote;
if (factor < 0.4) if (nt.Tone == tonePlayer && nt.EndBeat + 1 == beat && !nt.Hit)
factor = 0.0; Player[p].SingLine[line].IncLastNoteLength();
else if (factor > 0.9)
factor = 1.0;
else else
{ Player[p].SingLine[line].AddNote(new CNote(beat, 1, tonePlayer, String.Empty, false, ENoteType.Freestyle));
factor -= 0.4;
factor *= 2;
factor *= factor;
}
double points = CSettings.LinebonusScore * factor * 1f / numLinesWithPoints;
_Player[p].Points += points;
_Player[p].PointsLineBonus += points;
} }
else
Player[p].SingLine[line].AddNote(new CNote(beat, 1, tonePlayer, String.Empty, false, ENoteType.Freestyle));
}
}
// Line Bonus
int numLinesWithPoints = song.Notes.GetNumLinesWithPoints(Player[p].LineNr);
if (note == lines[line].NoteCount - 1 && numLinesWithPoints > 0)
{
if (notes[note].EndBeat == beat && lines[line].Points > 0f)
{
double factor = Player[p].SingLine[line].Points / (double)lines[line].Points;
if (factor < 0.4)
factor = 0.0;
else if (factor > 0.9)
factor = 1.0;
else
{
factor -= 0.4;
factor *= 2;
factor *= factor;
}
double points = CSettings.LinebonusScore * factor * 1f / numLinesWithPoints;
Player[p].Points += points;
Player[p].PointsLineBonus += points;
} }
} }
} }
} }
} }
_OldBeatD = _CurrentBeatD; _OldBeatD = ActBeatD;
} }
} }
} }
+38 -114
View File
@@ -518,7 +518,7 @@ namespace Vocaluxe.Base
bool resume = true; bool resume = true;
bool eventsAvailable = false; bool eventsAvailable;
bool inputEventsAvailable = CInput.PollKeyEvent(ref inputKeyEvent); bool inputEventsAvailable = CInput.PollKeyEvent(ref inputKeyEvent);
while ((eventsAvailable = keys.PollEvent(ref keyEvent)) || inputEventsAvailable) while ((eventsAvailable = keys.PollEvent(ref keyEvent)) || inputEventsAvailable)
@@ -746,125 +746,49 @@ namespace Vocaluxe.Base
private static void _DrawDebugInfos() private static void _DrawDebugInfos()
{ {
string txt = String.Empty; if (CConfig.DebugLevel == EDebugLevel.TR_CONFIG_OFF)
return;
List<String> debugOutput = new List<string>();
debugOutput.Add(CTime.GetFPS().ToString("FPS: 000"));
if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL1)
{
debugOutput.Add(CSound.GetStreamCount().ToString(CLanguage.Translate("TR_DEBUG_AUDIO_STREAMS") + ": 00"));
debugOutput.Add(CVideo.GetNumStreams().ToString(CLanguage.Translate("TR_DEBUG_VIDEO_STREAMS") + ": 00"));
debugOutput.Add(CDraw.TextureCount().ToString(CLanguage.Translate("TR_DEBUG_TEXTURES") + ": 00000"));
long memory = GC.GetTotalMemory(false);
debugOutput.Add((memory / 1000000L).ToString(CLanguage.Translate("TR_DEBUG_MEMORY") + ": 00000 MB"));
if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL2)
{
debugOutput.Add(CSound.RecordGetToneAbs(0).ToString(CLanguage.Translate("TR_DEBUG_TONE_ABS") + " P1: 00"));
debugOutput.Add(CSound.RecordGetMaxVolume(0).ToString(CLanguage.Translate("TR_DEBUG_MAX_VOLUME") + " P1: 0.000"));
debugOutput.Add(CSound.RecordGetToneAbs(1).ToString(CLanguage.Translate("TR_DEBUG_TONE_ABS") + " P2: 00"));
debugOutput.Add(CSound.RecordGetMaxVolume(1).ToString(CLanguage.Translate("TR_DEBUG_MAX_VOLUME") + " P2: 0.000"));
if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL3)
{
debugOutput.Add(CSongs.NumSongsWithCoverLoaded.ToString(CLanguage.Translate("TR_DEBUG_SONGS") + ": 00000"));
if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL_MAX)
{
debugOutput.Add(_Cursor.X.ToString(CLanguage.Translate("TR_DEBUG_MOUSE") + " : (0000/") + _Cursor.Y.ToString("0000)"));
}
}
}
}
CFonts.Style = EStyle.Normal; CFonts.Style = EStyle.Normal;
CFonts.SetFont("Normal"); CFonts.SetFont("Normal");
CFonts.Height = 30;
SColorF gray = new SColorF(1f, 1f, 1f, 0.5f); SColorF gray = new SColorF(1f, 1f, 1f, 0.5f);
float y = 0;
float dy = 0; foreach (var txt in debugOutput)
if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_ONLY_FPS)
{ {
txt = CTime.GetFPS().ToString("FPS: 000"); RectangleF rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), y, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt));
CFonts.Height = 30f;
RectangleF rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt));
CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear)); CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear));
CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear); CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear);
dy += rect.Height; y += rect.Height;
}
if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL1)
{
txt = CSound.GetStreamCount().ToString(CLanguage.Translate("TR_DEBUG_AUDIO_STREAMS") + ": 00");
RectangleF rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt));
CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear));
CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear);
dy += rect.Height;
}
if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL1)
{
txt = CVideo.GetNumStreams().ToString(CLanguage.Translate("TR_DEBUG_VIDEO_STREAMS") + ": 00");
RectangleF rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt));
CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear));
CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear);
dy += rect.Height;
}
if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL1)
{
txt = CDraw.TextureCount().ToString(CLanguage.Translate("TR_DEBUG_TEXTURES") + ": 00000");
RectangleF rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt));
CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear));
CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear);
dy += rect.Height;
}
if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL1)
{
long memory = GC.GetTotalMemory(false);
txt = (memory / 1000000L).ToString(CLanguage.Translate("TR_DEBUG_MEMORY") + ": 00000 MB");
RectangleF rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt));
CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear));
CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear);
dy += rect.Height;
}
if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL2)
{
txt = CSound.RecordGetToneAbs(0).ToString(CLanguage.Translate("TR_DEBUG_TONE_ABS") + " P1: 00");
RectangleF rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt));
CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear));
CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear);
dy += rect.Height;
txt = CSound.RecordGetMaxVolume(0).ToString(CLanguage.Translate("TR_DEBUG_MAX_VOLUME") + " P1: 0.000");
rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt));
CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear));
CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear);
dy += rect.Height;
txt = CSound.RecordGetToneAbs(1).ToString(CLanguage.Translate("TR_DEBUG_TONE_ABS") + " P2: 00");
rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt));
CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear));
CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear);
dy += rect.Height;
txt = CSound.RecordGetMaxVolume(1).ToString(CLanguage.Translate("TR_DEBUG_MAX_VOLUME") + " P2: 0.000");
rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt));
CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear));
CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear);
dy += rect.Height;
}
if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL3)
{
txt = CSongs.NumSongsWithCoverLoaded.ToString(CLanguage.Translate("TR_DEBUG_SONGS") + ": 00000");
RectangleF rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt));
CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear));
CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear);
dy += rect.Height;
}
if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL_MAX)
{
txt = _Cursor.X.ToString(CLanguage.Translate("TR_DEBUG_MOUSE") + " : (0000/") + _Cursor.Y.ToString("0000)");
RectangleF rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt));
CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear));
CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear);
dy += rect.Height;
} }
} }
+15 -16
View File
@@ -181,24 +181,23 @@ namespace Vocaluxe.Base
return true; return true;
} }
private static bool _LoadLanguageEntries(CXMLReader xmlReader, ref Dictionary<string, string> texts) private static bool _LoadLanguageEntries(CXMLReader xmlReader, out Dictionary<string, string> texts)
{ {
texts = new Dictionary<string, string>(); texts = new Dictionary<string, string>();
List<string> names = xmlReader.GetAttributes("resources", "name"); List<string> names = xmlReader.GetAttributes("resources", "name");
string value = string.Empty;
foreach (string name in names) foreach (string name in names)
{ {
if (xmlReader.GetValue("//resources/string[@name='" + name + "']", ref value, "")) string value;
if (!xmlReader.GetValue("//resources/string[@name='" + name + "']", out value, ""))
continue;
try
{ {
try texts.Add(name, value);
{ }
texts.Add(name, value); catch (Exception e)
} {
catch (Exception e) CLog.LogError("Error reading language file " + xmlReader.FileName + ": " + e.Message);
{ return false;
CLog.LogError("Error reading language file " + xmlReader.FileName + ": " + e.Message);
return false;
}
} }
} }
return true; return true;
@@ -211,7 +210,7 @@ namespace Vocaluxe.Base
return false; return false;
string value = string.Empty; string value = string.Empty;
if (xmlReader.GetValue("//resources/string[@name='language']", ref value, value)) if (xmlReader.GetValue("//resources/string[@name='language']", out value, value))
{ {
int nr = GetLanguageNr(value); int nr = GetLanguageNr(value);
@@ -220,7 +219,7 @@ namespace Vocaluxe.Base
SPartyLanguage lang = new SPartyLanguage(); SPartyLanguage lang = new SPartyLanguage();
lang.PartyModeID = partyModeID; lang.PartyModeID = partyModeID;
if (!_LoadLanguageEntries(xmlReader, ref lang.Texts)) if (!_LoadLanguageEntries(xmlReader, out lang.Texts))
return false; return false;
_Languages[nr].PartyModeTexts.Add(lang); _Languages[nr].PartyModeTexts.Add(lang);
@@ -243,7 +242,7 @@ namespace Vocaluxe.Base
return; return;
string value = string.Empty; string value = string.Empty;
if (xmlReader.GetValue("//resources/string[@name='language']", ref value, value)) if (xmlReader.GetValue("//resources/string[@name='language']", out value, value))
{ {
lang.Name = value; lang.Name = value;
@@ -252,7 +251,7 @@ namespace Vocaluxe.Base
lang.PartyModeTexts = new List<SPartyLanguage>(); lang.PartyModeTexts = new List<SPartyLanguage>();
_LoadLanguageEntries(xmlReader, ref lang.Texts); _LoadLanguageEntries(xmlReader, out lang.Texts);
_Languages.Add(lang); _Languages.Add(lang);
} }
+2 -2
View File
@@ -686,9 +686,9 @@ namespace Vocaluxe.Base
return CVideo.VdSkip(videoStream, startPosition, videoGap); return CVideo.VdSkip(videoStream, startPosition, videoGap);
} }
public bool GetFrame(int videoStream, ref STexture videoTexture, float time, ref float videoTime) public bool GetFrame(int videoStream, ref STexture videoTexture, float time, out float videoTime)
{ {
return CVideo.VdGetFrame(videoStream, ref videoTexture, time, ref videoTime); return CVideo.VdGetFrame(videoStream, ref videoTexture, time, out videoTime);
} }
public bool IsFinished(int videoStream) public bool IsFinished(int videoStream)
+10 -10
View File
@@ -107,7 +107,7 @@ namespace Vocaluxe.Base
{ {
if (usedKeys[i] != _NormalGameModeID) if (usedKeys[i] != _NormalGameModeID)
{ {
SPartyMode mode = new SPartyMode(); SPartyMode mode;
_PartyModes.TryGetValue(usedKeys[i], out mode); _PartyModes.TryGetValue(usedKeys[i], out mode);
if (mode.PartyMode != null) if (mode.PartyMode != null)
@@ -144,7 +144,7 @@ namespace Vocaluxe.Base
public static void SetPartyMode(int partyModeID) public static void SetPartyMode(int partyModeID)
{ {
if (!_PartyModes.TryGetValue(partyModeID, out _CurrentPartyMode)) if (!_PartyModes.TryGetValue(partyModeID, out _CurrentPartyMode))
CLog.LogError("CParty: Can't find party mode ID: " + partyModeID.ToString()); CLog.LogError("CParty: Can't find party mode ID: " + partyModeID);
_CurrentPartyMode.PartyMode.Init(); _CurrentPartyMode.PartyMode.Init();
} }
@@ -246,15 +246,15 @@ namespace Vocaluxe.Base
bool loaded = true; bool loaded = true;
loaded &= xmlReader.TryGetIntValue("//root/PartyModeSystemVersion", ref pm.PartyModeSystemVersion); loaded &= xmlReader.TryGetIntValue("//root/PartyModeSystemVersion", ref pm.PartyModeSystemVersion);
loaded &= xmlReader.GetValue("//root/Info/Name", ref pm.Name, "ERROR Name"); loaded &= xmlReader.GetValue("//root/Info/Name", out pm.Name, "ERROR Name");
loaded &= xmlReader.GetValue("//root/Info/Description", ref pm.Description, "ERROR Description"); loaded &= xmlReader.GetValue("//root/Info/Description", out pm.Description, "ERROR Description");
loaded &= xmlReader.GetValue("//root/Info/Author", ref pm.Author, "ERROR Author"); loaded &= xmlReader.GetValue("//root/Info/Author", out pm.Author, "ERROR Author");
loaded &= xmlReader.GetValue("//root/Info/Folder", ref pm.Folder, "ERROR Folder"); loaded &= xmlReader.GetValue("//root/Info/Folder", out pm.Folder, "ERROR Folder");
loaded &= xmlReader.GetValue("//root/Info/PartyModeFile", ref pm.PartyModeFile, "ERROR PartyModeFile"); loaded &= xmlReader.GetValue("//root/Info/PartyModeFile", out pm.PartyModeFile, "ERROR PartyModeFile");
loaded &= xmlReader.GetInnerValues("PartyScreens", ref pm.ScreenFiles); loaded &= xmlReader.GetInnerValues("PartyScreens", ref pm.ScreenFiles);
loaded &= xmlReader.TryGetIntValue("//root/Info/PartyModeVersionMajor", ref pm.PartyModeVersionMajor); loaded &= xmlReader.TryGetIntValue("//root/Info/PartyModeVersionMajor", ref pm.PartyModeVersionMajor);
loaded &= xmlReader.TryGetIntValue("//root/Info/PartyModeVersionMinor", ref pm.PartyModeVersionMinor); loaded &= xmlReader.TryGetIntValue("//root/Info/PartyModeVersionMinor", ref pm.PartyModeVersionMinor);
loaded &= xmlReader.GetValue("//root/Info/TargetAudience", ref pm.TargetAudience, "ERROR TargetAudience"); loaded &= xmlReader.GetValue("//root/Info/TargetAudience", out pm.TargetAudience, "ERROR TargetAudience");
if (!loaded) if (!loaded)
{ {
@@ -359,7 +359,7 @@ namespace Vocaluxe.Base
using (CodeDomProvider cdp = CodeDomProvider.CreateProvider("CSharp")) using (CodeDomProvider cdp = CodeDomProvider.CreateProvider("CSharp"))
{ {
CompilerResults compileResult = null; CompilerResults compileResult;
try try
{ {
@@ -393,7 +393,7 @@ namespace Vocaluxe.Base
return null; return null;
} }
CMenuParty screen = null; CMenuParty screen;
try try
{ {
screen = (CMenuParty)instance; screen = (CMenuParty)instance;
+23 -25
View File
@@ -243,39 +243,37 @@ namespace Vocaluxe.Base
{ {
using (sr = new StreamReader(file, Encoding.Default, true)) using (sr = new StreamReader(file, Encoding.Default, true))
{ {
int pos = -1;
string line; string line;
while ((line = sr.ReadLine()) != null) while ((line = sr.ReadLine()) != null)
{ {
pos = line.IndexOf(":"); int pos = line.IndexOf(":", StringComparison.Ordinal);
if (pos > 0) if (pos <= 0)
continue;
//Name or comment
if (line[0] == '#')
{ {
//Name or comment string identifier = line.Substring(1, pos - 1).Trim();
if (line[0] == '#') string value = line.Substring(pos + 1, line.Length - pos - 1).Trim();
if (identifier.ToUpper() == "NAME")
pl.PlaylistName = value;
}
//Song
else
{
string artist = line.Substring(0, pos - 1).Trim();
string title = line.Substring(pos + 1, line.Length - pos - 1).Trim();
bool found = false;
for (int s = 0; s < allSongs.Length; s++)
{ {
string identifier = line.Substring(1, pos - 1).Trim(); if (allSongs[s].Artist == artist && allSongs[s].Title == title)
string value = line.Substring(pos + 1, line.Length - pos - 1).Trim();
if (identifier.ToUpper() == "NAME")
pl.PlaylistName = value;
}
//Song
else
{
string artist = line.Substring(0, pos - 1).Trim();
string title = line.Substring(pos + 1, line.Length - pos - 1).Trim();
bool found = false;
for (int s = 0; s < allSongs.Length; s++)
{ {
if (allSongs[s].Artist == artist && allSongs[s].Title == title) pl.AddSong(allSongs[s].ID);
{ found = true;
pl.AddSong(allSongs[s].ID); break;
found = true;
break;
}
} }
if (!found)
CLog.LogError("Can't find song '" + title + "' from '" + artist + "' in playlist file: " + file);
} }
if (!found)
CLog.LogError("Can't find song '" + title + "' from '" + artist + "' in playlist file: " + file);
} }
} }
} }
+2 -3
View File
@@ -362,7 +362,6 @@ namespace Vocaluxe.Base
finally finally
{ {
writer.Close(); writer.Close();
writer = null;
} }
} }
@@ -376,7 +375,7 @@ namespace Vocaluxe.Base
return; return;
string value = String.Empty; string value = String.Empty;
if (xmlReader.GetValue("//root/Info/PlayerName", ref value, value)) if (xmlReader.GetValue("//root/Info/PlayerName", out value, value))
{ {
profile.PlayerName = value; profile.PlayerName = value;
@@ -384,7 +383,7 @@ namespace Vocaluxe.Base
xmlReader.TryGetEnumValue("//root/Info/Difficulty", ref profile.Difficulty); xmlReader.TryGetEnumValue("//root/Info/Difficulty", ref profile.Difficulty);
profile.Avatar = new SAvatar(-1); profile.Avatar = new SAvatar(-1);
if (xmlReader.GetValue("//root/Info/Avatar", ref value, value)) if (xmlReader.GetValue("//root/Info/Avatar", out value, value))
profile.Avatar = _GetAvatar(value); profile.Avatar = _GetAvatar(value);
profile.GuestProfile = EOffOn.TR_CONFIG_OFF; profile.GuestProfile = EOffOn.TR_CONFIG_OFF;
+11 -7
View File
@@ -64,7 +64,7 @@ namespace Vocaluxe.Base
public const int ZNear = -100; public const int ZNear = -100;
public const int ZFar = 100; public const int ZFar = 100;
public static bool IsFullScreen = false; public static bool IsFullScreen;
public static int VertexBufferElements = 10000; public static int VertexBufferElements = 10000;
public const string Icon = "Vocaluxe.ico"; public const string Icon = "Vocaluxe.ico";
@@ -142,12 +142,14 @@ namespace Vocaluxe.Base
public static string GetVersionText() public static string GetVersionText()
{ {
string version = "v" + VersionMajor.ToString() + "." + string version = "v" + VersionMajor + "." +
VersionMinor.ToString() + "." + VersionMinor + "." +
VersionSub.ToString() + " (" + Arch + ")"; VersionSub + " (" + Arch + ")";
// ReSharper disable ConditionIsAlwaysTrueOrFalse
if (VersionRevision != ERevision.Release) if (VersionRevision != ERevision.Release)
version += " " + GetVersionStatus() + String.Format(" ({0:0000)}", Build); // ReSharper restore ConditionIsAlwaysTrueOrFalse
version += " " + _GetVersionStatus() + String.Format(" ({0:0000)}", Build);
return version; return version;
} }
@@ -162,11 +164,13 @@ namespace Vocaluxe.Base
return version + " " + GetVersionText(); return version + " " + GetVersionText();
} }
public static string GetVersionStatus() private static string _GetVersionStatus()
{ {
string result = String.Empty; string result;
// ReSharper disable ConditionIsAlwaysTrueOrFalse
if (VersionRevision != ERevision.Release) if (VersionRevision != ERevision.Release)
// ReSharper restore ConditionIsAlwaysTrueOrFalse
result = Enum.GetName(typeof(ERevision), VersionRevision); result = Enum.GetName(typeof(ERevision), VersionRevision);
return result; return result;
+4 -6
View File
@@ -124,15 +124,13 @@ namespace Vocaluxe.Base
private List<SSongPointer> _CreateSortList(string fieldName) private List<SSongPointer> _CreateSortList(string fieldName)
{ {
FieldInfo field = null;
bool isString = false;
List<SSongPointer> sortList = new List<SSongPointer>(); List<SSongPointer> sortList = new List<SSongPointer>();
if (fieldName.Length == 0) if (fieldName.Length == 0)
CSongs.Filter.FilteredSongs.ForEach((song) => sortList.Add(new SSongPointer(song.ID, ""))); CSongs.Filter.FilteredSongs.ForEach(song => sortList.Add(new SSongPointer(song.ID, "")));
else else
{ {
field = typeof(CSong).GetField(fieldName, BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.Public); FieldInfo field = typeof(CSong).GetField(fieldName, BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.Public);
isString = field.FieldType == typeof(string); bool isString = field.FieldType == typeof(string);
if (!isString && field.FieldType != typeof(List<String>)) if (!isString && field.FieldType != typeof(List<String>))
throw new Exception("Unkown sort field type"); throw new Exception("Unkown sort field type");
foreach (CSong song in CSongs.Filter.FilteredSongs) foreach (CSong song in CSongs.Filter.FilteredSongs)
@@ -147,7 +145,7 @@ namespace Vocaluxe.Base
sortList.Add(new SSongPointer(song.ID, "")); sortList.Add(new SSongPointer(song.ID, ""));
else else
{ {
foreach (String sortString in (List<String>)value) foreach (String sortString in values)
sortList.Add(new SSongPointer(song.ID, sortString)); sortList.Add(new SSongPointer(song.ID, sortString));
} }
} }
+4 -8
View File
@@ -445,14 +445,10 @@ namespace Vocaluxe.Base
if (!SongsLoaded || CoverLoaded) if (!SongsLoaded || CoverLoaded)
return; return;
if (_CoverLoaderThread == null) if (_CoverLoaderThread != null)
{ return;
_CoverLoaderThread = new Thread(_LoadCover); _CoverLoaderThread = new Thread(_LoadCover) {Name = "CoverLoader", Priority = ThreadPriority.BelowNormal, IsBackground = true};
_CoverLoaderThread.Name = "CoverLoader"; _CoverLoaderThread.Start();
_CoverLoaderThread.Priority = ThreadPriority.BelowNormal;
_CoverLoaderThread.IsBackground = true;
_CoverLoaderThread.Start();
}
/* /*
if (_CoverLoadTimer.ElapsedMilliseconds >= WaitTime) if (_CoverLoadTimer.ElapsedMilliseconds >= WaitTime)
+21 -21
View File
@@ -134,7 +134,7 @@ namespace Vocaluxe.Base
} }
} }
public static SCursor Cursor = new SCursor(); public static SCursor Cursor;
#endregion Vars #endregion Vars
#region Theme and Skin loading and writing #region Theme and Skin loading and writing
@@ -166,7 +166,7 @@ namespace Vocaluxe.Base
if (xmlReader == null) if (xmlReader == null)
return false; return false;
string value = String.Empty; string value;
// load skins/textures // load skins/textures
@@ -176,7 +176,7 @@ namespace Vocaluxe.Base
{ {
try try
{ {
xmlReader.GetValue("//root/Skins/" + name, ref value, String.Empty); xmlReader.GetValue("//root/Skins/" + name, out value, String.Empty);
SSkinElement sk = _Skins[skinIndex].SkinList[name]; SSkinElement sk = _Skins[skinIndex].SkinList[name];
sk.Value = value; sk.Value = value;
sk.VideoIndex = -1; sk.VideoIndex = -1;
@@ -196,7 +196,7 @@ namespace Vocaluxe.Base
{ {
try try
{ {
xmlReader.GetValue("//root/Videos/" + _Skins[skinIndex].VideoList[i].Name, ref value, String.Empty); xmlReader.GetValue("//root/Videos/" + _Skins[skinIndex].VideoList[i].Name, out value, String.Empty);
SSkinElement sk = new SSkinElement(); SSkinElement sk = new SSkinElement();
sk.Name = _Skins[skinIndex].VideoList[i].Name; sk.Name = _Skins[skinIndex].VideoList[i].Name;
sk.Value = value; sk.Value = value;
@@ -267,7 +267,7 @@ namespace Vocaluxe.Base
{ {
if (themeIndex < 0 || themeIndex >= _Themes.Count) if (themeIndex < 0 || themeIndex >= _Themes.Count)
{ {
CLog.LogError("Can't find Theme Index " + themeIndex.ToString()); CLog.LogError("Can't find Theme Index " + themeIndex);
return false; return false;
} }
@@ -425,11 +425,11 @@ namespace Vocaluxe.Base
if (version == _ThemeSystemVersion) if (version == _ThemeSystemVersion)
{ {
xmlReader.GetValue("//root/Info/Name", ref theme.Name, String.Empty); xmlReader.GetValue("//root/Info/Name", out theme.Name, String.Empty);
if (theme.Name.Length > 0) if (theme.Name.Length > 0)
{ {
xmlReader.GetValue("//root/Info/Author", ref theme.Author, String.Empty); xmlReader.GetValue("//root/Info/Author", out theme.Author, String.Empty);
xmlReader.GetValue("//root/Info/SkinFolder", ref theme.SkinFolder, String.Empty); xmlReader.GetValue("//root/Info/SkinFolder", out theme.SkinFolder, String.Empty);
xmlReader.TryGetIntValue("//root/Info/ThemeVersionMajor", ref theme.ThemeVersionMajor); xmlReader.TryGetIntValue("//root/Info/ThemeVersionMajor", ref theme.ThemeVersionMajor);
xmlReader.TryGetIntValue("//root/Info/ThemeVersionMinor", ref theme.ThemeVersionMinor); xmlReader.TryGetIntValue("//root/Info/ThemeVersionMinor", ref theme.ThemeVersionMinor);
theme.Path = Path.GetDirectoryName(filePath); theme.Path = Path.GetDirectoryName(filePath);
@@ -447,7 +447,7 @@ namespace Vocaluxe.Base
else else
msg += "the file is for newer program versions! "; msg += "the file is for newer program versions! ";
msg += "Current ThemeSystemVersion is " + _ThemeSystemVersion.ToString() + " but found " + version; msg += "Current ThemeSystemVersion is " + _ThemeSystemVersion + " but found " + version;
CLog.LogError(msg); CLog.LogError(msg);
} }
return true; return true;
@@ -470,7 +470,7 @@ namespace Vocaluxe.Base
{ {
if (themeIndex < 0 || themeIndex >= _Themes.Count) if (themeIndex < 0 || themeIndex >= _Themes.Count)
{ {
CLog.LogError("Error List Skins. Can't find Theme index: " + themeIndex.ToString()); CLog.LogError("Error List Skins. Can't find Theme index: " + themeIndex);
return; return;
} }
@@ -492,10 +492,10 @@ namespace Vocaluxe.Base
if (version == _SkinSystemVersion) if (version == _SkinSystemVersion)
{ {
xmlReader.GetValue("//root/Info/Name", ref skin.Name, String.Empty); xmlReader.GetValue("//root/Info/Name", out skin.Name, String.Empty);
if (skin.Name.Length > 0) if (skin.Name.Length > 0)
{ {
xmlReader.GetValue("//root/Info/Author", ref skin.Author, String.Empty); xmlReader.GetValue("//root/Info/Author", out skin.Author, String.Empty);
xmlReader.TryGetIntValue("//root/Info/SkinVersionMajor", ref skin.SkinVersionMajor); xmlReader.TryGetIntValue("//root/Info/SkinVersionMajor", ref skin.SkinVersionMajor);
xmlReader.TryGetIntValue("//root/Info/SkinVersionMinor", ref skin.SkinVersionMinor); xmlReader.TryGetIntValue("//root/Info/SkinVersionMinor", ref skin.SkinVersionMinor);
@@ -534,7 +534,7 @@ namespace Vocaluxe.Base
else else
msg += "the file is for newer program versions! "; msg += "the file is for newer program versions! ";
msg += "Current SkinSystemVersion is " + _SkinSystemVersion.ToString(); msg += "Current SkinSystemVersion is " + _SkinSystemVersion;
CLog.LogError(msg); CLog.LogError(msg);
} }
} }
@@ -635,7 +635,7 @@ namespace Vocaluxe.Base
sk.VideoIndex = CVideo.VdLoad(GetVideoFilePath(sk.Name, partyModeID)); sk.VideoIndex = CVideo.VdLoad(GetVideoFilePath(sk.Name, partyModeID));
CVideo.VdSetLoop(sk.VideoIndex, true); CVideo.VdSetLoop(sk.VideoIndex, true);
} }
CVideo.VdGetFrame(sk.VideoIndex, ref sk.Texture, time, ref time); CVideo.VdGetFrame(sk.VideoIndex, ref sk.Texture, time, out time);
_Skins[skinIndex].VideoList[i] = sk; _Skins[skinIndex].VideoList[i] = sk;
return sk.Texture; return sk.Texture;
} }
@@ -729,14 +729,14 @@ namespace Vocaluxe.Base
float value = 0f; float value = 0f;
int i = 1; int i = 1;
while (xmlReader.TryGetFloatValue("//root/Colors/Player" + i.ToString() + "/R", ref value)) while (xmlReader.TryGetFloatValue("//root/Colors/Player" + i + "/R", ref value))
{ {
SColorF color = new SColorF(); SColorF color = new SColorF();
color.R = value; color.R = value;
xmlReader.TryGetFloatValue("//root/Colors/Player" + i.ToString() + "/G", ref color.G); xmlReader.TryGetFloatValue("//root/Colors/Player" + i + "/G", ref color.G);
xmlReader.TryGetFloatValue("//root/Colors/Player" + i.ToString() + "/B", ref color.B); xmlReader.TryGetFloatValue("//root/Colors/Player" + i + "/B", ref color.B);
xmlReader.TryGetFloatValue("//root/Colors/Player" + i.ToString() + "/A", ref color.A); xmlReader.TryGetFloatValue("//root/Colors/Player" + i + "/A", ref color.A);
playerColors.Add(color); playerColors.Add(color);
i++; i++;
@@ -766,12 +766,12 @@ namespace Vocaluxe.Base
private static void _LoadCursor(CXMLReader xmlReader, int skinIndex) private static void _LoadCursor(CXMLReader xmlReader, int skinIndex)
{ {
string value = String.Empty; string value = String.Empty;
xmlReader.GetValue("//root/Cursor/Skin", ref Cursor.SkinName, value); xmlReader.GetValue("//root/Cursor/Skin", out Cursor.SkinName, value);
xmlReader.TryGetFloatValue("//root/Cursor/W", ref Cursor.W); xmlReader.TryGetFloatValue("//root/Cursor/W", ref Cursor.W);
xmlReader.TryGetFloatValue("//root/Cursor/H", ref Cursor.H); xmlReader.TryGetFloatValue("//root/Cursor/H", ref Cursor.H);
if (xmlReader.GetValue("//root/Cursor/Color", ref value, value)) if (xmlReader.GetValue("//root/Cursor/Color", out value, value))
{ {
SColorF color = GetColor(value, _Skins[skinIndex].PartyModeID); SColorF color = GetColor(value, _Skins[skinIndex].PartyModeID);
Cursor.R = color.R; Cursor.R = color.R;
@@ -799,7 +799,7 @@ namespace Vocaluxe.Base
writer.WriteStartElement("Colors"); writer.WriteStartElement("Colors");
for (int i = 0; i < _Skins[skinIndex].ThemeColors.Player.Length; i++) for (int i = 0; i < _Skins[skinIndex].ThemeColors.Player.Length; i++)
{ {
writer.WriteStartElement("Player" + (i + 1).ToString()); writer.WriteStartElement("Player" + (i + 1));
writer.WriteElementString("R", _Skins[skinIndex].ThemeColors.Player[i].R.ToString("#0.000")); writer.WriteElementString("R", _Skins[skinIndex].ThemeColors.Player[i].R.ToString("#0.000"));
writer.WriteElementString("G", _Skins[skinIndex].ThemeColors.Player[i].G.ToString("#0.000")); writer.WriteElementString("G", _Skins[skinIndex].ThemeColors.Player[i].G.ToString("#0.000"));
+6 -26
View File
@@ -155,9 +155,7 @@ namespace Vocaluxe.Base
{ {
_CheckModifiers(); _CheckModifiers();
bool repeat = false; bool repeat = _Keys == e.KeyCode;
if (_Keys == e.KeyCode)
repeat = true;
if (!_Timer.IsRunning || (_Timer.ElapsedMilliseconds > 75) || !repeat) if (!_Timer.IsRunning || (_Timer.ElapsedMilliseconds > 75) || !repeat)
{ {
@@ -212,9 +210,6 @@ namespace Vocaluxe.Base
private readonly List<SMouseEvent> _EventsPool; private readonly List<SMouseEvent> _EventsPool;
private readonly List<SMouseEvent> _CurrentPool; private readonly List<SMouseEvent> _CurrentPool;
private int _X;
private int _Y;
private readonly Object _CopyLock = new Object(); private readonly Object _CopyLock = new Object();
private bool _ModAlt; private bool _ModAlt;
@@ -223,17 +218,7 @@ namespace Vocaluxe.Base
private readonly Stopwatch _Timer; private readonly Stopwatch _Timer;
public int X public bool Visible;
{
get { return _X; }
}
public int Y
{
get { return _Y; }
}
public bool Visible = false;
public CMouse() public CMouse()
{ {
@@ -258,8 +243,6 @@ namespace Vocaluxe.Base
{ {
_EventsPool.Add(pool); _EventsPool.Add(pool);
} }
_X = x;
_Y = y;
} }
private void _Del(int index) private void _Del(int index)
@@ -324,14 +307,11 @@ namespace Vocaluxe.Base
public bool PollEvent(ref SMouseEvent mouseEvent) public bool PollEvent(ref SMouseEvent mouseEvent)
{ {
if (_CurrentPool.Count > 0) if (_CurrentPool.Count <= 0)
{
mouseEvent = _CurrentPool[0];
_Del(0);
return true;
}
else
return false; return false;
mouseEvent = _CurrentPool[0];
_Del(0);
return true;
} }
public void CopyEvents() public void CopyEvents()
+6 -6
View File
@@ -80,9 +80,9 @@ namespace Vocaluxe.Base
return _VideoDecoder.GetLength(streamID); return _VideoDecoder.GetLength(streamID);
} }
public static bool VdGetFrame(int streamID, ref STexture frame, float time, ref float videoTime) public static bool VdGetFrame(int streamID, ref STexture frame, float time, out float videoTime)
{ {
return _VideoDecoder.GetFrame(streamID, ref frame, time, ref videoTime); return _VideoDecoder.GetFrame(streamID, ref frame, time, out videoTime);
} }
public static bool VdSkip(int streamID, float start, float gap) public static bool VdSkip(int streamID, float start, float gap)
@@ -178,7 +178,7 @@ namespace Vocaluxe.Base
STexture tex = new STexture(-1); STexture tex = new STexture(-1);
tex.Height = 0f; tex.Height = 0f;
CVideo.VdGetFrame(_VideoStream, ref tex, videoTime, ref videoTime); CVideo.VdGetFrame(_VideoStream, ref tex, videoTime, out videoTime);
if (tex.Height > 0) if (tex.Height > 0)
{ {
@@ -188,7 +188,7 @@ namespace Vocaluxe.Base
} }
RectangleF bounds = new RectangleF(0f, 0f, CSettings.RenderW, CSettings.RenderH); RectangleF bounds = new RectangleF(0f, 0f, CSettings.RenderW, CSettings.RenderH);
RectangleF rect = new RectangleF(0f, 0f, _VideoTexture.Width, _VideoTexture.Height); RectangleF rect = new RectangleF(0f, 0f, _VideoTexture.Width, _VideoTexture.Height);
CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, EAspect.Crop); CHelper.SetRect(bounds, out rect, rect.Width / rect.Height, EAspect.Crop);
CDraw.DrawTexture(_VideoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CSettings.ZFar / 4)); CDraw.DrawTexture(_VideoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CSettings.ZFar / 4));
} }
@@ -198,8 +198,8 @@ namespace Vocaluxe.Base
float videoTime = 0f; float videoTime = 0f;
while (_VideoTexture.Index == -1 && videoTime < 1f) while (_VideoTexture.Index == -1 && videoTime < 1f)
{ {
float dummy = 0f; float dummy;
CVideo.VdGetFrame(_VideoStream, ref _VideoTexture, 0, ref dummy); CVideo.VdGetFrame(_VideoStream, ref _VideoTexture, 0, out dummy);
videoTime += 0.05f; videoTime += 0.05f;
} }
} }
+5 -8
View File
@@ -26,8 +26,8 @@ namespace Vocaluxe.GameModes
{ {
struct SSongQueque struct SSongQueque
{ {
public int SongID; public readonly int SongID;
public EGameMode GameMode; public readonly EGameMode GameMode;
public SSongQueque(int songID, EGameMode gameMode) public SSongQueque(int songID, EGameMode gameMode)
{ {
@@ -38,10 +38,9 @@ namespace Vocaluxe.GameModes
abstract class CGameMode : IGameMode abstract class CGameMode : IGameMode
{ {
protected bool _Initialized = false; private List<SSongQueque> _SongQueque;
protected List<SSongQueque> _SongQueque; private int _CurrentSong;
protected int _CurrentSong; private CPoints _Points;
protected CPoints _Points;
#region Implementation #region Implementation
public virtual void Init() public virtual void Init()
@@ -235,7 +234,5 @@ namespace Vocaluxe.GameModes
return _Points; return _Points;
} }
#endregion Implementation #endregion Implementation
protected virtual void _SongManipulation(int songIndex) {}
} }
} }
+1 -8
View File
@@ -21,12 +21,5 @@ namespace Vocaluxe.GameModes
{ {
// Nomal singing // Nomal singing
class CGameModeNormal : CGameMode class CGameModeNormal : CGameMode
{ {}
public override void Init()
{
base.Init();
_Initialized = true;
}
}
} }
+49 -135
View File
@@ -21,7 +21,6 @@ using System.Drawing.Drawing2D;
using System.Threading; using System.Threading;
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
using OpenTK.Graphics.OpenGL;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
@@ -89,14 +88,12 @@ namespace Vocaluxe.Lib.Draw
//Check AA Mode //Check AA Mode
CConfig.AAMode = (EAntiAliasingModes)_CheckAntiAliasingMode((int)CConfig.AAMode); CConfig.AAMode = (EAntiAliasingModes)_CheckAntiAliasingMode((int)CConfig.AAMode);
CConfig.ColorDepth = (EColorDepth)_CheckColorDepth((int)CConfig.ColorDepth);
ColorFormat cf = new ColorFormat(32);
GraphicsMode gm;
bool ok = false; bool ok = false;
try try
{ {
gm = new GraphicsMode(cf, 24, 0, (int)CConfig.AAMode); GraphicsMode gm = new GraphicsMode((int)CConfig.ColorDepth, 24, 0, (int)CConfig.AAMode);
_Control = new GLControl(gm, 2, 1, GraphicsContextFlags.Default); _Control = new GLControl(gm, 2, 1, GraphicsContextFlags.Default);
if (_Control.GraphicsMode != null) if (_Control.GraphicsMode != null)
ok = true; ok = true;
@@ -140,127 +137,60 @@ namespace Vocaluxe.Lib.Draw
#region Helpers #region Helpers
private int _CheckAntiAliasingMode(int setValue) private int _CheckAntiAliasingMode(int setValue)
{ {
int result = 0; int samples = 0;
GraphicsMode mode = null;
bool done = false;
while (!done && (result <= 32)) if (setValue > 32)
setValue = 32;
while (samples<=setValue)
{ {
GraphicsMode mode;
try try
{ {
mode = new GraphicsMode(16, 0, 0, result); mode = new GraphicsMode(16, 0, 0, samples);
} }
catch (Exception) catch (Exception)
{ {
done = true; break;
result /= 2;
if (result == 1)
result = 0;
} }
if (mode != null) if (mode.Samples != samples)
{ break;
try if (samples == 0)
{ samples = 2;
if (mode.Samples == result)
{
if (result == 0)
result = 2;
else
result *= 2;
}
else
{
done = true;
result /= 2;
if (result == 1)
result = 0;
}
}
catch (Exception)
{
done = true;
result /= 2;
if (result == 1)
result = 0;
}
}
else else
{ samples *= 2;
done = true;
result /= 2;
if (result == 1)
result = 0;
}
} }
if (result > 64) if (samples == 2)
result = 32; return 0;
return samples / 2;
if (setValue < result)
return setValue;
else
return result;
} }
private int _CheckColorDeep(int setValue) private int _CheckColorDepth(int setValue)
{ {
int result = 8; int result = 16;
GraphicsMode mode = null;
bool done = false;
while (!done && (result <= 32)) if (setValue > 32)
setValue = 32;
while (result <= setValue)
{ {
GraphicsMode mode;
try try
{ {
mode = new GraphicsMode(result, 0, 0, 0); mode = new GraphicsMode(result, 0, 0, 0);
} }
catch (Exception) catch (Exception)
{ {
done = true; break;
result -= 8;
if (result == 0)
result = 8;
}
if (mode != null)
{
try
{
if (mode.ColorFormat == result)
result += 8;
else
{
done = true;
result -= 8;
if (result == 0)
result = 8;
}
}
catch (Exception)
{
done = true;
result -= 8;
if (result == 0)
result = 8;
}
}
else
{
done = true;
result -= 8;
if (result == 0)
result = 8;
} }
if (mode.ColorFormat != result)
break;
result += 8;
} }
if (result > 32) return result - 8;
result = 32;
if (setValue < result)
return setValue;
else
return result;
} }
private void _ToggleFullScreen() private void _ToggleFullScreen()
@@ -590,7 +520,7 @@ namespace Vocaluxe.Lib.Draw
public void CopyScreen(ref STexture texture) public void CopyScreen(ref STexture texture)
{ {
if (!_TextureExists(ref texture) || (texture.Width != GetScreenWidth()) || (texture.Height != GetScreenHeight())) if (!_TextureExists(ref texture) || Math.Abs(texture.Width - GetScreenWidth()) > 1 || Math.Abs(texture.Height - GetScreenHeight()) > 1)
{ {
RemoveTexture(ref texture); RemoveTexture(ref texture);
texture = CopyScreen(); texture = CopyScreen();
@@ -608,7 +538,7 @@ namespace Vocaluxe.Lib.Draw
public void MakeScreenShot() public void MakeScreenShot()
{ {
string file = "Screenshot_"; const string file = "Screenshot_";
string path = Path.Combine(Environment.CurrentDirectory, CSettings.FolderScreenshots); string path = Path.Combine(Environment.CurrentDirectory, CSettings.FolderScreenshots);
int i = 0; int i = 0;
@@ -678,7 +608,7 @@ namespace Vocaluxe.Lib.Draw
OpenTK.Graphics.OpenGL.GL.Enable(OpenTK.Graphics.OpenGL.EnableCap.Blend); OpenTK.Graphics.OpenGL.GL.Enable(OpenTK.Graphics.OpenGL.EnableCap.Blend);
if (rect.Rotation != 0f) if (Math.Abs(rect.Rotation) > 0.001)
{ {
OpenTK.Graphics.OpenGL.GL.Translate(0.5f, 0.5f, 0); OpenTK.Graphics.OpenGL.GL.Translate(0.5f, 0.5f, 0);
OpenTK.Graphics.OpenGL.GL.Rotate(-rect.Rotation, 0f, 0f, 1f); OpenTK.Graphics.OpenGL.GL.Rotate(-rect.Rotation, 0f, 0f, 1f);
@@ -724,7 +654,7 @@ namespace Vocaluxe.Lib.Draw
} }
try try
{ {
return AddTexture(bmp, texturePath); return AddTexture(bmp);
} }
finally finally
{ {
@@ -736,11 +666,6 @@ namespace Vocaluxe.Lib.Draw
} }
public STexture AddTexture(Bitmap bmp) public STexture AddTexture(Bitmap bmp)
{
return AddTexture(bmp, String.Empty);
}
public STexture AddTexture(Bitmap bmp, string texturePath)
{ {
STexture texture = new STexture(-1); STexture texture = new STexture(-1);
@@ -985,11 +910,8 @@ namespace Vocaluxe.Lib.Draw
public STexture QuequeTexture(int w, int h, ref byte[] data) public STexture QuequeTexture(int w, int h, ref byte[] data)
{ {
STexture texture = new STexture(-1); STexture texture = new STexture(-1);
STextureQueque queque = new STextureQueque(); STextureQueque queque = new STextureQueque {Data = data, Height = h, Width = w};
queque.Data = data;
queque.Height = h;
queque.Width = w;
texture.Height = h; texture.Height = h;
texture.Width = w; texture.Width = w;
@@ -1071,29 +993,21 @@ namespace Vocaluxe.Lib.Draw
{ {
if (_UsePBO) if (_UsePBO)
{ {
try OpenTK.Graphics.OpenGL.GL.BindBuffer(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer, texture.PBO);
{
OpenTK.Graphics.OpenGL.GL.BindBuffer(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer, texture.PBO);
IntPtr buffer = OpenTK.Graphics.OpenGL.GL.MapBuffer(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer, OpenTK.Graphics.OpenGL.BufferAccess.WriteOnly); IntPtr buffer = OpenTK.Graphics.OpenGL.GL.MapBuffer(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer, OpenTK.Graphics.OpenGL.BufferAccess.WriteOnly);
Marshal.Copy(data, 0, buffer, data.Length); Marshal.Copy(data, 0, buffer, data.Length);
OpenTK.Graphics.OpenGL.GL.UnmapBuffer(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer); OpenTK.Graphics.OpenGL.GL.UnmapBuffer(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer);
OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, texture.ID); OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, texture.ID);
OpenTK.Graphics.OpenGL.GL.TexSubImage2D(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0, 0, 0, (int)texture.Width, (int)texture.Height, OpenTK.Graphics.OpenGL.GL.TexSubImage2D(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0, 0, 0, (int)texture.Width, (int)texture.Height,
OpenTK.Graphics.OpenGL.PixelFormat.Bgra, OpenTK.Graphics.OpenGL.PixelType.UnsignedByte, IntPtr.Zero); OpenTK.Graphics.OpenGL.PixelFormat.Bgra, OpenTK.Graphics.OpenGL.PixelType.UnsignedByte, IntPtr.Zero);
OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0); OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0);
OpenTK.Graphics.OpenGL.GL.BindBuffer(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer, 0); OpenTK.Graphics.OpenGL.GL.BindBuffer(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer, 0);
return true; return true;
}
catch (Exception)
{
throw;
//_UsePBO = false;
}
} }
OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, texture.ID); OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, texture.ID);
@@ -1180,7 +1094,7 @@ namespace Vocaluxe.Lib.Draw
public void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored) public void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored)
{ {
if (rect.W == 0f || rect.H == 0f || bounds.H == 0f || bounds.W == 0f || color.A == 0f) if (Math.Abs(rect.W) < float.Epsilon || Math.Abs(rect.H) < float.Epsilon || Math.Abs(bounds.H) < float.Epsilon || Math.Abs(bounds.W) < float.Epsilon || Math.Abs(color.A) < float.Epsilon)
return; return;
if (bounds.X > rect.X + rect.W || bounds.X + bounds.W < rect.X) if (bounds.X > rect.X + rect.W || bounds.X + bounds.W < rect.X)
@@ -1234,7 +1148,7 @@ namespace Vocaluxe.Lib.Draw
OpenTK.Graphics.OpenGL.GL.MatrixMode(OpenTK.Graphics.OpenGL.MatrixMode.Texture); OpenTK.Graphics.OpenGL.GL.MatrixMode(OpenTK.Graphics.OpenGL.MatrixMode.Texture);
OpenTK.Graphics.OpenGL.GL.PushMatrix(); OpenTK.Graphics.OpenGL.GL.PushMatrix();
if (rect.Rotation != 0f) if (Math.Abs(rect.Rotation) > float.Epsilon)
{ {
OpenTK.Graphics.OpenGL.GL.Translate(0.5f, 0.5f, 0); OpenTK.Graphics.OpenGL.GL.Translate(0.5f, 0.5f, 0);
OpenTK.Graphics.OpenGL.GL.Rotate(-rect.Rotation, 0f, 0f, 1f); OpenTK.Graphics.OpenGL.GL.Rotate(-rect.Rotation, 0f, 0f, 1f);
@@ -1319,7 +1233,7 @@ namespace Vocaluxe.Lib.Draw
public void DrawTextureReflection(STexture texture, SRectF rect, SColorF color, SRectF bounds, float space, float height) public void DrawTextureReflection(STexture texture, SRectF rect, SColorF color, SRectF bounds, float space, float height)
{ {
if (rect.W == 0f || rect.H == 0f || bounds.H == 0f || bounds.W == 0f || color.A == 0f || height <= 0f) if (Math.Abs(rect.W) < float.Epsilon || Math.Abs(rect.H) < float.Epsilon || Math.Abs(bounds.H) < float.Epsilon || Math.Abs(bounds.W) < float.Epsilon || Math.Abs(color.A) < float.Epsilon || height <= float.Epsilon)
return; return;
if (bounds.X > rect.X + rect.W || bounds.X + bounds.W < rect.X) if (bounds.X > rect.X + rect.W || bounds.X + bounds.W < rect.X)
@@ -1375,7 +1289,7 @@ namespace Vocaluxe.Lib.Draw
OpenTK.Graphics.OpenGL.GL.MatrixMode(OpenTK.Graphics.OpenGL.MatrixMode.Texture); OpenTK.Graphics.OpenGL.GL.MatrixMode(OpenTK.Graphics.OpenGL.MatrixMode.Texture);
OpenTK.Graphics.OpenGL.GL.PushMatrix(); OpenTK.Graphics.OpenGL.GL.PushMatrix();
if (rect.Rotation != 0f) if (Math.Abs(rect.Rotation) > float.Epsilon)
{ {
OpenTK.Graphics.OpenGL.GL.Translate(0.5f, 0.5f, 0); OpenTK.Graphics.OpenGL.GL.Translate(0.5f, 0.5f, 0);
OpenTK.Graphics.OpenGL.GL.Rotate(-rect.Rotation, 0f, 0f, 1f); OpenTK.Graphics.OpenGL.GL.Rotate(-rect.Rotation, 0f, 0f, 1f);
+6 -12
View File
@@ -66,7 +66,7 @@ namespace Vocaluxe.Lib.Input
public static bool Init() public static bool Init()
{ {
int result = -1; int result;
try try
{ {
result = hid_init(); result = hid_init();
@@ -77,10 +77,7 @@ namespace Vocaluxe.Lib.Input
return false; return false;
} }
if (result == 0) return result == 0;
return true;
return false;
} }
[DllImport(_HIDApiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_exit", CharSet = CharSet.Unicode)] [DllImport(_HIDApiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_exit", CharSet = CharSet.Unicode)]
@@ -88,7 +85,7 @@ namespace Vocaluxe.Lib.Input
public static bool Exit() public static bool Exit()
{ {
int result = -1; int result;
try try
{ {
result = hid_exit(); result = hid_exit();
@@ -99,10 +96,7 @@ namespace Vocaluxe.Lib.Input
return false; return false;
} }
if (result == 0) return result == 0;
return true;
return false;
} }
[DllImport(_HIDApiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_enumerate", CharSet = CharSet.Ansi)] [DllImport(_HIDApiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_enumerate", CharSet = CharSet.Ansi)]
@@ -169,7 +163,7 @@ namespace Vocaluxe.Lib.Input
data = new byte[length]; data = new byte[length];
IntPtr dataPtr = Marshal.AllocHGlobal(length); IntPtr dataPtr = Marshal.AllocHGlobal(length);
int result = -1; int result;
try try
{ {
result = hid_read_timeout(device, dataPtr, length, milliseconds); result = hid_read_timeout(device, dataPtr, length, milliseconds);
@@ -197,7 +191,7 @@ namespace Vocaluxe.Lib.Input
data = new byte[length]; data = new byte[length];
IntPtr dataPtr = Marshal.AllocHGlobal(length); IntPtr dataPtr = Marshal.AllocHGlobal(length);
int result = -1; int result;
try try
{ {
result = hid_read(device, dataPtr, length); result = hid_read(device, dataPtr, length);
+8 -19
View File
@@ -153,8 +153,8 @@ namespace Vocaluxe.Lib.Input.WiiMote
} }
else else
{ {
bool startRumble = false; bool startRumble;
bool stopRumble = false; bool stopRumble;
lock (_Sync) lock (_Sync)
{ {
startRumble = _RumbleTimer.ShouldStart; startRumble = _RumbleTimer.ShouldStart;
@@ -211,13 +211,6 @@ namespace Vocaluxe.Lib.Input.WiiMote
Point p = ws.IRState.Position; Point p = ws.IRState.Position;
p.X = 1023 - p.X; p.X = 1023 - p.X;
//key events
bool alt = false;
bool shift = false;
bool ctrl = false;
bool pressed = false;
char unicode = char.MinValue;
EGesture gesture = _Gesture.GetGesture(p); EGesture gesture = _Gesture.GetGesture(p);
bool lb = false; bool lb = false;
bool rb = gesture == EGesture.Back; bool rb = gesture == EGesture.Back;
@@ -262,9 +255,9 @@ namespace Vocaluxe.Lib.Input.WiiMote
_ButtonStates[10] = ws.ButtonState.Two; _ButtonStates[10] = ws.ButtonState.Two;
if (alt || shift || ctrl || pressed || unicode != char.MinValue || key != Keys.None) if (key != Keys.None)
{ {
SKeyEvent pool = new SKeyEvent(ESender.WiiMote, alt, shift, ctrl, pressed, unicode, key); SKeyEvent pool = new SKeyEvent(ESender.WiiMote, false, false, false, false, char.MinValue, key);
lock (_KeyCopyLock) lock (_KeyCopyLock)
{ {
@@ -273,8 +266,8 @@ namespace Vocaluxe.Lib.Input.WiiMote
} }
//mouse events //mouse events
float reducing = 0.15f; const float reducing = 0.15f;
float factor = 1f / (1f - reducing * 2f); const float factor = 1f / (1f - reducing * 2f);
float rx = ((p.X / 1024f) - reducing) * factor; float rx = ((p.X / 1024f) - reducing) * factor;
float ry = ((p.Y / 768f) - reducing) * factor; float ry = ((p.Y / 768f) - reducing) * factor;
@@ -282,11 +275,7 @@ namespace Vocaluxe.Lib.Input.WiiMote
int y = (int)(ry * CSettings.RenderH); int y = (int)(ry * CSettings.RenderH);
bool ld = false;
bool lbh = !lb && ws.ButtonState.A; bool lbh = !lb && ws.ButtonState.A;
bool rbh = false;
bool mb = false;
bool mbh = false;
int wheel = 0; int wheel = 0;
if (gesture == EGesture.ScrollUp) if (gesture == EGesture.ScrollUp)
@@ -299,12 +288,12 @@ namespace Vocaluxe.Lib.Input.WiiMote
if (!lb && !rb && (p.X != _OldPosition.X || p.Y != _OldPosition.Y)) if (!lb && !rb && (p.X != _OldPosition.X || p.Y != _OldPosition.Y))
{ {
mpool = new SMouseEvent(ESender.WiiMote, alt, shift, ctrl, x, y, false, false, false, wheel, lbh, rbh, false, mbh); mpool = new SMouseEvent(ESender.WiiMote, false, false, false, x, y, false, false, false, wheel, lbh, false, false, false);
trigger = true; trigger = true;
} }
else if (lb || rb) else if (lb || rb)
{ {
mpool = new SMouseEvent(ESender.WiiMote, alt, shift, ctrl, x, y, lb, ld, rb, wheel, false, false, mb, false); mpool = new SMouseEvent(ESender.WiiMote, false, false, false, x, y, lb, false, rb, wheel, false, false, false, false);
trigger = true; trigger = true;
} }
+54 -53
View File
@@ -29,15 +29,17 @@ namespace Vocaluxe.Lib.Input.WiiMote
#region DataTypes #region DataTypes
public class CWiiMoteStatus public class CWiiMoteStatus
{ {
public SAccelCalibrationInfo AccelCalibrationInfo = new SAccelCalibrationInfo(); public SAccelCalibrationInfo AccelCalibrationInfo;
public SAccelStatus AccelState = new SAccelStatus(); public SAccelStatus AccelState;
public SButtons ButtonState = new SButtons(); public SButtons ButtonState;
public SIRState IRState = new SIRState(); public SIRState IRState;
// ReSharper disable NotAccessedField.Global
public byte Battery; public byte Battery;
// ReSharper restore NotAccessedField.Global
public bool Rumble; public bool Rumble;
@@ -68,7 +70,9 @@ namespace Vocaluxe.Lib.Input.WiiMote
{ {
public bool Active; public bool Active;
public Point Position; // X: 0-1023; Y: 0-767 public Point Position; // X: 0-1023; Y: 0-767
// ReSharper disable NotAccessedField.Global
public int Width; // 0-15 public int Width; // 0-15
// ReSharper restore NotAccessedField.Global
} }
public struct SIRState public struct SIRState
@@ -82,7 +86,9 @@ namespace Vocaluxe.Lib.Input.WiiMote
public struct SAccelStatus public struct SAccelStatus
{ {
public SPoint3 RawValues; //0-255 public SPoint3 RawValues; //0-255
// ReSharper disable NotAccessedField.Global
public SPoint3F Values; //0-3 public SPoint3F Values; //0-3
// ReSharper restore NotAccessedField.Global
} }
public struct SAccelCalibrationInfo public struct SAccelCalibrationInfo
@@ -124,7 +130,7 @@ namespace Vocaluxe.Lib.Input.WiiMote
#region Events #region Events
public class CWiiMoteChangedEventArgs : EventArgs public class CWiiMoteChangedEventArgs : EventArgs
{ {
public CWiiMoteStatus WiiMoteState; public readonly CWiiMoteStatus WiiMoteState;
public CWiiMoteChangedEventArgs(CWiiMoteStatus ws) public CWiiMoteChangedEventArgs(CWiiMoteStatus ws)
{ {
@@ -133,7 +139,7 @@ namespace Vocaluxe.Lib.Input.WiiMote
} }
#endregion Events #endregion Events
public class CWiiMoteLib : IDisposable public sealed class CWiiMoteLib : IDisposable
{ {
// ReSharper disable InconsistentNaming // ReSharper disable InconsistentNaming
private const ushort _VID = 0x057e; private const ushort _VID = 0x057e;
@@ -152,6 +158,7 @@ namespace Vocaluxe.Lib.Input.WiiMote
// output commands // output commands
private enum EOutputReport : byte private enum EOutputReport : byte
{ {
// ReSharper disable UnusedMember.Local
// ReSharper disable InconsistentNaming // ReSharper disable InconsistentNaming
LEDs = 0x11, LEDs = 0x11,
// ReSharper restore InconsistentNaming // ReSharper restore InconsistentNaming
@@ -163,6 +170,7 @@ namespace Vocaluxe.Lib.Input.WiiMote
SpeakerData = 0x18, SpeakerData = 0x18,
SpeakerMute = 0x19, SpeakerMute = 0x19,
IR2 = 0x1a, IR2 = 0x1a,
// ReSharper restore UnusedMember.Local
}; };
// data handling // data handling
@@ -176,11 +184,7 @@ namespace Vocaluxe.Lib.Input.WiiMote
private bool _Active; private bool _Active;
private bool _Error; private bool _Error;
private bool _Connected; public bool Connected { get; private set; }
public bool Connected
{
get { return _Connected; }
}
private readonly CWiiMoteStatus _WiiMoteState = new CWiiMoteStatus(); private readonly CWiiMoteStatus _WiiMoteState = new CWiiMoteStatus();
private readonly AutoResetEvent _ReadDone = new AutoResetEvent(false); private readonly AutoResetEvent _ReadDone = new AutoResetEvent(false);
@@ -189,13 +193,18 @@ namespace Vocaluxe.Lib.Input.WiiMote
#region Interface #region Interface
public CWiiMoteLib() public CWiiMoteLib()
{ {
_Connected = false; Connected = false;
_Active = true; _Active = true;
_Error = false; _Error = false;
_Reader = new Thread(_ReaderLoop); _Reader = new Thread(_ReaderLoop);
_Reader.Start(); _Reader.Start();
} }
~CWiiMoteLib()
{
Dispose(false);
}
private bool _TryConnect(ushort pid) private bool _TryConnect(ushort pid)
{ {
bool connected = CHIDApi.Open(_VID, pid, out _Handle); bool connected = CHIDApi.Open(_VID, pid, out _Handle);
@@ -210,7 +219,7 @@ namespace Vocaluxe.Lib.Input.WiiMote
public bool Connect() public bool Connect()
{ {
_Connected = false; Connected = false;
if (_Error) if (_Error)
return false; return false;
@@ -220,7 +229,7 @@ namespace Vocaluxe.Lib.Input.WiiMote
if (!CHIDApi.Init()) if (!CHIDApi.Init())
{ {
CLog.LogError("WiiMoteLib: Can't initialize HID API"); CLog.LogError("WiiMoteLib: Can't initialize HID API");
string msg = "Please install the Visual C++ Redistributable Packages 2008!"; const string msg = "Please install the Visual C++ Redistributable Packages 2008!";
CLog.LogError(msg); CLog.LogError(msg);
_Active = false; _Active = false;
@@ -229,25 +238,25 @@ namespace Vocaluxe.Lib.Input.WiiMote
} }
//Try WiiMotion //Try WiiMotion
_Connected = _TryConnect(_PID); Connected = _TryConnect(_PID);
//Try WiiMotion Plus //Try WiiMotion Plus
if (!_Connected) if (!Connected)
_Connected = _TryConnect(_PIDPlus); Connected = _TryConnect(_PIDPlus);
return _Connected; return Connected;
} }
public void Disconnect() public void Disconnect()
{ {
_Connected = false; Connected = false;
_Active = false; _Active = false;
CHIDApi.Exit(); CHIDApi.Exit();
} }
public void SetReportType(EInputReport type, EIRSensitivity irSensitivity, bool continuous) public void SetReportType(EInputReport type, EIRSensitivity irSensitivity, bool continuous)
{ {
if (!_Connected) if (!Connected)
return; return;
switch (type) switch (type)
@@ -275,18 +284,17 @@ namespace Vocaluxe.Lib.Input.WiiMote
_WiiMoteState.LEDState.LED3 = led3; _WiiMoteState.LEDState.LED3 = led3;
_WiiMoteState.LEDState.LED4 = led4; _WiiMoteState.LEDState.LED4 = led4;
if (!_Connected) if (!Connected)
return; return;
_ClearReport(); _ClearReport();
_Buff[0] = (byte)EOutputReport.LEDs; _Buff[0] = (byte)EOutputReport.LEDs;
_Buff[1] = (byte)( _Buff[1] = (byte)((led1 ? 0x10 : 0x00) |
(led1 ? 0x10 : 0x00) | (led2 ? 0x20 : 0x00) |
(led2 ? 0x20 : 0x00) | (led3 ? 0x40 : 0x00) |
(led3 ? 0x40 : 0x00) | (led4 ? 0x80 : 0x00) |
(led4 ? 0x80 : 0x00) | _RumbleBit);
_RumbleBit);
CHIDApi.Write(_Handle, _Buff); CHIDApi.Write(_Handle, _Buff);
} }
@@ -301,11 +309,6 @@ namespace Vocaluxe.Lib.Input.WiiMote
_WiiMoteState.LEDState.LED3, _WiiMoteState.LEDState.LED3,
_WiiMoteState.LEDState.LED4); _WiiMoteState.LEDState.LED4);
} }
public CWiiMoteStatus WiiMoteState
{
get { return _WiiMoteState; }
}
#endregion Interface #endregion Interface
#region Private stuff #region Private stuff
@@ -315,7 +318,7 @@ namespace Vocaluxe.Lib.Input.WiiMote
{ {
Thread.Sleep(5); Thread.Sleep(5);
if (_Handle != IntPtr.Zero && _Connected) if (_Handle != IntPtr.Zero && Connected)
{ {
byte[] buff = new byte[_ReportLength]; byte[] buff = new byte[_ReportLength];
@@ -341,7 +344,7 @@ namespace Vocaluxe.Lib.Input.WiiMote
{ {
if (buff == null) if (buff == null)
{ {
_Connected = false; Connected = false;
return false; return false;
} }
@@ -408,6 +411,7 @@ namespace Vocaluxe.Lib.Input.WiiMote
return true; return true;
} }
/*
private byte[] _DecryptBuffer(byte[] buff) private byte[] _DecryptBuffer(byte[] buff)
{ {
for (int i = 0; i < buff.Length; i++) for (int i = 0; i < buff.Length; i++)
@@ -415,6 +419,7 @@ namespace Vocaluxe.Lib.Input.WiiMote
return buff; return buff;
} }
*/
private void _ParseButtons(byte[] buff) private void _ParseButtons(byte[] buff)
{ {
@@ -450,14 +455,15 @@ namespace Vocaluxe.Lib.Input.WiiMote
switch (_WiiMoteState.IRState.Mode) switch (_WiiMoteState.IRState.Mode)
{ {
case EIRMode.Basic: case EIRMode.Basic:
if (_WiiMoteState.IRState.Sensors[0].Active = !(buff[6] == 0xff && buff[7] == 0xff)) _WiiMoteState.IRState.Sensors[0].Active = !(buff[6] == 0xff && buff[7] == 0xff);
if (_WiiMoteState.IRState.Sensors[0].Active)
{ {
_WiiMoteState.IRState.Sensors[0].Position.X = buff[6] | ((buff[8] >> 4) & 0x03) << 8; _WiiMoteState.IRState.Sensors[0].Position.X = buff[6] | ((buff[8] >> 4) & 0x03) << 8;
_WiiMoteState.IRState.Sensors[0].Position.Y = buff[7] | ((buff[8] >> 6) & 0x03) << 8; _WiiMoteState.IRState.Sensors[0].Position.Y = buff[7] | ((buff[8] >> 6) & 0x03) << 8;
_WiiMoteState.IRState.Sensors[0].Width = 0; _WiiMoteState.IRState.Sensors[0].Width = 0;
} }
_WiiMoteState.IRState.Sensors[1].Active = !(buff[9] == 0xff && buff[10] == 0xff);
if (_WiiMoteState.IRState.Sensors[1].Active = !(buff[9] == 0xff && buff[10] == 0xff)) if (_WiiMoteState.IRState.Sensors[1].Active)
{ {
_WiiMoteState.IRState.Sensors[1].Position.X = buff[9] | ((buff[8] >> 0) & 0x03) << 8; _WiiMoteState.IRState.Sensors[1].Position.X = buff[9] | ((buff[8] >> 0) & 0x03) << 8;
_WiiMoteState.IRState.Sensors[1].Position.Y = buff[10] | ((buff[8] >> 2) & 0x03) << 8; _WiiMoteState.IRState.Sensors[1].Position.Y = buff[10] | ((buff[8] >> 2) & 0x03) << 8;
@@ -467,12 +473,12 @@ namespace Vocaluxe.Lib.Input.WiiMote
case EIRMode.Extended: case EIRMode.Extended:
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
if (_WiiMoteState.IRState.Sensors[i].Active = !(buff[6 + i * 3] == 0xff && buff[7 + i * 3] == 0xff && buff[8 + i * 3] == 0xff)) _WiiMoteState.IRState.Sensors[i].Active = !(buff[6 + i * 3] == 0xff && buff[7 + i * 3] == 0xff && buff[8 + i * 3] == 0xff);
{ if (!_WiiMoteState.IRState.Sensors[i].Active)
_WiiMoteState.IRState.Sensors[i].Position.X = buff[6 + i * 3] | ((buff[8 + i * 3] >> 4) & 0x03) << 8; continue;
_WiiMoteState.IRState.Sensors[i].Position.Y = buff[7 + i * 3] | ((buff[8 + i * 3] >> 6) & 0x03) << 8; _WiiMoteState.IRState.Sensors[i].Position.X = buff[6 + i * 3] | ((buff[8 + i * 3] >> 4) & 0x03) << 8;
_WiiMoteState.IRState.Sensors[i].Width = buff[8 + i * 3] & 0x0f; _WiiMoteState.IRState.Sensors[i].Position.Y = buff[7 + i * 3] | ((buff[8 + i * 3] >> 6) & 0x03) << 8;
} _WiiMoteState.IRState.Sensors[i].Width = buff[8 + i * 3] & 0x0f;
} }
break; break;
} }
@@ -504,13 +510,13 @@ namespace Vocaluxe.Lib.Input.WiiMote
if ((buff[3] & 0x08) != 0) if ((buff[3] & 0x08) != 0)
{ {
CLog.LogError("Error reading data from WiiMote: Bytes do not exist"); CLog.LogError("Error reading data from WiiMote: Bytes do not exist");
_Connected = false; Connected = false;
} }
if ((buff[3] & 0x07) != 0) if ((buff[3] & 0x07) != 0)
{ {
CLog.LogError("Error reading data from WiiMote: Attempt to read from write-only registers."); CLog.LogError("Error reading data from WiiMote: Attempt to read from write-only registers.");
_Connected = false; Connected = false;
} }
int size = (buff[3] >> 4) + 1; int size = (buff[3] >> 4) + 1;
@@ -524,12 +530,7 @@ namespace Vocaluxe.Lib.Input.WiiMote
private byte _RumbleBit private byte _RumbleBit
{ {
get get { return (byte)(_WiiMoteState.Rumble ? 1 : 0); }
{
if (_WiiMoteState.Rumble)
return 0x1;
return 0x0;
}
} }
private bool _ReadCalibration() private bool _ReadCalibration()
@@ -649,7 +650,7 @@ namespace Vocaluxe.Lib.Input.WiiMote
if (!_ReadDone.WaitOne(1000, false)) if (!_ReadDone.WaitOne(1000, false))
{ {
_Connected = false; Connected = false;
return null; return null;
} }
@@ -687,7 +688,7 @@ namespace Vocaluxe.Lib.Input.WiiMote
} }
// ReSharper disable InconsistentNaming // ReSharper disable InconsistentNaming
protected virtual void Dispose(bool disposing) private void Dispose(bool disposing)
// ReSharper restore InconsistentNaming // ReSharper restore InconsistentNaming
{ {
if (disposing) if (disposing)
+18 -27
View File
@@ -93,12 +93,6 @@ namespace Vocaluxe.Lib.Playlist
return; return;
} }
if (writer == null)
{
CLog.LogError("Error creating/opening Playlist File " + PlaylistFile);
return;
}
try try
{ {
writer.WriteStartDocument(); writer.WriteStartDocument();
@@ -114,7 +108,7 @@ namespace Vocaluxe.Lib.Playlist
CSong song = CSongs.GetSong(Songs[i].SongID); CSong song = CSongs.GetSong(Songs[i].SongID);
if (song != null) if (song != null)
{ {
writer.WriteStartElement("Song" + (i + 1).ToString()); writer.WriteStartElement("Song" + (i + 1));
writer.WriteElementString("Artist", song.Artist); writer.WriteElementString("Artist", song.Artist);
writer.WriteElementString("Title", song.Title); writer.WriteElementString("Title", song.Title);
writer.WriteElementString("GameMode", Enum.GetName(typeof(EGameMode), Songs[i].GameMode)); writer.WriteElementString("GameMode", Enum.GetName(typeof(EGameMode), Songs[i].GameMode));
@@ -143,40 +137,37 @@ namespace Vocaluxe.Lib.Playlist
return; return;
string value = String.Empty; string value = String.Empty;
if (xmlReader.GetValue("//root/Info/PlaylistName", ref value, value)) if (xmlReader.GetValue("//root/Info/PlaylistName", out value, value))
{ {
PlaylistName = value; PlaylistName = value;
Songs = new List<CPlaylistSong>(); Songs = new List<CPlaylistSong>();
List<string> songs = xmlReader.GetValues("Songs"); List<string> songs = xmlReader.GetValues("Songs");
string artist = String.Empty;
string title = String.Empty;
EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL; EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL;
for (int i = 0; i < songs.Count; i++) foreach (string song in songs) {
{ string artist;
xmlReader.GetValue("//root/Songs/" + songs[i] + "/Artist", ref artist, String.Empty); string title;
xmlReader.GetValue("//root/Songs/" + songs[i] + "/Title", ref title, String.Empty); xmlReader.GetValue("//root/Songs/" + song + "/Artist", out artist, String.Empty);
xmlReader.TryGetEnumValue("//root/Songs/" + songs[i] + "/GameMode", ref gm); xmlReader.GetValue("//root/Songs/" + song + "/Title", out title, String.Empty);
xmlReader.TryGetEnumValue("//root/Songs/" + song + "/GameMode", ref gm);
CPlaylistSong song = new CPlaylistSong(); CPlaylistSong playlistSong = new CPlaylistSong();
song.SongID = -1; playlistSong.SongID = -1;
CSong[] allSongs = CSongs.AllSongs; CSong[] allSongs = CSongs.AllSongs;
for (int s = 0; s < allSongs.Length; s++) foreach (CSong curSong in allSongs) {
{ if (curSong.Artist != artist || curSong.Title != title)
if (allSongs[s].Artist == artist && allSongs[s].Title == title) continue;
{ playlistSong.SongID = curSong.ID;
song.SongID = allSongs[s].ID; break;
break;
}
} }
if (song.SongID != -1) if (playlistSong.SongID != -1)
{ {
song.GameMode = gm; playlistSong.GameMode = gm;
Songs.Add(song); Songs.Add(playlistSong);
} }
else else
CLog.LogError("Can't find song '" + title + "' from '" + artist + "' in playlist file: " + PlaylistFile); CLog.LogError("Can't find song '" + title + "' from '" + artist + "' in playlist file: " + PlaylistFile);
+6 -8
View File
@@ -792,7 +792,7 @@ namespace Vocaluxe.Lib.Sound
if (_Paused) if (_Paused)
return; return;
int queuedCount = 0; int queuedCount;
bool doit = true; bool doit = true;
AL.GetSource(_Source, ALGetSourcei.BuffersQueued, out queuedCount); AL.GetSource(_Source, ALGetSourcei.BuffersQueued, out queuedCount);
@@ -801,7 +801,7 @@ namespace Vocaluxe.Lib.Sound
{ {
AL.GetSource(_Source, ALGetSourcei.BuffersProcessed, out processedCount); AL.GetSource(_Source, ALGetSourcei.BuffersProcessed, out processedCount);
doit = false; doit = false;
Console.WriteLine("Buffers Processed on Stream " + _Source.ToString() + " = " + processedCount.ToString()); Console.WriteLine("Buffers Processed on Stream " + _Source + " = " + processedCount);
if (processedCount < 1) if (processedCount < 1)
return; return;
} }
@@ -839,7 +839,7 @@ namespace Vocaluxe.Lib.Sound
} }
int buffer = 0; int buffer;
if (!doit) if (!doit)
buffer = AL.SourceUnqueueBuffer(_Source); buffer = AL.SourceUnqueueBuffer(_Source);
else else
@@ -850,11 +850,9 @@ namespace Vocaluxe.Lib.Sound
if (buffer != 0) if (buffer != 0)
{ {
if (_Format.ChannelCount == 2) ALFormat alFormat = (_Format.ChannelCount == 2)?ALFormat.Stereo16:ALFormat.Mono16;
AL.BufferData(buffer, ALFormat.Stereo16, buf, buf.Length, _Format.SamplesPerSecond); AL.BufferData(buffer, alFormat, buf, buf.Length, _Format.SamplesPerSecond);
else Console.WriteLine("Write to Buffer: " + buffer);
AL.BufferData(buffer, ALFormat.Mono16, buf, buf.Length, _Format.SamplesPerSecond);
Console.WriteLine("Write to Buffer: " + buffer.ToString());
AL.SourceQueueBuffer(_Source, buffer); AL.SourceQueueBuffer(_Source, buffer);
} }
} }
+1 -1
View File
@@ -17,7 +17,6 @@
// */ // */
#endregion #endregion
using PortAudioSharp;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
@@ -26,6 +25,7 @@ using System.Runtime.InteropServices;
using System.Threading; using System.Threading;
using Vocaluxe.Base; using Vocaluxe.Base;
using Vocaluxe.Lib.Sound.Decoder; using Vocaluxe.Lib.Sound.Decoder;
using Vocaluxe.Lib.Sound.PortAudio;
namespace Vocaluxe.Lib.Sound namespace Vocaluxe.Lib.Sound
{ {
+3 -4
View File
@@ -18,11 +18,11 @@
#endregion #endregion
using System.Threading; using System.Threading;
using PortAudioSharp;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using Vocaluxe.Base; using Vocaluxe.Base;
using Vocaluxe.Lib.Sound.PortAudio;
namespace Vocaluxe.Lib.Sound namespace Vocaluxe.Lib.Sound
{ {
@@ -77,7 +77,7 @@ namespace Vocaluxe.Lib.Sound
dev.ID = i; dev.ID = i;
dev.Name = info.Name; dev.Name = info.Name;
dev.Driver = info.Name + i.ToString(); dev.Driver = info.Name + i;
dev.Inputs = new List<SInput>(); dev.Inputs = new List<SInput>();
SInput inp = new SInput(); SInput inp = new SInput();
@@ -155,7 +155,6 @@ namespace Vocaluxe.Lib.Sound
} }
} }
bool result = true;
for (int i = 0; i < _RecHandle.Length; i++) for (int i = 0; i < _RecHandle.Length; i++)
{ {
if (active[i]) if (active[i])
@@ -181,7 +180,7 @@ namespace Vocaluxe.Lib.Sound
return false; return false;
} }
} }
return result; return true;
} }
/// <summary> /// <summary>
@@ -18,7 +18,6 @@
#endregion #endregion
using System; using System;
using System.IO;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using Vocaluxe.Base; using Vocaluxe.Base;
using Vocaluxe.Lib.Video.Acinerella; using Vocaluxe.Lib.Video.Acinerella;
@@ -69,7 +68,7 @@ namespace Vocaluxe.Lib.Sound.Decoder
return; return;
} }
int audioStreamIndex = -1; int audioStreamIndex;
SACDecoder audiodecoder; SACDecoder audiodecoder;
try try
{ {
@@ -176,7 +175,7 @@ namespace Vocaluxe.Lib.Sound.Decoder
return; return;
} }
int frameFinished = 0; int frameFinished;
try try
{ {
frameFinished = CAcinerella.AcGetAudioFrame(_InstancePtr, _Audiodecoder); frameFinished = CAcinerella.AcGetAudioFrame(_InstancePtr, _Audiodecoder);
+2 -7
View File
@@ -20,7 +20,7 @@
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace PortAudioSharp namespace Vocaluxe.Lib.Sound.PortAudio
{ {
/** /**
<summary> <summary>
@@ -28,7 +28,7 @@ namespace PortAudioSharp
</summary> </summary>
*/ */
public partial class CPortAudio public static partial class CPortAudio
{ {
#region **** PORTAUDIO CALLBACKS **** #region **** PORTAUDIO CALLBACKS ****
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
@@ -549,10 +549,5 @@ namespace PortAudioSharp
[DllImport(_PaDll, CallingConvention = CallingConvention.Cdecl)] [DllImport(_PaDll, CallingConvention = CallingConvention.Cdecl)]
public static extern void Pa_Sleep(int msec); public static extern void Pa_Sleep(int msec);
#endregion #endregion
private CPortAudio()
{
// This is a static class
}
} }
} }
@@ -20,10 +20,10 @@
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace PortAudioSharp namespace Vocaluxe.Lib.Sound.PortAudio
{ {
/// <summary> PortAudio v.19 bindings for .NET - ASIO bindings </summary> /// <summary> PortAudio v.19 bindings for .NET - ASIO bindings </summary>
public partial class CPortAudio public static partial class CPortAudio
{ {
#region **** PORTAUDIO DATA STRUCTURES **** #region **** PORTAUDIO DATA STRUCTURES ****
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
+2 -5
View File
@@ -25,7 +25,7 @@ namespace Vocaluxe.Lib.Video
abstract class CVideoDecoder : IVideoDecoder abstract class CVideoDecoder : IVideoDecoder
{ {
protected List<SVideoStreams> _Streams = new List<SVideoStreams>(); protected List<SVideoStreams> _Streams = new List<SVideoStreams>();
protected bool _Initialized = false; protected bool _Initialized;
public virtual bool Init() public virtual bool Init()
{ {
@@ -57,10 +57,7 @@ namespace Vocaluxe.Lib.Video
return 0f; return 0f;
} }
public virtual bool GetFrame(int streamID, ref STexture frame, float time, ref float videoTime) public abstract bool GetFrame(int streamID, ref STexture frame, float time, out float videoTime);
{
return true;
}
public virtual bool Skip(int streamID, float start, float gap) public virtual bool Skip(int streamID, float start, float gap)
{ {
+8 -9
View File
@@ -91,14 +91,15 @@ namespace Vocaluxe.Lib.Video
return false; return false;
} }
public override bool GetFrame(int streamID, ref STexture frame, float time, ref float videoTime) public override bool GetFrame(int streamID, ref STexture frame, float time, out float videoTime)
{ {
videoTime = 0;
if (_Initialized) if (_Initialized)
{ {
lock (_MutexDecoder) lock (_MutexDecoder)
{ {
if (_AlreadyAdded(streamID)) if (_AlreadyAdded(streamID))
return _Decoder[_GetStreamIndex(streamID)].GetFrame(ref frame, time, ref videoTime); return _Decoder[_GetStreamIndex(streamID)].GetFrame(ref frame, time, out videoTime);
} }
} }
return false; return false;
@@ -315,8 +316,9 @@ namespace Vocaluxe.Lib.Video
return true; return true;
} }
public bool GetFrame(ref STexture frame, float time, ref float videoTime) public bool GetFrame(ref STexture frame, float time, out float videoTime)
{ {
videoTime = 0;
if (!_FileOpened) if (!_FileOpened)
return false; return false;
@@ -461,7 +463,7 @@ namespace Vocaluxe.Lib.Video
private void _DoOpen() private void _DoOpen()
{ {
bool ok = false; bool ok;
SACInstance instance = new SACInstance(); SACInstance instance = new SACInstance();
try try
{ {
@@ -486,7 +488,7 @@ namespace Vocaluxe.Lib.Video
_Duration = instance.Info.Duration / 1000f; _Duration = instance.Info.Duration / 1000f;
int videoStreamIndex = -1; int videoStreamIndex;
SACDecoder videodecoder; SACDecoder videodecoder;
try try
{ {
@@ -541,9 +543,7 @@ namespace Vocaluxe.Lib.Video
float myTime = _Time + _VideoSkipTime; float myTime = _Time + _VideoSkipTime;
float timeDifference = myTime - _VideoDecoderTime; float timeDifference = myTime - _VideoDecoderTime;
bool dropFrame = false; bool dropFrame = timeDifference >= (framedropcount - 1) * _VideoTimeBase;
if (timeDifference >= (framedropcount - 1) * _VideoTimeBase)
dropFrame = true;
if (_Terminated) if (_Terminated)
return; return;
@@ -610,7 +610,6 @@ namespace Vocaluxe.Lib.Video
} }
else else
_NoMoreFrames = true; _NoMoreFrames = true;
return;
} }
else else
{ {
+1 -1
View File
@@ -78,7 +78,7 @@ namespace Vocaluxe.Lib.Video
return CGstreamerVideoWrapper.GetVideoLength(streamID); return CGstreamerVideoWrapper.GetVideoLength(streamID);
} }
public bool GetFrame(int streamID, ref STexture frame, float time, ref float videoTime) public bool GetFrame(int streamID, ref STexture frame, float time, out float videoTime)
{ {
SManagedFrame managedFrame = CGstreamerVideoWrapper.GetFrame(streamID, time); SManagedFrame managedFrame = CGstreamerVideoWrapper.GetFrame(streamID, time);
videoTime = managedFrame.Videotime; videoTime = managedFrame.Videotime;
+1 -1
View File
@@ -44,7 +44,7 @@ namespace Vocaluxe.Lib.Video
int GetNumStreams(); int GetNumStreams();
float GetLength(int streamID); float GetLength(int streamID);
bool GetFrame(int streamID, ref STexture frame, float time, ref float videoTime); bool GetFrame(int streamID, ref STexture frame, float time, out float videoTime);
bool Skip(int streamID, float start, float gap); bool Skip(int streamID, float start, float gap);
void SetLoop(int streamID, bool loop); void SetLoop(int streamID, bool loop);
void Pause(int streamID); void Pause(int streamID);
+41 -52
View File
@@ -18,7 +18,6 @@
#endregion #endregion
using System; using System;
using System.Collections.Generic;
using System.Windows.Forms; using System.Windows.Forms;
using Vocaluxe.Base; using Vocaluxe.Base;
using VocaluxeLib.Menu; using VocaluxeLib.Menu;
@@ -91,23 +90,14 @@ namespace Vocaluxe.Screens
_ThemeStatics = new string[] {_StaticBG, _StaticCover}; _ThemeStatics = new string[] {_StaticBG, _StaticCover};
_ThemeTexts = new string[] {_TextCurrentSong}; _ThemeTexts = new string[] {_TextCurrentSong};
List<string> buttons = new List<string>(); _ThemeButtons = new string[]{_ButtonPlay,_ButtonPause,_ButtonPrevious,_ButtonNext,_ButtonRepeat,_ButtonShowVideo,_ButtonSing,_ButtonToBackgroundVideo};
buttons.Add(_ButtonPlay);
buttons.Add(_ButtonPause);
buttons.Add(_ButtonPrevious);
buttons.Add(_ButtonNext);
buttons.Add(_ButtonRepeat);
buttons.Add(_ButtonShowVideo);
buttons.Add(_ButtonSing);
buttons.Add(_ButtonToBackgroundVideo);
_ThemeButtons = buttons.ToArray();
} }
public override void LoadTheme(string xmlPath) public override void LoadTheme(string xmlPath)
{ {
base.LoadTheme(xmlPath); base.LoadTheme(xmlPath);
_ScreenArea = Statics[_StaticBG].Rect; _ScreenArea = _Statics[_StaticBG].Rect;
} }
public override bool HandleInput(SKeyEvent keyEvent) public override bool HandleInput(SKeyEvent keyEvent)
@@ -124,21 +114,21 @@ namespace Vocaluxe.Screens
return false; return false;
case Keys.Enter: case Keys.Enter:
if (Buttons[_ButtonNext].Selected) if (_Buttons[_ButtonNext].Selected)
CBackgroundMusic.Next(); CBackgroundMusic.Next();
if (Buttons[_ButtonPrevious].Selected) if (_Buttons[_ButtonPrevious].Selected)
CBackgroundMusic.Previous(); CBackgroundMusic.Previous();
if (Buttons[_ButtonPlay].Selected) if (_Buttons[_ButtonPlay].Selected)
CBackgroundMusic.Play(); CBackgroundMusic.Play();
if (Buttons[_ButtonPause].Selected) if (_Buttons[_ButtonPause].Selected)
CBackgroundMusic.Pause(); CBackgroundMusic.Pause();
if (Buttons[_ButtonRepeat].Selected) if (_Buttons[_ButtonRepeat].Selected)
CBackgroundMusic.RepeatSong = !CBackgroundMusic.RepeatSong; CBackgroundMusic.RepeatSong = !CBackgroundMusic.RepeatSong;
if (Buttons[_ButtonShowVideo].Selected) if (_Buttons[_ButtonShowVideo].Selected)
_VideoPreview = !_VideoPreview; _VideoPreview = !_VideoPreview;
if (Buttons[_ButtonSing].Selected) if (_Buttons[_ButtonSing].Selected)
_StartSong(CBackgroundMusic.SongID, CBackgroundMusic.Duet); _StartSong(CBackgroundMusic.SongID);
if (Buttons[_ButtonToBackgroundVideo].Selected) if (_Buttons[_ButtonToBackgroundVideo].Selected)
_VideoBackground = !_VideoBackground; _VideoBackground = !_VideoBackground;
break; break;
} }
@@ -150,23 +140,23 @@ namespace Vocaluxe.Screens
public override bool HandleMouse(SMouseEvent mouseEvent) public override bool HandleMouse(SMouseEvent mouseEvent)
{ {
base.HandleMouse(mouseEvent); base.HandleMouse(mouseEvent);
if (mouseEvent.LB && IsMouseOver(mouseEvent)) if (mouseEvent.LB && _IsMouseOver(mouseEvent))
{ {
if (Buttons[_ButtonNext].Selected) if (_Buttons[_ButtonNext].Selected)
CBackgroundMusic.Next(); CBackgroundMusic.Next();
if (Buttons[_ButtonPrevious].Selected) if (_Buttons[_ButtonPrevious].Selected)
CBackgroundMusic.Previous(); CBackgroundMusic.Previous();
if (Buttons[_ButtonPlay].Selected) if (_Buttons[_ButtonPlay].Selected)
CBackgroundMusic.Play(); CBackgroundMusic.Play();
if (Buttons[_ButtonPause].Selected) if (_Buttons[_ButtonPause].Selected)
CBackgroundMusic.Pause(); CBackgroundMusic.Pause();
if (Buttons[_ButtonRepeat].Selected) if (_Buttons[_ButtonRepeat].Selected)
CBackgroundMusic.RepeatSong = !CBackgroundMusic.RepeatSong; CBackgroundMusic.RepeatSong = !CBackgroundMusic.RepeatSong;
if (Buttons[_ButtonShowVideo].Selected) if (_Buttons[_ButtonShowVideo].Selected)
_VideoPreview = !_VideoPreview; _VideoPreview = !_VideoPreview;
if (Buttons[_ButtonSing].Selected) if (_Buttons[_ButtonSing].Selected)
_StartSong(CBackgroundMusic.SongID, CBackgroundMusic.Duet); _StartSong(CBackgroundMusic.SongID);
if (Buttons[_ButtonToBackgroundVideo].Selected) if (_Buttons[_ButtonToBackgroundVideo].Selected)
_VideoBackground = !_VideoBackground; _VideoBackground = !_VideoBackground;
} }
else if (mouseEvent.LB) else if (mouseEvent.LB)
@@ -184,11 +174,11 @@ namespace Vocaluxe.Screens
public override bool UpdateGame() public override bool UpdateGame()
{ {
Statics[_StaticCover].Visible = !_VideoPreviewInt || !CBackgroundMusic.SongHasVideo; _Statics[_StaticCover].Visible = !_VideoPreviewInt || !CBackgroundMusic.SongHasVideo;
Buttons[_ButtonToBackgroundVideo].Pressed = _VideoBackground; _Buttons[_ButtonToBackgroundVideo].Pressed = _VideoBackground;
Buttons[_ButtonShowVideo].Pressed = _VideoPreviewInt; _Buttons[_ButtonShowVideo].Pressed = _VideoPreviewInt;
Buttons[_ButtonRepeat].Pressed = CBackgroundMusic.RepeatSong; _Buttons[_ButtonRepeat].Pressed = CBackgroundMusic.RepeatSong;
Buttons[_ButtonSing].Visible = CBackgroundMusic.CanSing && CParty.CurrentPartyModeID == -1; _Buttons[_ButtonSing].Visible = CBackgroundMusic.CanSing && CParty.CurrentPartyModeID == -1;
return true; return true;
} }
@@ -196,31 +186,30 @@ namespace Vocaluxe.Screens
{ {
if (!_Active) if (!_Active)
return false; return false;
Statics[_StaticCover].Texture = CBackgroundMusic.Cover; _Statics[_StaticCover].Texture = CBackgroundMusic.Cover;
if (CBackgroundMusic.VideoEnabled && _VideoPreview && CBackgroundMusic.SongHasVideo) if (CBackgroundMusic.VideoEnabled && _VideoPreview && CBackgroundMusic.SongHasVideo)
CDraw.DrawTexture(Statics[_StaticCover], CBackgroundMusic.GetVideoTexture(), EAspect.Crop); CDraw.DrawTexture(_Statics[_StaticCover], CBackgroundMusic.GetVideoTexture(), EAspect.Crop);
Buttons[_ButtonPause].Visible = CBackgroundMusic.Playing; _Buttons[_ButtonPause].Visible = CBackgroundMusic.Playing;
Buttons[_ButtonPlay].Visible = !CBackgroundMusic.Playing; _Buttons[_ButtonPlay].Visible = !CBackgroundMusic.Playing;
Texts[_TextCurrentSong].Text = CBackgroundMusic.ArtistAndTitle; _Texts[_TextCurrentSong].Text = CBackgroundMusic.ArtistAndTitle;
return base.Draw(); return base.Draw();
} }
private void _StartSong(int songNr, bool duet) private void _StartSong(int songNr)
{ {
if (songNr >= 0 && CSongs.SongsLoaded) if (songNr < 0 || !CSongs.SongsLoaded)
{ return;
CGame.Reset(); CGame.Reset();
CGame.ClearSongs(); CGame.ClearSongs();
EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL; EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL;
if (CSongs.AllSongs[songNr].IsDuet) if (CSongs.AllSongs[songNr].IsDuet)
gm = EGameMode.TR_GAMEMODE_DUET; gm = EGameMode.TR_GAMEMODE_DUET;
CGame.AddSong(songNr, gm); CGame.AddSong(songNr, gm);
CGraphics.FadeTo(EScreens.ScreenNames); CGraphics.FadeTo(EScreens.ScreenNames);
}
} }
} }
} }
+21 -23
View File
@@ -46,8 +46,8 @@ namespace Vocaluxe.Screens
{ {
base.LoadTheme(xmlPath); base.LoadTheme(xmlPath);
_ScreenArea = Statics[_StaticBG].Rect; _ScreenArea = _Statics[_StaticBG].Rect;
SelectSlides[_SelectSlideVolume].AddValues(new string[] _SelectSlides[_SelectSlideVolume].AddValues(new string[]
{"0", "5", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55", "60", "65", "70", "75", "80", "85", "90", "95", "100"}); {"0", "5", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55", "60", "65", "70", "75", "80", "85", "90", "95", "100"});
} }
@@ -65,27 +65,25 @@ namespace Vocaluxe.Screens
_SaveConfig(); _SaveConfig();
return true; return true;
} }
else if (mouseEvent.Wheel > 0 && CHelper.IsInBounds(_ScreenArea, mouseEvent)) if (mouseEvent.Wheel > 0 && CHelper.IsInBounds(_ScreenArea, mouseEvent))
{ {
if (SelectSlides[_SelectSlideVolume].Selection - mouseEvent.Wheel >= 0) if (_SelectSlides[_SelectSlideVolume].Selection - mouseEvent.Wheel >= 0)
SelectSlides[_SelectSlideVolume].Selection = SelectSlides[_SelectSlideVolume].Selection - mouseEvent.Wheel; _SelectSlides[_SelectSlideVolume].Selection = _SelectSlides[_SelectSlideVolume].Selection - mouseEvent.Wheel;
else if (SelectSlides[_SelectSlideVolume].Selection - mouseEvent.Wheel < 0) else if (_SelectSlides[_SelectSlideVolume].Selection - mouseEvent.Wheel < 0)
SelectSlides[_SelectSlideVolume].Selection = 0; _SelectSlides[_SelectSlideVolume].Selection = 0;
_SaveConfig(); _SaveConfig();
return true; return true;
} }
else if (mouseEvent.Wheel < 0 && CHelper.IsInBounds(_ScreenArea, mouseEvent)) if (mouseEvent.Wheel < 0 && CHelper.IsInBounds(_ScreenArea, mouseEvent))
{ {
if (SelectSlides[_SelectSlideVolume].Selection - mouseEvent.Wheel < SelectSlides[_SelectSlideVolume].NumValues) if (_SelectSlides[_SelectSlideVolume].Selection - mouseEvent.Wheel < _SelectSlides[_SelectSlideVolume].NumValues)
SelectSlides[_SelectSlideVolume].Selection = SelectSlides[_SelectSlideVolume].Selection - mouseEvent.Wheel; _SelectSlides[_SelectSlideVolume].Selection = _SelectSlides[_SelectSlideVolume].Selection - mouseEvent.Wheel;
else if (SelectSlides[_SelectSlideVolume].Selection - mouseEvent.Wheel >= SelectSlides[_SelectSlideVolume].NumValues) else if (_SelectSlides[_SelectSlideVolume].Selection - mouseEvent.Wheel >= _SelectSlides[_SelectSlideVolume].NumValues)
SelectSlides[_SelectSlideVolume].Selection = SelectSlides[_SelectSlideVolume].NumValues - 1; _SelectSlides[_SelectSlideVolume].Selection = _SelectSlides[_SelectSlideVolume].NumValues - 1;
_SaveConfig(); _SaveConfig();
return true; return true;
} }
else if (mouseEvent.RB) return !mouseEvent.RB;
return false;
return true;
} }
public override void OnShow() public override void OnShow()
@@ -114,20 +112,20 @@ namespace Vocaluxe.Screens
{ {
case EScreens.ScreenSong: case EScreens.ScreenSong:
if (CSongs.IsInCategory) if (CSongs.IsInCategory)
CConfig.PreviewMusicVolume = SelectSlides[_SelectSlideVolume].Selection * 5; CConfig.PreviewMusicVolume = _SelectSlides[_SelectSlideVolume].Selection * 5;
else else
{ {
CConfig.BackgroundMusicVolume = SelectSlides[_SelectSlideVolume].Selection * 5; CConfig.BackgroundMusicVolume = _SelectSlides[_SelectSlideVolume].Selection * 5;
CBackgroundMusic.ApplyVolume(); CBackgroundMusic.ApplyVolume();
} }
break; break;
case EScreens.ScreenSing: case EScreens.ScreenSing:
CConfig.GameMusicVolume = SelectSlides[_SelectSlideVolume].Selection * 5; CConfig.GameMusicVolume = _SelectSlides[_SelectSlideVolume].Selection * 5;
break; break;
default: default:
CConfig.BackgroundMusicVolume = SelectSlides[_SelectSlideVolume].Selection * 5; CConfig.BackgroundMusicVolume = _SelectSlides[_SelectSlideVolume].Selection * 5;
CBackgroundMusic.ApplyVolume(); CBackgroundMusic.ApplyVolume();
break; break;
} }
@@ -140,17 +138,17 @@ namespace Vocaluxe.Screens
{ {
case EScreens.ScreenSong: case EScreens.ScreenSong:
if (CSongs.IsInCategory) if (CSongs.IsInCategory)
SelectSlides[_SelectSlideVolume].Selection = CConfig.PreviewMusicVolume / 5; _SelectSlides[_SelectSlideVolume].Selection = CConfig.PreviewMusicVolume / 5;
else else
SelectSlides[_SelectSlideVolume].Selection = CConfig.BackgroundMusicVolume / 5; _SelectSlides[_SelectSlideVolume].Selection = CConfig.BackgroundMusicVolume / 5;
break; break;
case EScreens.ScreenSing: case EScreens.ScreenSing:
SelectSlides[_SelectSlideVolume].Selection = CConfig.GameMusicVolume / 5; _SelectSlides[_SelectSlideVolume].Selection = CConfig.GameMusicVolume / 5;
break; break;
default: default:
SelectSlides[_SelectSlideVolume].Selection = CConfig.BackgroundMusicVolume / 5; _SelectSlides[_SelectSlideVolume].Selection = CConfig.BackgroundMusicVolume / 5;
break; break;
} }
} }
-1
View File
@@ -451,7 +451,6 @@ namespace Vocaluxe.Screens
//Start Text-Timer //Start Text-Timer
_TextTimer.Start(); _TextTimer.Start();
active = true;
} }
} }
else if (_CreditNames[i].Y <= 360f) else if (_CreditNames[i].Y <= 360f)
+30 -30
View File
@@ -60,34 +60,34 @@ namespace Vocaluxe.Screens
_TextNumber = new string[_NumEntrys]; _TextNumber = new string[_NumEntrys];
for (int i = 0; i < _NumEntrys; i++) for (int i = 0; i < _NumEntrys; i++)
{ {
_TextNumber[i] = "TextNumber" + (i + 1).ToString(); _TextNumber[i] = "TextNumber" + (i + 1);
texts.Add(_TextNumber[i]); texts.Add(_TextNumber[i]);
} }
_TextName = new string[_NumEntrys]; _TextName = new string[_NumEntrys];
for (int i = 0; i < _NumEntrys; i++) for (int i = 0; i < _NumEntrys; i++)
{ {
_TextName[i] = "TextName" + (i + 1).ToString(); _TextName[i] = "TextName" + (i + 1);
texts.Add(_TextName[i]); texts.Add(_TextName[i]);
} }
_TextScore = new string[_NumEntrys]; _TextScore = new string[_NumEntrys];
for (int i = 0; i < _NumEntrys; i++) for (int i = 0; i < _NumEntrys; i++)
{ {
_TextScore[i] = "TextScore" + (i + 1).ToString(); _TextScore[i] = "TextScore" + (i + 1);
texts.Add(_TextScore[i]); texts.Add(_TextScore[i]);
} }
_TextDate = new string[_NumEntrys]; _TextDate = new string[_NumEntrys];
for (int i = 0; i < _NumEntrys; i++) for (int i = 0; i < _NumEntrys; i++)
{ {
_TextDate[i] = "TextDate" + (i + 1).ToString(); _TextDate[i] = "TextDate" + (i + 1);
texts.Add(_TextDate[i]); texts.Add(_TextDate[i]);
} }
_ParticleEffectNew = new string[_NumEntrys]; _ParticleEffectNew = new string[_NumEntrys];
for (int i = 0; i < _NumEntrys; i++) for (int i = 0; i < _NumEntrys; i++)
_ParticleEffectNew[i] = "ParticleEffectNew" + (i + 1).ToString(); _ParticleEffectNew[i] = "ParticleEffectNew" + (i + 1);
_ThemeTexts = texts.ToArray(); _ThemeTexts = texts.ToArray();
_ThemeParticleEffects = _ParticleEffectNew; _ThemeParticleEffects = _ParticleEffectNew;
@@ -131,7 +131,7 @@ namespace Vocaluxe.Screens
public override bool HandleMouse(SMouseEvent mouseEvent) public override bool HandleMouse(SMouseEvent mouseEvent)
{ {
if (mouseEvent.LB && IsMouseOver(mouseEvent)) {} if (mouseEvent.LB && _IsMouseOver(mouseEvent)) {}
if (mouseEvent.LB) if (mouseEvent.LB)
_LeaveScreen(); _LeaveScreen();
@@ -160,34 +160,34 @@ namespace Vocaluxe.Screens
{ {
if (_Pos + p < _Scores[_Round].Count) if (_Pos + p < _Scores[_Round].Count)
{ {
Texts[_TextNumber[p]].Visible = true; _Texts[_TextNumber[p]].Visible = true;
Texts[_TextName[p]].Visible = true; _Texts[_TextName[p]].Visible = true;
Texts[_TextScore[p]].Visible = true; _Texts[_TextScore[p]].Visible = true;
Texts[_TextDate[p]].Visible = true; _Texts[_TextDate[p]].Visible = true;
Texts[_TextNumber[p]].Text = (_Pos + p + 1).ToString(); _Texts[_TextNumber[p]].Text = (_Pos + p + 1).ToString();
string name = _Scores[_Round][_Pos + p].Name; string name = _Scores[_Round][_Pos + p].Name;
name += " [" + CLanguage.Translate(Enum.GetName(typeof(EGameDifficulty), _Scores[_Round][_Pos + p].Difficulty)) + "]"; name += " [" + CLanguage.Translate(Enum.GetName(typeof(EGameDifficulty), _Scores[_Round][_Pos + p].Difficulty)) + "]";
if (_IsDuet) if (_IsDuet)
name += " (P" + (_Scores[_Round][_Pos + p].LineNr + 1).ToString() + ")"; name += " (P" + (_Scores[_Round][_Pos + p].LineNr + 1) + ")";
Texts[_TextName[p]].Text = name; _Texts[_TextName[p]].Text = name;
Texts[_TextScore[p]].Text = _Scores[_Round][_Pos + p].Score.ToString("00000"); _Texts[_TextScore[p]].Text = _Scores[_Round][_Pos + p].Score.ToString("00000");
Texts[_TextDate[p]].Text = _Scores[_Round][_Pos + p].Date; _Texts[_TextDate[p]].Text = _Scores[_Round][_Pos + p].Date;
if (_IsNewEntry(_Scores[_Round][_Pos + p].ID)) if (_IsNewEntry(_Scores[_Round][_Pos + p].ID))
ParticleEffects[_ParticleEffectNew[p]].Visible = true; _ParticleEffects[_ParticleEffectNew[p]].Visible = true;
else else
ParticleEffects[_ParticleEffectNew[p]].Visible = false; _ParticleEffects[_ParticleEffectNew[p]].Visible = false;
} }
else else
{ {
Texts[_TextNumber[p]].Visible = false; _Texts[_TextNumber[p]].Visible = false;
Texts[_TextName[p]].Visible = false; _Texts[_TextName[p]].Visible = false;
Texts[_TextScore[p]].Visible = false; _Texts[_TextScore[p]].Visible = false;
Texts[_TextDate[p]].Visible = false; _Texts[_TextDate[p]].Visible = false;
ParticleEffects[_ParticleEffectNew[p]].Visible = false; _ParticleEffects[_ParticleEffectNew[p]].Visible = false;
} }
} }
return true; return true;
@@ -249,7 +249,7 @@ namespace Vocaluxe.Screens
for (int round = 0; round < points.NumRounds; round++) for (int round = 0; round < points.NumRounds; round++)
{ {
SPlayer player = points.GetPlayer(round, CGame.NumPlayer)[0]; SPlayer player = points.GetPlayer(round, CGame.NumPlayer)[0];
CDataBase.LoadScore(ref _Scores[round], player); CDataBase.LoadScore(out _Scores[round], player);
} }
} }
@@ -262,31 +262,31 @@ namespace Vocaluxe.Screens
if (song == null) if (song == null)
return; return;
Texts[_TextSongName].Text = song.Artist + " - " + song.Title; _Texts[_TextSongName].Text = song.Artist + " - " + song.Title;
if (points.NumRounds > 1) if (points.NumRounds > 1)
Texts[_TextSongName].Text += " (" + (_Round + 1) + "/" + points.NumRounds + ")"; _Texts[_TextSongName].Text += " (" + (_Round + 1) + "/" + points.NumRounds + ")";
switch (CGame.GetGameMode(_Round)) switch (CGame.GetGameMode(_Round))
{ {
case EGameMode.TR_GAMEMODE_NORMAL: case EGameMode.TR_GAMEMODE_NORMAL:
Texts[_TextSongMode].Text = "TR_GAMEMODE_NORMAL"; _Texts[_TextSongMode].Text = "TR_GAMEMODE_NORMAL";
break; break;
case EGameMode.TR_GAMEMODE_MEDLEY: case EGameMode.TR_GAMEMODE_MEDLEY:
Texts[_TextSongMode].Text = "TR_GAMEMODE_MEDLEY"; _Texts[_TextSongMode].Text = "TR_GAMEMODE_MEDLEY";
break; break;
case EGameMode.TR_GAMEMODE_DUET: case EGameMode.TR_GAMEMODE_DUET:
Texts[_TextSongMode].Text = "TR_GAMEMODE_DUET"; _Texts[_TextSongMode].Text = "TR_GAMEMODE_DUET";
_IsDuet = true; _IsDuet = true;
break; break;
case EGameMode.TR_GAMEMODE_SHORTSONG: case EGameMode.TR_GAMEMODE_SHORTSONG:
Texts[_TextSongMode].Text = "TR_GAMEMODE_SHORTSONG"; _Texts[_TextSongMode].Text = "TR_GAMEMODE_SHORTSONG";
break; break;
default: default:
Texts[_TextSongMode].Text = "TR_GAMEMODE_NORMAL"; _Texts[_TextSongMode].Text = "TR_GAMEMODE_NORMAL";
break; break;
} }
+12 -14
View File
@@ -32,7 +32,6 @@ namespace Vocaluxe.Screens
{ {
get { return 1; } get { return 1; }
} }
private const float _WaitTime = 0.5f; //wait time before starting first video
private const string _TextStatus = "TextStatus"; private const string _TextStatus = "TextStatus";
@@ -103,10 +102,9 @@ namespace Vocaluxe.Screens
} }
} }
_SongLoaderThread = new Thread(CSongs.LoadSongs); _SongLoaderThread = new Thread(CSongs.LoadSongs) {Name = "SongLoader"};
_SongLoaderThread.Name = "SongLoader";
Texts[_TextStatus].Text = CLanguage.Translate("TR_SCREENLOAD_TOTAL") + ": 0 " + _Texts[_TextStatus].Text = CLanguage.Translate("TR_SCREENLOAD_TOTAL") + ": 0 " +
CLanguage.Translate("TR_SCREENLOAD_SONGS") + " (0 " + CLanguage.Translate("TR_SCREENLOAD_SONGS") + " (0 " +
CLanguage.Translate("TR_SCREENLOAD_LOADED") + ")"; CLanguage.Translate("TR_SCREENLOAD_LOADED") + ")";
@@ -129,8 +127,8 @@ namespace Vocaluxe.Screens
if (CConfig.VideoBackgrounds == EOffOn.TR_CONFIG_ON) if (CConfig.VideoBackgrounds == EOffOn.TR_CONFIG_ON)
{ {
for (int i = 0; i < _Intros.Length; i++) foreach (CVideoPlayer videoPlayer in _Intros)
_Intros[i].PreLoad(); videoPlayer.PreLoad();
} }
CLog.StartBenchmark(0, "Load Songs Full"); CLog.StartBenchmark(0, "Load Songs Full");
@@ -169,8 +167,8 @@ namespace Vocaluxe.Screens
if (CSettings.GameState == EGameState.Normal) if (CSettings.GameState == EGameState.Normal)
CGraphics.FadeTo(EScreens.ScreenMain); CGraphics.FadeTo(EScreens.ScreenMain);
Texts[_TextStatus].Text = _Texts[_TextStatus].Text =
CLanguage.Translate("TR_SCREENLOAD_TOTAL") + ": " + CSongs.NumAllSongs.ToString() + " " + CLanguage.Translate("TR_SCREENLOAD_TOTAL") + ": " + CSongs.NumAllSongs + " " +
CLanguage.Translate("TR_SCREENLOAD_SONGS") + " (" + CSongs.NumSongsWithCoverLoaded + " " + CLanguage.Translate("TR_SCREENLOAD_SONGS") + " (" + CSongs.NumSongsWithCoverLoaded + " " +
CLanguage.Translate("TR_SCREENLOAD_LOADED") + ")"; CLanguage.Translate("TR_SCREENLOAD_LOADED") + ")";
@@ -190,12 +188,12 @@ namespace Vocaluxe.Screens
public override bool Draw() public override bool Draw()
{ {
DrawBG(); _DrawBG();
for (int i = 0; i < _Intros.Length; i++) foreach (CVideoPlayer videoPlayer in _Intros)
_Intros[i].Draw(); videoPlayer.Draw();
DrawFG(); _DrawFG();
return true; return true;
} }
@@ -205,8 +203,8 @@ namespace Vocaluxe.Screens
_Timer.Stop(); _Timer.Stop();
_Timer.Reset(); _Timer.Reset();
for (int i = 0; i < _Intros.Length; i++) foreach (CVideoPlayer videoPlayer in _Intros)
_Intros[i].Close(); videoPlayer.Close();
CBackgroundMusic.CanSing = true; CBackgroundMusic.CanSing = true;
+19 -13
View File
@@ -72,22 +72,22 @@ namespace Vocaluxe.Screens
break; break;
case Keys.Enter: case Keys.Enter:
if (Buttons[_ButtonSing].Selected) if (_Buttons[_ButtonSing].Selected)
{ {
CParty.SetNormalGameMode(); CParty.SetNormalGameMode();
CGraphics.FadeTo(EScreens.ScreenSong); CGraphics.FadeTo(EScreens.ScreenSong);
} }
if (Buttons[_ButtonParty].Selected) if (_Buttons[_ButtonParty].Selected)
CGraphics.FadeTo(EScreens.ScreenParty); CGraphics.FadeTo(EScreens.ScreenParty);
if (Buttons[_ButtonOptions].Selected) if (_Buttons[_ButtonOptions].Selected)
CGraphics.FadeTo(EScreens.ScreenOptions); CGraphics.FadeTo(EScreens.ScreenOptions);
if (Buttons[_ButtonProfiles].Selected) if (_Buttons[_ButtonProfiles].Selected)
CGraphics.FadeTo(EScreens.ScreenProfiles); CGraphics.FadeTo(EScreens.ScreenProfiles);
if (Buttons[_ButtonExit].Selected) if (_Buttons[_ButtonExit].Selected)
return false; return false;
break; break;
@@ -100,30 +100,31 @@ namespace Vocaluxe.Screens
{ {
base.HandleMouse(mouseEvent); base.HandleMouse(mouseEvent);
if (mouseEvent.LB && IsMouseOver(mouseEvent)) if (mouseEvent.LB && _IsMouseOver(mouseEvent))
{ {
if (Buttons[_ButtonSing].Selected) if (_Buttons[_ButtonSing].Selected)
{ {
CParty.SetNormalGameMode(); CParty.SetNormalGameMode();
CGraphics.FadeTo(EScreens.ScreenSong); CGraphics.FadeTo(EScreens.ScreenSong);
} }
if (Buttons[_ButtonParty].Selected) if (_Buttons[_ButtonParty].Selected)
CGraphics.FadeTo(EScreens.ScreenParty); CGraphics.FadeTo(EScreens.ScreenParty);
if (Buttons[_ButtonOptions].Selected) if (_Buttons[_ButtonOptions].Selected)
CGraphics.FadeTo(EScreens.ScreenOptions); CGraphics.FadeTo(EScreens.ScreenOptions);
if (Buttons[_ButtonProfiles].Selected) if (_Buttons[_ButtonProfiles].Selected)
CGraphics.FadeTo(EScreens.ScreenProfiles); CGraphics.FadeTo(EScreens.ScreenProfiles);
if (Buttons[_ButtonExit].Selected) if (_Buttons[_ButtonExit].Selected)
return false; return false;
} }
return true; return true;
} }
// ReSharper disable RedundantOverridenMember
public override void OnShow() public override void OnShow()
{ {
base.OnShow(); base.OnShow();
@@ -131,6 +132,7 @@ namespace Vocaluxe.Screens
//if (Snowflakes != null) //if (Snowflakes != null)
// Snowflakes.Resume(); // Snowflakes.Resume();
} }
// ReSharper restore RedundantOverridenMember
public override bool UpdateGame() public override bool UpdateGame()
{ {
@@ -139,16 +141,18 @@ namespace Vocaluxe.Screens
public override bool Draw() public override bool Draw()
{ {
DrawBG(); _DrawBG();
//if (Snowflakes == null) //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 = 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.Update();
//Snowflakes.Draw(); //Snowflakes.Draw();
DrawFG(); _DrawFG();
// ReSharper disable ConditionIsAlwaysTrueOrFalse
if (CSettings.VersionRevision != ERevision.Release) if (CSettings.VersionRevision != ERevision.Release)
// ReSharper restore ConditionIsAlwaysTrueOrFalse
{ {
CFonts.SetFont("Normal"); CFonts.SetFont("Normal");
CFonts.Style = EStyle.Normal; CFonts.Style = EStyle.Normal;
@@ -158,6 +162,7 @@ namespace Vocaluxe.Screens
return true; return true;
} }
// ReSharper disable RedundantOverridenMember
public override void OnClose() public override void OnClose()
{ {
base.OnClose(); base.OnClose();
@@ -165,5 +170,6 @@ namespace Vocaluxe.Screens
//if (Snowflakes != null) //if (Snowflakes != null)
// Snowflakes.Pause(); // Snowflakes.Pause();
} }
// ReSharper restore RedundantOverridenMember
} }
} }
+112 -122
View File
@@ -115,10 +115,10 @@ namespace Vocaluxe.Screens
_PlayerNr[i] = i; _PlayerNr[i] = i;
for (int i = 0; i < CSettings.MaxNumPlayer; i++) for (int i = 0; i < CSettings.MaxNumPlayer; i++)
_OriginalPlayerAvatarTextures[i] = Statics[_StaticPlayerAvatar[i]].Texture; _OriginalPlayerAvatarTextures[i] = _Statics[_StaticPlayerAvatar[i]].Texture;
for (int i = 1; i <= CSettings.MaxNumPlayer; i++) for (int i = 1; i <= CSettings.MaxNumPlayer; i++)
Equalizers["EqualizerPlayer" + i].ScreenHandles = true; _Equalizers["EqualizerPlayer" + i].ScreenHandles = true;
} }
public override bool HandleInput(SKeyEvent keyEvent) public override bool HandleInput(SKeyEvent keyEvent)
@@ -128,20 +128,20 @@ namespace Vocaluxe.Screens
case Keys.Add: case Keys.Add:
if (CConfig.NumPlayer + 1 <= CSettings.MaxNumPlayer) if (CConfig.NumPlayer + 1 <= CSettings.MaxNumPlayer)
{ {
SelectSlides[_SelectSlidePlayerNumber].Selection = CConfig.NumPlayer; _SelectSlides[_SelectSlidePlayerNumber].Selection = CConfig.NumPlayer;
_UpdatePlayerNumber(); _UpdatePlayerNumber();
//Update Tiles-List //Update Tiles-List
NameSelections[_NameSelection].UpdateList(); _NameSelections[_NameSelection].UpdateList();
} }
break; break;
case Keys.Subtract: case Keys.Subtract:
if (CConfig.NumPlayer - 1 > 0) if (CConfig.NumPlayer - 1 > 0)
{ {
SelectSlides[_SelectSlidePlayerNumber].Selection = CConfig.NumPlayer - 2; _SelectSlides[_SelectSlidePlayerNumber].Selection = CConfig.NumPlayer - 2;
_UpdatePlayerNumber(); _UpdatePlayerNumber();
//Update Tiles-List //Update Tiles-List
NameSelections[_NameSelection].UpdateList(); _NameSelections[_NameSelection].UpdateList();
} }
break; break;
@@ -157,7 +157,7 @@ namespace Vocaluxe.Screens
_SelectingKeyboardPlayerNr++; _SelectingKeyboardPlayerNr++;
else else
_SelectingKeyboardPlayerNr = 1; _SelectingKeyboardPlayerNr = 1;
NameSelections[_NameSelection].KeyboardSelection(true, _SelectingKeyboardPlayerNr); _NameSelections[_NameSelection].KeyboardSelection(true, _SelectingKeyboardPlayerNr);
} }
break; break;
} }
@@ -165,14 +165,14 @@ namespace Vocaluxe.Screens
if (_SelectingKeyboardActive) if (_SelectingKeyboardActive)
{ {
//Handle left/right/up/down //Handle left/right/up/down
NameSelections[_NameSelection].HandleInput(keyEvent); _NameSelections[_NameSelection].HandleInput(keyEvent);
switch (keyEvent.Key) switch (keyEvent.Key)
{ {
case Keys.Enter: case Keys.Enter:
//Check, if a player is selected //Check, if a player is selected
if (NameSelections[_NameSelection].Selection > -1) if (_NameSelections[_NameSelection].Selection > -1)
{ {
_SelectedPlayerNr = NameSelections[_NameSelection].Selection; _SelectedPlayerNr = _NameSelections[_NameSelection].Selection;
//Update Game-infos with new player //Update Game-infos with new player
CGame.Player[_SelectingKeyboardPlayerNr - 1].Name = CProfiles.Profiles[_SelectedPlayerNr].PlayerName; CGame.Player[_SelectingKeyboardPlayerNr - 1].Name = CProfiles.Profiles[_SelectedPlayerNr].PlayerName;
CGame.Player[_SelectingKeyboardPlayerNr - 1].Difficulty = CProfiles.Profiles[_SelectedPlayerNr].Difficulty; CGame.Player[_SelectingKeyboardPlayerNr - 1].Difficulty = CProfiles.Profiles[_SelectedPlayerNr].Difficulty;
@@ -181,13 +181,13 @@ namespace Vocaluxe.Screens
CConfig.Players[_SelectingKeyboardPlayerNr - 1] = CProfiles.Profiles[_SelectedPlayerNr].ProfileFile; CConfig.Players[_SelectingKeyboardPlayerNr - 1] = CProfiles.Profiles[_SelectedPlayerNr].ProfileFile;
CConfig.SaveConfig(); CConfig.SaveConfig();
//Update texture and name //Update texture and name
Statics[_StaticPlayerAvatar[_SelectingKeyboardPlayerNr - 1]].Texture = CProfiles.Profiles[_SelectedPlayerNr].Avatar.Texture; _Statics[_StaticPlayerAvatar[_SelectingKeyboardPlayerNr - 1]].Texture = CProfiles.Profiles[_SelectedPlayerNr].Avatar.Texture;
Texts[_TextPlayer[_SelectingKeyboardPlayerNr - 1]].Text = CProfiles.Profiles[_SelectedPlayerNr].PlayerName; _Texts[_TextPlayer[_SelectingKeyboardPlayerNr - 1]].Text = CProfiles.Profiles[_SelectedPlayerNr].PlayerName;
//Update profile-warning //Update profile-warning
_CheckPlayers(); _CheckPlayers();
//Update Tiles-List //Update Tiles-List
NameSelections[_NameSelection].UpdateList(); _NameSelections[_NameSelection].UpdateList();
SetInteractionToButton(Buttons[_ButtonStart]); _SetInteractionToButton(_Buttons[_ButtonStart]);
} }
//Started selecting with 'P' //Started selecting with 'P'
if (_SelectingKeyboardUnendless) if (_SelectingKeyboardUnendless)
@@ -197,12 +197,12 @@ namespace Vocaluxe.Screens
//Reset all values //Reset all values
_SelectingKeyboardPlayerNr = 0; _SelectingKeyboardPlayerNr = 0;
_SelectingKeyboardActive = false; _SelectingKeyboardActive = false;
NameSelections[_NameSelection].KeyboardSelection(false, -1); _NameSelections[_NameSelection].KeyboardSelection(false, -1);
} }
else else
{ {
_SelectingKeyboardPlayerNr++; _SelectingKeyboardPlayerNr++;
NameSelections[_NameSelection].KeyboardSelection(true, _SelectingKeyboardPlayerNr); _NameSelections[_NameSelection].KeyboardSelection(true, _SelectingKeyboardPlayerNr);
} }
} }
else else
@@ -210,7 +210,7 @@ namespace Vocaluxe.Screens
//Reset all values //Reset all values
_SelectingKeyboardPlayerNr = 0; _SelectingKeyboardPlayerNr = 0;
_SelectingKeyboardActive = false; _SelectingKeyboardActive = false;
NameSelections[_NameSelection].KeyboardSelection(false, -1); _NameSelections[_NameSelection].KeyboardSelection(false, -1);
} }
break; break;
@@ -221,12 +221,12 @@ namespace Vocaluxe.Screens
//Reset all values //Reset all values
_SelectingKeyboardPlayerNr = 0; _SelectingKeyboardPlayerNr = 0;
_SelectingKeyboardActive = false; _SelectingKeyboardActive = false;
NameSelections[_NameSelection].KeyboardSelection(false, -1); _NameSelections[_NameSelection].KeyboardSelection(false, -1);
} }
else else
{ {
_SelectingKeyboardPlayerNr = 1; _SelectingKeyboardPlayerNr = 1;
NameSelections[_NameSelection].KeyboardSelection(true, 1); _NameSelections[_NameSelection].KeyboardSelection(true, 1);
} }
_SelectingKeyboardUnendless = false; _SelectingKeyboardUnendless = false;
break; break;
@@ -237,12 +237,12 @@ namespace Vocaluxe.Screens
//Reset all values //Reset all values
_SelectingKeyboardPlayerNr = 0; _SelectingKeyboardPlayerNr = 0;
_SelectingKeyboardActive = false; _SelectingKeyboardActive = false;
NameSelections[_NameSelection].KeyboardSelection(false, -1); _NameSelections[_NameSelection].KeyboardSelection(false, -1);
} }
else else
{ {
_SelectingKeyboardPlayerNr = 2; _SelectingKeyboardPlayerNr = 2;
NameSelections[_NameSelection].KeyboardSelection(true, 2); _NameSelections[_NameSelection].KeyboardSelection(true, 2);
} }
_SelectingKeyboardUnendless = false; _SelectingKeyboardUnendless = false;
break; break;
@@ -253,12 +253,12 @@ namespace Vocaluxe.Screens
//Reset all values //Reset all values
_SelectingKeyboardPlayerNr = 0; _SelectingKeyboardPlayerNr = 0;
_SelectingKeyboardActive = false; _SelectingKeyboardActive = false;
NameSelections[_NameSelection].KeyboardSelection(false, -1); _NameSelections[_NameSelection].KeyboardSelection(false, -1);
} }
else else
{ {
_SelectingKeyboardPlayerNr = 3; _SelectingKeyboardPlayerNr = 3;
NameSelections[_NameSelection].KeyboardSelection(true, 3); _NameSelections[_NameSelection].KeyboardSelection(true, 3);
} }
_SelectingKeyboardUnendless = false; _SelectingKeyboardUnendless = false;
break; break;
@@ -269,12 +269,12 @@ namespace Vocaluxe.Screens
//Reset all values //Reset all values
_SelectingKeyboardPlayerNr = 0; _SelectingKeyboardPlayerNr = 0;
_SelectingKeyboardActive = false; _SelectingKeyboardActive = false;
NameSelections[_NameSelection].KeyboardSelection(false, -1); _NameSelections[_NameSelection].KeyboardSelection(false, -1);
} }
else else
{ {
_SelectingKeyboardPlayerNr = 4; _SelectingKeyboardPlayerNr = 4;
NameSelections[_NameSelection].KeyboardSelection(true, 4); _NameSelections[_NameSelection].KeyboardSelection(true, 4);
} }
_SelectingKeyboardUnendless = false; _SelectingKeyboardUnendless = false;
break; break;
@@ -285,12 +285,12 @@ namespace Vocaluxe.Screens
//Reset all values //Reset all values
_SelectingKeyboardPlayerNr = 0; _SelectingKeyboardPlayerNr = 0;
_SelectingKeyboardActive = false; _SelectingKeyboardActive = false;
NameSelections[_NameSelection].KeyboardSelection(false, -1); _NameSelections[_NameSelection].KeyboardSelection(false, -1);
} }
else else
{ {
_SelectingKeyboardPlayerNr = 5; _SelectingKeyboardPlayerNr = 5;
NameSelections[_NameSelection].KeyboardSelection(true, 5); _NameSelections[_NameSelection].KeyboardSelection(true, 5);
} }
_SelectingKeyboardUnendless = false; _SelectingKeyboardUnendless = false;
break; break;
@@ -301,12 +301,12 @@ namespace Vocaluxe.Screens
//Reset all values //Reset all values
_SelectingKeyboardPlayerNr = 0; _SelectingKeyboardPlayerNr = 0;
_SelectingKeyboardActive = false; _SelectingKeyboardActive = false;
NameSelections[_NameSelection].KeyboardSelection(false, -1); _NameSelections[_NameSelection].KeyboardSelection(false, -1);
} }
else else
{ {
_SelectingKeyboardPlayerNr = 6; _SelectingKeyboardPlayerNr = 6;
NameSelections[_NameSelection].KeyboardSelection(true, 6); _NameSelections[_NameSelection].KeyboardSelection(true, 6);
} }
_SelectingKeyboardUnendless = false; _SelectingKeyboardUnendless = false;
break; break;
@@ -316,7 +316,7 @@ namespace Vocaluxe.Screens
_SelectingKeyboardPlayerNr = 0; _SelectingKeyboardPlayerNr = 0;
_SelectingKeyboardActive = false; _SelectingKeyboardActive = false;
_SelectingKeyboardUnendless = false; _SelectingKeyboardUnendless = false;
NameSelections[_NameSelection].KeyboardSelection(false, -1); _NameSelections[_NameSelection].KeyboardSelection(false, -1);
break; break;
case Keys.Delete: case Keys.Delete:
@@ -328,31 +328,31 @@ namespace Vocaluxe.Screens
CConfig.Players[_SelectingKeyboardPlayerNr - 1] = String.Empty; CConfig.Players[_SelectingKeyboardPlayerNr - 1] = String.Empty;
CConfig.SaveConfig(); CConfig.SaveConfig();
//Update texture and name //Update texture and name
Statics[_StaticPlayerAvatar[_SelectingKeyboardPlayerNr - 1]].Texture = _OriginalPlayerAvatarTextures[_SelectingKeyboardPlayerNr - 1]; _Statics[_StaticPlayerAvatar[_SelectingKeyboardPlayerNr - 1]].Texture = _OriginalPlayerAvatarTextures[_SelectingKeyboardPlayerNr - 1];
Texts[_TextPlayer[_SelectingKeyboardPlayerNr - 1]].Text = CLanguage.Translate("TR_SCREENNAMES_PLAYER") + " " + _SelectingKeyboardPlayerNr.ToString(); _Texts[_TextPlayer[_SelectingKeyboardPlayerNr - 1]].Text = CLanguage.Translate("TR_SCREENNAMES_PLAYER") + " " + _SelectingKeyboardPlayerNr;
//Update profile-warning //Update profile-warning
_CheckPlayers(); _CheckPlayers();
//Reset all values //Reset all values
_SelectingKeyboardPlayerNr = 0; _SelectingKeyboardPlayerNr = 0;
_SelectingKeyboardActive = false; _SelectingKeyboardActive = false;
NameSelections[_NameSelection].KeyboardSelection(false, -1); _NameSelections[_NameSelection].KeyboardSelection(false, -1);
//Update Tiles-List //Update Tiles-List
NameSelections[_NameSelection].UpdateList(); _NameSelections[_NameSelection].UpdateList();
break; break;
case Keys.F10: case Keys.F10:
if (CGame.GetNumSongs() == 1 && CGame.GetSong(1).IsDuet) if (CGame.GetNumSongs() == 1 && CGame.GetSong(1).IsDuet)
{ {
if (SelectSlides[_SelectSlideDuetPlayer[_SelectingKeyboardPlayerNr - 1]].Selection == 0) if (_SelectSlides[_SelectSlideDuetPlayer[_SelectingKeyboardPlayerNr - 1]].Selection == 0)
SelectSlides[_SelectSlideDuetPlayer[_SelectingKeyboardPlayerNr - 1]].Selection = 1; _SelectSlides[_SelectSlideDuetPlayer[_SelectingKeyboardPlayerNr - 1]].Selection = 1;
else else
SelectSlides[_SelectSlideDuetPlayer[_SelectingKeyboardPlayerNr - 1]].Selection = 0; _SelectSlides[_SelectSlideDuetPlayer[_SelectingKeyboardPlayerNr - 1]].Selection = 0;
//Reset all values //Reset all values
_SelectingKeyboardPlayerNr = 0; _SelectingKeyboardPlayerNr = 0;
_SelectingKeyboardActive = false; _SelectingKeyboardActive = false;
_SelectingKeyboardUnendless = false; _SelectingKeyboardUnendless = false;
NameSelections[_NameSelection].KeyboardSelection(false, -1); _NameSelections[_NameSelection].KeyboardSelection(false, -1);
SetInteractionToButton(Buttons[_ButtonStart]); _SetInteractionToButton(_Buttons[_ButtonStart]);
} }
break; break;
} }
@@ -371,13 +371,11 @@ namespace Vocaluxe.Screens
case Keys.Enter: case Keys.Enter:
if (!processed && Buttons[_ButtonBack].Selected) if (_Buttons[_ButtonBack].Selected)
{ {
processed = true; processed = true;
CGraphics.FadeTo(EScreens.ScreenSong); CGraphics.FadeTo(EScreens.ScreenSong);
} }else
if (!processed /* && Buttons[ButtonStart].Selected */)
{ {
processed = true; processed = true;
_StartSong(); _StartSong();
@@ -422,7 +420,7 @@ namespace Vocaluxe.Screens
if (_SelectingKeyboardPlayerNr > 0 && _SelectingKeyboardPlayerNr <= CConfig.NumPlayer) if (_SelectingKeyboardPlayerNr > 0 && _SelectingKeyboardPlayerNr <= CConfig.NumPlayer)
{ {
_SelectingKeyboardActive = true; _SelectingKeyboardActive = true;
NameSelections[_NameSelection].KeyboardSelection(true, _SelectingKeyboardPlayerNr); _NameSelections[_NameSelection].KeyboardSelection(true, _SelectingKeyboardPlayerNr);
} }
} }
@@ -440,17 +438,17 @@ namespace Vocaluxe.Screens
_OldMouseX = mouseEvent.X; _OldMouseX = mouseEvent.X;
_OldMouseY = mouseEvent.Y; _OldMouseY = mouseEvent.Y;
//Check if mouse if over tile //Check if mouse if over tile
if (NameSelections[_NameSelection].IsOverTile(mouseEvent)) if (_NameSelections[_NameSelection].IsOverTile(mouseEvent))
{ {
//Get player-number of tile //Get player-number of tile
_SelectedPlayerNr = NameSelections[_NameSelection].TilePlayerNr(mouseEvent); _SelectedPlayerNr = _NameSelections[_NameSelection].TilePlayerNr(mouseEvent);
if (_SelectedPlayerNr != -1) if (_SelectedPlayerNr != -1)
{ {
//Activate mouse-selecting //Activate mouse-selecting
_SelectingMouseActive = true; _SelectingMouseActive = true;
//Update of Drag/Drop-Texture //Update of Drag/Drop-Texture
CStatic selectedPlayer = NameSelections[_NameSelection].TilePlayerAvatar(mouseEvent); CStatic selectedPlayer = _NameSelections[_NameSelection].TilePlayerAvatar(mouseEvent);
_ChooseAvatarStatic.Visible = true; _ChooseAvatarStatic.Visible = true;
_ChooseAvatarStatic.Rect = selectedPlayer.Rect; _ChooseAvatarStatic.Rect = selectedPlayer.Rect;
_ChooseAvatarStatic.Rect.Z = CSettings.ZNear; _ChooseAvatarStatic.Rect.Z = CSettings.ZNear;
@@ -479,10 +477,10 @@ namespace Vocaluxe.Screens
for (int i = 0; i < _StaticPlayer.Length; i++) for (int i = 0; i < _StaticPlayer.Length; i++)
{ {
//Check first, if area is "ReplacedStr:::1:::" //Check first, if area is "ReplacedStr:::1:::"
if (Statics[_StaticPlayer[i]].Visible) if (_Statics[_StaticPlayer[i]].Visible)
{ {
//Check if Mouse is in area //Check if Mouse is in area
if (CHelper.IsInBounds(Statics[_StaticPlayer[i]].Rect, mouseEvent)) if (CHelper.IsInBounds(_Statics[_StaticPlayer[i]].Rect, mouseEvent))
{ {
//Update Game-infos with new player //Update Game-infos with new player
CGame.Player[i].Name = CProfiles.Profiles[_SelectedPlayerNr].PlayerName; CGame.Player[i].Name = CProfiles.Profiles[_SelectedPlayerNr].PlayerName;
@@ -492,12 +490,12 @@ namespace Vocaluxe.Screens
CConfig.Players[i] = CProfiles.Profiles[_SelectedPlayerNr].ProfileFile; CConfig.Players[i] = CProfiles.Profiles[_SelectedPlayerNr].ProfileFile;
CConfig.SaveConfig(); CConfig.SaveConfig();
//Update texture and name //Update texture and name
Statics[_StaticPlayerAvatar[i]].Texture = _ChooseAvatarStatic.Texture; _Statics[_StaticPlayerAvatar[i]].Texture = _ChooseAvatarStatic.Texture;
Texts[_TextPlayer[i]].Text = CProfiles.Profiles[_SelectedPlayerNr].PlayerName; _Texts[_TextPlayer[i]].Text = CProfiles.Profiles[_SelectedPlayerNr].PlayerName;
//Update profile-warning //Update profile-warning
_CheckPlayers(); _CheckPlayers();
//Update Tiles-List //Update Tiles-List
NameSelections[_NameSelection].UpdateList(); _NameSelections[_NameSelection].UpdateList();
} }
} }
} }
@@ -508,28 +506,20 @@ namespace Vocaluxe.Screens
_ChooseAvatarStatic.Visible = false; _ChooseAvatarStatic.Visible = false;
} }
if (mouseEvent.LB && IsMouseOver(mouseEvent)) {} if (mouseEvent.LB && _IsMouseOver(mouseEvent)) {}
if (mouseEvent.LB && IsMouseOver(mouseEvent)) if (mouseEvent.LB && _IsMouseOver(mouseEvent))
{ {
bool processed = false; if (_Buttons[_ButtonBack].Selected)
if (!processed && Buttons[_ButtonBack].Selected)
{ {
processed = true;
CGraphics.FadeTo(EScreens.ScreenSong); CGraphics.FadeTo(EScreens.ScreenSong);
} }else if (_Buttons[_ButtonStart].Selected)
if (!processed && Buttons[_ButtonStart].Selected)
{ {
processed = true;
_StartSong(); _StartSong();
} }else
if (!processed)
_UpdatePlayerNumber(); _UpdatePlayerNumber();
//Update Tiles-List //Update Tiles-List
NameSelections[_NameSelection].UpdateList(); _NameSelections[_NameSelection].UpdateList();
} }
if (mouseEvent.RB) if (mouseEvent.RB)
@@ -538,7 +528,7 @@ namespace Vocaluxe.Screens
//Remove profile-selection //Remove profile-selection
for (int i = 0; i < CConfig.NumPlayer; i++) for (int i = 0; i < CConfig.NumPlayer; i++)
{ {
if (CHelper.IsInBounds(Statics[_StaticPlayer[i]].Rect, mouseEvent)) if (CHelper.IsInBounds(_Statics[_StaticPlayer[i]].Rect, mouseEvent))
{ {
CGame.Player[i].ProfileID = -1; CGame.Player[i].ProfileID = -1;
CGame.Player[i].Name = String.Empty; CGame.Player[i].Name = String.Empty;
@@ -547,12 +537,12 @@ namespace Vocaluxe.Screens
CConfig.Players[i] = String.Empty; CConfig.Players[i] = String.Empty;
CConfig.SaveConfig(); CConfig.SaveConfig();
//Update texture and name //Update texture and name
Statics[_StaticPlayerAvatar[i]].Texture = _OriginalPlayerAvatarTextures[i]; _Statics[_StaticPlayerAvatar[i]].Texture = _OriginalPlayerAvatarTextures[i];
Texts[_TextPlayer[i]].Text = CLanguage.Translate("TR_SCREENNAMES_PLAYER") + " " + (i + 1).ToString(); _Texts[_TextPlayer[i]].Text = CLanguage.Translate("TR_SCREENNAMES_PLAYER") + " " + (i + 1);
//Update profile-warning //Update profile-warning
_CheckPlayers(); _CheckPlayers();
//Update Tiles-List //Update Tiles-List
NameSelections[_NameSelection].UpdateList(); _NameSelections[_NameSelection].UpdateList();
exit = false; exit = false;
} }
} }
@@ -563,10 +553,10 @@ namespace Vocaluxe.Screens
//Check mouse-wheel for scrolling //Check mouse-wheel for scrolling
if (mouseEvent.Wheel != 0) if (mouseEvent.Wheel != 0)
{ {
if (CHelper.IsInBounds(NameSelections[_NameSelection].Rect, mouseEvent)) if (CHelper.IsInBounds(_NameSelections[_NameSelection].Rect, mouseEvent))
{ {
int offset = NameSelections[_NameSelection].Offset + mouseEvent.Wheel; int offset = _NameSelections[_NameSelection].Offset + mouseEvent.Wheel;
NameSelections[_NameSelection].UpdateList(offset); _NameSelections[_NameSelection].UpdateList(offset);
} }
} }
return true; return true;
@@ -577,7 +567,7 @@ namespace Vocaluxe.Screens
for (int i = 1; i <= CGame.NumPlayer; i++) for (int i = 1; i <= CGame.NumPlayer; i++)
{ {
CSound.AnalyzeBuffer(i - 1); CSound.AnalyzeBuffer(i - 1);
Equalizers["EqualizerPlayer" + i].Update(CSound.ToneWeigth(i - 1)); _Equalizers["EqualizerPlayer" + i].Update(CSound.ToneWeigth(i - 1));
} }
return true; return true;
} }
@@ -587,7 +577,7 @@ namespace Vocaluxe.Screens
base.OnShow(); base.OnShow();
CSound.RecordStart(); CSound.RecordStart();
NameSelections[_NameSelection].Init(); _NameSelections[_NameSelection].Init();
_UpdateSlides(); _UpdateSlides();
_UpdatePlayerNumber(); _UpdatePlayerNumber();
@@ -601,29 +591,29 @@ namespace Vocaluxe.Screens
{ {
if (CGame.Player[i].ProfileID > -1 && CProfiles.NumProfiles > CGame.Player[i].ProfileID) if (CGame.Player[i].ProfileID > -1 && CProfiles.NumProfiles > CGame.Player[i].ProfileID)
{ {
Statics[_StaticPlayerAvatar[i]].Texture = CProfiles.Profiles[CGame.Player[i].ProfileID].Avatar.Texture; _Statics[_StaticPlayerAvatar[i]].Texture = CProfiles.Profiles[CGame.Player[i].ProfileID].Avatar.Texture;
Texts[_TextPlayer[i]].Text = CProfiles.Profiles[CGame.Player[i].ProfileID].PlayerName; _Texts[_TextPlayer[i]].Text = CProfiles.Profiles[CGame.Player[i].ProfileID].PlayerName;
} }
} }
if (CGame.GetNumSongs() == 1 && CGame.GetSong(1).IsDuet) if (CGame.GetNumSongs() == 1 && CGame.GetSong(1).IsDuet)
{ {
SelectSlides[_SelectSlideDuetPlayer[i]].Clear(); _SelectSlides[_SelectSlideDuetPlayer[i]].Clear();
if (i + 1 <= CGame.NumPlayer) if (i + 1 <= CGame.NumPlayer)
SelectSlides[_SelectSlideDuetPlayer[i]].Visible = true; _SelectSlides[_SelectSlideDuetPlayer[i]].Visible = true;
else else
SelectSlides[_SelectSlideDuetPlayer[i]].Visible = false; _SelectSlides[_SelectSlideDuetPlayer[i]].Visible = false;
SelectSlides[_SelectSlideDuetPlayer[i]].AddValue(CGame.GetSong(1).DuetPart1); _SelectSlides[_SelectSlideDuetPlayer[i]].AddValue(CGame.GetSong(1).DuetPart1);
SelectSlides[_SelectSlideDuetPlayer[i]].AddValue(CGame.GetSong(1).DuetPart2); _SelectSlides[_SelectSlideDuetPlayer[i]].AddValue(CGame.GetSong(1).DuetPart2);
if ((i + 1) % 2 == 0) if ((i + 1) % 2 == 0)
SelectSlides[_SelectSlideDuetPlayer[i]].Selection = 1; _SelectSlides[_SelectSlideDuetPlayer[i]].Selection = 1;
else else
SelectSlides[_SelectSlideDuetPlayer[i]].Selection = 0; _SelectSlides[_SelectSlideDuetPlayer[i]].Selection = 0;
} }
else else
SelectSlides[_SelectSlideDuetPlayer[i]].Visible = false; _SelectSlides[_SelectSlideDuetPlayer[i]].Visible = false;
} }
SetInteractionToButton(Buttons[_ButtonStart]); _SetInteractionToButton(_Buttons[_ButtonStart]);
} }
public override void OnClose() public override void OnClose()
@@ -639,7 +629,7 @@ namespace Vocaluxe.Screens
if (_ChooseAvatarStatic.Visible) if (_ChooseAvatarStatic.Visible)
_ChooseAvatarStatic.Draw(); _ChooseAvatarStatic.Draw();
for (int i = 1; i <= CGame.NumPlayer; i++) for (int i = 1; i <= CGame.NumPlayer; i++)
Equalizers["EqualizerPlayer" + i].Draw(); _Equalizers["EqualizerPlayer" + i].Draw();
return true; return true;
} }
@@ -649,7 +639,7 @@ namespace Vocaluxe.Screens
{ {
if (CGame.Player[i].ProfileID < 0) if (CGame.Player[i].ProfileID < 0)
{ {
CGame.Player[i].Name = "Player " + (i + 1).ToString(); CGame.Player[i].Name = "Player " + (i + 1);
CGame.Player[i].Difficulty = EGameDifficulty.TR_CONFIG_EASY; CGame.Player[i].Difficulty = EGameDifficulty.TR_CONFIG_EASY;
CGame.Player[i].ProfileID = -1; CGame.Player[i].ProfileID = -1;
} }
@@ -660,7 +650,7 @@ namespace Vocaluxe.Screens
CGame.Player[i].Name = ""; CGame.Player[i].Name = "";
} }
if (CGame.GetNumSongs() == 1 && CGame.GetSong(1).IsDuet) if (CGame.GetNumSongs() == 1 && CGame.GetSong(1).IsDuet)
CGame.Player[i].LineNr = SelectSlides[_SelectSlideDuetPlayer[i]].Selection; CGame.Player[i].LineNr = _SelectSlides[_SelectSlideDuetPlayer[i]].Selection;
} }
CGraphics.FadeTo(EScreens.ScreenSing); CGraphics.FadeTo(EScreens.ScreenSing);
@@ -668,36 +658,36 @@ namespace Vocaluxe.Screens
private void _UpdateSlides() private void _UpdateSlides()
{ {
SelectSlides[_SelectSlidePlayerNumber].Clear(); _SelectSlides[_SelectSlidePlayerNumber].Clear();
for (int i = 1; i <= CSettings.MaxNumPlayer; i++) for (int i = 1; i <= CSettings.MaxNumPlayer; i++)
SelectSlides[_SelectSlidePlayerNumber].AddValue(CLanguage.Translate("TR_SCREENNAMES_" + i + "PLAYER")); _SelectSlides[_SelectSlidePlayerNumber].AddValue(CLanguage.Translate("TR_SCREENNAMES_" + i + "PLAYER"));
SelectSlides[_SelectSlidePlayerNumber].Selection = CConfig.NumPlayer - 1; _SelectSlides[_SelectSlidePlayerNumber].Selection = CConfig.NumPlayer - 1;
} }
private void _UpdatePlayerNumber() private void _UpdatePlayerNumber()
{ {
CConfig.NumPlayer = SelectSlides[_SelectSlidePlayerNumber].Selection + 1; CConfig.NumPlayer = _SelectSlides[_SelectSlidePlayerNumber].Selection + 1;
CGame.NumPlayer = SelectSlides[_SelectSlidePlayerNumber].Selection + 1; CGame.NumPlayer = _SelectSlides[_SelectSlidePlayerNumber].Selection + 1;
for (int i = 1; i <= CSettings.MaxNumPlayer; i++) for (int i = 1; i <= CSettings.MaxNumPlayer; i++)
{ {
if (i <= CGame.NumPlayer) if (i <= CGame.NumPlayer)
{ {
Statics["StaticPlayer" + i].Visible = true; _Statics["StaticPlayer" + i].Visible = true;
Statics["StaticPlayerAvatar" + i].Visible = true; _Statics["StaticPlayerAvatar" + i].Visible = true;
Texts["TextPlayer" + i].Visible = true; _Texts["TextPlayer" + i].Visible = true;
if (Texts["TextPlayer" + i].Text.Length == 0) if (_Texts["TextPlayer" + i].Text.Length == 0)
Texts["TextPlayer" + i].Text = CLanguage.Translate("TR_SCREENNAMES_PLAYER") + " " + i.ToString(); _Texts["TextPlayer" + i].Text = CLanguage.Translate("TR_SCREENNAMES_PLAYER") + " " + i;
Equalizers["EqualizerPlayer" + i].Visible = true; _Equalizers["EqualizerPlayer" + i].Visible = true;
if (CGame.GetNumSongs() == 1 && CGame.GetSong(1).IsDuet) if (CGame.GetNumSongs() == 1 && CGame.GetSong(1).IsDuet)
SelectSlides["SelectSlideDuetPlayer" + i].Visible = true; _SelectSlides["SelectSlideDuetPlayer" + i].Visible = true;
} }
else else
{ {
Statics["StaticPlayer" + i].Visible = false; _Statics["StaticPlayer" + i].Visible = false;
Statics["StaticPlayerAvatar" + i].Visible = false; _Statics["StaticPlayerAvatar" + i].Visible = false;
Texts["TextPlayer" + i].Visible = false; _Texts["TextPlayer" + i].Visible = false;
Equalizers["EqualizerPlayer" + i].Visible = false; _Equalizers["EqualizerPlayer" + i].Visible = false;
SelectSlides["SelectSlideDuetPlayer" + i].Visible = false; _SelectSlides["SelectSlideDuetPlayer" + i].Visible = false;
} }
} }
CConfig.SaveConfig(); CConfig.SaveConfig();
@@ -715,8 +705,8 @@ namespace Vocaluxe.Screens
} }
if (playerWithoutMicro.Count > 0) if (playerWithoutMicro.Count > 0)
{ {
Statics[_StaticWarningMics].Visible = true; _Statics[_StaticWarningMics].Visible = true;
Texts[_TextWarningMics].Visible = true; _Texts[_TextWarningMics].Visible = true;
if (playerWithoutMicro.Count > 1) if (playerWithoutMicro.Count > 1)
{ {
@@ -726,20 +716,20 @@ namespace Vocaluxe.Screens
if (playerWithoutMicro.Count - 1 == i) if (playerWithoutMicro.Count - 1 == i)
playerNums += playerWithoutMicro[i].ToString(); playerNums += playerWithoutMicro[i].ToString();
else if (playerWithoutMicro.Count - 2 == i) else if (playerWithoutMicro.Count - 2 == i)
playerNums += playerWithoutMicro[i].ToString() + " " + CLanguage.Translate("TR_GENERAL_AND") + " "; playerNums += playerWithoutMicro[i] + " " + CLanguage.Translate("TR_GENERAL_AND") + " ";
else else
playerNums += playerWithoutMicro[i].ToString() + ", "; playerNums += playerWithoutMicro[i] + ", ";
} }
Texts[_TextWarningMics].Text = CLanguage.Translate("TR_SCREENNAMES_WARNING_MICS_PL").Replace("%v", playerNums); _Texts[_TextWarningMics].Text = CLanguage.Translate("TR_SCREENNAMES_WARNING_MICS_PL").Replace("%v", playerNums);
} }
else else
Texts[_TextWarningMics].Text = CLanguage.Translate("TR_SCREENNAMES_WARNING_MICS_SG").Replace("%v", playerWithoutMicro[0].ToString()); _Texts[_TextWarningMics].Text = CLanguage.Translate("TR_SCREENNAMES_WARNING_MICS_SG").Replace("%v", playerWithoutMicro[0].ToString());
} }
else else
{ {
Statics[_StaticWarningMics].Visible = false; _Statics[_StaticWarningMics].Visible = false;
Texts[_TextWarningMics].Visible = false; _Texts[_TextWarningMics].Visible = false;
} }
} }
@@ -754,8 +744,8 @@ namespace Vocaluxe.Screens
if (playerWithoutProfile.Count > 0) if (playerWithoutProfile.Count > 0)
{ {
Statics[_StaticWarningProfiles].Visible = true; _Statics[_StaticWarningProfiles].Visible = true;
Texts[_TextWarningProfiles].Visible = true; _Texts[_TextWarningProfiles].Visible = true;
if (playerWithoutProfile.Count > 1) if (playerWithoutProfile.Count > 1)
{ {
@@ -765,20 +755,20 @@ namespace Vocaluxe.Screens
if (playerWithoutProfile.Count - 1 == i) if (playerWithoutProfile.Count - 1 == i)
playerNums += playerWithoutProfile[i].ToString(); playerNums += playerWithoutProfile[i].ToString();
else if (playerWithoutProfile.Count - 2 == i) else if (playerWithoutProfile.Count - 2 == i)
playerNums += playerWithoutProfile[i].ToString() + " " + CLanguage.Translate("TR_GENERAL_AND") + " "; playerNums += playerWithoutProfile[i] + " " + CLanguage.Translate("TR_GENERAL_AND") + " ";
else else
playerNums += playerWithoutProfile[i].ToString() + ", "; playerNums += playerWithoutProfile[i] + ", ";
} }
Texts[_TextWarningProfiles].Text = CLanguage.Translate("TR_SCREENNAMES_WARNING_PROFILES_PL").Replace("%v", playerNums); _Texts[_TextWarningProfiles].Text = CLanguage.Translate("TR_SCREENNAMES_WARNING_PROFILES_PL").Replace("%v", playerNums);
} }
else else
Texts[_TextWarningProfiles].Text = CLanguage.Translate("TR_SCREENNAMES_WARNING_PROFILES_SG").Replace("%v", playerWithoutProfile[0].ToString()); _Texts[_TextWarningProfiles].Text = CLanguage.Translate("TR_SCREENNAMES_WARNING_PROFILES_SG").Replace("%v", playerWithoutProfile[0].ToString());
} }
else else
{ {
Statics[_StaticWarningProfiles].Visible = false; _Statics[_StaticWarningProfiles].Visible = false;
Texts[_TextWarningProfiles].Visible = false; _Texts[_TextWarningProfiles].Visible = false;
} }
} }
} }
+13 -13
View File
@@ -65,22 +65,22 @@ namespace Vocaluxe.Screens
break; break;
case Keys.Enter: case Keys.Enter:
if (Buttons[_ButtonOptionsGame].Selected) if (_Buttons[_ButtonOptionsGame].Selected)
CGraphics.FadeTo(EScreens.ScreenOptionsGame); CGraphics.FadeTo(EScreens.ScreenOptionsGame);
if (Buttons[_ButtonOptionsSound].Selected) if (_Buttons[_ButtonOptionsSound].Selected)
CGraphics.FadeTo(EScreens.ScreenOptionsSound); CGraphics.FadeTo(EScreens.ScreenOptionsSound);
if (Buttons[_ButtonOptionsRecord].Selected) if (_Buttons[_ButtonOptionsRecord].Selected)
CGraphics.FadeTo(EScreens.ScreenOptionsRecord); CGraphics.FadeTo(EScreens.ScreenOptionsRecord);
if (Buttons[_ButtonOptionsVideo].Selected) if (_Buttons[_ButtonOptionsVideo].Selected)
CGraphics.FadeTo(EScreens.ScreenOptionsVideo); CGraphics.FadeTo(EScreens.ScreenOptionsVideo);
if (Buttons[_ButtonOptionsLyrics].Selected) if (_Buttons[_ButtonOptionsLyrics].Selected)
CGraphics.FadeTo(EScreens.ScreenOptionsLyrics); CGraphics.FadeTo(EScreens.ScreenOptionsLyrics);
if (Buttons[_ButtonOptionsTheme].Selected) if (_Buttons[_ButtonOptionsTheme].Selected)
CGraphics.FadeTo(EScreens.ScreenOptionsTheme); CGraphics.FadeTo(EScreens.ScreenOptionsTheme);
break; break;
@@ -93,24 +93,24 @@ namespace Vocaluxe.Screens
{ {
base.HandleMouse(mouseEvent); base.HandleMouse(mouseEvent);
if (mouseEvent.LB && IsMouseOver(mouseEvent)) if (mouseEvent.LB && _IsMouseOver(mouseEvent))
{ {
if (Buttons[_ButtonOptionsGame].Selected) if (_Buttons[_ButtonOptionsGame].Selected)
CGraphics.FadeTo(EScreens.ScreenOptionsGame); CGraphics.FadeTo(EScreens.ScreenOptionsGame);
if (Buttons[_ButtonOptionsSound].Selected) if (_Buttons[_ButtonOptionsSound].Selected)
CGraphics.FadeTo(EScreens.ScreenOptionsSound); CGraphics.FadeTo(EScreens.ScreenOptionsSound);
if (Buttons[_ButtonOptionsRecord].Selected) if (_Buttons[_ButtonOptionsRecord].Selected)
CGraphics.FadeTo(EScreens.ScreenOptionsRecord); CGraphics.FadeTo(EScreens.ScreenOptionsRecord);
if (Buttons[_ButtonOptionsVideo].Selected) if (_Buttons[_ButtonOptionsVideo].Selected)
CGraphics.FadeTo(EScreens.ScreenOptionsVideo); CGraphics.FadeTo(EScreens.ScreenOptionsVideo);
if (Buttons[_ButtonOptionsLyrics].Selected) if (_Buttons[_ButtonOptionsLyrics].Selected)
CGraphics.FadeTo(EScreens.ScreenOptionsLyrics); CGraphics.FadeTo(EScreens.ScreenOptionsLyrics);
if (Buttons[_ButtonOptionsTheme].Selected) if (_Buttons[_ButtonOptionsTheme].Selected)
CGraphics.FadeTo(EScreens.ScreenOptionsTheme); CGraphics.FadeTo(EScreens.ScreenOptionsTheme);
} }
+16 -16
View File
@@ -52,14 +52,14 @@ namespace Vocaluxe.Screens
{ {
base.LoadTheme(xmlPath); base.LoadTheme(xmlPath);
SelectSlides[_SelectSlideLanguage].AddValues(CLanguage.GetLanguageNames()); _SelectSlides[_SelectSlideLanguage].AddValues(CLanguage.GetLanguageNames());
SelectSlides[_SelectSlideLanguage].Selection = CLanguage.LanguageId; _SelectSlides[_SelectSlideLanguage].Selection = CLanguage.LanguageId;
SelectSlides[_SelectSlideDebugLevel].SetValues<EDebugLevel>((int)CConfig.DebugLevel); _SelectSlides[_SelectSlideDebugLevel].SetValues<EDebugLevel>((int)CConfig.DebugLevel);
SelectSlides[_SelectSlideSongMenu].SetValues<ESongMenu>((int)CConfig.SongMenu); _SelectSlides[_SelectSlideSongMenu].SetValues<ESongMenu>((int)CConfig.SongMenu);
SelectSlides[_SelectSlideSongSorting].SetValues<ESongSorting>((int)CConfig.SongSorting); _SelectSlides[_SelectSlideSongSorting].SetValues<ESongSorting>((int)CConfig.SongSorting);
SelectSlides[_SelectSlideTabs].SetValues<EOffOn>((int)CConfig.Tabs); _SelectSlides[_SelectSlideTabs].SetValues<EOffOn>((int)CConfig.Tabs);
SelectSlides[_SelectSlideTimerMode].SetValues<ETimerMode>((int)CConfig.TimerMode); _SelectSlides[_SelectSlideTimerMode].SetValues<ETimerMode>((int)CConfig.TimerMode);
} }
public override bool HandleInput(SKeyEvent keyEvent) public override bool HandleInput(SKeyEvent keyEvent)
@@ -82,7 +82,7 @@ namespace Vocaluxe.Screens
break; break;
case Keys.Enter: case Keys.Enter:
if (Buttons[_ButtonExit].Selected) if (_Buttons[_ButtonExit].Selected)
{ {
_SaveConfig(); _SaveConfig();
CGraphics.FadeTo(EScreens.ScreenOptions); CGraphics.FadeTo(EScreens.ScreenOptions);
@@ -111,10 +111,10 @@ namespace Vocaluxe.Screens
CGraphics.FadeTo(EScreens.ScreenOptions); CGraphics.FadeTo(EScreens.ScreenOptions);
} }
if (mouseEvent.LB && IsMouseOver(mouseEvent)) if (mouseEvent.LB && _IsMouseOver(mouseEvent))
{ {
_SaveConfig(); _SaveConfig();
if (Buttons[_ButtonExit].Selected) if (_Buttons[_ButtonExit].Selected)
CGraphics.FadeTo(EScreens.ScreenOptions); CGraphics.FadeTo(EScreens.ScreenOptions);
} }
return true; return true;
@@ -133,13 +133,13 @@ namespace Vocaluxe.Screens
private void _SaveConfig() private void _SaveConfig()
{ {
CLanguage.LanguageId = SelectSlides[_SelectSlideLanguage].Selection; CLanguage.LanguageId = _SelectSlides[_SelectSlideLanguage].Selection;
CConfig.Language = CLanguage.GetLanguageName(CLanguage.LanguageId); CConfig.Language = CLanguage.GetLanguageName(CLanguage.LanguageId);
CConfig.DebugLevel = (EDebugLevel)SelectSlides[_SelectSlideDebugLevel].Selection; CConfig.DebugLevel = (EDebugLevel)_SelectSlides[_SelectSlideDebugLevel].Selection;
CConfig.SongMenu = (ESongMenu)SelectSlides[_SelectSlideSongMenu].Selection; CConfig.SongMenu = (ESongMenu)_SelectSlides[_SelectSlideSongMenu].Selection;
CConfig.SongSorting = (ESongSorting)SelectSlides[_SelectSlideSongSorting].Selection; CConfig.SongSorting = (ESongSorting)_SelectSlides[_SelectSlideSongSorting].Selection;
CConfig.Tabs = (EOffOn)SelectSlides[_SelectSlideTabs].Selection; CConfig.Tabs = (EOffOn)_SelectSlides[_SelectSlideTabs].Selection;
CConfig.TimerMode = (ETimerMode)SelectSlides[_SelectSlideTimerMode].Selection; CConfig.TimerMode = (ETimerMode)_SelectSlides[_SelectSlideTimerMode].Selection;
CConfig.SaveConfig(); CConfig.SaveConfig();
+7 -7
View File
@@ -47,8 +47,8 @@ namespace Vocaluxe.Screens
public override void LoadTheme(string xmlPath) public override void LoadTheme(string xmlPath)
{ {
base.LoadTheme(xmlPath); base.LoadTheme(xmlPath);
SelectSlides[_SelectSlideLyricStyle].SetValues<ELyricStyle>((int)CConfig.LyricStyle); _SelectSlides[_SelectSlideLyricStyle].SetValues<ELyricStyle>((int)CConfig.LyricStyle);
SelectSlides[_SelectSlideLyricsOnTop].SetValues<EOffOn>((int)CConfig.LyricsOnTop); _SelectSlides[_SelectSlideLyricsOnTop].SetValues<EOffOn>((int)CConfig.LyricsOnTop);
} }
public override bool HandleInput(SKeyEvent keyEvent) public override bool HandleInput(SKeyEvent keyEvent)
@@ -72,7 +72,7 @@ namespace Vocaluxe.Screens
break; break;
case Keys.Enter: case Keys.Enter:
if (Buttons[_ButtonExit].Selected) if (_Buttons[_ButtonExit].Selected)
{ {
_SaveConfig(); _SaveConfig();
CGraphics.FadeTo(EScreens.ScreenOptions); CGraphics.FadeTo(EScreens.ScreenOptions);
@@ -100,10 +100,10 @@ namespace Vocaluxe.Screens
_SaveConfig(); _SaveConfig();
CGraphics.FadeTo(EScreens.ScreenOptions); CGraphics.FadeTo(EScreens.ScreenOptions);
} }
if (mouseEvent.LB && IsMouseOver(mouseEvent)) if (mouseEvent.LB && _IsMouseOver(mouseEvent))
{ {
_SaveConfig(); _SaveConfig();
if (Buttons[_ButtonExit].Selected) if (_Buttons[_ButtonExit].Selected)
CGraphics.FadeTo(EScreens.ScreenOptions); CGraphics.FadeTo(EScreens.ScreenOptions);
} }
return true; return true;
@@ -122,8 +122,8 @@ namespace Vocaluxe.Screens
private void _SaveConfig() private void _SaveConfig()
{ {
CConfig.LyricsOnTop = (EOffOn)SelectSlides[_SelectSlideLyricsOnTop].Selection; CConfig.LyricsOnTop = (EOffOn)_SelectSlides[_SelectSlideLyricsOnTop].Selection;
CConfig.LyricStyle = (ELyricStyle)SelectSlides[_SelectSlideLyricStyle].Selection; CConfig.LyricStyle = (ELyricStyle)_SelectSlides[_SelectSlideLyricStyle].Selection;
CConfig.SaveConfig(); CConfig.SaveConfig();
} }
} }
+79 -79
View File
@@ -94,31 +94,31 @@ namespace Vocaluxe.Screens
if (max > 7) if (max > 7)
max = 7; max = 7;
SelectSlides[_SelectSlideRecordChannel1].NumVisible = max; _SelectSlides[_SelectSlideRecordChannel1].NumVisible = max;
SelectSlides[_SelectSlideRecordChannel2].NumVisible = max; _SelectSlides[_SelectSlideRecordChannel2].NumVisible = max;
SelectSlides[_SelectSlideRecordChannel1].AddValue(CLanguage.Translate("TR_CONFIG_OFF")); _SelectSlides[_SelectSlideRecordChannel1].AddValue(CLanguage.Translate("TR_CONFIG_OFF"));
SelectSlides[_SelectSlideRecordChannel2].AddValue(CLanguage.Translate("TR_CONFIG_OFF")); _SelectSlides[_SelectSlideRecordChannel2].AddValue(CLanguage.Translate("TR_CONFIG_OFF"));
for (int i = 1; i <= CSettings.MaxNumPlayer; i++) for (int i = 1; i <= CSettings.MaxNumPlayer; i++)
{ {
SelectSlides[_SelectSlideRecordChannel1].AddValue(i.ToString()); _SelectSlides[_SelectSlideRecordChannel1].AddValue(i.ToString());
SelectSlides[_SelectSlideRecordChannel2].AddValue(i.ToString()); _SelectSlides[_SelectSlideRecordChannel2].AddValue(i.ToString());
} }
for (int i = 0; i < 26; i++) for (int i = 0; i < 26; i++)
SelectSlides[_SelectSlideDelay].AddValue((i * 20).ToString() + " ms"); _SelectSlides[_SelectSlideDelay].AddValue((i * 20) + " ms");
_ChannelEnergy = new float[_StaticEnergyChannel.Length]; _ChannelEnergy = new float[_StaticEnergyChannel.Length];
for (int i = 0; i < _ChannelEnergy.Length; i++) for (int i = 0; i < _ChannelEnergy.Length; i++)
{ {
Statics[_StaticEnergyChannel[i]].Visible = false; _Statics[_StaticEnergyChannel[i]].Visible = false;
_ChannelEnergy[i] = 0f; _ChannelEnergy[i] = 0f;
} }
Equalizers[_EqualizerChannel1].ScreenHandles = true; _Equalizers[_EqualizerChannel1].ScreenHandles = true;
Equalizers[_EqualizerChannel2].ScreenHandles = true; _Equalizers[_EqualizerChannel2].ScreenHandles = true;
} }
public override bool HandleInput(SKeyEvent keyEvent) public override bool HandleInput(SKeyEvent keyEvent)
@@ -142,13 +142,13 @@ namespace Vocaluxe.Screens
break; break;
case Keys.Enter: case Keys.Enter:
if (Buttons[_ButtonExit].Selected) if (_Buttons[_ButtonExit].Selected)
{ {
_SaveMicConfig(); _SaveMicConfig();
CGraphics.FadeTo(EScreens.ScreenOptions); CGraphics.FadeTo(EScreens.ScreenOptions);
} }
if (Buttons[_ButtonDelayTest].Selected) if (_Buttons[_ButtonDelayTest].Selected)
_TestDelay(); _TestDelay();
break; break;
@@ -158,32 +158,32 @@ namespace Vocaluxe.Screens
break; break;
case Keys.Left: case Keys.Left:
if (SelectSlides[_SelectSlideRecordDevices].Selected) if (_SelectSlides[_SelectSlideRecordDevices].Selected)
_OnDeviceEvent(); _OnDeviceEvent();
if (SelectSlides[_SelectSlideRecordInputs].Selected) if (_SelectSlides[_SelectSlideRecordInputs].Selected)
_OnInputEvent(); _OnInputEvent();
if (SelectSlides[_SelectSlideRecordChannel1].Selected || if (_SelectSlides[_SelectSlideRecordChannel1].Selected ||
SelectSlides[_SelectSlideRecordChannel2].Selected) _SelectSlides[_SelectSlideRecordChannel2].Selected)
_SetMicConfig(); _SetMicConfig();
if (SelectSlides[_SelectSlideDelay].Selected) if (_SelectSlides[_SelectSlideDelay].Selected)
_SaveDelayConfig(); _SaveDelayConfig();
break; break;
case Keys.Right: case Keys.Right:
if (SelectSlides[_SelectSlideRecordDevices].Selected) if (_SelectSlides[_SelectSlideRecordDevices].Selected)
_OnDeviceEvent(); _OnDeviceEvent();
if (SelectSlides[_SelectSlideRecordInputs].Selected) if (_SelectSlides[_SelectSlideRecordInputs].Selected)
_OnInputEvent(); _OnInputEvent();
if (SelectSlides[_SelectSlideRecordChannel1].Selected || if (_SelectSlides[_SelectSlideRecordChannel1].Selected ||
SelectSlides[_SelectSlideRecordChannel2].Selected) _SelectSlides[_SelectSlideRecordChannel2].Selected)
_SetMicConfig(); _SetMicConfig();
if (SelectSlides[_SelectSlideDelay].Selected) if (_SelectSlides[_SelectSlideDelay].Selected)
_SaveDelayConfig(); _SaveDelayConfig();
break; break;
} }
@@ -201,28 +201,28 @@ namespace Vocaluxe.Screens
CGraphics.FadeTo(EScreens.ScreenOptions); CGraphics.FadeTo(EScreens.ScreenOptions);
} }
if (mouseEvent.LB && IsMouseOver(mouseEvent)) if (mouseEvent.LB && _IsMouseOver(mouseEvent))
{ {
if (SelectSlides[_SelectSlideRecordDevices].Selected) if (_SelectSlides[_SelectSlideRecordDevices].Selected)
_OnDeviceEvent(); _OnDeviceEvent();
if (SelectSlides[_SelectSlideRecordInputs].Selected) if (_SelectSlides[_SelectSlideRecordInputs].Selected)
_OnInputEvent(); _OnInputEvent();
if (SelectSlides[_SelectSlideRecordChannel1].Selected || if (_SelectSlides[_SelectSlideRecordChannel1].Selected ||
SelectSlides[_SelectSlideRecordChannel2].Selected) _SelectSlides[_SelectSlideRecordChannel2].Selected)
_SetMicConfig(); _SetMicConfig();
if (SelectSlides[_SelectSlideDelay].Selected) if (_SelectSlides[_SelectSlideDelay].Selected)
_SaveDelayConfig(); _SaveDelayConfig();
if (Buttons[_ButtonExit].Selected) if (_Buttons[_ButtonExit].Selected)
{ {
_SaveMicConfig(); _SaveMicConfig();
CGraphics.FadeTo(EScreens.ScreenOptions); CGraphics.FadeTo(EScreens.ScreenOptions);
} }
if (Buttons[_ButtonDelayTest].Selected) if (_Buttons[_ButtonDelayTest].Selected)
_TestDelay(); _TestDelay();
} }
return true; return true;
@@ -249,10 +249,10 @@ namespace Vocaluxe.Screens
{ {
int player = 0; int player = 0;
if (i == 0) if (i == 0)
player = SelectSlides[_SelectSlideRecordChannel1].Selection; player = _SelectSlides[_SelectSlideRecordChannel1].Selection;
if (i == 1) if (i == 1)
player = SelectSlides[_SelectSlideRecordChannel2].Selection; player = _SelectSlides[_SelectSlideRecordChannel2].Selection;
if (_DelayTest[i].Timer.ElapsedMilliseconds > _MaxDelayTime * 1000f || player == 0) if (_DelayTest[i].Timer.ElapsedMilliseconds > _MaxDelayTime * 1000f || player == 0)
{ {
@@ -269,39 +269,39 @@ namespace Vocaluxe.Screens
} }
} }
} }
Texts[_TextDelayChannel1].Text = _DelayTest[0].Delay.ToString("000") + " ms"; _Texts[_TextDelayChannel1].Text = _DelayTest[0].Delay.ToString("000") + " ms";
Texts[_TextDelayChannel2].Text = _DelayTest[1].Delay.ToString("000") + " ms"; _Texts[_TextDelayChannel2].Text = _DelayTest[1].Delay.ToString("000") + " ms";
} }
if (_CheckMicConfig()) if (_CheckMicConfig())
{ {
_ChannelEnergy[0] = 0f; _ChannelEnergy[0] = 0f;
int player = SelectSlides[_SelectSlideRecordChannel1].Selection; int player = _SelectSlides[_SelectSlideRecordChannel1].Selection;
if (player > 0) if (player > 0)
{ {
_ChannelEnergy[0] = CSound.RecordGetMaxVolume(player - 1); _ChannelEnergy[0] = CSound.RecordGetMaxVolume(player - 1);
Equalizers[_EqualizerChannel1].Update(CSound.ToneWeigth(player - 1)); _Equalizers[_EqualizerChannel1].Update(CSound.ToneWeigth(player - 1));
} }
else else
Equalizers[_EqualizerChannel1].Reset(); _Equalizers[_EqualizerChannel1].Reset();
_ChannelEnergy[1] = 0f; _ChannelEnergy[1] = 0f;
player = SelectSlides[_SelectSlideRecordChannel2].Selection; player = _SelectSlides[_SelectSlideRecordChannel2].Selection;
if (player > 0) if (player > 0)
{ {
_ChannelEnergy[1] = CSound.RecordGetMaxVolume(player - 1); _ChannelEnergy[1] = CSound.RecordGetMaxVolume(player - 1);
Equalizers[_EqualizerChannel2].Update(CSound.ToneWeigth(player - 1)); _Equalizers[_EqualizerChannel2].Update(CSound.ToneWeigth(player - 1));
} }
else else
Equalizers[_EqualizerChannel2].Reset(); _Equalizers[_EqualizerChannel2].Reset();
} }
else else
{ {
for (int i = 0; i < _ChannelEnergy.Length; i++) for (int i = 0; i < _ChannelEnergy.Length; i++)
_ChannelEnergy[i] = 0f; _ChannelEnergy[i] = 0f;
Equalizers[_EqualizerChannel1].Reset(); _Equalizers[_EqualizerChannel1].Reset();
Equalizers[_EqualizerChannel2].Reset(); _Equalizers[_EqualizerChannel2].Reset();
} }
return true; return true;
@@ -311,8 +311,8 @@ namespace Vocaluxe.Screens
{ {
base.OnShow(); base.OnShow();
SelectSlides[_SelectSlideRecordDevices].Clear(); _SelectSlides[_SelectSlideRecordDevices].Clear();
SelectSlides[_SelectSlideRecordInputs].Clear(); _SelectSlides[_SelectSlideRecordInputs].Clear();
for (int i = 0; i < _ChannelEnergy.Length; i++) for (int i = 0; i < _ChannelEnergy.Length; i++)
_ChannelEnergy[i] = 0f; _ChannelEnergy[i] = 0f;
@@ -328,20 +328,20 @@ namespace Vocaluxe.Screens
_GetFirstConfiguredRecordDevice(ref _DeviceNr, ref _InputNr); _GetFirstConfiguredRecordDevice(ref _DeviceNr, ref _InputNr);
for (int dev = 0; dev < _Devices.Length; dev++) for (int dev = 0; dev < _Devices.Length; dev++)
SelectSlides[_SelectSlideRecordDevices].AddValue(_Devices[dev].Name); _SelectSlides[_SelectSlideRecordDevices].AddValue(_Devices[dev].Name);
SelectSlides[_SelectSlideRecordDevices].Selection = _DeviceNr; _SelectSlides[_SelectSlideRecordDevices].Selection = _DeviceNr;
for (int inp = 0; inp < _Devices[0].Inputs.Count; inp++) for (int inp = 0; inp < _Devices[0].Inputs.Count; inp++)
SelectSlides[_SelectSlideRecordInputs].AddValue(_Devices[0].Inputs[inp].Name); _SelectSlides[_SelectSlideRecordInputs].AddValue(_Devices[0].Inputs[inp].Name);
SelectSlides[_SelectSlideRecordInputs].Selection = _InputNr; _SelectSlides[_SelectSlideRecordInputs].Selection = _InputNr;
_UpdateChannels(); _UpdateChannels();
} }
SelectSlides[_SelectSlideRecordChannel1].Visible = _Devices != null; _SelectSlides[_SelectSlideRecordChannel1].Visible = _Devices != null;
SelectSlides[_SelectSlideRecordChannel2].Visible = _Devices != null; _SelectSlides[_SelectSlideRecordChannel2].Visible = _Devices != null;
Statics[_StaticWarning].Visible = false; _Statics[_StaticWarning].Visible = false;
Texts[_TextWarning].Visible = false; _Texts[_TextWarning].Visible = false;
_DelayTest = null; _DelayTest = null;
if (_Devices != null) if (_Devices != null)
@@ -354,7 +354,7 @@ namespace Vocaluxe.Screens
} }
} }
SelectSlides[_SelectSlideDelay].Selection = CConfig.MicDelay / 20; _SelectSlides[_SelectSlideDelay].Selection = CConfig.MicDelay / 20;
_DelayTestRunning = false; _DelayTestRunning = false;
_DelaySound = -1; _DelaySound = -1;
@@ -368,38 +368,38 @@ namespace Vocaluxe.Screens
public override bool Draw() public override bool Draw()
{ {
DrawBG(); _DrawBG();
if (!_CheckMicConfig()) if (!_CheckMicConfig())
{ {
Statics[_StaticWarning].Visible = true; _Statics[_StaticWarning].Visible = true;
Texts[_TextWarning].Visible = true; _Texts[_TextWarning].Visible = true;
} }
else else
{ {
Statics[_StaticWarning].Visible = false; _Statics[_StaticWarning].Visible = false;
Texts[_TextWarning].Visible = false; _Texts[_TextWarning].Visible = false;
} }
for (int i = 0; i < _StaticEnergyChannel.Length; i++) for (int i = 0; i < _StaticEnergyChannel.Length; i++)
{ {
if (_ChannelEnergy[i] > 0f) if (_ChannelEnergy[i] > 0f)
{ {
SRectF rect = new SRectF(Statics[_StaticEnergyChannel[i]].Rect.X, SRectF rect = new SRectF(_Statics[_StaticEnergyChannel[i]].Rect.X,
Statics[_StaticEnergyChannel[i]].Rect.Y, _Statics[_StaticEnergyChannel[i]].Rect.Y,
Statics[_StaticEnergyChannel[i]].Rect.W * _ChannelEnergy[i], _Statics[_StaticEnergyChannel[i]].Rect.W * _ChannelEnergy[i],
Statics[_StaticEnergyChannel[i]].Rect.H, _Statics[_StaticEnergyChannel[i]].Rect.H,
Statics[_StaticEnergyChannel[i]].Rect.Z); _Statics[_StaticEnergyChannel[i]].Rect.Z);
CDraw.DrawTexture(Statics[_StaticEnergyChannel[i]].Texture, Statics[_StaticEnergyChannel[i]].Rect, CDraw.DrawTexture(_Statics[_StaticEnergyChannel[i]].Texture, _Statics[_StaticEnergyChannel[i]].Rect,
new SColorF(1f, 1f, 1f, 1f), rect); new SColorF(1f, 1f, 1f, 1f), rect);
} }
} }
Equalizers[_EqualizerChannel1].Draw(); _Equalizers[_EqualizerChannel1].Draw();
Equalizers[_EqualizerChannel2].Draw(); _Equalizers[_EqualizerChannel2].Draw();
DrawFG(); _DrawFG();
return true; return true;
} }
@@ -415,25 +415,25 @@ namespace Vocaluxe.Screens
private void _OnDeviceEvent() private void _OnDeviceEvent()
{ {
if (SelectSlides[_SelectSlideRecordDevices].Selection != _DeviceNr) if (_SelectSlides[_SelectSlideRecordDevices].Selection != _DeviceNr)
{ {
SelectSlides[_SelectSlideRecordInputs].Clear(); _SelectSlides[_SelectSlideRecordInputs].Clear();
_DeviceNr = SelectSlides[_SelectSlideRecordDevices].Selection; _DeviceNr = _SelectSlides[_SelectSlideRecordDevices].Selection;
_InputNr = 0; _InputNr = 0;
for (int inp = 0; inp < _Devices[_DeviceNr].Inputs.Count; inp++) for (int inp = 0; inp < _Devices[_DeviceNr].Inputs.Count; inp++)
SelectSlides[_SelectSlideRecordInputs].AddValue(_Devices[_DeviceNr].Inputs[inp].Name); _SelectSlides[_SelectSlideRecordInputs].AddValue(_Devices[_DeviceNr].Inputs[inp].Name);
_InputNr = 0; _InputNr = 0;
SelectSlides[_SelectSlideRecordInputs].Selection = 0; _SelectSlides[_SelectSlideRecordInputs].Selection = 0;
_UpdateChannels(); _UpdateChannels();
} }
} }
private void _OnInputEvent() private void _OnInputEvent()
{ {
if (SelectSlides[_SelectSlideRecordInputs].Selection != _InputNr) if (_SelectSlides[_SelectSlideRecordInputs].Selection != _InputNr)
{ {
_InputNr = SelectSlides[_SelectSlideRecordInputs].Selection; _InputNr = _SelectSlides[_SelectSlideRecordInputs].Selection;
_UpdateChannels(); _UpdateChannels();
} }
@@ -441,7 +441,7 @@ namespace Vocaluxe.Screens
private void _SaveDelayConfig() private void _SaveDelayConfig()
{ {
CConfig.MicDelay = SelectSlides[_SelectSlideDelay].Selection * 20; CConfig.MicDelay = _SelectSlides[_SelectSlideDelay].Selection * 20;
CConfig.SaveConfig(); CConfig.SaveConfig();
} }
@@ -489,15 +489,15 @@ namespace Vocaluxe.Screens
if (_DeviceNr < 0) if (_DeviceNr < 0)
return; return;
SInput input = _Devices[_DeviceNr].Inputs[_InputNr]; SInput input = _Devices[_DeviceNr].Inputs[_InputNr];
input.PlayerChannel1 = SelectSlides[_SelectSlideRecordChannel1].Selection; input.PlayerChannel1 = _SelectSlides[_SelectSlideRecordChannel1].Selection;
input.PlayerChannel2 = SelectSlides[_SelectSlideRecordChannel2].Selection; input.PlayerChannel2 = _SelectSlides[_SelectSlideRecordChannel2].Selection;
_Devices[_DeviceNr].Inputs[_InputNr] = input; _Devices[_DeviceNr].Inputs[_InputNr] = input;
} }
private void _UpdateChannels() private void _UpdateChannels()
{ {
SelectSlides[_SelectSlideRecordChannel1].Selection = _Devices[_DeviceNr].Inputs[_InputNr].PlayerChannel1; _SelectSlides[_SelectSlideRecordChannel1].Selection = _Devices[_DeviceNr].Inputs[_InputNr].PlayerChannel1;
SelectSlides[_SelectSlideRecordChannel2].Selection = _Devices[_DeviceNr].Inputs[_InputNr].PlayerChannel2; _SelectSlides[_SelectSlideRecordChannel2].Selection = _Devices[_DeviceNr].Inputs[_InputNr].PlayerChannel2;
_SaveMicConfig(); _SaveMicConfig();
} }
+20 -20
View File
@@ -54,18 +54,18 @@ namespace Vocaluxe.Screens
public override void LoadTheme(string xmlPath) public override void LoadTheme(string xmlPath)
{ {
base.LoadTheme(xmlPath); base.LoadTheme(xmlPath);
SelectSlides[_SelectSlideBackgroundMusic].SetValues<EOffOn>((int)CConfig.BackgroundMusic); _SelectSlides[_SelectSlideBackgroundMusic].SetValues<EOffOn>((int)CConfig.BackgroundMusic);
SelectSlides[_SelectSlideBackgroundMusicVolume].AddValues(new string[] _SelectSlides[_SelectSlideBackgroundMusicVolume].AddValues(new string[]
{"0", "5", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55", "60", "65", "70", "75", "80", "85", "90", "95", "100"}); {"0", "5", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55", "60", "65", "70", "75", "80", "85", "90", "95", "100"});
SelectSlides[_SelectSlideBackgroundMusicVolume].Selection = CConfig.BackgroundMusicVolume / 5; _SelectSlides[_SelectSlideBackgroundMusicVolume].Selection = CConfig.BackgroundMusicVolume / 5;
SelectSlides[_SelectSlideBackgroundMusicSource].SetValues<EBackgroundMusicSource>((int)CConfig.BackgroundMusicSource); _SelectSlides[_SelectSlideBackgroundMusicSource].SetValues<EBackgroundMusicSource>((int)CConfig.BackgroundMusicSource);
SelectSlides[_SelectSlideBackgroundMusicSource].Selection = (int)CConfig.BackgroundMusicSource; _SelectSlides[_SelectSlideBackgroundMusicSource].Selection = (int)CConfig.BackgroundMusicSource;
SelectSlides[_SelectSlidePreviewMusicVolume].AddValues(new string[] _SelectSlides[_SelectSlidePreviewMusicVolume].AddValues(new string[]
{"0", "5", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55", "60", "65", "70", "75", "80", "85", "90", "95", "100"}); {"0", "5", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55", "60", "65", "70", "75", "80", "85", "90", "95", "100"});
SelectSlides[_SelectSlidePreviewMusicVolume].Selection = CConfig.PreviewMusicVolume / 5; _SelectSlides[_SelectSlidePreviewMusicVolume].Selection = CConfig.PreviewMusicVolume / 5;
SelectSlides[_SelectSlideGameMusicVolume].AddValues(new string[] _SelectSlides[_SelectSlideGameMusicVolume].AddValues(new string[]
{"0", "5", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55", "60", "65", "70", "75", "80", "85", "90", "95", "100"}); {"0", "5", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55", "60", "65", "70", "75", "80", "85", "90", "95", "100"});
SelectSlides[_SelectSlideGameMusicVolume].Selection = CConfig.GameMusicVolume / 5; _SelectSlides[_SelectSlideGameMusicVolume].Selection = CConfig.GameMusicVolume / 5;
} }
public override bool HandleInput(SKeyEvent keyEvent) public override bool HandleInput(SKeyEvent keyEvent)
@@ -89,7 +89,7 @@ namespace Vocaluxe.Screens
break; break;
case Keys.Enter: case Keys.Enter:
if (Buttons[_ButtonExit].Selected) if (_Buttons[_ButtonExit].Selected)
{ {
_SaveConfig(); _SaveConfig();
CGraphics.FadeTo(EScreens.ScreenOptions); CGraphics.FadeTo(EScreens.ScreenOptions);
@@ -117,10 +117,10 @@ namespace Vocaluxe.Screens
_SaveConfig(); _SaveConfig();
CGraphics.FadeTo(EScreens.ScreenOptions); CGraphics.FadeTo(EScreens.ScreenOptions);
} }
if (mouseEvent.LB && IsMouseOver(mouseEvent)) if (mouseEvent.LB && _IsMouseOver(mouseEvent))
{ {
_SaveConfig(); _SaveConfig();
if (Buttons[_ButtonExit].Selected) if (_Buttons[_ButtonExit].Selected)
CGraphics.FadeTo(EScreens.ScreenOptions); CGraphics.FadeTo(EScreens.ScreenOptions);
} }
return true; return true;
@@ -129,7 +129,7 @@ namespace Vocaluxe.Screens
public override bool UpdateGame() public override bool UpdateGame()
{ {
if (_BackgroundMusicVolume != CConfig.BackgroundMusicVolume) if (_BackgroundMusicVolume != CConfig.BackgroundMusicVolume)
SelectSlides[_SelectSlideBackgroundMusicVolume].Selection = CConfig.BackgroundMusicVolume / 5; _SelectSlides[_SelectSlideBackgroundMusicVolume].Selection = CConfig.BackgroundMusicVolume / 5;
return true; return true;
} }
@@ -145,19 +145,19 @@ namespace Vocaluxe.Screens
_BackgroundMusic = CConfig.BackgroundMusic; _BackgroundMusic = CConfig.BackgroundMusic;
_BackgroundMusicVolume = CConfig.BackgroundMusicVolume; _BackgroundMusicVolume = CConfig.BackgroundMusicVolume;
SelectSlides[_SelectSlideGameMusicVolume].Selection = CConfig.GameMusicVolume / 5; _SelectSlides[_SelectSlideGameMusicVolume].Selection = CConfig.GameMusicVolume / 5;
SelectSlides[_SelectSlidePreviewMusicVolume].Selection = CConfig.PreviewMusicVolume / 5; _SelectSlides[_SelectSlidePreviewMusicVolume].Selection = CConfig.PreviewMusicVolume / 5;
} }
private void _SaveConfig() private void _SaveConfig()
{ {
CConfig.GameMusicVolume = SelectSlides[_SelectSlideGameMusicVolume].Selection * 5; CConfig.GameMusicVolume = _SelectSlides[_SelectSlideGameMusicVolume].Selection * 5;
CConfig.PreviewMusicVolume = SelectSlides[_SelectSlidePreviewMusicVolume].Selection * 5; CConfig.PreviewMusicVolume = _SelectSlides[_SelectSlidePreviewMusicVolume].Selection * 5;
CConfig.SaveConfig(); CConfig.SaveConfig();
EOffOn newOffOn = (EOffOn)SelectSlides[_SelectSlideBackgroundMusic].Selection; EOffOn newOffOn = (EOffOn)_SelectSlides[_SelectSlideBackgroundMusic].Selection;
EBackgroundMusicSource newSource = (EBackgroundMusicSource)SelectSlides[_SelectSlideBackgroundMusicSource].Selection; EBackgroundMusicSource newSource = (EBackgroundMusicSource)_SelectSlides[_SelectSlideBackgroundMusicSource].Selection;
float newVolume = SelectSlides[_SelectSlideBackgroundMusicVolume].Selection * 5; float newVolume = _SelectSlides[_SelectSlideBackgroundMusicVolume].Selection * 5;
CBackgroundMusic.CheckAndApplyConfig(newOffOn, newSource, newVolume); CBackgroundMusic.CheckAndApplyConfig(newOffOn, newSource, newVolume);
} }
+31 -32
View File
@@ -71,19 +71,19 @@ namespace Vocaluxe.Screens
{ {
base.LoadTheme(xmlPath); base.LoadTheme(xmlPath);
SelectSlides[_SelectSlideTheme].AddValues(CTheme.ThemeNames); _SelectSlides[_SelectSlideTheme].AddValues(CTheme.ThemeNames);
SelectSlides[_SelectSlideTheme].Selection = CTheme.GetThemeIndex(-1); _SelectSlides[_SelectSlideTheme].Selection = CTheme.GetThemeIndex(-1);
SelectSlides[_SelectSlideSkin].AddValues(CTheme.SkinNames); _SelectSlides[_SelectSlideSkin].AddValues(CTheme.SkinNames);
SelectSlides[_SelectSlideSkin].Selection = CTheme.GetSkinIndex(-1); _SelectSlides[_SelectSlideSkin].Selection = CTheme.GetSkinIndex(-1);
SelectSlides[_SelectSlideCover].AddValues(CCover.CoverThemes); _SelectSlides[_SelectSlideCover].AddValues(CCover.CoverThemes);
SelectSlides[_SelectSlideCover].Selection = CCover.GetCoverThemeIndex(); _SelectSlides[_SelectSlideCover].Selection = CCover.GetCoverThemeIndex();
SelectSlides[_SelectSlideNoteLines].SetValues<EOffOn>((int)CConfig.DrawNoteLines); _SelectSlides[_SelectSlideNoteLines].SetValues<EOffOn>((int)CConfig.DrawNoteLines);
SelectSlides[_SelectSlideToneHelper].SetValues<EOffOn>((int)CConfig.DrawToneHelper); _SelectSlides[_SelectSlideToneHelper].SetValues<EOffOn>((int)CConfig.DrawToneHelper);
SelectSlides[_SelectSlideTimerLook].SetValues<ETimerLook>((int)CConfig.TimerLook); _SelectSlides[_SelectSlideTimerLook].SetValues<ETimerLook>((int)CConfig.TimerLook);
SelectSlides[_SelectSlideFadeInfo].SetValues<EFadePlayerInfo>((int)CConfig.FadePlayerInfo); _SelectSlides[_SelectSlideFadeInfo].SetValues<EFadePlayerInfo>((int)CConfig.FadePlayerInfo);
SelectSlides[_SelectSlideCoverLoading].SetValues<ECoverLoading>((int)CConfig.CoverLoading); _SelectSlides[_SelectSlideCoverLoading].SetValues<ECoverLoading>((int)CConfig.CoverLoading);
} }
public override bool HandleInput(SKeyEvent keyEvent) public override bool HandleInput(SKeyEvent keyEvent)
@@ -106,7 +106,7 @@ namespace Vocaluxe.Screens
break; break;
case Keys.Enter: case Keys.Enter:
if (Buttons[_ButtonExit].Selected) if (_Buttons[_ButtonExit].Selected)
_Close(); _Close();
break; break;
@@ -129,9 +129,9 @@ namespace Vocaluxe.Screens
if (mouseEvent.RB) if (mouseEvent.RB)
_Close(); _Close();
if (mouseEvent.LB && IsMouseOver(mouseEvent)) if (mouseEvent.LB && _IsMouseOver(mouseEvent))
{ {
if (Buttons[_ButtonExit].Selected) if (_Buttons[_ButtonExit].Selected)
_Close(); _Close();
else else
_OnChange(); _OnChange();
@@ -168,18 +168,18 @@ namespace Vocaluxe.Screens
private void _SaveConfig() private void _SaveConfig()
{ {
CConfig.Theme = CTheme.ThemeNames[SelectSlides[_SelectSlideTheme].Selection]; CConfig.Theme = CTheme.ThemeNames[_SelectSlides[_SelectSlideTheme].Selection];
CConfig.Skin = CTheme.SkinNames[SelectSlides[_SelectSlideSkin].Selection]; CConfig.Skin = CTheme.SkinNames[_SelectSlides[_SelectSlideSkin].Selection];
CConfig.CoverTheme = CCover.CoverThemes[SelectSlides[_SelectSlideCover].Selection]; CConfig.CoverTheme = CCover.CoverThemes[_SelectSlides[_SelectSlideCover].Selection];
CConfig.DrawNoteLines = (EOffOn)SelectSlides[_SelectSlideNoteLines].Selection; CConfig.DrawNoteLines = (EOffOn)_SelectSlides[_SelectSlideNoteLines].Selection;
CConfig.DrawToneHelper = (EOffOn)SelectSlides[_SelectSlideToneHelper].Selection; CConfig.DrawToneHelper = (EOffOn)_SelectSlides[_SelectSlideToneHelper].Selection;
CConfig.TimerLook = (ETimerLook)SelectSlides[_SelectSlideTimerLook].Selection; CConfig.TimerLook = (ETimerLook)_SelectSlides[_SelectSlideTimerLook].Selection;
CConfig.FadePlayerInfo = (EFadePlayerInfo)SelectSlides[_SelectSlideFadeInfo].Selection; CConfig.FadePlayerInfo = (EFadePlayerInfo)_SelectSlides[_SelectSlideFadeInfo].Selection;
CConfig.CoverLoading = (ECoverLoading)SelectSlides[_SelectSlideCoverLoading].Selection; CConfig.CoverLoading = (ECoverLoading)_SelectSlides[_SelectSlideCoverLoading].Selection;
CConfig.SaveConfig(); CConfig.SaveConfig();
if (_OldCoverTheme != SelectSlides[_SelectSlideCover].Selection) if (_OldCoverTheme != _SelectSlides[_SelectSlideCover].Selection)
{ {
CCover.ReloadCover(); CCover.ReloadCover();
CSongs.Filter.SearchString = String.Empty; CSongs.Filter.SearchString = String.Empty;
@@ -187,10 +187,10 @@ namespace Vocaluxe.Screens
CSongs.Categorizer.Tabs = CConfig.Tabs; CSongs.Categorizer.Tabs = CConfig.Tabs;
} }
if (_OldTheme != SelectSlides[_SelectSlideTheme].Selection) if (_OldTheme != _SelectSlides[_SelectSlideTheme].Selection)
{ {
CConfig.Theme = CTheme.ThemeNames[SelectSlides[_SelectSlideTheme].Selection]; CConfig.Theme = CTheme.ThemeNames[_SelectSlides[_SelectSlideTheme].Selection];
_OldTheme = SelectSlides[_SelectSlideTheme].Selection; _OldTheme = _SelectSlides[_SelectSlideTheme].Selection;
CTheme.UnloadSkins(); CTheme.UnloadSkins();
CFonts.UnloadThemeFonts(CConfig.Theme); CFonts.UnloadThemeFonts(CConfig.Theme);
@@ -204,16 +204,15 @@ namespace Vocaluxe.Screens
CTheme.LoadSkins(); CTheme.LoadSkins();
CTheme.LoadTheme(); CTheme.LoadTheme();
CGraphics.ReloadTheme(); CGraphics.ReloadTheme();
return;
} }
} }
private void _OnChange() private void _OnChange()
{ {
if (_OldTheme != SelectSlides[_SelectSlideTheme].Selection) if (_OldTheme != _SelectSlides[_SelectSlideTheme].Selection)
{ {
CConfig.Theme = CTheme.ThemeNames[SelectSlides[_SelectSlideTheme].Selection]; CConfig.Theme = CTheme.ThemeNames[_SelectSlides[_SelectSlideTheme].Selection];
_OldTheme = SelectSlides[_SelectSlideTheme].Selection; _OldTheme = _SelectSlides[_SelectSlideTheme].Selection;
CTheme.UnloadSkins(); CTheme.UnloadSkins();
CFonts.UnloadThemeFonts(CConfig.Theme); CFonts.UnloadThemeFonts(CConfig.Theme);
@@ -233,9 +232,9 @@ namespace Vocaluxe.Screens
return; return;
} }
if (_TempSkin != SelectSlides[_SelectSlideSkin].Selection) if (_TempSkin != _SelectSlides[_SelectSlideSkin].Selection)
{ {
_TempSkin = SelectSlides[_SelectSlideSkin].Selection; _TempSkin = _SelectSlides[_SelectSlideSkin].Selection;
_PauseBG(); _PauseBG();
CConfig.Skin = CTheme.SkinNames[_TempSkin]; CConfig.Skin = CTheme.SkinNames[_TempSkin];
+48 -48
View File
@@ -66,10 +66,10 @@ namespace Vocaluxe.Screens
{ {
base.LoadTheme(xmlPath); base.LoadTheme(xmlPath);
SelectSlides[_SelectSlideVideoBackgrounds].SetValues<EOffOn>((int)CConfig.VideoBackgrounds); _SelectSlides[_SelectSlideVideoBackgrounds].SetValues<EOffOn>((int)CConfig.VideoBackgrounds);
SelectSlides[_SelectSlideVideoPreview].SetValues<EOffOn>((int)CConfig.VideoPreview); _SelectSlides[_SelectSlideVideoPreview].SetValues<EOffOn>((int)CConfig.VideoPreview);
SelectSlides[_SelectSlideVideosInSongs].SetValues<EOffOn>((int)CConfig.VideosInSongs); _SelectSlides[_SelectSlideVideosInSongs].SetValues<EOffOn>((int)CConfig.VideosInSongs);
SelectSlides[_SelectSlideVideosToBackground].SetValues<EOffOn>((int)CConfig.VideosToBackground); _SelectSlides[_SelectSlideVideosToBackground].SetValues<EOffOn>((int)CConfig.VideosToBackground);
} }
public override bool HandleInput(SKeyEvent keyEvent) public override bool HandleInput(SKeyEvent keyEvent)
@@ -93,7 +93,7 @@ namespace Vocaluxe.Screens
break; break;
case Keys.Enter: case Keys.Enter:
if (Buttons[_ButtonExit].Selected) if (_Buttons[_ButtonExit].Selected)
{ {
_SaveConfig(); _SaveConfig();
CGraphics.FadeTo(EScreens.ScreenOptions); CGraphics.FadeTo(EScreens.ScreenOptions);
@@ -101,17 +101,17 @@ namespace Vocaluxe.Screens
break; break;
case Keys.Left: case Keys.Left:
if (SelectSlides[_SelectSlideWebcamDevices].Selected) if (_SelectSlides[_SelectSlideWebcamDevices].Selected)
_OnDeviceEvent(); _OnDeviceEvent();
if (SelectSlides[_SelectSlideWebcamCapabilities].Selected) if (_SelectSlides[_SelectSlideWebcamCapabilities].Selected)
_OnCapabilitiesEvent(); _OnCapabilitiesEvent();
_SaveConfig(); _SaveConfig();
break; break;
case Keys.Right: case Keys.Right:
if (SelectSlides[_SelectSlideWebcamDevices].Selected) if (_SelectSlides[_SelectSlideWebcamDevices].Selected)
_OnDeviceEvent(); _OnDeviceEvent();
if (SelectSlides[_SelectSlideWebcamCapabilities].Selected) if (_SelectSlides[_SelectSlideWebcamCapabilities].Selected)
_OnCapabilitiesEvent(); _OnCapabilitiesEvent();
_SaveConfig(); _SaveConfig();
break; break;
@@ -130,14 +130,14 @@ namespace Vocaluxe.Screens
CGraphics.FadeTo(EScreens.ScreenOptions); CGraphics.FadeTo(EScreens.ScreenOptions);
} }
if (mouseEvent.LB && IsMouseOver(mouseEvent)) if (mouseEvent.LB && _IsMouseOver(mouseEvent))
{ {
if (SelectSlides[_SelectSlideWebcamDevices].Selected) if (_SelectSlides[_SelectSlideWebcamDevices].Selected)
_OnDeviceEvent(); _OnDeviceEvent();
if (SelectSlides[_SelectSlideWebcamCapabilities].Selected) if (_SelectSlides[_SelectSlideWebcamCapabilities].Selected)
_OnCapabilitiesEvent(); _OnCapabilitiesEvent();
_SaveConfig(); _SaveConfig();
if (Buttons[_ButtonExit].Selected) if (_Buttons[_ButtonExit].Selected)
CGraphics.FadeTo(EScreens.ScreenOptions); CGraphics.FadeTo(EScreens.ScreenOptions);
} }
return true; return true;
@@ -146,8 +146,8 @@ namespace Vocaluxe.Screens
public override bool UpdateGame() public override bool UpdateGame()
{ {
CWebcam.GetFrame(ref _WebcamTexture); CWebcam.GetFrame(ref _WebcamTexture);
Statics[_StaticWebcamOutput].Texture = _WebcamTexture; _Statics[_StaticWebcamOutput].Texture = _WebcamTexture;
SelectSlides[_SelectSlideVideosToBackground].Selection = (int)CConfig.VideosToBackground; _SelectSlides[_SelectSlideVideosToBackground].Selection = (int)CConfig.VideosToBackground;
return true; return true;
} }
@@ -167,8 +167,8 @@ namespace Vocaluxe.Screens
public override void OnShow() public override void OnShow()
{ {
base.OnShow(); base.OnShow();
SelectSlides[_SelectSlideWebcamDevices].Clear(); _SelectSlides[_SelectSlideWebcamDevices].Clear();
SelectSlides[_SelectSlideWebcamCapabilities].Clear(); _SelectSlides[_SelectSlideWebcamCapabilities].Clear();
_DeviceNr = -1; _DeviceNr = -1;
_CapabilityNr = -1; _CapabilityNr = -1;
@@ -186,16 +186,16 @@ namespace Vocaluxe.Screens
_GetFirstConfiguredWebcamDevice(ref _DeviceNr, ref _CapabilityNr); _GetFirstConfiguredWebcamDevice(ref _DeviceNr, ref _CapabilityNr);
foreach (SWebcamDevice d in devices) foreach (SWebcamDevice d in devices)
SelectSlides[_SelectSlideWebcamDevices].AddValue(d.Name); _SelectSlides[_SelectSlideWebcamDevices].AddValue(d.Name);
SelectSlides[_SelectSlideWebcamDevices].Selection = _DeviceNr; _SelectSlides[_SelectSlideWebcamDevices].Selection = _DeviceNr;
foreach (SCapabilities c in devices[_DeviceNr].Capabilities) foreach (SCapabilities c in devices[_DeviceNr].Capabilities)
SelectSlides[_SelectSlideWebcamCapabilities].AddValue(c.Width.ToString() + " x " + c.Height.ToString() + " @ " + c.Framerate.ToString() + " FPS "); _SelectSlides[_SelectSlideWebcamCapabilities].AddValue(c.Width + " x " + c.Height + " @ " + c.Framerate + " FPS ");
_Config.MonikerString = devices[SelectSlides[_SelectSlideWebcamDevices].Selection].MonikerString; _Config.MonikerString = devices[_SelectSlides[_SelectSlideWebcamDevices].Selection].MonikerString;
_Config.Width = devices[SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[SelectSlides[_SelectSlideWebcamCapabilities].Selection].Width; _Config.Width = devices[_SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Width;
_Config.Height = devices[SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[SelectSlides[_SelectSlideWebcamCapabilities].Selection].Height; _Config.Height = devices[_SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Height;
_Config.Framerate = _Config.Framerate =
devices[SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[SelectSlides[_SelectSlideWebcamCapabilities].Selection].Framerate; devices[_SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Framerate;
CWebcam.Close(); CWebcam.Close();
CWebcam.Select(CConfig.WebcamConfig); CWebcam.Select(CConfig.WebcamConfig);
CWebcam.Start(); CWebcam.Start();
@@ -208,17 +208,17 @@ namespace Vocaluxe.Screens
devices = null; devices = null;
} }
SelectSlides[_SelectSlideWebcamDevices].Visible = devices != null && devices.Length > 0; _SelectSlides[_SelectSlideWebcamDevices].Visible = devices != null && devices.Length > 0;
SelectSlides[_SelectSlideWebcamCapabilities].Visible = devices != null && devices.Length > 0; _SelectSlides[_SelectSlideWebcamCapabilities].Visible = devices != null && devices.Length > 0;
Statics[_StaticWebcamOutput].Visible = devices != null && devices.Length > 0; _Statics[_StaticWebcamOutput].Visible = devices != null && devices.Length > 0;
} }
private void _SaveConfig() private void _SaveConfig()
{ {
CConfig.VideoBackgrounds = (EOffOn)SelectSlides[_SelectSlideVideoBackgrounds].Selection; CConfig.VideoBackgrounds = (EOffOn)_SelectSlides[_SelectSlideVideoBackgrounds].Selection;
CConfig.VideoPreview = (EOffOn)SelectSlides[_SelectSlideVideoPreview].Selection; CConfig.VideoPreview = (EOffOn)_SelectSlides[_SelectSlideVideoPreview].Selection;
CConfig.VideosInSongs = (EOffOn)SelectSlides[_SelectSlideVideosInSongs].Selection; CConfig.VideosInSongs = (EOffOn)_SelectSlides[_SelectSlideVideosInSongs].Selection;
CConfig.VideosToBackground = (EOffOn)SelectSlides[_SelectSlideVideosToBackground].Selection; CConfig.VideosToBackground = (EOffOn)_SelectSlides[_SelectSlideVideosToBackground].Selection;
CConfig.WebcamConfig = _Config; CConfig.WebcamConfig = _Config;
CBackgroundMusic.VideoEnabled = true; CBackgroundMusic.VideoEnabled = true;
@@ -228,24 +228,24 @@ namespace Vocaluxe.Screens
private void _OnDeviceEvent() private void _OnDeviceEvent()
{ {
if (SelectSlides[_SelectSlideWebcamDevices].Selection != _DeviceNr) if (_SelectSlides[_SelectSlideWebcamDevices].Selection != _DeviceNr)
{ {
SelectSlides[_SelectSlideWebcamCapabilities].Clear(); _SelectSlides[_SelectSlideWebcamCapabilities].Clear();
_DeviceNr = SelectSlides[_SelectSlideWebcamDevices].Selection; _DeviceNr = _SelectSlides[_SelectSlideWebcamDevices].Selection;
_CapabilityNr = 0; _CapabilityNr = 0;
SWebcamDevice[] d = CWebcam.GetDevices(); SWebcamDevice[] d = CWebcam.GetDevices();
for (int i = 0; i < d[SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities.Count; i++) for (int i = 0; i < d[_SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities.Count; i++)
{ {
SelectSlides[_SelectSlideWebcamCapabilities].AddValue(d[_DeviceNr].Capabilities[i].Width.ToString() + " x " + d[_DeviceNr].Capabilities[i].Height.ToString() + _SelectSlides[_SelectSlideWebcamCapabilities].AddValue(d[_DeviceNr].Capabilities[i].Width + " x " + d[_DeviceNr].Capabilities[i].Height +
" @ " + d[_DeviceNr].Capabilities[i].Framerate.ToString() + "FPS"); " @ " + d[_DeviceNr].Capabilities[i].Framerate + "FPS");
} }
SelectSlides[_SelectSlideWebcamCapabilities].Selection = 0; _SelectSlides[_SelectSlideWebcamCapabilities].Selection = 0;
_Config.MonikerString = d[SelectSlides[_SelectSlideWebcamDevices].Selection].MonikerString; _Config.MonikerString = d[_SelectSlides[_SelectSlideWebcamDevices].Selection].MonikerString;
_Config.Width = d[SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[SelectSlides[_SelectSlideWebcamCapabilities].Selection].Width; _Config.Width = d[_SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Width;
_Config.Height = d[SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[SelectSlides[_SelectSlideWebcamCapabilities].Selection].Height; _Config.Height = d[_SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Height;
_Config.Framerate = d[SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[SelectSlides[_SelectSlideWebcamCapabilities].Selection].Framerate; _Config.Framerate = d[_SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Framerate;
CWebcam.Close(); CWebcam.Close();
CWebcam.Select(_Config); CWebcam.Select(_Config);
@@ -255,15 +255,15 @@ namespace Vocaluxe.Screens
private void _OnCapabilitiesEvent() private void _OnCapabilitiesEvent()
{ {
if (SelectSlides[_SelectSlideWebcamCapabilities].Selection != _CapabilityNr) if (_SelectSlides[_SelectSlideWebcamCapabilities].Selection != _CapabilityNr)
{ {
_CapabilityNr = SelectSlides[_SelectSlideWebcamCapabilities].Selection; _CapabilityNr = _SelectSlides[_SelectSlideWebcamCapabilities].Selection;
SWebcamDevice[] d = CWebcam.GetDevices(); SWebcamDevice[] d = CWebcam.GetDevices();
_Config.MonikerString = d[SelectSlides[_SelectSlideWebcamDevices].Selection].MonikerString; _Config.MonikerString = d[_SelectSlides[_SelectSlideWebcamDevices].Selection].MonikerString;
_Config.Width = d[SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[SelectSlides[_SelectSlideWebcamCapabilities].Selection].Width; _Config.Width = d[_SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Width;
_Config.Height = d[SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[SelectSlides[_SelectSlideWebcamCapabilities].Selection].Height; _Config.Height = d[_SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Height;
_Config.Framerate = d[SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[SelectSlides[_SelectSlideWebcamCapabilities].Selection].Framerate; _Config.Framerate = d[_SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Framerate;
CWebcam.Close(); CWebcam.Close();
CWebcam.Select(_Config); CWebcam.Select(_Config);
+30 -30
View File
@@ -69,16 +69,16 @@ namespace Vocaluxe.Screens
break; break;
case Keys.Enter: case Keys.Enter:
if (Buttons[_ButtonStart].Selected) if (_Buttons[_ButtonStart].Selected)
_StartPartyMode(); _StartPartyMode();
if (Buttons[_ButtonExit].Selected) if (_Buttons[_ButtonExit].Selected)
CGraphics.FadeTo(EScreens.ScreenMain); CGraphics.FadeTo(EScreens.ScreenMain);
break; break;
case Keys.Left: case Keys.Left:
case Keys.Right: case Keys.Right:
if (SelectSlides[_SelectSlideModes].Selected) if (_SelectSlides[_SelectSlideModes].Selected)
_UpdateSelection(); _UpdateSelection();
break; break;
} }
@@ -90,15 +90,15 @@ namespace Vocaluxe.Screens
{ {
base.HandleMouse(mouseEvent); base.HandleMouse(mouseEvent);
if (mouseEvent.LB && IsMouseOver(mouseEvent)) if (mouseEvent.LB && _IsMouseOver(mouseEvent))
{ {
if (Buttons[_ButtonStart].Selected) if (_Buttons[_ButtonStart].Selected)
_StartPartyMode(); _StartPartyMode();
if (Buttons[_ButtonExit].Selected) if (_Buttons[_ButtonExit].Selected)
CGraphics.FadeTo(EScreens.ScreenMain); CGraphics.FadeTo(EScreens.ScreenMain);
if (SelectSlides[_SelectSlideModes].Selected) if (_SelectSlides[_SelectSlideModes].Selected)
_UpdateSelection(); _UpdateSelection();
} }
@@ -114,13 +114,13 @@ namespace Vocaluxe.Screens
_PartyModeInfos = CParty.GetPartyModeInfos(); _PartyModeInfos = CParty.GetPartyModeInfos();
SelectSlides[_SelectSlideModes].Clear(); _SelectSlides[_SelectSlideModes].Clear();
foreach (SPartyModeInfos info in _PartyModeInfos) foreach (SPartyModeInfos info in _PartyModeInfos)
SelectSlides[_SelectSlideModes].AddValue(info.Name, info.PartyModeID); _SelectSlides[_SelectSlideModes].AddValue(info.Name, info.PartyModeID);
SelectSlides[_SelectSlideModes].Selection = 0; _SelectSlides[_SelectSlideModes].Selection = 0;
_UpdateSelection(); _UpdateSelection();
SetInteractionToSelectSlide(SelectSlides[_SelectSlideModes]); _SetInteractionToSelectSlide(_SelectSlides[_SelectSlideModes]);
} }
public override bool UpdateGame() public override bool UpdateGame()
@@ -140,49 +140,49 @@ namespace Vocaluxe.Screens
if (_PartyModeInfos.Count == 0) if (_PartyModeInfos.Count == 0)
return; return;
int index = SelectSlides[_SelectSlideModes].Selection; int index = _SelectSlides[_SelectSlideModes].Selection;
if (index >= _PartyModeInfos.Count) if (index >= _PartyModeInfos.Count)
return; return;
//Description //Description
Texts[_TextDescription].Text = _PartyModeInfos[index].Description; _Texts[_TextDescription].Text = _PartyModeInfos[index].Description;
Texts[_TextDescription].TranslationID = _PartyModeInfos[index].PartyModeID; _Texts[_TextDescription].TranslationID = _PartyModeInfos[index].PartyModeID;
//TargetAudience //TargetAudience
Texts[_TextTargetAudience].TranslationID = _PartyModeInfos[index].PartyModeID; _Texts[_TextTargetAudience].TranslationID = _PartyModeInfos[index].PartyModeID;
Texts[_TextTargetAudience].Text = _PartyModeInfos[index].TargetAudience; _Texts[_TextTargetAudience].Text = _PartyModeInfos[index].TargetAudience;
//NumTeams //NumTeams
if (_PartyModeInfos[index].MaxTeams == 0) if (_PartyModeInfos[index].MaxTeams == 0)
Texts[_TextNumTeams].Text = "TR_SCREENPARTY_NOTEAMS"; _Texts[_TextNumTeams].Text = "TR_SCREENPARTY_NOTEAMS";
else if (_PartyModeInfos[index].MaxTeams == _PartyModeInfos[index].MinTeams) else if (_PartyModeInfos[index].MaxTeams == _PartyModeInfos[index].MinTeams)
Texts[_TextNumTeams].Text = _PartyModeInfos[index].MaxTeams.ToString(); _Texts[_TextNumTeams].Text = _PartyModeInfos[index].MaxTeams.ToString();
else if (_PartyModeInfos[index].MaxTeams > _PartyModeInfos[index].MinTeams) else if (_PartyModeInfos[index].MaxTeams > _PartyModeInfos[index].MinTeams)
Texts[_TextNumTeams].Text = _PartyModeInfos[index].MinTeams + " - " + _PartyModeInfos[index].MaxTeams; _Texts[_TextNumTeams].Text = _PartyModeInfos[index].MinTeams + " - " + _PartyModeInfos[index].MaxTeams;
//NumPlayers //NumPlayers
if (_PartyModeInfos[index].MaxPlayers == _PartyModeInfos[index].MinPlayers) if (_PartyModeInfos[index].MaxPlayers == _PartyModeInfos[index].MinPlayers)
Texts[_TextNumPlayers].Text = _PartyModeInfos[index].MaxTeams.ToString(); _Texts[_TextNumPlayers].Text = _PartyModeInfos[index].MaxTeams.ToString();
else if (_PartyModeInfos[index].MaxPlayers > _PartyModeInfos[index].MinPlayers) else if (_PartyModeInfos[index].MaxPlayers > _PartyModeInfos[index].MinPlayers)
Texts[_TextNumPlayers].Text = _PartyModeInfos[index].MinPlayers + " - " + _PartyModeInfos[index].MaxPlayers; _Texts[_TextNumPlayers].Text = _PartyModeInfos[index].MinPlayers + " - " + _PartyModeInfos[index].MaxPlayers;
//Author //Author
Texts[_TextAuthor].Text = _PartyModeInfos[index].Author; _Texts[_TextAuthor].Text = _PartyModeInfos[index].Author;
Texts[_TextAuthor].TranslationID = _PartyModeInfos[index].PartyModeID; _Texts[_TextAuthor].TranslationID = _PartyModeInfos[index].PartyModeID;
//Version //Version
Texts[_TextVersion].Text = _PartyModeInfos[index].VersionMajor + "." + _PartyModeInfos[index].VersionMinor; _Texts[_TextVersion].Text = _PartyModeInfos[index].VersionMajor + "." + _PartyModeInfos[index].VersionMinor;
Texts[_TextVersion].TranslationID = _PartyModeInfos[index].PartyModeID; _Texts[_TextVersion].TranslationID = _PartyModeInfos[index].PartyModeID;
if (!_PartyModeInfos[index].Playable) if (!_PartyModeInfos[index].Playable)
{ {
Buttons[_ButtonStart].Visible = false; _Buttons[_ButtonStart].Visible = false;
Texts[_TextError].Visible = true; _Texts[_TextError].Visible = true;
} }
else else
{ {
Buttons[_ButtonStart].Visible = true; _Buttons[_ButtonStart].Visible = true;
Texts[_TextError].Visible = false; _Texts[_TextError].Visible = false;
} }
} }
@@ -191,7 +191,7 @@ namespace Vocaluxe.Screens
if (_PartyModeInfos.Count == 0) if (_PartyModeInfos.Count == 0)
return; return;
int index = SelectSlides[_SelectSlideModes].Selection; int index = _SelectSlides[_SelectSlideModes].Selection;
if (index >= _PartyModeInfos.Count) if (index >= _PartyModeInfos.Count)
return; return;
+96 -96
View File
@@ -79,16 +79,16 @@ namespace Vocaluxe.Screens
{ {
base.LoadTheme(xmlPath); base.LoadTheme(xmlPath);
Buttons[_ButtonSaveSnapshot].Visible = false; _Buttons[_ButtonSaveSnapshot].Visible = false;
Buttons[_ButtonDiscardSnapshot].Visible = false; _Buttons[_ButtonDiscardSnapshot].Visible = false;
Buttons[_ButtonTakeSnapshot].Visible = false; _Buttons[_ButtonTakeSnapshot].Visible = false;
if (CWebcam.GetDevices().Length > 0) if (CWebcam.GetDevices().Length > 0)
Buttons[_ButtonWebcam].Visible = true; _Buttons[_ButtonWebcam].Visible = true;
else else
Buttons[_ButtonWebcam].Visible = false; _Buttons[_ButtonWebcam].Visible = false;
SelectSlides[_SelectSlideDifficulty].SetValues<EGameDifficulty>(0); _SelectSlides[_SelectSlideDifficulty].SetValues<EGameDifficulty>(0);
SelectSlides[_SelectSlideGuestProfile].SetValues<EOffOn>(0); _SelectSlides[_SelectSlideGuestProfile].SetValues<EOffOn>(0);
SelectSlides[_SelectSlideActive].SetValues<EOffOn>(0); _SelectSlides[_SelectSlideActive].SetValues<EOffOn>(0);
} }
public override bool HandleInput(SKeyEvent keyEvent) public override bool HandleInput(SKeyEvent keyEvent)
@@ -103,8 +103,8 @@ namespace Vocaluxe.Screens
case EEditMode.None: case EEditMode.None:
break; break;
case EEditMode.PlayerName: case EEditMode.PlayerName:
SelectSlides[_SelectSlideProfiles].RenameValue( _SelectSlides[_SelectSlideProfiles].RenameValue(
CProfiles.AddGetPlayerName(SelectSlides[_SelectSlideProfiles].Selection, keyEvent.Unicode)); CProfiles.AddGetPlayerName(_SelectSlides[_SelectSlideProfiles].Selection, keyEvent.Unicode));
break; break;
} }
} }
@@ -117,36 +117,36 @@ namespace Vocaluxe.Screens
break; break;
case Keys.Enter: case Keys.Enter:
if (Buttons[_ButtonExit].Selected) if (_Buttons[_ButtonExit].Selected)
CGraphics.FadeTo(EScreens.ScreenMain); CGraphics.FadeTo(EScreens.ScreenMain);
else if (Buttons[_ButtonSave].Selected) else if (_Buttons[_ButtonSave].Selected)
_SaveProfiles(); _SaveProfiles();
else if (Buttons[_ButtonNew].Selected) else if (_Buttons[_ButtonNew].Selected)
_NewProfile(); _NewProfile();
else if (Buttons[_ButtonPlayerName].Selected) else if (_Buttons[_ButtonPlayerName].Selected)
{ {
if (CProfiles.NumProfiles > 0 && _EditMode != EEditMode.PlayerName) if (CProfiles.NumProfiles > 0 && _EditMode != EEditMode.PlayerName)
_EditMode = EEditMode.PlayerName; _EditMode = EEditMode.PlayerName;
else else
_EditMode = EEditMode.None; _EditMode = EEditMode.None;
} }
else if (Buttons[_ButtonDelete].Selected) else if (_Buttons[_ButtonDelete].Selected)
_DeleteProfile(); _DeleteProfile();
else if (Buttons[_ButtonWebcam].Selected && CWebcam.GetDevices().Length > 0) else if (_Buttons[_ButtonWebcam].Selected && CWebcam.GetDevices().Length > 0)
_OnWebcam(); _OnWebcam();
else if (Buttons[_ButtonSaveSnapshot].Selected && CWebcam.GetDevices().Length > 0) else if (_Buttons[_ButtonSaveSnapshot].Selected && CWebcam.GetDevices().Length > 0)
_OnSaveSnapshot(); _OnSaveSnapshot();
else if (Buttons[_ButtonDiscardSnapshot].Selected && CWebcam.GetDevices().Length > 0) else if (_Buttons[_ButtonDiscardSnapshot].Selected && CWebcam.GetDevices().Length > 0)
_OnDiscardSnapshot(); _OnDiscardSnapshot();
else if (Buttons[_ButtonTakeSnapshot].Selected && CWebcam.GetDevices().Length > 0) else if (_Buttons[_ButtonTakeSnapshot].Selected && CWebcam.GetDevices().Length > 0)
_OnTakeSnapshot(); _OnTakeSnapshot();
break; break;
case Keys.Back: case Keys.Back:
if (_EditMode == EEditMode.PlayerName) if (_EditMode == EEditMode.PlayerName)
{ {
SelectSlides[_SelectSlideProfiles].RenameValue( _SelectSlides[_SelectSlideProfiles].RenameValue(
CProfiles.GetDeleteCharInPlayerName(SelectSlides[_SelectSlideProfiles].Selection)); CProfiles.GetDeleteCharInPlayerName(_SelectSlides[_SelectSlideProfiles].Selection));
} }
else else
CGraphics.FadeTo(EScreens.ScreenMain); CGraphics.FadeTo(EScreens.ScreenMain);
@@ -156,25 +156,25 @@ namespace Vocaluxe.Screens
_DeleteProfile(); _DeleteProfile();
break; break;
} }
if (SelectSlides[_SelectSlideDifficulty].Selected) if (_SelectSlides[_SelectSlideDifficulty].Selected)
{ {
CProfiles.SetDifficulty(SelectSlides[_SelectSlideProfiles].Selection, CProfiles.SetDifficulty(_SelectSlides[_SelectSlideProfiles].Selection,
(EGameDifficulty)SelectSlides[_SelectSlideDifficulty].Selection); (EGameDifficulty)_SelectSlides[_SelectSlideDifficulty].Selection);
} }
else if (SelectSlides[_SelectSlideAvatars].Selected) else if (_SelectSlides[_SelectSlideAvatars].Selected)
{ {
CProfiles.SetAvatar(SelectSlides[_SelectSlideProfiles].Selection, CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].Selection,
SelectSlides[_SelectSlideAvatars].Selection); _SelectSlides[_SelectSlideAvatars].Selection);
} }
else if (SelectSlides[_SelectSlideGuestProfile].Selected) else if (_SelectSlides[_SelectSlideGuestProfile].Selected)
{ {
CProfiles.SetGuestProfile(SelectSlides[_SelectSlideProfiles].Selection, CProfiles.SetGuestProfile(_SelectSlides[_SelectSlideProfiles].Selection,
(EOffOn)SelectSlides[_SelectSlideGuestProfile].Selection); (EOffOn)_SelectSlides[_SelectSlideGuestProfile].Selection);
} }
else if (SelectSlides[_SelectSlideActive].Selected) else if (_SelectSlides[_SelectSlideActive].Selected)
{ {
CProfiles.SetActive(SelectSlides[_SelectSlideProfiles].Selection, CProfiles.SetActive(_SelectSlides[_SelectSlideProfiles].Selection,
(EOffOn)SelectSlides[_SelectSlideActive].Selection); (EOffOn)_SelectSlides[_SelectSlideActive].Selection);
} }
} }
@@ -186,52 +186,52 @@ namespace Vocaluxe.Screens
if (_EditMode == EEditMode.None) if (_EditMode == EEditMode.None)
base.HandleMouse(mouseEvent); base.HandleMouse(mouseEvent);
if (mouseEvent.LB && IsMouseOver(mouseEvent)) if (mouseEvent.LB && _IsMouseOver(mouseEvent))
{ {
if (Buttons[_ButtonExit].Selected) if (_Buttons[_ButtonExit].Selected)
CGraphics.FadeTo(EScreens.ScreenMain); CGraphics.FadeTo(EScreens.ScreenMain);
else if (Buttons[_ButtonSave].Selected) else if (_Buttons[_ButtonSave].Selected)
_SaveProfiles(); _SaveProfiles();
else if (Buttons[_ButtonNew].Selected) else if (_Buttons[_ButtonNew].Selected)
_NewProfile(); _NewProfile();
else if (Buttons[_ButtonDelete].Selected) else if (_Buttons[_ButtonDelete].Selected)
_DeleteProfile(); _DeleteProfile();
else if (Buttons[_ButtonPlayerName].Selected) else if (_Buttons[_ButtonPlayerName].Selected)
{ {
if (CProfiles.NumProfiles > 0 && _EditMode != EEditMode.PlayerName) if (CProfiles.NumProfiles > 0 && _EditMode != EEditMode.PlayerName)
_EditMode = EEditMode.PlayerName; _EditMode = EEditMode.PlayerName;
else else
_EditMode = EEditMode.None; _EditMode = EEditMode.None;
} }
else if (SelectSlides[_SelectSlideDifficulty].Selected) else if (_SelectSlides[_SelectSlideDifficulty].Selected)
{ {
CProfiles.SetDifficulty(SelectSlides[_SelectSlideProfiles].Selection, CProfiles.SetDifficulty(_SelectSlides[_SelectSlideProfiles].Selection,
(EGameDifficulty)SelectSlides[_SelectSlideDifficulty].Selection); (EGameDifficulty)_SelectSlides[_SelectSlideDifficulty].Selection);
} }
else if (SelectSlides[_SelectSlideAvatars].Selected) else if (_SelectSlides[_SelectSlideAvatars].Selected)
{ {
CProfiles.SetAvatar(SelectSlides[_SelectSlideProfiles].Selection, CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].Selection,
SelectSlides[_SelectSlideAvatars].Selection); _SelectSlides[_SelectSlideAvatars].Selection);
if (CWebcam.GetDevices().Length > 0 && _WebcamTexture.Index > 0) if (CWebcam.GetDevices().Length > 0 && _WebcamTexture.Index > 0)
_OnDiscardSnapshot(); _OnDiscardSnapshot();
} }
else if (SelectSlides[_SelectSlideGuestProfile].Selected) else if (_SelectSlides[_SelectSlideGuestProfile].Selected)
{ {
CProfiles.SetGuestProfile(SelectSlides[_SelectSlideProfiles].Selection, CProfiles.SetGuestProfile(_SelectSlides[_SelectSlideProfiles].Selection,
(EOffOn)SelectSlides[_SelectSlideGuestProfile].Selection); (EOffOn)_SelectSlides[_SelectSlideGuestProfile].Selection);
} }
else if (SelectSlides[_SelectSlideActive].Selected) else if (_SelectSlides[_SelectSlideActive].Selected)
{ {
CProfiles.SetActive(SelectSlides[_SelectSlideProfiles].Selection, CProfiles.SetActive(_SelectSlides[_SelectSlideProfiles].Selection,
(EOffOn)SelectSlides[_SelectSlideActive].Selection); (EOffOn)_SelectSlides[_SelectSlideActive].Selection);
} }
else if (Buttons[_ButtonWebcam].Selected && CWebcam.GetDevices().Length > 0) else if (_Buttons[_ButtonWebcam].Selected && CWebcam.GetDevices().Length > 0)
_OnWebcam(); _OnWebcam();
else if (Buttons[_ButtonSaveSnapshot].Selected && CWebcam.GetDevices().Length > 0) else if (_Buttons[_ButtonSaveSnapshot].Selected && CWebcam.GetDevices().Length > 0)
_OnSaveSnapshot(); _OnSaveSnapshot();
else if (Buttons[_ButtonDiscardSnapshot].Selected && CWebcam.GetDevices().Length > 0) else if (_Buttons[_ButtonDiscardSnapshot].Selected && CWebcam.GetDevices().Length > 0)
_OnDiscardSnapshot(); _OnDiscardSnapshot();
else if (Buttons[_ButtonTakeSnapshot].Selected && CWebcam.GetDevices().Length > 0) else if (_Buttons[_ButtonTakeSnapshot].Selected && CWebcam.GetDevices().Length > 0)
_OnTakeSnapshot(); _OnTakeSnapshot();
} }
@@ -242,10 +242,10 @@ namespace Vocaluxe.Screens
private void _OnTakeSnapshot() private void _OnTakeSnapshot()
{ {
Buttons[_ButtonSaveSnapshot].Visible = true; _Buttons[_ButtonSaveSnapshot].Visible = true;
Buttons[_ButtonDiscardSnapshot].Visible = true; _Buttons[_ButtonDiscardSnapshot].Visible = true;
Buttons[_ButtonWebcam].Visible = false; _Buttons[_ButtonWebcam].Visible = false;
Buttons[_ButtonTakeSnapshot].Visible = false; _Buttons[_ButtonTakeSnapshot].Visible = false;
_Snapshot = CWebcam.GetBitmap(); _Snapshot = CWebcam.GetBitmap();
} }
@@ -254,10 +254,10 @@ namespace Vocaluxe.Screens
CWebcam.Stop(); CWebcam.Stop();
CDraw.RemoveTexture(ref _WebcamTexture); CDraw.RemoveTexture(ref _WebcamTexture);
_Snapshot = null; _Snapshot = null;
Buttons[_ButtonSaveSnapshot].Visible = false; _Buttons[_ButtonSaveSnapshot].Visible = false;
Buttons[_ButtonDiscardSnapshot].Visible = false; _Buttons[_ButtonDiscardSnapshot].Visible = false;
Buttons[_ButtonTakeSnapshot].Visible = false; _Buttons[_ButtonTakeSnapshot].Visible = false;
Buttons[_ButtonWebcam].Visible = true; _Buttons[_ButtonWebcam].Visible = true;
} }
private void _OnSaveSnapshot() private void _OnSaveSnapshot()
@@ -277,15 +277,15 @@ namespace Vocaluxe.Screens
{ {
if (CProfiles.Avatars[j].FileName == (filename + i + ".png")) if (CProfiles.Avatars[j].FileName == (filename + i + ".png"))
{ {
CProfiles.SetAvatar(SelectSlides[_SelectSlideProfiles].Selection, j); CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].Selection, j);
break; break;
} }
} }
Buttons[_ButtonSaveSnapshot].Visible = false; _Buttons[_ButtonSaveSnapshot].Visible = false;
Buttons[_ButtonDiscardSnapshot].Visible = false; _Buttons[_ButtonDiscardSnapshot].Visible = false;
Buttons[_ButtonTakeSnapshot].Visible = false; _Buttons[_ButtonTakeSnapshot].Visible = false;
Buttons[_ButtonWebcam].Visible = true; _Buttons[_ButtonWebcam].Visible = true;
} }
private void _OnWebcam() private void _OnWebcam()
@@ -293,38 +293,38 @@ namespace Vocaluxe.Screens
_Snapshot = null; _Snapshot = null;
CWebcam.Start(); CWebcam.Start();
CWebcam.GetFrame(ref _WebcamTexture); CWebcam.GetFrame(ref _WebcamTexture);
Buttons[_ButtonSaveSnapshot].Visible = false; _Buttons[_ButtonSaveSnapshot].Visible = false;
Buttons[_ButtonDiscardSnapshot].Visible = false; _Buttons[_ButtonDiscardSnapshot].Visible = false;
Buttons[_ButtonTakeSnapshot].Visible = true; _Buttons[_ButtonTakeSnapshot].Visible = true;
Buttons[_ButtonWebcam].Visible = false; _Buttons[_ButtonWebcam].Visible = false;
} }
public override bool UpdateGame() public override bool UpdateGame()
{ {
if (SelectSlides[_SelectSlideProfiles].Selection > -1) if (_SelectSlides[_SelectSlideProfiles].Selection > -1)
{ {
Buttons[_ButtonPlayerName].Text.Text = CProfiles.GetPlayerName(SelectSlides[_SelectSlideProfiles].Selection); _Buttons[_ButtonPlayerName].Text.Text = CProfiles.GetPlayerName(_SelectSlides[_SelectSlideProfiles].Selection);
if (_EditMode == EEditMode.PlayerName) if (_EditMode == EEditMode.PlayerName)
Buttons[_ButtonPlayerName].Text.Text += "|"; _Buttons[_ButtonPlayerName].Text.Text += "|";
SelectSlides[_SelectSlideDifficulty].Selection = (int)CProfiles.GetDifficulty(SelectSlides[_SelectSlideProfiles].Selection); _SelectSlides[_SelectSlideDifficulty].Selection = (int)CProfiles.GetDifficulty(_SelectSlides[_SelectSlideProfiles].Selection);
SelectSlides[_SelectSlideGuestProfile].Selection = (int)CProfiles.GetGuestProfile(SelectSlides[_SelectSlideProfiles].Selection); _SelectSlides[_SelectSlideGuestProfile].Selection = (int)CProfiles.GetGuestProfile(_SelectSlides[_SelectSlideProfiles].Selection);
SelectSlides[_SelectSlideActive].Selection = (int)CProfiles.GetActive(SelectSlides[_SelectSlideProfiles].Selection); _SelectSlides[_SelectSlideActive].Selection = (int)CProfiles.GetActive(_SelectSlides[_SelectSlideProfiles].Selection);
int avatarNr = CProfiles.GetAvatarNr(SelectSlides[_SelectSlideProfiles].Selection); int avatarNr = CProfiles.GetAvatarNr(_SelectSlides[_SelectSlideProfiles].Selection);
SelectSlides[_SelectSlideAvatars].Selection = avatarNr; _SelectSlides[_SelectSlideAvatars].Selection = avatarNr;
if (CWebcam.GetDevices().Length > 0 && _WebcamTexture.Index > 0) if (CWebcam.GetDevices().Length > 0 && _WebcamTexture.Index > 0)
{ {
if (_Snapshot == null) if (_Snapshot == null)
CWebcam.GetFrame(ref _WebcamTexture); CWebcam.GetFrame(ref _WebcamTexture);
Statics[_StaticAvatar].Texture = _WebcamTexture; _Statics[_StaticAvatar].Texture = _WebcamTexture;
RectangleF bounds = new RectangleF(_WebcamTexture.Rect.X, _WebcamTexture.Rect.Y, _WebcamTexture.Rect.W, _WebcamTexture.Rect.H); RectangleF bounds = new RectangleF(_WebcamTexture.Rect.X, _WebcamTexture.Rect.Y, _WebcamTexture.Rect.W, _WebcamTexture.Rect.H);
RectangleF rect = new RectangleF(0f, 0f, _WebcamTexture.Rect.W, _WebcamTexture.Rect.H); RectangleF rect = new RectangleF(0f, 0f, _WebcamTexture.Rect.W, _WebcamTexture.Rect.H);
CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, EAspect.Crop); CHelper.SetRect(bounds, out rect, rect.Width / rect.Height, EAspect.Crop);
} }
else else
Statics[_StaticAvatar].Texture = CProfiles.Avatars[avatarNr].Texture; _Statics[_StaticAvatar].Texture = CProfiles.Avatars[avatarNr].Texture;
} }
return true; return true;
@@ -357,7 +357,7 @@ namespace Vocaluxe.Screens
private void _DeleteProfile() private void _DeleteProfile()
{ {
CProfiles.DeleteProfile(SelectSlides[_SelectSlideProfiles].Selection); CProfiles.DeleteProfile(_SelectSlides[_SelectSlideProfiles].Selection);
_LoadProfiles(); _LoadProfiles();
UpdateGame(); UpdateGame();
} }
@@ -365,25 +365,25 @@ namespace Vocaluxe.Screens
private void _LoadProfiles() private void _LoadProfiles()
{ {
_EditMode = EEditMode.None; _EditMode = EEditMode.None;
SelectSlides[_SelectSlideProfiles].Clear(); _SelectSlides[_SelectSlideProfiles].Clear();
for (int i = 0; i < CProfiles.NumProfiles; i++) for (int i = 0; i < CProfiles.NumProfiles; i++)
SelectSlides[_SelectSlideProfiles].AddValue(CProfiles.GetPlayerName(i)); _SelectSlides[_SelectSlideProfiles].AddValue(CProfiles.GetPlayerName(i));
if (CProfiles.NumProfiles > 0 && CProfiles.NumAvatars > 0) if (CProfiles.NumProfiles > 0 && CProfiles.NumAvatars > 0)
{ {
SelectSlides[_SelectSlideDifficulty].Selection = (int)CProfiles.GetDifficulty(SelectSlides[_SelectSlideProfiles].Selection); _SelectSlides[_SelectSlideDifficulty].Selection = (int)CProfiles.GetDifficulty(_SelectSlides[_SelectSlideProfiles].Selection);
SelectSlides[_SelectSlideGuestProfile].Selection = (int)CProfiles.GetGuestProfile(SelectSlides[_SelectSlideProfiles].Selection); _SelectSlides[_SelectSlideGuestProfile].Selection = (int)CProfiles.GetGuestProfile(_SelectSlides[_SelectSlideProfiles].Selection);
SelectSlides[_SelectSlideActive].Selection = (int)CProfiles.GetActive(SelectSlides[_SelectSlideProfiles].Selection); _SelectSlides[_SelectSlideActive].Selection = (int)CProfiles.GetActive(_SelectSlides[_SelectSlideProfiles].Selection);
SelectSlides[_SelectSlideAvatars].Selection = CProfiles.GetAvatarNr(SelectSlides[_SelectSlideProfiles].Selection); _SelectSlides[_SelectSlideAvatars].Selection = CProfiles.GetAvatarNr(_SelectSlides[_SelectSlideProfiles].Selection);
} }
} }
private void _LoadAvatars() private void _LoadAvatars()
{ {
SelectSlides[_SelectSlideAvatars].Clear(); _SelectSlides[_SelectSlideAvatars].Clear();
for (int i = 0; i < CProfiles.NumAvatars; i++) for (int i = 0; i < CProfiles.NumAvatars; i++)
SelectSlides[_SelectSlideAvatars].AddValue(CProfiles.Avatars[i].FileName); _SelectSlides[_SelectSlideAvatars].AddValue(CProfiles.Avatars[i].FileName);
} }
private void _NewProfile() private void _NewProfile()
@@ -391,12 +391,12 @@ namespace Vocaluxe.Screens
_EditMode = EEditMode.None; _EditMode = EEditMode.None;
CProfiles.NewProfile(); CProfiles.NewProfile();
_LoadProfiles(); _LoadProfiles();
SelectSlides[_SelectSlideProfiles].LastValue(); _SelectSlides[_SelectSlideProfiles].LastValue();
CProfiles.SetAvatar(SelectSlides[_SelectSlideProfiles].Selection, CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].Selection,
SelectSlides[_SelectSlideAvatars].Selection); _SelectSlides[_SelectSlideAvatars].Selection);
SetInteractionToButton(Buttons[_ButtonPlayerName]); _SetInteractionToButton(_Buttons[_ButtonPlayerName]);
_EditMode = EEditMode.PlayerName; _EditMode = EEditMode.PlayerName;
} }
} }
+58 -63
View File
@@ -58,8 +58,7 @@ namespace Vocaluxe.Screens
{ {
base.Init(); base.Init();
List<string> texts = new List<string>(); List<string> texts = new List<string> {_TextSong};
texts.Add(_TextSong);
_BuildTextStrings(ref texts); _BuildTextStrings(ref texts);
@@ -119,10 +118,7 @@ namespace Vocaluxe.Screens
public override void OnShow() public override void OnShow()
{ {
base.OnShow(); base.OnShow();
if (CGame.NumRounds > 1) _Round = CGame.NumRounds > 1 ? 0 : 1;
_Round = 0;
else
_Round = 1;
_Points = CGame.GetPoints(); _Points = CGame.GetPoints();
_SetVisibility(); _SetVisibility();
@@ -156,19 +152,19 @@ namespace Vocaluxe.Screens
if (_StaticPointsBarDrawnPoints[p] > player[p].Points) if (_StaticPointsBarDrawnPoints[p] > player[p].Points)
_StaticPointsBarDrawnPoints[p] = player[p].Points; _StaticPointsBarDrawnPoints[p] = player[p].Points;
string direction = (string)ScreenSettings[_ScreenSettingAnimationDirection].GetValue(); string direction = (string)_ScreenSettings[_ScreenSettingAnimationDirection].GetValue();
if (direction.ToLower() == "vertical") if (direction.ToLower() == "vertical")
{ {
Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.W = ((float)_StaticPointsBarDrawnPoints[p]) * _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.W = ((float)_StaticPointsBarDrawnPoints[p]) *
(Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.W / 10000); (_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.W / 10000);
} }
else else
{ {
Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H = ((float)_StaticPointsBarDrawnPoints[p]) * _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H = ((float)_StaticPointsBarDrawnPoints[p]) *
(Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H / 10000); (_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H / 10000);
Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.Y = Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H + _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[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.Y -
Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H; _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H;
} }
} }
} }
@@ -182,7 +178,7 @@ namespace Vocaluxe.Screens
return true; return true;
} }
public string GetRating(double points) private static string _GetRating(double points)
{ {
string rating = String.Empty; string rating = String.Empty;
@@ -222,7 +218,7 @@ namespace Vocaluxe.Screens
{ {
if (player <= numplayer) if (player <= numplayer)
{ {
string target = "P" + (player + 1).ToString() + "N" + (numplayer + 1).ToString(); string target = "P" + (player + 1) + "N" + (numplayer + 1);
_TextNames[player, numplayer] = "TextName" + target; _TextNames[player, numplayer] = "TextName" + target;
_TextScores[player, numplayer] = "TextScore" + target; _TextScores[player, numplayer] = "TextScore" + target;
_TextRatings[player, numplayer] = "TextRating" + target; _TextRatings[player, numplayer] = "TextRating" + target;
@@ -247,17 +243,16 @@ namespace Vocaluxe.Screens
{ {
for (int player = 0; player < CSettings.MaxNumPlayer; player++) for (int player = 0; player < CSettings.MaxNumPlayer; player++)
{ {
if (player <= numplayer) if (player > numplayer)
{ continue;
string target = "P" + (player + 1).ToString() + "N" + (numplayer + 1).ToString(); string target = "P" + (player + 1) + "N" + (numplayer + 1);
_StaticPointsBarBG[player, numplayer] = "StaticPointsBarBG" + target; _StaticPointsBarBG[player, numplayer] = "StaticPointsBarBG" + target;
_StaticPointsBar[player, numplayer] = "StaticPointsBar" + target; _StaticPointsBar[player, numplayer] = "StaticPointsBar" + target;
_StaticAvatar[player, numplayer] = "StaticAvatar" + target; _StaticAvatar[player, numplayer] = "StaticAvatar" + target;
statics.Add(_StaticPointsBarBG[player, numplayer]); statics.Add(_StaticPointsBarBG[player, numplayer]);
statics.Add(_StaticPointsBar[player, numplayer]); statics.Add(_StaticPointsBar[player, numplayer]);
statics.Add(_StaticAvatar[player, numplayer]); statics.Add(_StaticAvatar[player, numplayer]);
}
} }
} }
} }
@@ -272,14 +267,14 @@ namespace Vocaluxe.Screens
if (song == null) if (song == null)
return; return;
Texts[_TextSong].Text = song.Artist + " - " + song.Title; _Texts[_TextSong].Text = song.Artist + " - " + song.Title;
if (_Points.NumRounds > 1) if (_Points.NumRounds > 1)
Texts[_TextSong].Text += " (" + _Round + "/" + _Points.NumRounds + ")"; _Texts[_TextSong].Text += " (" + _Round + "/" + _Points.NumRounds + ")";
player = _Points.GetPlayer(_Round - 1, CGame.NumPlayer); player = _Points.GetPlayer(_Round - 1, CGame.NumPlayer);
} }
else else
{ {
Texts[_TextSong].Text = "TR_SCREENSCORE_OVERALLSCORE"; _Texts[_TextSong].Text = "TR_SCREENSCORE_OVERALLSCORE";
for (int i = 0; i < CGame.NumRounds; i++) for (int i = 0; i < CGame.NumRounds; i++)
{ {
SPlayer[] points = _Points.GetPlayer(i, CGame.NumPlayer); SPlayer[] points = _Points.GetPlayer(i, CGame.NumPlayer);
@@ -303,59 +298,59 @@ namespace Vocaluxe.Screens
if (song != null) if (song != null)
{ {
if (!song.IsDuet) if (!song.IsDuet)
Texts[_TextNames[p, CGame.NumPlayer - 1]].Text = player[p].Name; _Texts[_TextNames[p, CGame.NumPlayer - 1]].Text = player[p].Name;
else if (player[p].LineNr == 0 && song.DuetPart1 != "Part 1") else if (player[p].LineNr == 0 && song.DuetPart1 != "Part 1")
Texts[_TextNames[p, CGame.NumPlayer - 1]].Text = player[p].Name + " (" + song.DuetPart1 + ")"; _Texts[_TextNames[p, CGame.NumPlayer - 1]].Text = player[p].Name + " (" + song.DuetPart1 + ")";
else if (player[p].LineNr == 1 && song.DuetPart2 != "Part 2") else if (player[p].LineNr == 1 && song.DuetPart2 != "Part 2")
Texts[_TextNames[p, CGame.NumPlayer - 1]].Text = player[p].Name + " (" + song.DuetPart2 + ")"; _Texts[_TextNames[p, CGame.NumPlayer - 1]].Text = player[p].Name + " (" + song.DuetPart2 + ")";
else else
Texts[_TextNames[p, CGame.NumPlayer - 1]].Text = player[p].Name; _Texts[_TextNames[p, CGame.NumPlayer - 1]].Text = player[p].Name;
} }
else else
Texts[_TextNames[p, CGame.NumPlayer - 1]].Text = player[p].Name; _Texts[_TextNames[p, CGame.NumPlayer - 1]].Text = player[p].Name;
if (CGame.NumPlayer < (int)ScreenSettings[_ScreenSettingShortScore].GetValue()) if (CGame.NumPlayer < (int)_ScreenSettings[_ScreenSettingShortScore].GetValue())
Texts[_TextScores[p, CGame.NumPlayer - 1]].Text = ((int)Math.Round(player[p].Points)).ToString("0000") + " " + CLanguage.Translate("TR_SCREENSCORE_POINTS"); _Texts[_TextScores[p, CGame.NumPlayer - 1]].Text = ((int)Math.Round(player[p].Points)).ToString("0000") + " " + CLanguage.Translate("TR_SCREENSCORE_POINTS");
else else
Texts[_TextScores[p, CGame.NumPlayer - 1]].Text = ((int)Math.Round(player[p].Points)).ToString("0000"); _Texts[_TextScores[p, CGame.NumPlayer - 1]].Text = ((int)Math.Round(player[p].Points)).ToString("0000");
if (CGame.NumPlayer < (int)ScreenSettings[_ScreenSettingShortDifficulty].GetValue()) if (CGame.NumPlayer < (int)_ScreenSettings[_ScreenSettingShortDifficulty].GetValue())
{ {
Texts[_TextDifficulty[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate("TR_SCREENSCORE_GAMEDIFFICULTY") + ": " + _Texts[_TextDifficulty[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate("TR_SCREENSCORE_GAMEDIFFICULTY") + ": " +
CLanguage.Translate(player[p].Difficulty.ToString()); CLanguage.Translate(player[p].Difficulty.ToString());
} }
else else
Texts[_TextDifficulty[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate(player[p].Difficulty.ToString()); _Texts[_TextDifficulty[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate(player[p].Difficulty.ToString());
if (CGame.NumPlayer < (int)ScreenSettings[_ScreenSettingShortRating].GetValue()) if (CGame.NumPlayer < (int)_ScreenSettings[_ScreenSettingShortRating].GetValue())
{ {
Texts[_TextRatings[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate("TR_SCREENSCORE_RATING") + ": " + _Texts[_TextRatings[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate("TR_SCREENSCORE_RATING") + ": " +
CLanguage.Translate(GetRating((int)Math.Round(player[p].Points))); CLanguage.Translate(_GetRating((int)Math.Round(player[p].Points)));
} }
else else
Texts[_TextRatings[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate(GetRating((int)Math.Round(player[p].Points))); _Texts[_TextRatings[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate(_GetRating((int)Math.Round(player[p].Points)));
_StaticPointsBarDrawnPoints[p] = 0.0; _StaticPointsBarDrawnPoints[p] = 0.0;
string direction = (string)ScreenSettings[_ScreenSettingAnimationDirection].GetValue(); string direction = (string)_ScreenSettings[_ScreenSettingAnimationDirection].GetValue();
if (direction.ToLower() == "vertical") if (direction.ToLower() == "vertical")
Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.W = 0; _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.W = 0;
else else
{ {
Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H = 0; _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[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.Y = _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H +
Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.Y - _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.Y -
Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H; _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H;
} }
if (player[p].ProfileID >= 0 && player[p].ProfileID < CProfiles.NumProfiles) if (player[p].ProfileID >= 0 && player[p].ProfileID < CProfiles.NumProfiles)
Statics[_StaticAvatar[p, CGame.NumPlayer - 1]].Texture = CProfiles.Profiles[player[p].ProfileID].Avatar.Texture; _Statics[_StaticAvatar[p, CGame.NumPlayer - 1]].Texture = CProfiles.Profiles[player[p].ProfileID].Avatar.Texture;
} }
if (CConfig.ScoreAnimationTime < 1) if (CConfig.ScoreAnimationTime < 1)
{ {
for (int p = 0; p < CGame.NumPlayer; p++) for (int p = 0; p < CGame.NumPlayer; p++)
{ {
Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H = ((float)player[p].Points) * (Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H / 10000); _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H = ((float)player[p].Points) * (_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H / 10000);
Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.Y = Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H + _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[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.Y -
Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H; _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H;
_StaticPointsBarDrawnPoints[p] = player[p].Points; _StaticPointsBarDrawnPoints[p] = player[p].Points;
} }
} }
@@ -372,15 +367,15 @@ namespace Vocaluxe.Screens
{ {
if (player <= numplayer) if (player <= numplayer)
{ {
Texts[_TextNames[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer; _Texts[_TextNames[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer;
Texts[_TextScores[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer; _Texts[_TextScores[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer;
Texts[_TextRatings[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer; _Texts[_TextRatings[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer;
Texts[_TextDifficulty[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer; _Texts[_TextDifficulty[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer;
Statics[_StaticPointsBar[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer; _Statics[_StaticPointsBar[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer;
Statics[_StaticPointsBarBG[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer; _Statics[_StaticPointsBarBG[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer;
Statics[_StaticAvatar[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer; _Statics[_StaticAvatar[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer;
Statics[_StaticAvatar[player, numplayer]].Texture = new STexture(-1); _Statics[_StaticAvatar[player, numplayer]].Texture = new STexture(-1);
} }
} }
} }
+213 -218
View File
@@ -163,17 +163,17 @@ namespace Vocaluxe.Screens
{ {
base.LoadTheme(xmlPath); base.LoadTheme(xmlPath);
Statics[_StaticTimeLine].Visible = false; _Statics[_StaticTimeLine].Visible = false;
Statics[_StaticTimeLineExpandedNormal].Visible = false; _Statics[_StaticTimeLineExpandedNormal].Visible = false;
Statics[_StaticTimeLineExpandedHighlighted].Visible = false; _Statics[_StaticTimeLineExpandedHighlighted].Visible = false;
Statics[_StaticPauseBG].Visible = false; _Statics[_StaticPauseBG].Visible = false;
Texts[_TextPause].Visible = false; _Texts[_TextPause].Visible = false;
Statics[_StaticPauseBG].Visible = false; _Statics[_StaticPauseBG].Visible = false;
Texts[_TextPause].Visible = false; _Texts[_TextPause].Visible = false;
Buttons[_ButtonCancel].Visible = false; _Buttons[_ButtonCancel].Visible = false;
Buttons[_ButtonContinue].Visible = false; _Buttons[_ButtonContinue].Visible = false;
} }
public override bool HandleInput(SKeyEvent keyEvent) public override bool HandleInput(SKeyEvent keyEvent)
@@ -191,13 +191,13 @@ namespace Vocaluxe.Screens
case Keys.Escape: case Keys.Escape:
_TogglePause(); _TogglePause();
if (_Pause) if (_Pause)
SetInteractionToButton(Buttons[_ButtonCancel]); _SetInteractionToButton(_Buttons[_ButtonCancel]);
break; break;
case Keys.P: case Keys.P:
_TogglePause(); _TogglePause();
if (_Pause) if (_Pause)
SetInteractionToButton(Buttons[_ButtonContinue]); _SetInteractionToButton(_Buttons[_ButtonContinue]);
break; break;
case Keys.T: case Keys.T:
@@ -240,11 +240,11 @@ namespace Vocaluxe.Screens
} }
break; break;
case Keys.Enter: case Keys.Enter:
if (Buttons[_ButtonContinue].Selected && _Pause) if (_Buttons[_ButtonContinue].Selected && _Pause)
_TogglePause(); _TogglePause();
if (Buttons[_ButtonCancel].Selected && _Pause) if (_Buttons[_ButtonCancel].Selected && _Pause)
_Stop(); _Stop();
if (Buttons[_ButtonSkip].Selected && _Pause) if (_Buttons[_ButtonSkip].Selected && _Pause)
{ {
_LoadNextSong(); _LoadNextSong();
_TogglePause(); _TogglePause();
@@ -288,18 +288,18 @@ namespace Vocaluxe.Screens
{ {
_TogglePause(); _TogglePause();
if (_Pause) if (_Pause)
SetInteractionToButton(Buttons[_ButtonContinue]); _SetInteractionToButton(_Buttons[_ButtonContinue]);
} }
if (mouseEvent.LB && IsMouseOver(mouseEvent) && _Pause) if (mouseEvent.LB && _IsMouseOver(mouseEvent) && _Pause)
{ {
if (Buttons[_ButtonContinue].Selected && _Pause) if (_Buttons[_ButtonContinue].Selected && _Pause)
_TogglePause(); _TogglePause();
if (Buttons[_ButtonCancel].Selected && _Pause) if (_Buttons[_ButtonCancel].Selected && _Pause)
_Stop(); _Stop();
if (Buttons[_ButtonSkip].Selected && _Pause) if (_Buttons[_ButtonSkip].Selected && _Pause)
{ {
_LoadNextSong(); _LoadNextSong();
_TogglePause(); _TogglePause();
@@ -339,48 +339,48 @@ namespace Vocaluxe.Screens
float[] alpha = _CalcFadingAlpha(); float[] alpha = _CalcFadingAlpha();
if (alpha != null) if (alpha != null)
{ {
Lyrics[_LyricMain].Alpha = alpha[0]; _Lyrics[_LyricMain].Alpha = alpha[0];
Lyrics[_LyricSub].Alpha = alpha[1]; _Lyrics[_LyricSub].Alpha = alpha[1];
Lyrics[_LyricMainTop].Alpha = alpha[0]; _Lyrics[_LyricMainTop].Alpha = alpha[0];
Lyrics[_LyricSubTop].Alpha = alpha[1]; _Lyrics[_LyricSubTop].Alpha = alpha[1];
Statics[_StaticLyrics].Alpha = alpha[0]; _Statics[_StaticLyrics].Alpha = alpha[0];
Statics[_StaticLyricsTop].Alpha = alpha[0]; _Statics[_StaticLyricsTop].Alpha = alpha[0];
Statics[_StaticLyricHelper].Alpha = alpha[0]; _Statics[_StaticLyricHelper].Alpha = alpha[0];
Statics[_StaticLyricHelperTop].Alpha = alpha[0]; _Statics[_StaticLyricHelperTop].Alpha = alpha[0];
for (int p = 0; p < CGame.NumPlayer; p++) for (int p = 0; p < CGame.NumPlayer; p++)
{ {
SingNotes[_SingBars].SetAlpha(_NoteLines[p], alpha[CGame.Player[p].LineNr * 2]); _SingNotes[_SingBars].SetAlpha(_NoteLines[p], alpha[CGame.Player[p].LineNr * 2]);
if (CConfig.FadePlayerInfo == EFadePlayerInfo.TR_CONFIG_FADEPLAYERINFO_INFO || CConfig.FadePlayerInfo == EFadePlayerInfo.TR_CONFIG_FADEPLAYERINFO_ALL) if (CConfig.FadePlayerInfo == EFadePlayerInfo.TR_CONFIG_FADEPLAYERINFO_INFO || CConfig.FadePlayerInfo == EFadePlayerInfo.TR_CONFIG_FADEPLAYERINFO_ALL)
{ {
Statics[_StaticAvatars[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Player[p].LineNr * 2]; _Statics[_StaticAvatars[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Player[p].LineNr * 2];
Texts[_TextNames[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Player[p].LineNr * 2]; _Texts[_TextNames[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Player[p].LineNr * 2];
} }
if (CConfig.FadePlayerInfo == EFadePlayerInfo.TR_CONFIG_FADEPLAYERINFO_ALL) if (CConfig.FadePlayerInfo == EFadePlayerInfo.TR_CONFIG_FADEPLAYERINFO_ALL)
{ {
Statics[_StaticScores[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Player[p].LineNr * 2]; _Statics[_StaticScores[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Player[p].LineNr * 2];
Statics[_StaticAvatars[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Player[p].LineNr * 2]; _Statics[_StaticAvatars[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Player[p].LineNr * 2];
Texts[_TextNames[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Player[p].LineNr * 2]; _Texts[_TextNames[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Player[p].LineNr * 2];
Texts[_TextScores[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Player[p].LineNr * 2]; _Texts[_TextScores[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Player[p].LineNr * 2];
} }
} }
if (alpha.Length > 2) if (alpha.Length > 2)
{ {
Lyrics[_LyricMainDuet].Alpha = alpha[0]; _Lyrics[_LyricMainDuet].Alpha = alpha[0];
Lyrics[_LyricSubDuet].Alpha = alpha[1]; _Lyrics[_LyricSubDuet].Alpha = alpha[1];
Statics[_StaticLyricsDuet].Alpha = alpha[0]; _Statics[_StaticLyricsDuet].Alpha = alpha[0];
Statics[_StaticLyricHelperDuet].Alpha = alpha[0]; _Statics[_StaticLyricHelperDuet].Alpha = alpha[0];
Lyrics[_LyricMain].Alpha = alpha[2]; _Lyrics[_LyricMain].Alpha = alpha[2];
Lyrics[_LyricSub].Alpha = alpha[3]; _Lyrics[_LyricSub].Alpha = alpha[3];
Statics[_StaticLyrics].Alpha = alpha[2]; _Statics[_StaticLyrics].Alpha = alpha[2];
Statics[_StaticLyricHelper].Alpha = alpha[2]; _Statics[_StaticLyricHelper].Alpha = alpha[2];
} }
} }
@@ -388,15 +388,15 @@ namespace Vocaluxe.Screens
for (int p = 0; p < CGame.NumPlayer; p++) for (int p = 0; p < CGame.NumPlayer; p++)
{ {
if (CGame.Player[p].Points < 10000) if (CGame.Player[p].Points < 10000)
Texts[_TextScores[p, CGame.NumPlayer - 1]].Text = CGame.Player[p].Points.ToString("0000"); _Texts[_TextScores[p, CGame.NumPlayer - 1]].Text = CGame.Player[p].Points.ToString("0000");
else else
Texts[_TextScores[p, CGame.NumPlayer - 1]].Text = CGame.Player[p].Points.ToString("00000"); _Texts[_TextScores[p, CGame.NumPlayer - 1]].Text = CGame.Player[p].Points.ToString("00000");
} }
if (_CurrentVideo != -1 && !_FadeOut && CConfig.VideosInSongs == EOffOn.TR_CONFIG_ON) if (_CurrentVideo != -1 && !_FadeOut && CConfig.VideosInSongs == EOffOn.TR_CONFIG_ON)
{ {
float vtime = 0f; float vtime;
CVideo.VdGetFrame(_CurrentVideo, ref _CurrentVideoTexture, _CurrentTime, ref vtime); CVideo.VdGetFrame(_CurrentVideo, ref _CurrentVideoTexture, _CurrentTime, out vtime);
} }
if (_Webcam) if (_Webcam)
@@ -423,15 +423,15 @@ namespace Vocaluxe.Screens
_TimeRects.Clear(); _TimeRects.Clear();
SingNotes[_SingBars].Reset(); _SingNotes[_SingBars].Reset();
for (int i = 0; i < CSettings.MaxNumPlayer; i++) for (int i = 0; i < CSettings.MaxNumPlayer; i++)
_NoteLines[i] = -1; _NoteLines[i] = -1;
foreach (CLyric lyric in Lyrics) foreach (CLyric lyric in _Lyrics)
lyric.LyricStyle = CConfig.LyricStyle; lyric.LyricStyle = CConfig.LyricStyle;
for (int p = 0; p < CGame.NumPlayer; p++) for (int p = 0; p < CGame.NumPlayer; p++)
Statics[_StaticAvatars[p, CGame.NumPlayer - 1]].Aspect = EAspect.Crop; _Statics[_StaticAvatars[p, CGame.NumPlayer - 1]].Aspect = EAspect.Crop;
_SetVisibility(); _SetVisibility();
_UpdateAvatars(); _UpdateAvatars();
@@ -458,7 +458,7 @@ namespace Vocaluxe.Screens
{ {
RectangleF bounds = new RectangleF(0, 0, CSettings.RenderW, CSettings.RenderH); RectangleF bounds = new RectangleF(0, 0, CSettings.RenderW, CSettings.RenderH);
RectangleF rect = new RectangleF(0f, 0f, _CurrentVideoTexture.Width, _CurrentVideoTexture.Height); RectangleF rect = new RectangleF(0f, 0f, _CurrentVideoTexture.Width, _CurrentVideoTexture.Height);
CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, _VideoAspect); CHelper.SetRect(bounds, out rect, rect.Width / rect.Height, _VideoAspect);
CDraw.DrawTexture(_CurrentVideoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, 0f), CDraw.DrawTexture(_CurrentVideoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, 0f),
_CurrentVideoTexture.Color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f), false); _CurrentVideoTexture.Color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f), false);
@@ -467,7 +467,7 @@ namespace Vocaluxe.Screens
{ {
RectangleF bounds = new RectangleF(0, 0, CSettings.RenderW, CSettings.RenderH); RectangleF bounds = new RectangleF(0, 0, CSettings.RenderW, CSettings.RenderH);
RectangleF rect = new RectangleF(0f, 0f, _CurrentWebcamFrameTexture.Width, _CurrentWebcamFrameTexture.Height); RectangleF rect = new RectangleF(0f, 0f, _CurrentWebcamFrameTexture.Width, _CurrentWebcamFrameTexture.Height);
CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, _VideoAspect); CHelper.SetRect(bounds, out rect, rect.Width / rect.Height, _VideoAspect);
CDraw.DrawTexture(_CurrentWebcamFrameTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, 0f), CDraw.DrawTexture(_CurrentWebcamFrameTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, 0f),
_CurrentVideoTexture.Color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f), false); _CurrentVideoTexture.Color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f), false);
@@ -477,56 +477,56 @@ namespace Vocaluxe.Screens
// Draw Background // Draw Background
RectangleF bounds = new RectangleF(0, 0, CSettings.RenderW, CSettings.RenderH); RectangleF bounds = new RectangleF(0, 0, CSettings.RenderW, CSettings.RenderH);
RectangleF rect = new RectangleF(0f, 0f, _Background.Width, _Background.Height); RectangleF rect = new RectangleF(0f, 0f, _Background.Width, _Background.Height);
CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, EAspect.Crop); CHelper.SetRect(bounds, out rect, rect.Width / rect.Height, EAspect.Crop);
CDraw.DrawTexture(_Background, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, 0f), CDraw.DrawTexture(_Background, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, 0f),
_Background.Color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f), false); _Background.Color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f), false);
} }
} }
DrawBG(); _DrawBG();
foreach (CStatic stat in Statics) foreach (CStatic stat in _Statics)
stat.Draw(); stat.Draw();
foreach (CText text in Texts) foreach (CText text in _Texts)
text.Draw(); text.Draw();
switch (CConfig.TimerLook) switch (CConfig.TimerLook)
{ {
case ETimerLook.TR_CONFIG_TIMERLOOK_NORMAL: case ETimerLook.TR_CONFIG_TIMERLOOK_NORMAL:
CDraw.DrawTexture(Statics[_StaticTimeLine].Texture, Statics[_StaticTimeLine].Rect, new SColorF(1, 1, 1, 1), _TimeLineRect); CDraw.DrawTexture(_Statics[_StaticTimeLine].Texture, _Statics[_StaticTimeLine].Rect, new SColorF(1, 1, 1, 1), _TimeLineRect);
break; break;
case ETimerLook.TR_CONFIG_TIMERLOOK_EXPANDED: case ETimerLook.TR_CONFIG_TIMERLOOK_EXPANDED:
for (int i = 0; i < _TimeRects.Count; i++) for (int i = 0; i < _TimeRects.Count; i++)
CDraw.DrawTexture(_TimeRects[i].Rect.Texture, Statics[_StaticTimeLine].Rect, _TimeRects[i].Rect.Color, _TimeRects[i].Rect.Rect); CDraw.DrawTexture(_TimeRects[i].Rect.Texture, _Statics[_StaticTimeLine].Rect, _TimeRects[i].Rect.Color, _TimeRects[i].Rect.Rect);
break; break;
} }
Lyrics[_LyricSub].Draw(-100); _Lyrics[_LyricSub].Draw(-100);
Lyrics[_LyricMain].Draw(CGame.Beat); _Lyrics[_LyricMain].Draw(CGame.Beat);
Lyrics[_LyricSubDuet].Draw(-100); _Lyrics[_LyricSubDuet].Draw(-100);
Lyrics[_LyricMainDuet].Draw(CGame.Beat); _Lyrics[_LyricMainDuet].Draw(CGame.Beat);
Lyrics[_LyricSubTop].Draw(-100); _Lyrics[_LyricSubTop].Draw(-100);
Lyrics[_LyricMainTop].Draw(CGame.Beat); _Lyrics[_LyricMainTop].Draw(CGame.Beat);
for (int i = 0; i < CGame.NumPlayer; i++) for (int i = 0; i < CGame.NumPlayer; i++)
SingNotes[_SingBars].Draw(_NoteLines[i], CGame.Player[i].SingLine, i); _SingNotes[_SingBars].Draw(_NoteLines[i], CGame.Player[i].SingLine, i);
_DrawLyricHelper(); _DrawLyricHelper();
if (_Pause) if (_Pause)
{ {
Statics[_StaticPauseBG].ForceDraw(); _Statics[_StaticPauseBG].ForceDraw();
Texts[_TextPause].ForceDraw(); _Texts[_TextPause].ForceDraw();
foreach (CButton button in Buttons) foreach (CButton button in _Buttons)
button.Draw(); button.Draw();
foreach (CSelectSlide slide in SelectSlides) foreach (CSelectSlide slide in _SelectSlides)
slide.Draw(); slide.Draw();
} }
@@ -557,15 +557,15 @@ namespace Vocaluxe.Screens
} }
CDraw.RemoveTexture(ref _Background); CDraw.RemoveTexture(ref _Background);
Lyrics[_LyricMain].Clear(); _Lyrics[_LyricMain].Clear();
Lyrics[_LyricSub].Clear(); _Lyrics[_LyricSub].Clear();
Lyrics[_LyricMainDuet].Clear(); _Lyrics[_LyricMainDuet].Clear();
Lyrics[_LyricSubDuet].Clear(); _Lyrics[_LyricSubDuet].Clear();
Lyrics[_LyricMainTop].Clear(); _Lyrics[_LyricMainTop].Clear();
Lyrics[_LyricSubTop].Clear(); _Lyrics[_LyricSubTop].Clear();
Texts[_TextSongName].Text = String.Empty; _Texts[_TextSongName].Text = String.Empty;
Texts[_TextDuetName1].Text = String.Empty; _Texts[_TextDuetName1].Text = String.Empty;
Texts[_TextDuetName2].Text = String.Empty; _Texts[_TextDuetName2].Text = String.Empty;
GC.Collect(); GC.Collect();
} }
@@ -592,8 +592,8 @@ namespace Vocaluxe.Screens
string songname = song.Artist + " - " + song.Title; string songname = song.Artist + " - " + song.Title;
int rounds = CGame.GetNumSongs(); int rounds = CGame.GetNumSongs();
if (rounds > 1) if (rounds > 1)
songname += " (" + CGame.RoundNr + "/" + rounds.ToString() + ")"; songname += " (" + CGame.RoundNr + "/" + rounds + ")";
Texts[_TextSongName].Text = songname; _Texts[_TextSongName].Text = songname;
_CurrentStream = CSound.Load(song.GetMP3(), true); _CurrentStream = CSound.Load(song.GetMP3(), true);
CSound.SetStreamVolumeMax(_CurrentStream, CConfig.GameMusicVolume); CSound.SetStreamVolumeMax(_CurrentStream, CConfig.GameMusicVolume);
@@ -625,13 +625,13 @@ namespace Vocaluxe.Screens
if (song.BackgroundFileName.Length > 0) if (song.BackgroundFileName.Length > 0)
_Background = CDraw.AddTexture(Path.Combine(song.Folder, song.BackgroundFileName)); _Background = CDraw.AddTexture(Path.Combine(song.Folder, song.BackgroundFileName));
SingNotes[_SingBars].Reset(); _SingNotes[_SingBars].Reset();
if (song.IsDuet) if (song.IsDuet)
{ {
Texts[_TextDuetName1].Text = song.DuetPart1; _Texts[_TextDuetName1].Text = song.DuetPart1;
Texts[_TextDuetName2].Text = song.DuetPart2; _Texts[_TextDuetName2].Text = song.DuetPart2;
//More than one song: Player is not assigned to line by user //More than one song: Player is not assigned to line by user
//Otherwise, this is done by CScreenNames //Otherwise, this is done by CScreenNames
if (CGame.GetNumSongs() > 1) if (CGame.GetNumSongs() > 1)
@@ -654,8 +654,8 @@ namespace Vocaluxe.Screens
for (int p = 0; p < CGame.NumPlayer; p++) for (int p = 0; p < CGame.NumPlayer; p++)
{ {
_NoteLines[p] = SingNotes[_SingBars].AddPlayer( _NoteLines[p] = _SingNotes[_SingBars].AddPlayer(
SingNotes[_SingBars].BarPos[p, CGame.NumPlayer - 1], _SingNotes[_SingBars].BarPos[p, CGame.NumPlayer - 1],
CTheme.GetPlayerColor(p + 1), CTheme.GetPlayerColor(p + 1),
p); p);
} }
@@ -683,22 +683,22 @@ namespace Vocaluxe.Screens
private void _SetDuetLyricsVisibility(bool isDuet) private void _SetDuetLyricsVisibility(bool isDuet)
{ {
Statics[_StaticLyricsDuet].Visible = isDuet; _Statics[_StaticLyricsDuet].Visible = isDuet;
Lyrics[_LyricMainDuet].Visible = isDuet; _Lyrics[_LyricMainDuet].Visible = isDuet;
Lyrics[_LyricSubDuet].Visible = isDuet; _Lyrics[_LyricSubDuet].Visible = isDuet;
if (isDuet) if (isDuet)
{ {
Lyrics[_LyricMainTop].Visible = false; _Lyrics[_LyricMainTop].Visible = false;
Lyrics[_LyricSubTop].Visible = false; _Lyrics[_LyricSubTop].Visible = false;
Statics[_StaticLyricsTop].Visible = false; _Statics[_StaticLyricsTop].Visible = false;
} }
else else
{ {
bool lyricsOnTop = (CGame.NumPlayer != 1) && CConfig.LyricsOnTop == EOffOn.TR_CONFIG_ON; bool lyricsOnTop = (CGame.NumPlayer != 1) && CConfig.LyricsOnTop == EOffOn.TR_CONFIG_ON;
Lyrics[_LyricMainTop].Visible = lyricsOnTop; _Lyrics[_LyricMainTop].Visible = lyricsOnTop;
Lyrics[_LyricSubTop].Visible = lyricsOnTop; _Lyrics[_LyricSubTop].Visible = lyricsOnTop;
Statics[_StaticLyricsTop].Visible = lyricsOnTop; _Statics[_StaticLyricsTop].Visible = lyricsOnTop;
} }
} }
@@ -781,54 +781,54 @@ namespace Vocaluxe.Screens
for (int j = 0; j < CGame.NumPlayer; j++) for (int j = 0; j < CGame.NumPlayer; j++)
{ {
if (CGame.Player[j].LineNr == i) if (CGame.Player[j].LineNr == i)
SingNotes[_SingBars].AddLine(_NoteLines[j], line, nr, j); _SingNotes[_SingBars].AddLine(_NoteLines[j], line, nr, j);
} }
if (i == 0 && !song.IsDuet || i == 1 && song.IsDuet) if (i == 0 && !song.IsDuet || i == 1 && song.IsDuet)
{ {
Lyrics[_LyricMain].SetLine(line[nr]); _Lyrics[_LyricMain].SetLine(line[nr]);
Lyrics[_LyricMainTop].SetLine(line[nr]); _Lyrics[_LyricMainTop].SetLine(line[nr]);
_TimeToFirstNote = CGame.GetTimeFromBeats(line[nr].FirstNoteBeat - line[nr].StartBeat, song.BPM); _TimeToFirstNote = CGame.GetTimeFromBeats(line[nr].FirstNoteBeat - line[nr].StartBeat, song.BPM);
_RemainingTimeToFirstNote = CGame.GetTimeFromBeats(line[nr].FirstNoteBeat - CGame.GetBeatFromTime(_CurrentTime, song.BPM, song.Gap), song.BPM); _RemainingTimeToFirstNote = CGame.GetTimeFromBeats(line[nr].FirstNoteBeat - CGame.GetBeatFromTime(_CurrentTime, song.BPM, song.Gap), song.BPM);
if (line.Length >= nr + 2) if (line.Length >= nr + 2)
{ {
Lyrics[_LyricSub].SetLine(line[nr + 1]); _Lyrics[_LyricSub].SetLine(line[nr + 1]);
Lyrics[_LyricSubTop].SetLine(line[nr + 1]); _Lyrics[_LyricSubTop].SetLine(line[nr + 1]);
} }
else else
{ {
Lyrics[_LyricSub].Clear(); _Lyrics[_LyricSub].Clear();
Lyrics[_LyricSubTop].Clear(); _Lyrics[_LyricSubTop].Clear();
} }
} }
if (i == 0 && song.IsDuet) if (i == 0 && song.IsDuet)
{ {
Lyrics[_LyricMainDuet].SetLine(line[nr]); _Lyrics[_LyricMainDuet].SetLine(line[nr]);
_TimeToFirstNoteDuet = CGame.GetTimeFromBeats(line[nr].FirstNoteBeat - line[nr].StartBeat, song.BPM); _TimeToFirstNoteDuet = CGame.GetTimeFromBeats(line[nr].FirstNoteBeat - line[nr].StartBeat, song.BPM);
_RemainingTimeToFirstNoteDuet = CGame.GetTimeFromBeats(line[nr].FirstNoteBeat - CGame.GetBeatFromTime(_CurrentTime, song.BPM, song.Gap), song.BPM); _RemainingTimeToFirstNoteDuet = CGame.GetTimeFromBeats(line[nr].FirstNoteBeat - CGame.GetBeatFromTime(_CurrentTime, song.BPM, song.Gap), song.BPM);
if (line.Length >= nr + 2) if (line.Length >= nr + 2)
Lyrics[_LyricSubDuet].SetLine(line[nr + 1]); _Lyrics[_LyricSubDuet].SetLine(line[nr + 1]);
else else
Lyrics[_LyricSubDuet].Clear(); _Lyrics[_LyricSubDuet].Clear();
} }
} }
else else
{ {
if (i == 0 && !song.IsDuet || i == 1 && song.IsDuet) if (i == 0 && !song.IsDuet || i == 1 && song.IsDuet)
{ {
Lyrics[_LyricMain].Clear(); _Lyrics[_LyricMain].Clear();
Lyrics[_LyricSub].Clear(); _Lyrics[_LyricSub].Clear();
Lyrics[_LyricMainTop].Clear(); _Lyrics[_LyricMainTop].Clear();
Lyrics[_LyricSubTop].Clear(); _Lyrics[_LyricSubTop].Clear();
_TimeToFirstNote = 0f; _TimeToFirstNote = 0f;
} }
if (i == 0 && song.IsDuet) if (i == 0 && song.IsDuet)
{ {
Lyrics[_LyricMainDuet].Clear(); _Lyrics[_LyricMainDuet].Clear();
Lyrics[_LyricSubDuet].Clear(); _Lyrics[_LyricSubDuet].Clear();
_TimeToFirstNoteDuet = 0f; _TimeToFirstNoteDuet = 0f;
} }
} }
@@ -840,19 +840,19 @@ namespace Vocaluxe.Screens
_Pause = !_Pause; _Pause = !_Pause;
if (_Pause) if (_Pause)
{ {
Buttons[_ButtonCancel].Visible = true; _Buttons[_ButtonCancel].Visible = true;
Buttons[_ButtonContinue].Visible = true; _Buttons[_ButtonContinue].Visible = true;
if (CGame.NumRounds > CGame.RoundNr && CGame.NumRounds > 1) if (CGame.NumRounds > CGame.RoundNr && CGame.NumRounds > 1)
Buttons[_ButtonSkip].Visible = true; _Buttons[_ButtonSkip].Visible = true;
else else
Buttons[_ButtonSkip].Visible = false; _Buttons[_ButtonSkip].Visible = false;
CSound.Pause(_CurrentStream); CSound.Pause(_CurrentStream);
} }
else else
{ {
Buttons[_ButtonCancel].Visible = false; _Buttons[_ButtonCancel].Visible = false;
Buttons[_ButtonContinue].Visible = false; _Buttons[_ButtonContinue].Visible = false;
Buttons[_ButtonSkip].Visible = false; _Buttons[_ButtonSkip].Visible = false;
CSound.Play(_CurrentStream); CSound.Play(_CurrentStream);
CWebcam.Start(); CWebcam.Start();
} }
@@ -869,7 +869,7 @@ namespace Vocaluxe.Screens
{ {
if (player <= numplayer) if (player <= numplayer)
{ {
string target = "P" + (player + 1).ToString() + "N" + (numplayer + 1).ToString(); string target = "P" + (player + 1) + "N" + (numplayer + 1);
_TextScores[player, numplayer] = "TextScore" + target; _TextScores[player, numplayer] = "TextScore" + target;
_TextNames[player, numplayer] = "TextName" + target; _TextNames[player, numplayer] = "TextName" + target;
@@ -891,7 +891,7 @@ namespace Vocaluxe.Screens
{ {
if (player <= numplayer) if (player <= numplayer)
{ {
string target = "P" + (player + 1).ToString() + "N" + (numplayer + 1).ToString(); string target = "P" + (player + 1) + "N" + (numplayer + 1);
_StaticScores[player, numplayer] = "StaticScore" + target; _StaticScores[player, numplayer] = "StaticScore" + target;
_StaticAvatars[player, numplayer] = "StaticAvatar" + target; _StaticAvatars[player, numplayer] = "StaticAvatar" + target;
@@ -904,17 +904,17 @@ namespace Vocaluxe.Screens
private void _SetVisibility() private void _SetVisibility()
{ {
Statics[_StaticLyricsDuet].Visible = false; _Statics[_StaticLyricsDuet].Visible = false;
Statics[_StaticLyricHelper].Visible = false; _Statics[_StaticLyricHelper].Visible = false;
Statics[_StaticLyricHelperDuet].Visible = false; _Statics[_StaticLyricHelperDuet].Visible = false;
Statics[_StaticLyricHelperTop].Visible = false; _Statics[_StaticLyricHelperTop].Visible = false;
Lyrics[_LyricMainDuet].Visible = false; _Lyrics[_LyricMainDuet].Visible = false;
Lyrics[_LyricSubDuet].Visible = false; _Lyrics[_LyricSubDuet].Visible = false;
Statics[_StaticSongText].Visible = false; _Statics[_StaticSongText].Visible = false;
Texts[_TextSongName].Visible = false; _Texts[_TextSongName].Visible = false;
Texts[_TextDuetName1].Visible = false; _Texts[_TextDuetName1].Visible = false;
Texts[_TextDuetName2].Visible = false; _Texts[_TextDuetName2].Visible = false;
for (int numplayer = 0; numplayer < CSettings.MaxNumPlayer; numplayer++) for (int numplayer = 0; numplayer < CSettings.MaxNumPlayer; numplayer++)
{ {
@@ -922,13 +922,13 @@ namespace Vocaluxe.Screens
{ {
if (player <= numplayer) if (player <= numplayer)
{ {
Texts[_TextScores[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer; _Texts[_TextScores[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer;
Texts[_TextNames[player, numplayer]].Visible = (numplayer + 1 == CGame.NumPlayer) _Texts[_TextNames[player, numplayer]].Visible = (numplayer + 1 == CGame.NumPlayer)
&& &&
(CConfig.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_BOTH || (CConfig.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_BOTH ||
CConfig.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_NAME); CConfig.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_NAME);
Statics[_StaticScores[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer; _Statics[_StaticScores[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer;
Statics[_StaticAvatars[player, numplayer]].Visible = (numplayer + 1 == CGame.NumPlayer) _Statics[_StaticAvatars[player, numplayer]].Visible = (numplayer + 1 == CGame.NumPlayer)
&& &&
(CConfig.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_BOTH || (CConfig.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_BOTH ||
CConfig.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_AVATAR); CConfig.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_AVATAR);
@@ -936,23 +936,23 @@ namespace Vocaluxe.Screens
} }
} }
Lyrics[_LyricMain].Alpha = 0f; _Lyrics[_LyricMain].Alpha = 0f;
Lyrics[_LyricSub].Alpha = 0f; _Lyrics[_LyricSub].Alpha = 0f;
Lyrics[_LyricMainTop].Alpha = 0f; _Lyrics[_LyricMainTop].Alpha = 0f;
Lyrics[_LyricSubTop].Alpha = 0f; _Lyrics[_LyricSubTop].Alpha = 0f;
Statics[_StaticLyrics].Alpha = 0f; _Statics[_StaticLyrics].Alpha = 0f;
Statics[_StaticLyricsTop].Alpha = 0f; _Statics[_StaticLyricsTop].Alpha = 0f;
Statics[_StaticLyricHelper].Alpha = 0f; _Statics[_StaticLyricHelper].Alpha = 0f;
Statics[_StaticLyricHelperTop].Alpha = 0f; _Statics[_StaticLyricHelperTop].Alpha = 0f;
Lyrics[_LyricMainDuet].Alpha = 0f; _Lyrics[_LyricMainDuet].Alpha = 0f;
Lyrics[_LyricSubDuet].Alpha = 0f; _Lyrics[_LyricSubDuet].Alpha = 0f;
Statics[_StaticLyricsDuet].Alpha = 0f; _Statics[_StaticLyricsDuet].Alpha = 0f;
Statics[_StaticLyricHelperDuet].Alpha = 0f; _Statics[_StaticLyricHelperDuet].Alpha = 0f;
} }
private void _DrawLyricHelper() private void _DrawLyricHelper()
@@ -981,28 +981,28 @@ namespace Vocaluxe.Screens
if (time > totaltime) if (time > totaltime)
time = totaltime; time = totaltime;
SRectF rect = Statics[_StaticLyricHelper].Rect; SRectF rect = _Statics[_StaticLyricHelper].Rect;
SColorF color = new SColorF( SColorF color = new SColorF(
Statics[_StaticLyricHelper].Color.R, _Statics[_StaticLyricHelper].Color.R,
Statics[_StaticLyricHelper].Color.G, _Statics[_StaticLyricHelper].Color.G,
Statics[_StaticLyricHelper].Color.B, _Statics[_StaticLyricHelper].Color.B,
Statics[_StaticLyricHelper].Color.A * Statics[_StaticLyricHelper].Alpha * alpha); _Statics[_StaticLyricHelper].Color.A * _Statics[_StaticLyricHelper].Alpha * alpha);
float distance = Lyrics[_LyricMain].GetCurrentLyricPosX() - rect.X - rect.W; float distance = _Lyrics[_LyricMain].GetCurrentLyricPosX() - rect.X - rect.W;
CDraw.DrawTexture(Statics[_StaticLyricHelper].Texture, CDraw.DrawTexture(_Statics[_StaticLyricHelper].Texture,
new SRectF(rect.X + distance * (1f - time / totaltime), rect.Y, rect.W, rect.H, rect.Z), color); new SRectF(rect.X + distance * (1f - time / totaltime), rect.Y, rect.W, rect.H, rect.Z), color);
if (Statics[_StaticLyricsTop].Visible) if (_Statics[_StaticLyricsTop].Visible)
{ {
rect = Statics[_StaticLyricHelperTop].Rect; rect = _Statics[_StaticLyricHelperTop].Rect;
color = new SColorF( color = new SColorF(
Statics[_StaticLyricHelperTop].Color.R, _Statics[_StaticLyricHelperTop].Color.R,
Statics[_StaticLyricHelperTop].Color.G, _Statics[_StaticLyricHelperTop].Color.G,
Statics[_StaticLyricHelperTop].Color.B, _Statics[_StaticLyricHelperTop].Color.B,
Statics[_StaticLyricHelperTop].Color.A * Statics[_StaticLyricHelper].Alpha * alpha); _Statics[_StaticLyricHelperTop].Color.A * _Statics[_StaticLyricHelper].Alpha * alpha);
distance = Lyrics[_LyricMainTop].GetCurrentLyricPosX() - rect.X - rect.W; distance = _Lyrics[_LyricMainTop].GetCurrentLyricPosX() - rect.X - rect.W;
CDraw.DrawTexture(Statics[_StaticLyricHelperTop].Texture, CDraw.DrawTexture(_Statics[_StaticLyricHelperTop].Texture,
new SRectF(rect.X + distance * (1f - time / totaltime), rect.Y, rect.W, rect.H, rect.Z), color); new SRectF(rect.X + distance * (1f - time / totaltime), rect.Y, rect.W, rect.H, rect.Z), color);
} }
} }
@@ -1020,16 +1020,16 @@ namespace Vocaluxe.Screens
if (time > totaltime) if (time > totaltime)
time = totaltime; time = totaltime;
SRectF rect = Statics[_StaticLyricHelperDuet].Rect; SRectF rect = _Statics[_StaticLyricHelperDuet].Rect;
SColorF color = new SColorF( SColorF color = new SColorF(
Statics[_StaticLyricHelperDuet].Color.R, _Statics[_StaticLyricHelperDuet].Color.R,
Statics[_StaticLyricHelperDuet].Color.G, _Statics[_StaticLyricHelperDuet].Color.G,
Statics[_StaticLyricHelperDuet].Color.B, _Statics[_StaticLyricHelperDuet].Color.B,
Statics[_StaticLyricHelperDuet].Color.A * Statics[_StaticLyricHelperDuet].Alpha * alpha); _Statics[_StaticLyricHelperDuet].Color.A * _Statics[_StaticLyricHelperDuet].Alpha * alpha);
float distance = Lyrics[_LyricMainDuet].GetCurrentLyricPosX() - rect.X - rect.W; float distance = _Lyrics[_LyricMainDuet].GetCurrentLyricPosX() - rect.X - rect.W;
CDraw.DrawTexture(Statics[_StaticLyricHelperDuet].Texture, CDraw.DrawTexture(_Statics[_StaticLyricHelperDuet].Texture,
new SRectF(rect.X + distance * (1f - time / totaltime), rect.Y, rect.W, rect.H, rect.Z), new SRectF(rect.X + distance * (1f - time / totaltime), rect.Y, rect.W, rect.H, rect.Z),
color); color);
} }
@@ -1121,8 +1121,7 @@ namespace Vocaluxe.Screens
// sub // sub
if (currentLineSub < line.Length - 2) if (currentLineSub < line.Length - 2)
{ {
float diff = 0f; float diff = CGame.GetTimeFromBeats(line[currentLineSub + 1].FirstNoteBeat, song.BPM) - currentTime;
diff = CGame.GetTimeFromBeats(line[currentLineSub + 1].FirstNoteBeat, song.BPM) - currentTime;
if (diff > dt) if (diff > dt)
alpha[i * 2 + 1] = 1f - (diff - dt) / rt; alpha[i * 2 + 1] = 1f - (diff - dt) / rt;
@@ -1140,36 +1139,36 @@ namespace Vocaluxe.Screens
private void _UpdateSongText() private void _UpdateSongText()
{ {
if (_TimerSongText.IsRunning && !Lyrics[_LyricMainDuet].Visible && !Lyrics[_LyricMainTop].Visible) if (_TimerSongText.IsRunning && !_Lyrics[_LyricMainDuet].Visible && !_Lyrics[_LyricMainTop].Visible)
{ {
float t = _TimerSongText.ElapsedMilliseconds / 1000f; float t = _TimerSongText.ElapsedMilliseconds / 1000f;
if (t < 10f) if (t < 10f)
{ {
Statics[_StaticSongText].Visible = true; _Statics[_StaticSongText].Visible = true;
Texts[_TextSongName].Visible = true; _Texts[_TextSongName].Visible = true;
if (t < 7f) if (t < 7f)
{ {
Statics[_StaticSongText].Color.A = 1f; _Statics[_StaticSongText].Color.A = 1f;
Texts[_TextSongName].Color.A = 1f; _Texts[_TextSongName].Color.A = 1f;
} }
else else
{ {
Statics[_StaticSongText].Color.A = (3f - (t - 7f)) / 3f; _Statics[_StaticSongText].Color.A = (3f - (t - 7f)) / 3f;
Texts[_TextSongName].Color.A = (3f - (t - 7f)) / 3f; _Texts[_TextSongName].Color.A = (3f - (t - 7f)) / 3f;
} }
} }
else else
{ {
Statics[_StaticSongText].Visible = false; _Statics[_StaticSongText].Visible = false;
Texts[_TextSongName].Visible = false; _Texts[_TextSongName].Visible = false;
_TimerSongText.Stop(); _TimerSongText.Stop();
} }
} }
else else
{ {
Statics[_StaticSongText].Visible = false; _Statics[_StaticSongText].Visible = false;
Texts[_TextSongName].Visible = false; _Texts[_TextSongName].Visible = false;
} }
} }
@@ -1183,50 +1182,50 @@ namespace Vocaluxe.Screens
float t = _TimerDuetText1.ElapsedMilliseconds / 1000f; float t = _TimerDuetText1.ElapsedMilliseconds / 1000f;
if (t < 10f) if (t < 10f)
{ {
Texts[_TextDuetName1].Visible = true; _Texts[_TextDuetName1].Visible = true;
if (t < 3f) if (t < 3f)
Texts[_TextDuetName1].Color.A = (3f - (3f - t)) / 3f; _Texts[_TextDuetName1].Color.A = (3f - (3f - t)) / 3f;
else if (t < 7f) else if (t < 7f)
Texts[_TextDuetName1].Color.A = 1f; _Texts[_TextDuetName1].Color.A = 1f;
else else
Texts[_TextDuetName1].Color.A = (3f - (t - 7f)) / 3f; _Texts[_TextDuetName1].Color.A = (3f - (t - 7f)) / 3f;
} }
else else
{ {
Texts[_TextDuetName1].Visible = false; _Texts[_TextDuetName1].Visible = false;
_TimerDuetText1.Stop(); _TimerDuetText1.Stop();
} }
} }
else if (!_TimerDuetText1.IsRunning && _TimerDuetText1.ElapsedMilliseconds == 0 && Lyrics[_LyricMainDuet].Alpha > 0 && CGame.GetSong().IsDuet) else if (!_TimerDuetText1.IsRunning && _TimerDuetText1.ElapsedMilliseconds == 0 && _Lyrics[_LyricMainDuet].Alpha > 0 && CGame.GetSong().IsDuet)
_TimerDuetText1.Start(); _TimerDuetText1.Start();
else else
Texts[_TextDuetName1].Visible = false; _Texts[_TextDuetName1].Visible = false;
//Timer for second duet-part //Timer for second duet-part
if (_TimerDuetText2.IsRunning) if (_TimerDuetText2.IsRunning)
{ {
float t = _TimerDuetText2.ElapsedMilliseconds / 1000f; float t = _TimerDuetText2.ElapsedMilliseconds / 1000f;
if (t < 10f) if (t < 10f)
{ {
Texts[_TextDuetName2].Visible = true; _Texts[_TextDuetName2].Visible = true;
if (t < 3f) if (t < 3f)
Texts[_TextDuetName2].Color.A = (3f - (3f - t)) / 3f; _Texts[_TextDuetName2].Color.A = (3f - (3f - t)) / 3f;
else if (t < 7f) else if (t < 7f)
Texts[_TextDuetName2].Color.A = 1f; _Texts[_TextDuetName2].Color.A = 1f;
else else
Texts[_TextDuetName2].Color.A = (3f - (t - 7f)) / 3f; _Texts[_TextDuetName2].Color.A = (3f - (t - 7f)) / 3f;
} }
else else
{ {
Texts[_TextDuetName2].Visible = false; _Texts[_TextDuetName2].Visible = false;
_TimerDuetText2.Stop(); _TimerDuetText2.Stop();
} }
} }
else if (!_TimerDuetText2.IsRunning && _TimerDuetText2.ElapsedMilliseconds == 0 && Lyrics[_LyricMain].Alpha > 0 && CGame.GetSong().IsDuet) else if (!_TimerDuetText2.IsRunning && _TimerDuetText2.ElapsedMilliseconds == 0 && _Lyrics[_LyricMain].Alpha > 0 && CGame.GetSong().IsDuet)
_TimerDuetText2.Start(); _TimerDuetText2.Start();
else else
Texts[_TextDuetName2].Visible = false; _Texts[_TextDuetName2].Visible = false;
} }
} }
@@ -1253,19 +1252,19 @@ namespace Vocaluxe.Screens
case ETimerMode.TR_CONFIG_TIMERMODE_CURRENT: case ETimerMode.TR_CONFIG_TIMERMODE_CURRENT:
int min = (int)Math.Floor(currentTime / 60f); int min = (int)Math.Floor(currentTime / 60f);
int sec = (int)(currentTime - min * 60f); int sec = (int)(currentTime - min * 60f);
Texts[_TextTime].Text = min.ToString("00") + ":" + sec.ToString("00"); _Texts[_TextTime].Text = min.ToString("00") + ":" + sec.ToString("00");
break; break;
case ETimerMode.TR_CONFIG_TIMERMODE_REMAINING: case ETimerMode.TR_CONFIG_TIMERMODE_REMAINING:
min = (int)Math.Floor(remainingTime / 60f); min = (int)Math.Floor(remainingTime / 60f);
sec = (int)(remainingTime - min * 60f); sec = (int)(remainingTime - min * 60f);
Texts[_TextTime].Text = "-" + min.ToString("00") + ":" + sec.ToString("00"); _Texts[_TextTime].Text = "-" + min.ToString("00") + ":" + sec.ToString("00");
break; break;
case ETimerMode.TR_CONFIG_TIMERMODE_TOTAL: case ETimerMode.TR_CONFIG_TIMERMODE_TOTAL:
min = (int)Math.Floor(totalTime / 60f); min = (int)Math.Floor(totalTime / 60f);
sec = (int)(totalTime - min * 60f); sec = (int)(totalTime - min * 60f);
Texts[_TextTime].Text = "#" + min.ToString("00") + ":" + sec.ToString("00"); _Texts[_TextTime].Text = "#" + min.ToString("00") + ":" + sec.ToString("00");
break; break;
} }
@@ -1273,43 +1272,43 @@ namespace Vocaluxe.Screens
switch (CConfig.TimerLook) switch (CConfig.TimerLook)
{ {
case ETimerLook.TR_CONFIG_TIMERLOOK_NORMAL: case ETimerLook.TR_CONFIG_TIMERLOOK_NORMAL:
_TimeLineRect.W = Statics[_StaticTimeLine].Rect.W * (currentTime / totalTime); _TimeLineRect.W = _Statics[_StaticTimeLine].Rect.W * (currentTime / totalTime);
break; break;
case ETimerLook.TR_CONFIG_TIMERLOOK_EXPANDED: case ETimerLook.TR_CONFIG_TIMERLOOK_EXPANDED:
CStatic stat = Statics[_StaticTimeLine]; CStatic stat = _Statics[_StaticTimeLine];
int currentBeat = CGame.CurrentBeat; int currentBeat = CGame.CurrentBeat;
for (int i = 0; i < _TimeRects.Count; i++) for (int i = 0; i < _TimeRects.Count; i++)
{ {
if (currentBeat >= _TimeRects[i].StartBeat && currentBeat <= _TimeRects[i].EndBeat) if (currentBeat >= _TimeRects[i].StartBeat && currentBeat <= _TimeRects[i].EndBeat)
{ {
_TimeRects[i].Rect.Texture = Statics[_StaticTimeLineExpandedHighlighted].Texture; _TimeRects[i].Rect.Texture = _Statics[_StaticTimeLineExpandedHighlighted].Texture;
_TimeRects[i].Rect.Color = Statics[_StaticTimeLineExpandedHighlighted].Color; _TimeRects[i].Rect.Color = _Statics[_StaticTimeLineExpandedHighlighted].Color;
} }
else else
{ {
_TimeRects[i].Rect.Texture = Statics[_StaticTimeLineExpandedNormal].Texture; _TimeRects[i].Rect.Texture = _Statics[_StaticTimeLineExpandedNormal].Texture;
_TimeRects[i].Rect.Color = Statics[_StaticTimeLineExpandedNormal].Color; _TimeRects[i].Rect.Color = _Statics[_StaticTimeLineExpandedNormal].Color;
} }
} }
Statics[_StaticTimePointer].Rect.X = stat.Rect.X + stat.Rect.W * (currentTime / totalTime); _Statics[_StaticTimePointer].Rect.X = stat.Rect.X + stat.Rect.W * (currentTime / totalTime);
break; break;
} }
} }
private void _PrepareTimeLine() private void _PrepareTimeLine()
{ {
CStatic stat = Statics[_StaticTimeLine]; CStatic stat = _Statics[_StaticTimeLine];
switch (CConfig.TimerLook) switch (CConfig.TimerLook)
{ {
case ETimerLook.TR_CONFIG_TIMERLOOK_NORMAL: case ETimerLook.TR_CONFIG_TIMERLOOK_NORMAL:
_TimeLineRect = new SRectF(stat.Rect.X, stat.Rect.Y, 0f, stat.Rect.H, stat.Rect.Z); _TimeLineRect = new SRectF(stat.Rect.X, stat.Rect.Y, 0f, stat.Rect.H, stat.Rect.Z);
Statics[_StaticTimePointer].Visible = false; _Statics[_StaticTimePointer].Visible = false;
break; break;
case ETimerLook.TR_CONFIG_TIMERLOOK_EXPANDED: case ETimerLook.TR_CONFIG_TIMERLOOK_EXPANDED:
_TimeRects.Clear(); _TimeRects.Clear();
Statics[_StaticTimePointer].Visible = true; _Statics[_StaticTimePointer].Visible = true;
CSong song = CGame.GetSong(); CSong song = CGame.GetSong();
@@ -1325,18 +1324,14 @@ namespace Vocaluxe.Screens
if (totalTime <= 0f) if (totalTime <= 0f)
return; return;
CLines[] lines = new CLines[song.Notes.Lines.Length]; CLines[] partLines = song.Notes.Lines;
lines = song.Notes.Lines; foreach (CLines partLine in partLines) {
for (int i = 0; i < lines.Length; i++) CLine[] line = partLine.Line;
{
CLine[] line = lines[i].Line;
for (int j = 0; j < line.Length; j++) for (int j = 0; j < line.Length; j++)
{ {
if (line[j].VisibleInTimeLine) if (line[j].VisibleInTimeLine)
{ {
STimeRect trect = new STimeRect(); STimeRect trect = new STimeRect {StartBeat = line[j].FirstNoteBeat, EndBeat = line[j].EndBeat};
trect.StartBeat = line[j].FirstNoteBeat;
trect.EndBeat = line[j].EndBeat;
trect.Rect = GetNewStatic(new STexture(-1), trect.Rect = GetNewStatic(new STexture(-1),
new SColorF(1f, 1f, 1f, 1f), new SColorF(1f, 1f, 1f, 1f),
new SRectF( new SRectF(
@@ -1359,9 +1354,9 @@ namespace Vocaluxe.Screens
for (int i = 0; i < CGame.NumPlayer; i++) for (int i = 0; i < CGame.NumPlayer; i++)
{ {
if (CGame.Player[i].ProfileID > -1 && CProfiles.NumProfiles > CGame.Player[i].ProfileID) if (CGame.Player[i].ProfileID > -1 && CProfiles.NumProfiles > CGame.Player[i].ProfileID)
Statics[_StaticAvatars[i, CGame.NumPlayer - 1]].Texture = CProfiles.Profiles[CGame.Player[i].ProfileID].Avatar.Texture; _Statics[_StaticAvatars[i, CGame.NumPlayer - 1]].Texture = CProfiles.Profiles[CGame.Player[i].ProfileID].Avatar.Texture;
else else
Statics[_StaticAvatars[i, CGame.NumPlayer - 1]].Visible = false; _Statics[_StaticAvatars[i, CGame.NumPlayer - 1]].Visible = false;
} }
} }
@@ -1370,9 +1365,9 @@ namespace Vocaluxe.Screens
for (int i = 0; i < CGame.NumPlayer; i++) for (int i = 0; i < CGame.NumPlayer; i++)
{ {
if (CGame.Player[i].ProfileID > -1 && CProfiles.NumProfiles > CGame.Player[i].ProfileID) if (CGame.Player[i].ProfileID > -1 && CProfiles.NumProfiles > CGame.Player[i].ProfileID)
Texts[_TextNames[i, CGame.NumPlayer - 1]].Text = CProfiles.Profiles[CGame.Player[i].ProfileID].PlayerName; _Texts[_TextNames[i, CGame.NumPlayer - 1]].Text = CProfiles.Profiles[CGame.Player[i].ProfileID].PlayerName;
else else
Texts[_TextNames[i, CGame.NumPlayer - 1]].Visible = false; _Texts[_TextNames[i, CGame.NumPlayer - 1]].Visible = false;
} }
} }
} }
+216 -216
View File
@@ -140,11 +140,11 @@ namespace Vocaluxe.Screens
{ {
base.LoadTheme(xmlPath); base.LoadTheme(xmlPath);
_ToggleSongOptions(ESongOptionsView.None); _ToggleSongOptions(ESongOptionsView.None);
Playlists[_Playlist].Visible = false; _Playlists[_Playlist].Visible = false;
_DragAndDropCover = GetNewStatic(); _DragAndDropCover = GetNewStatic();
Playlists[_Playlist].Init(); _Playlists[_Playlist].Init();
_AvailableGameModes.Clear(); _AvailableGameModes.Clear();
@@ -159,7 +159,7 @@ namespace Vocaluxe.Screens
if (_PlaylistActive) if (_PlaylistActive)
{ {
Playlists[_Playlist].HandleInput(keyEvent); _Playlists[_Playlist].HandleInput(keyEvent);
return true; return true;
} }
@@ -177,7 +177,7 @@ namespace Vocaluxe.Screens
} }
else else
{ {
SongMenus[_SongMenu].HandleInput(ref keyEvent, _Sso); _SongMenus[_SongMenu].HandleInput(ref keyEvent, _Sso);
_UpdatePartyModeOptions(); _UpdatePartyModeOptions();
if (keyEvent.Handled) if (keyEvent.Handled)
@@ -203,19 +203,19 @@ namespace Vocaluxe.Screens
{ {
if (i < _Sso.Selection.NumJokers.Length) if (i < _Sso.Selection.NumJokers.Length)
{ {
if (Buttons[_ButtonsJoker[i]].Selected) if (_Buttons[_ButtonsJoker[i]].Selected)
{ {
_SelectNextRandom(i); _SelectNextRandom(i);
return true; return true;
} }
} }
} }
if (Buttons[_ButtonStart].Selected) if (_Buttons[_ButtonStart].Selected)
_HandlePartySongSelection(SongMenus[_SongMenu].GetSelectedSong()); _HandlePartySongSelection(_SongMenus[_SongMenu].GetSelectedSong());
} }
if (CSongs.NumVisibleSongs > 0 && !_Sso.Selection.PartyMode) if (CSongs.NumVisibleSongs > 0 && !_Sso.Selection.PartyMode)
{ {
if (SongMenus[_SongMenu].GetSelectedSong() != -1 && !_SongOptionsActive) if (_SongMenus[_SongMenu].GetSelectedSong() != -1 && !_SongOptionsActive)
{ {
if (!_Sso.Selection.PartyMode) if (!_Sso.Selection.PartyMode)
_ToggleSongOptions(ESongOptionsView.Song); _ToggleSongOptions(ESongOptionsView.Song);
@@ -224,11 +224,11 @@ namespace Vocaluxe.Screens
break; break;
case Keys.Tab: case Keys.Tab:
if (Playlists[_Playlist].Visible) if (_Playlists[_Playlist].Visible)
{ {
_PlaylistActive = !_PlaylistActive; _PlaylistActive = !_PlaylistActive;
Playlists[_Playlist].Selected = _PlaylistActive; _Playlists[_Playlist].Selected = _PlaylistActive;
SongMenus[_SongMenu].SetActive(!_PlaylistActive); _SongMenus[_SongMenu].SetActive(!_PlaylistActive);
} }
break; break;
@@ -277,7 +277,7 @@ namespace Vocaluxe.Screens
case Keys.S: case Keys.S:
if (keyEvent.Mod == EModifier.Ctrl && CSongs.NumVisibleSongs > 0 && !_Sso.Selection.PartyMode) if (keyEvent.Mod == EModifier.Ctrl && CSongs.NumVisibleSongs > 0 && !_Sso.Selection.PartyMode)
_StartMedleySong(SongMenus[_SongMenu].GetSelectedSong()); _StartMedleySong(_SongMenus[_SongMenu].GetSelectedSong());
break; break;
case Keys.D1: case Keys.D1:
@@ -312,39 +312,39 @@ namespace Vocaluxe.Screens
switch (keyEvent.Key) switch (keyEvent.Key)
{ {
case Keys.Enter: case Keys.Enter:
if (Buttons[_ButtonOptionsClose].Selected) if (_Buttons[_ButtonOptionsClose].Selected)
_ToggleSongOptions(ESongOptionsView.None); _ToggleSongOptions(ESongOptionsView.None);
else if (Buttons[_ButtonOptionsSing].Selected) else if (_Buttons[_ButtonOptionsSing].Selected)
{ {
_ToggleSongOptions(ESongOptionsView.None); _ToggleSongOptions(ESongOptionsView.None);
_StartSong(SongMenus[_SongMenu].GetSelectedSong()); _StartSong(_SongMenus[_SongMenu].GetSelectedSong());
} }
else if (Buttons[_ButtonOptionsPlaylist].Selected) else if (_Buttons[_ButtonOptionsPlaylist].Selected)
{ {
_ToggleSongOptions(ESongOptionsView.None); _ToggleSongOptions(ESongOptionsView.None);
_OpenAndAddPlaylistAction(); _OpenAndAddPlaylistAction();
} }
else if (Buttons[_ButtonOptionsRandom].Selected) else if (_Buttons[_ButtonOptionsRandom].Selected)
{ {
if (CSongs.IsInCategory) if (CSongs.IsInCategory)
SongMenus[_SongMenu].SetSelectedSong(CSongs.GetRandomSong()); _SongMenus[_SongMenu].SetSelectedSong(CSongs.GetRandomSong());
else else
SongMenus[_SongMenu].SetSelectedCategory(CSongs.GetRandomCategory()); _SongMenus[_SongMenu].SetSelectedCategory(CSongs.GetRandomCategory());
} }
else if (Buttons[_ButtonOptionsSingAll].Selected) else if (_Buttons[_ButtonOptionsSingAll].Selected)
_StartRandomAllSongs(); _StartRandomAllSongs();
else if (Buttons[_ButtonOptionsSingAllVisible].Selected) else if (_Buttons[_ButtonOptionsSingAllVisible].Selected)
_StartRandomVisibleSongs(); _StartRandomVisibleSongs();
else if (Buttons[_ButtonOptionsOpenSelectedItem].Selected) else if (_Buttons[_ButtonOptionsOpenSelectedItem].Selected)
_HandleSelectButton(); _HandleSelectButton();
else if (SelectSlides[_SelectSlideOptionsPlaylistOpen].Selected) else if (_SelectSlides[_SelectSlideOptionsPlaylistOpen].Selected)
_OpenPlaylistAction(); _OpenPlaylistAction();
else if (Buttons[_ButtonOptionsRandomMedley].Selected) else if (_Buttons[_ButtonOptionsRandomMedley].Selected)
_ToggleSongOptions(ESongOptionsView.Medley); _ToggleSongOptions(ESongOptionsView.Medley);
else if (Buttons[_ButtonOptionsStartMedley].Selected) else if (_Buttons[_ButtonOptionsStartMedley].Selected)
{ {
_ToggleSongOptions(ESongOptionsView.None); _ToggleSongOptions(ESongOptionsView.None);
_StartRandomMedley(SelectSlides[_SelectSlideOptionsNumMedleySongs].Selection + 1, !CSongs.IsInCategory); _StartRandomMedley(_SelectSlides[_SelectSlideOptionsNumMedleySongs].Selection + 1, !CSongs.IsInCategory);
} }
break; break;
@@ -388,24 +388,24 @@ namespace Vocaluxe.Screens
_OldMousePosX = mouseEvent.X; _OldMousePosX = mouseEvent.X;
_OldMousePosY = mouseEvent.Y; _OldMousePosY = mouseEvent.Y;
if (Playlists[_Playlist].Visible && Playlists[_Playlist].IsMouseOver(mouseEvent)) if (_Playlists[_Playlist].Visible && _Playlists[_Playlist].IsMouseOver(mouseEvent))
{ {
_PlaylistActive = true; _PlaylistActive = true;
Playlists[_Playlist].Selected = _PlaylistActive; _Playlists[_Playlist].Selected = _PlaylistActive;
SongMenus[_SongMenu].SetActive(!_PlaylistActive); _SongMenus[_SongMenu].SetActive(!_PlaylistActive);
_ToggleSongOptions(ESongOptionsView.None); _ToggleSongOptions(ESongOptionsView.None);
} }
else if (CHelper.IsInBounds(SongMenus[_SongMenu].Rect, mouseEvent.X, mouseEvent.Y)) else if (CHelper.IsInBounds(_SongMenus[_SongMenu].Rect, mouseEvent.X, mouseEvent.Y))
{ {
_PlaylistActive = false; _PlaylistActive = false;
Playlists[_Playlist].Selected = _PlaylistActive; _Playlists[_Playlist].Selected = _PlaylistActive;
SongMenus[_SongMenu].SetActive(!_PlaylistActive); _SongMenus[_SongMenu].SetActive(!_PlaylistActive);
} }
if (Playlists[_Playlist].Visible && _PlaylistActive) if (_Playlists[_Playlist].Visible && _PlaylistActive)
{ {
if (Playlists[_Playlist].HandleMouse(mouseEvent)) if (_Playlists[_Playlist].HandleMouse(mouseEvent))
return true; return true;
} }
@@ -440,15 +440,15 @@ namespace Vocaluxe.Screens
{ {
//TODO: Causes Bug if you select a song (e.g. with Select random song) and double click a normal button. //TODO: Causes Bug if you select a song (e.g. with Select random song) and double click a normal button.
//E.g. clicking to fast on Select random song starts the next random song. is this OK? //E.g. clicking to fast on Select random song starts the next random song. is this OK?
if (CSongs.NumVisibleSongs > 0 && SongMenus[_SongMenu].GetActualSelection() != -1) if (CSongs.NumVisibleSongs > 0 && _SongMenus[_SongMenu].GetActualSelection() != -1)
{ {
_ToggleSongOptions(ESongOptionsView.None); _ToggleSongOptions(ESongOptionsView.None);
_StartVisibleSong(SongMenus[_SongMenu].GetActualSelection()); _StartVisibleSong(_SongMenus[_SongMenu].GetActualSelection());
return true; return true;
} }
} }
SongMenus[_SongMenu].HandleMouse(ref mouseEvent, _Sso); _SongMenus[_SongMenu].HandleMouse(ref mouseEvent, _Sso);
_UpdatePartyModeOptions(); _UpdatePartyModeOptions();
if (mouseEvent.Handled) if (mouseEvent.Handled)
@@ -456,84 +456,84 @@ namespace Vocaluxe.Screens
if (mouseEvent.LB) if (mouseEvent.LB)
{ {
if (IsMouseOver(mouseEvent)) if (_IsMouseOver(mouseEvent))
{ {
if (Buttons[_ButtonOpenOptions].Selected) if (_Buttons[_ButtonOpenOptions].Selected)
{ {
_ToggleSongOptions(ESongOptionsView.General); _ToggleSongOptions(ESongOptionsView.General);
return true; return true;
} }
else if (Buttons[_ButtonOptionsClose].Selected) else if (_Buttons[_ButtonOptionsClose].Selected)
{ {
_ToggleSongOptions(ESongOptionsView.None); _ToggleSongOptions(ESongOptionsView.None);
return true; return true;
} }
else if (Buttons[_ButtonOptionsSing].Selected) else if (_Buttons[_ButtonOptionsSing].Selected)
{ {
_ToggleSongOptions(ESongOptionsView.None); _ToggleSongOptions(ESongOptionsView.None);
_StartSong(SongMenus[_SongMenu].GetSelectedSong()); _StartSong(_SongMenus[_SongMenu].GetSelectedSong());
return true; return true;
} }
else if (Buttons[_ButtonOptionsPlaylist].Selected) else if (_Buttons[_ButtonOptionsPlaylist].Selected)
{ {
_ToggleSongOptions(ESongOptionsView.None); _ToggleSongOptions(ESongOptionsView.None);
_OpenAndAddPlaylistAction(); _OpenAndAddPlaylistAction();
return true; return true;
} }
else if (Buttons[_ButtonOptionsRandom].Selected) else if (_Buttons[_ButtonOptionsRandom].Selected)
{ {
if (CSongs.IsInCategory) if (CSongs.IsInCategory)
{ {
SongMenus[_SongMenu].SetSelectedSong(CSongs.GetRandomSong()); _SongMenus[_SongMenu].SetSelectedSong(CSongs.GetRandomSong());
return true; return true;
} }
} }
else if (Buttons[_ButtonOptionsRandomCategory].Selected) else if (_Buttons[_ButtonOptionsRandomCategory].Selected)
{ {
if (!CSongs.IsInCategory) if (!CSongs.IsInCategory)
{ {
SongMenus[_SongMenu].SetSelectedCategory(CSongs.GetRandomCategory()); _SongMenus[_SongMenu].SetSelectedCategory(CSongs.GetRandomCategory());
return true; return true;
} }
} }
else if (Buttons[_ButtonOptionsSingAll].Selected) else if (_Buttons[_ButtonOptionsSingAll].Selected)
{ {
_ToggleSongOptions(ESongOptionsView.None); _ToggleSongOptions(ESongOptionsView.None);
_StartRandomAllSongs(); _StartRandomAllSongs();
return true; return true;
} }
else if (Buttons[_ButtonOptionsSingAllVisible].Selected) else if (_Buttons[_ButtonOptionsSingAllVisible].Selected)
{ {
_ToggleSongOptions(ESongOptionsView.None); _ToggleSongOptions(ESongOptionsView.None);
_StartRandomVisibleSongs(); _StartRandomVisibleSongs();
return true; return true;
} }
else if (Buttons[_ButtonOptionsOpenSelectedItem].Selected) else if (_Buttons[_ButtonOptionsOpenSelectedItem].Selected)
{ {
_HandleSelectButton(); _HandleSelectButton();
return true; return true;
} }
else if (SelectSlides[_SelectSlideOptionsPlaylistOpen].ValueSelected) else if (_SelectSlides[_SelectSlideOptionsPlaylistOpen].ValueSelected)
{ {
_OpenPlaylistAction(); _OpenPlaylistAction();
return true; return true;
} }
else if (Buttons[_ButtonOptionsRandomMedley].Selected) else if (_Buttons[_ButtonOptionsRandomMedley].Selected)
{ {
_ToggleSongOptions(ESongOptionsView.Medley); _ToggleSongOptions(ESongOptionsView.Medley);
return true; return true;
} }
else if (Buttons[_ButtonOptionsStartMedley].Selected) else if (_Buttons[_ButtonOptionsStartMedley].Selected)
{ {
_ToggleSongOptions(ESongOptionsView.None); _ToggleSongOptions(ESongOptionsView.None);
_StartRandomMedley(SelectSlides[_SelectSlideOptionsNumMedleySongs].Selection + 1, !CSongs.IsInCategory); _StartRandomMedley(_SelectSlides[_SelectSlideOptionsNumMedleySongs].Selection + 1, !CSongs.IsInCategory);
return true; return true;
} }
else if (_Sso.Selection.RandomOnly && _Sso.Selection.NumJokers != null) else if (_Sso.Selection.RandomOnly && _Sso.Selection.NumJokers != null)
{ {
if (Buttons[_ButtonStart].Selected) if (_Buttons[_ButtonStart].Selected)
{ {
_HandlePartySongSelection(SongMenus[_SongMenu].GetSelectedSong()); _HandlePartySongSelection(_SongMenus[_SongMenu].GetSelectedSong());
return true; return true;
} }
@@ -541,7 +541,7 @@ namespace Vocaluxe.Screens
{ {
if (i < _Sso.Selection.NumJokers.Length) if (i < _Sso.Selection.NumJokers.Length)
{ {
if (Buttons[_ButtonsJoker[i]].Selected) if (_Buttons[_ButtonsJoker[i]].Selected)
{ {
_SelectNextRandom(i); _SelectNextRandom(i);
return true; return true;
@@ -551,9 +551,9 @@ namespace Vocaluxe.Screens
} }
} }
if (CSongs.NumVisibleSongs > 0 && SongMenus[_SongMenu].GetActualSelection() != -1 && !_Sso.Selection.PartyMode) if (CSongs.NumVisibleSongs > 0 && _SongMenus[_SongMenu].GetActualSelection() != -1 && !_Sso.Selection.PartyMode)
{ {
if (SongMenus[_SongMenu].GetSelectedSong() != -1 && !_SongOptionsActive) if (_SongMenus[_SongMenu].GetSelectedSong() != -1 && !_SongOptionsActive)
{ {
_ToggleSongOptions(ESongOptionsView.Song); _ToggleSongOptions(ESongOptionsView.Song);
return true; return true;
@@ -568,11 +568,11 @@ namespace Vocaluxe.Screens
if (mouseEvent.LBH) if (mouseEvent.LBH)
{ {
if (!_DragAndDropActive && Playlists[_Playlist].Visible && CSongs.NumVisibleSongs > 0 && SongMenus[_SongMenu].GetActualSelection() != -1) if (!_DragAndDropActive && _Playlists[_Playlist].Visible && CSongs.NumVisibleSongs > 0 && _SongMenus[_SongMenu].GetActualSelection() != -1)
{ {
_DragAndDropCover = SongMenus[_SongMenu].GetSelectedSongCover(); _DragAndDropCover = _SongMenus[_SongMenu].GetSelectedSongCover();
_DragAndDropCover.Rect.Z = CSettings.ZNear; _DragAndDropCover.Rect.Z = CSettings.ZNear;
Playlists[_Playlist].DragAndDropSongID = CSongs.VisibleSongs[SongMenus[_SongMenu].GetActualSelection()].ID; _Playlists[_Playlist].DragAndDropSongID = CSongs.VisibleSongs[_SongMenus[_SongMenu].GetActualSelection()].ID;
_DragAndDropActive = true; _DragAndDropActive = true;
return true; return true;
} }
@@ -582,7 +582,7 @@ namespace Vocaluxe.Screens
if (!mouseEvent.LBH && _DragAndDropActive) if (!mouseEvent.LBH && _DragAndDropActive)
{ {
_DragAndDropActive = false; _DragAndDropActive = false;
Playlists[_Playlist].DragAndDropSongID = -1; _Playlists[_Playlist].DragAndDropSongID = -1;
return true; return true;
} }
@@ -599,7 +599,7 @@ namespace Vocaluxe.Screens
else if (_Sso.Selection.CategoryChangeAllowed) else if (_Sso.Selection.CategoryChangeAllowed)
{ {
_ToggleSongOptions(ESongOptionsView.None); _ToggleSongOptions(ESongOptionsView.None);
SongMenus[_SongMenu].EnterCurrentCategory(); _SongMenus[_SongMenu].EnterCurrentCategory();
} }
} }
@@ -616,7 +616,7 @@ namespace Vocaluxe.Screens
_SearchText = _Sso.Sorting.SearchString; _SearchText = _Sso.Sorting.SearchString;
CGame.EnterNormalGame(); CGame.EnterNormalGame();
SongMenus[_SongMenu].OnShow(); _SongMenus[_SongMenu].OnShow();
if (_Sso.Selection.PartyMode) if (_Sso.Selection.PartyMode)
_PlaylistActive = false; _PlaylistActive = false;
@@ -624,52 +624,52 @@ namespace Vocaluxe.Screens
if (_Sso.Selection.PartyMode) if (_Sso.Selection.PartyMode)
_ToggleSongOptions(ESongOptionsView.None); _ToggleSongOptions(ESongOptionsView.None);
SongMenus[_SongMenu].SetActive(!_PlaylistActive); _SongMenus[_SongMenu].SetActive(!_PlaylistActive);
SongMenus[_SongMenu].SetSmallView(Playlists[_Playlist].Visible); _SongMenus[_SongMenu].SetSmallView(_Playlists[_Playlist].Visible);
if (Playlists[_Playlist].ActivePlaylistID != -1) if (_Playlists[_Playlist].ActivePlaylistID != -1)
Playlists[_Playlist].LoadPlaylist(Playlists[_Playlist].ActivePlaylistID); _Playlists[_Playlist].LoadPlaylist(_Playlists[_Playlist].ActivePlaylistID);
_DragAndDropActive = false; _DragAndDropActive = false;
Playlists[_Playlist].DragAndDropSongID = -1; _Playlists[_Playlist].DragAndDropSongID = -1;
UpdateGame(); UpdateGame();
} }
public override bool UpdateGame() public override bool UpdateGame()
{ {
if (SongMenus[_SongMenu].IsSmallView()) if (_SongMenus[_SongMenu].IsSmallView())
CheckPlaylist(); CheckPlaylist();
Texts[_TextCategory].Text = CSongs.GetCurrentCategoryName(); _Texts[_TextCategory].Text = CSongs.GetCurrentCategoryName();
if (CSongs.Category > -1 || CConfig.Tabs == EOffOn.TR_CONFIG_OFF) if (CSongs.Category > -1 || CConfig.Tabs == EOffOn.TR_CONFIG_OFF)
CBackgroundMusic.Disabled = true; CBackgroundMusic.Disabled = true;
else else
CBackgroundMusic.Disabled = false; CBackgroundMusic.Disabled = false;
int song = SongMenus[_SongMenu].GetActualSelection(); int song = _SongMenus[_SongMenu].GetActualSelection();
if ((CSongs.Category >= 0 || CConfig.Tabs == EOffOn.TR_CONFIG_OFF) && song >= 0 && song < CSongs.VisibleSongs.Length) if ((CSongs.Category >= 0 || CConfig.Tabs == EOffOn.TR_CONFIG_OFF) && song >= 0 && song < CSongs.VisibleSongs.Length)
Texts[_TextSelection].Text = CSongs.VisibleSongs[song].Artist + " - " + CSongs.VisibleSongs[song].Title; _Texts[_TextSelection].Text = CSongs.VisibleSongs[song].Artist + " - " + CSongs.VisibleSongs[song].Title;
else if (!CSongs.IsInCategory && song >= 0 && song < CSongs.Categories.Length) else if (!CSongs.IsInCategory && song >= 0 && song < CSongs.Categories.Length)
Texts[_TextSelection].Text = CSongs.Categories[song].Name; _Texts[_TextSelection].Text = CSongs.Categories[song].Name;
else else
Texts[_TextSelection].Text = String.Empty; _Texts[_TextSelection].Text = String.Empty;
Texts[_TextSearchBar].Text = _SearchText; _Texts[_TextSearchBar].Text = _SearchText;
if (_SearchActive) if (_SearchActive)
{ {
Texts[_TextSearchBar].Text += '|'; _Texts[_TextSearchBar].Text += '|';
Texts[_TextSearchBar].Visible = true; _Texts[_TextSearchBar].Visible = true;
Texts[_TextSearchBarTitle].Visible = true; _Texts[_TextSearchBarTitle].Visible = true;
Statics[_StaticSearchBar].Visible = true; _Statics[_StaticSearchBar].Visible = true;
} }
else else
{ {
Texts[_TextSearchBar].Visible = false; _Texts[_TextSearchBar].Visible = false;
Texts[_TextSearchBarTitle].Visible = false; _Texts[_TextSearchBarTitle].Visible = false;
Statics[_StaticSearchBar].Visible = false; _Statics[_StaticSearchBar].Visible = false;
} }
_UpdatePartyModeOptions(); _UpdatePartyModeOptions();
@@ -691,12 +691,12 @@ namespace Vocaluxe.Screens
{ {
base.OnClose(); base.OnClose();
CBackgroundMusic.Disabled = false; CBackgroundMusic.Disabled = false;
SongMenus[_SongMenu].OnHide(); _SongMenus[_SongMenu].OnHide();
} }
public override void ApplyVolume() public override void ApplyVolume()
{ {
SongMenus[_SongMenu].ApplyVolume(CConfig.PreviewMusicVolume); _SongMenus[_SongMenu].ApplyVolume(CConfig.PreviewMusicVolume);
} }
private void _HandlePartySongSelection(int songNr) private void _HandlePartySongSelection(int songNr)
@@ -723,12 +723,12 @@ namespace Vocaluxe.Screens
_SelectNextRandomSong(); _SelectNextRandomSong();
if (_Sso.Selection.SongIndex != -1) if (_Sso.Selection.SongIndex != -1)
SongMenus[_SongMenu].SetSelectedSong(_Sso.Selection.SongIndex); _SongMenus[_SongMenu].SetSelectedSong(_Sso.Selection.SongIndex);
} }
if (_SelectedSongID != SongMenus[_SongMenu].GetSelectedSong() && CSongs.Category > -1) if (_SelectedSongID != _SongMenus[_SongMenu].GetSelectedSong() && CSongs.Category > -1)
{ {
_SelectedSongID = SongMenus[_SongMenu].GetSelectedSong(); _SelectedSongID = _SongMenus[_SongMenu].GetSelectedSong();
CParty.OnSongChange(_SelectedSongID, ref _Sso); CParty.OnSongChange(_SelectedSongID, ref _Sso);
} }
@@ -745,55 +745,55 @@ namespace Vocaluxe.Screens
_ToggleSongOptions(ESongOptionsView.None); _ToggleSongOptions(ESongOptionsView.None);
} }
SongMenus[_SongMenu].Update(_Sso); _SongMenus[_SongMenu].Update(_Sso);
if (_Sso.Selection.RandomOnly && _Sso.Selection.NumJokers != null) if (_Sso.Selection.RandomOnly && _Sso.Selection.NumJokers != null)
{ {
Buttons[_ButtonStart].Visible = true; _Buttons[_ButtonStart].Visible = true;
if (!SongMenus[_SongMenu].IsSmallView()) if (!_SongMenus[_SongMenu].IsSmallView())
SongMenus[_SongMenu].SetSmallView(true); _SongMenus[_SongMenu].SetSmallView(true);
for (int i = 0; i < CMain.Settings.GetMaxNumPlayer(); i++) for (int i = 0; i < CMain.Settings.GetMaxNumPlayer(); i++)
{ {
if (i < _Sso.Selection.NumJokers.Length) if (i < _Sso.Selection.NumJokers.Length)
{ {
Buttons[_ButtonsJoker[i]].Visible = true; _Buttons[_ButtonsJoker[i]].Visible = true;
Buttons[_ButtonsJoker[i]].Text.Text = _Sso.Selection.NumJokers[i].ToString(); _Buttons[_ButtonsJoker[i]].Text.Text = _Sso.Selection.NumJokers[i].ToString();
Texts[_TextsPlayer[i]].Visible = true; _Texts[_TextsPlayer[i]].Visible = true;
bool nameExists = false; bool nameExists = false;
if (_Sso.Selection.TeamNames != null) if (_Sso.Selection.TeamNames != null)
{ {
if (_Sso.Selection.TeamNames.Length > i) if (_Sso.Selection.TeamNames.Length > i)
{ {
Texts[_TextsPlayer[i]].Text = _Sso.Selection.TeamNames[i]; _Texts[_TextsPlayer[i]].Text = _Sso.Selection.TeamNames[i];
nameExists = true; nameExists = true;
} }
} }
if (!nameExists) if (!nameExists)
Texts[_TextsPlayer[i]].Text = i.ToString(); _Texts[_TextsPlayer[i]].Text = i.ToString();
} }
else else
{ {
Buttons[_ButtonsJoker[i]].Visible = false; _Buttons[_ButtonsJoker[i]].Visible = false;
Texts[_TextsPlayer[i]].Visible = false; _Texts[_TextsPlayer[i]].Visible = false;
} }
} }
} }
else else
{ {
if (_Sso.Selection.PartyMode && SongMenus[_SongMenu].IsSmallView()) if (_Sso.Selection.PartyMode && _SongMenus[_SongMenu].IsSmallView())
SongMenus[_SongMenu].SetSmallView(false); _SongMenus[_SongMenu].SetSmallView(false);
for (int i = 0; i < CMain.Settings.GetMaxNumPlayer(); i++) for (int i = 0; i < CMain.Settings.GetMaxNumPlayer(); i++)
{ {
Buttons[_ButtonsJoker[i]].Visible = false; _Buttons[_ButtonsJoker[i]].Visible = false;
Texts[_TextsPlayer[i]].Visible = false; _Texts[_TextsPlayer[i]].Visible = false;
} }
Buttons[_ButtonStart].Visible = false; _Buttons[_ButtonStart].Visible = false;
} }
} }
@@ -802,8 +802,8 @@ namespace Vocaluxe.Screens
if ((CSongs.Category >= 0) && (songNr >= 0)) if ((CSongs.Category >= 0) && (songNr >= 0))
{ {
EGameMode gm; EGameMode gm;
if (_AvailableGameModes.Count >= SelectSlides[_SelectSlideOptionsMode].Selection) if (_AvailableGameModes.Count >= _SelectSlides[_SelectSlideOptionsMode].Selection)
gm = _AvailableGameModes[SelectSlides[_SelectSlideOptionsMode].Selection]; gm = _AvailableGameModes[_SelectSlides[_SelectSlideOptionsMode].Selection];
else else
{ {
if (CSongs.VisibleSongs[songNr].IsDuet) if (CSongs.VisibleSongs[songNr].IsDuet)
@@ -976,7 +976,7 @@ namespace Vocaluxe.Screens
if (CSongs.IsInCategory) if (CSongs.IsInCategory)
{ {
_ToggleSongOptions(ESongOptionsView.None); _ToggleSongOptions(ESongOptionsView.None);
SongMenus[_SongMenu].SetSelectedSong(CSongs.GetRandomSong()); _SongMenus[_SongMenu].SetSelectedSong(CSongs.GetRandomSong());
return true; return true;
} }
return false; return false;
@@ -987,7 +987,7 @@ namespace Vocaluxe.Screens
if (!CSongs.IsInCategory) if (!CSongs.IsInCategory)
{ {
_ToggleSongOptions(ESongOptionsView.None); _ToggleSongOptions(ESongOptionsView.None);
SongMenus[_SongMenu].SetSelectedCategory(CSongs.GetRandomCategory()); _SongMenus[_SongMenu].SetSelectedCategory(CSongs.GetRandomCategory());
return true; return true;
} }
return false; return false;
@@ -996,7 +996,7 @@ namespace Vocaluxe.Screens
private void _JumpTo(char letter) private void _JumpTo(char letter)
{ {
int start = 0; int start = 0;
int curSelected = SongMenus[_SongMenu].GetActualSelection(); int curSelected = _SongMenus[_SongMenu].GetActualSelection();
if (CSongs.IsInCategory) if (CSongs.IsInCategory)
{ {
//TODO: Check and use sorting method //TODO: Check and use sorting method
@@ -1012,7 +1012,7 @@ namespace Vocaluxe.Screens
if (visibleID < 0 && start > 1) if (visibleID < 0 && start > 1)
visibleID = Array.FindIndex(songs, 0, start - 1, element => element.Artist.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase)); visibleID = Array.FindIndex(songs, 0, start - 1, element => element.Artist.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase));
if (visibleID > -1) if (visibleID > -1)
SongMenus[_SongMenu].SetSelectedSong(visibleID); _SongMenus[_SongMenu].SetSelectedSong(visibleID);
} }
else else
{ {
@@ -1024,7 +1024,7 @@ namespace Vocaluxe.Screens
if (visibleID < 0 && start > 1) if (visibleID < 0 && start > 1)
visibleID = Array.FindIndex(categories, 0, start - 1, element => element.Name.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase)); visibleID = Array.FindIndex(categories, 0, start - 1, element => element.Name.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase));
if (visibleID > -1) if (visibleID > -1)
SongMenus[_SongMenu].SetSelectedCategory(visibleID); _SongMenus[_SongMenu].SetSelectedCategory(visibleID);
} }
} }
@@ -1036,7 +1036,7 @@ namespace Vocaluxe.Screens
bool refresh = false; bool refresh = false;
_SearchText = newFilterString; _SearchText = newFilterString;
int songIndex = SongMenus[_SongMenu].GetSelectedSong(); int songIndex = _SongMenus[_SongMenu].GetSelectedSong();
int songID = -1; int songID = -1;
if (songIndex != -1 && CSongs.NumVisibleSongs > 0 && CSongs.NumVisibleSongs > songIndex) if (songIndex != -1 && CSongs.NumVisibleSongs > 0 && CSongs.NumVisibleSongs > songIndex)
songID = CSongs.VisibleSongs[songIndex].ID; songID = CSongs.VisibleSongs[songIndex].ID;
@@ -1059,30 +1059,30 @@ namespace Vocaluxe.Screens
refresh = true; refresh = true;
if (refresh) if (refresh)
SongMenus[_SongMenu].OnHide(); _SongMenus[_SongMenu].OnHide();
SongMenus[_SongMenu].OnShow(); _SongMenus[_SongMenu].OnShow();
} }
private void _ToggleSongOptions(ESongOptionsView view) private void _ToggleSongOptions(ESongOptionsView view)
{ {
SelectSlides[_SelectSlideOptionsMode].Visible = false; _SelectSlides[_SelectSlideOptionsMode].Visible = false;
SelectSlides[_SelectSlideOptionsPlaylistAdd].Visible = false; _SelectSlides[_SelectSlideOptionsPlaylistAdd].Visible = false;
SelectSlides[_SelectSlideOptionsPlaylistOpen].Visible = false; _SelectSlides[_SelectSlideOptionsPlaylistOpen].Visible = false;
SelectSlides[_SelectSlideOptionsNumMedleySongs].Visible = false; _SelectSlides[_SelectSlideOptionsNumMedleySongs].Visible = false;
Buttons[_ButtonOptionsClose].Visible = false; _Buttons[_ButtonOptionsClose].Visible = false;
Buttons[_ButtonOptionsSing].Visible = false; _Buttons[_ButtonOptionsSing].Visible = false;
Buttons[_ButtonOptionsPlaylist].Visible = false; _Buttons[_ButtonOptionsPlaylist].Visible = false;
Buttons[_ButtonOptionsRandom].Visible = false; _Buttons[_ButtonOptionsRandom].Visible = false;
Buttons[_ButtonOptionsRandomCategory].Visible = false; _Buttons[_ButtonOptionsRandomCategory].Visible = false;
Buttons[_ButtonOptionsSingAll].Visible = false; _Buttons[_ButtonOptionsSingAll].Visible = false;
Buttons[_ButtonOptionsSingAllVisible].Visible = false; _Buttons[_ButtonOptionsSingAllVisible].Visible = false;
Buttons[_ButtonOptionsOpenSelectedItem].Visible = false; _Buttons[_ButtonOptionsOpenSelectedItem].Visible = false;
Buttons[_ButtonOptionsRandomMedley].Visible = false; _Buttons[_ButtonOptionsRandomMedley].Visible = false;
Buttons[_ButtonOptionsStartMedley].Visible = false; _Buttons[_ButtonOptionsStartMedley].Visible = false;
Texts[_TextOptionsTitle].Visible = false; _Texts[_TextOptionsTitle].Visible = false;
Statics[_StaticOptionsBG].Visible = false; _Statics[_StaticOptionsBG].Visible = false;
Buttons[_ButtonOpenOptions].Visible = true; _Buttons[_ButtonOpenOptions].Visible = true;
_SongOptionsActive = view != ESongOptionsView.None; _SongOptionsActive = view != ESongOptionsView.None;
@@ -1091,10 +1091,10 @@ namespace Vocaluxe.Screens
//Has to be done here otherwhise changed playlist names will not appear until OnShow is called! //Has to be done here otherwhise changed playlist names will not appear until OnShow is called!
_UpdatePlaylistNames(); _UpdatePlaylistNames();
Texts[_TextOptionsTitle].Visible = true; _Texts[_TextOptionsTitle].Visible = true;
Buttons[_ButtonOptionsClose].Visible = true; _Buttons[_ButtonOptionsClose].Visible = true;
Statics[_StaticOptionsBG].Visible = true; _Statics[_StaticOptionsBG].Visible = true;
Buttons[_ButtonOpenOptions].Visible = false; _Buttons[_ButtonOpenOptions].Visible = false;
if (view == ESongOptionsView.Song) if (view == ESongOptionsView.Song)
_ShowSongOptionsSong(); _ShowSongOptionsSong();
else if (view == ESongOptionsView.General) else if (view == ESongOptionsView.General)
@@ -1108,88 +1108,88 @@ namespace Vocaluxe.Screens
{ {
EGameMode lastMode = EGameMode.TR_GAMEMODE_NORMAL; EGameMode lastMode = EGameMode.TR_GAMEMODE_NORMAL;
if (_AvailableGameModes.Count > 0) if (_AvailableGameModes.Count > 0)
lastMode = _AvailableGameModes[SelectSlides[_SelectSlideOptionsMode].Selection]; lastMode = _AvailableGameModes[_SelectSlides[_SelectSlideOptionsMode].Selection];
SetInteractionToButton(Buttons[_ButtonOptionsSing]); _SetInteractionToButton(_Buttons[_ButtonOptionsSing]);
_AvailableGameModes.Clear(); _AvailableGameModes.Clear();
SelectSlides[_SelectSlideOptionsMode].Clear(); _SelectSlides[_SelectSlideOptionsMode].Clear();
if (CSongs.VisibleSongs[SongMenus[_SongMenu].GetSelectedSong()].IsDuet) if (CSongs.VisibleSongs[_SongMenus[_SongMenu].GetSelectedSong()].IsDuet)
{ {
SelectSlides[_SelectSlideOptionsMode].AddValue(Enum.GetName(typeof(EGameMode), EGameMode.TR_GAMEMODE_DUET)); _SelectSlides[_SelectSlideOptionsMode].AddValue(Enum.GetName(typeof(EGameMode), EGameMode.TR_GAMEMODE_DUET));
_AvailableGameModes.Add(EGameMode.TR_GAMEMODE_DUET); _AvailableGameModes.Add(EGameMode.TR_GAMEMODE_DUET);
} }
else else
{ {
SelectSlides[_SelectSlideOptionsMode].AddValue(Enum.GetName(typeof(EGameMode), EGameMode.TR_GAMEMODE_NORMAL)); _SelectSlides[_SelectSlideOptionsMode].AddValue(Enum.GetName(typeof(EGameMode), EGameMode.TR_GAMEMODE_NORMAL));
_AvailableGameModes.Add(EGameMode.TR_GAMEMODE_NORMAL); _AvailableGameModes.Add(EGameMode.TR_GAMEMODE_NORMAL);
SelectSlides[_SelectSlideOptionsMode].AddValue(Enum.GetName(typeof(EGameMode), EGameMode.TR_GAMEMODE_SHORTSONG)); _SelectSlides[_SelectSlideOptionsMode].AddValue(Enum.GetName(typeof(EGameMode), EGameMode.TR_GAMEMODE_SHORTSONG));
_AvailableGameModes.Add(EGameMode.TR_GAMEMODE_SHORTSONG); _AvailableGameModes.Add(EGameMode.TR_GAMEMODE_SHORTSONG);
} }
if (CSongs.VisibleSongs[SongMenus[_SongMenu].GetSelectedSong()].Medley.Source != EMedleySource.None) if (CSongs.VisibleSongs[_SongMenus[_SongMenu].GetSelectedSong()].Medley.Source != EMedleySource.None)
{ {
SelectSlides[_SelectSlideOptionsMode].AddValue(Enum.GetName(typeof(EGameMode), EGameMode.TR_GAMEMODE_MEDLEY)); _SelectSlides[_SelectSlideOptionsMode].AddValue(Enum.GetName(typeof(EGameMode), EGameMode.TR_GAMEMODE_MEDLEY));
_AvailableGameModes.Add(EGameMode.TR_GAMEMODE_MEDLEY); _AvailableGameModes.Add(EGameMode.TR_GAMEMODE_MEDLEY);
} }
//Set SelectSlide-Selection to last selected game-mode if possible //Set SelectSlide-Selection to last selected game-mode if possible
for (int i = 0; i < _AvailableGameModes.Count; i++) for (int i = 0; i < _AvailableGameModes.Count; i++)
{ {
if (_AvailableGameModes[i] == lastMode) if (_AvailableGameModes[i] == lastMode)
SelectSlides[_SelectSlideOptionsMode].SetSelectionByValueIndex(i); _SelectSlides[_SelectSlideOptionsMode].SetSelectionByValueIndex(i);
} }
SelectSlides[_SelectSlideOptionsMode].Visible = true; _SelectSlides[_SelectSlideOptionsMode].Visible = true;
SelectSlides[_SelectSlideOptionsPlaylistAdd].Visible = true; _SelectSlides[_SelectSlideOptionsPlaylistAdd].Visible = true;
Buttons[_ButtonOptionsSing].Visible = true; _Buttons[_ButtonOptionsSing].Visible = true;
Buttons[_ButtonOptionsPlaylist].Visible = true; _Buttons[_ButtonOptionsPlaylist].Visible = true;
SetInteractionToButton(Buttons[_ButtonOptionsSing]); _SetInteractionToButton(_Buttons[_ButtonOptionsSing]);
} }
private void _ShowSongOptionsGeneral() private void _ShowSongOptionsGeneral()
{ {
if (CSongs.IsInCategory) if (CSongs.IsInCategory)
{ {
Buttons[_ButtonOptionsRandom].Visible = true; _Buttons[_ButtonOptionsRandom].Visible = true;
Buttons[_ButtonOptionsSingAllVisible].Visible = true; _Buttons[_ButtonOptionsSingAllVisible].Visible = true;
} }
else else
Buttons[_ButtonOptionsRandomCategory].Visible = true; _Buttons[_ButtonOptionsRandomCategory].Visible = true;
Buttons[_ButtonOptionsSingAll].Visible = true; _Buttons[_ButtonOptionsSingAll].Visible = true;
Buttons[_ButtonOptionsRandomMedley].Visible = true; _Buttons[_ButtonOptionsRandomMedley].Visible = true;
Buttons[_ButtonOptionsOpenSelectedItem].Visible = true; _Buttons[_ButtonOptionsOpenSelectedItem].Visible = true;
if (SelectSlides[_SelectSlideOptionsPlaylistOpen].NumValues > 0) if (_SelectSlides[_SelectSlideOptionsPlaylistOpen].NumValues > 0)
SelectSlides[_SelectSlideOptionsPlaylistOpen].Visible = true; _SelectSlides[_SelectSlideOptionsPlaylistOpen].Visible = true;
if (Buttons[_ButtonOptionsRandom].Visible) if (_Buttons[_ButtonOptionsRandom].Visible)
SetInteractionToButton(Buttons[_ButtonOptionsRandom]); _SetInteractionToButton(_Buttons[_ButtonOptionsRandom]);
else else
SetInteractionToButton(Buttons[_ButtonOptionsRandomCategory]); _SetInteractionToButton(_Buttons[_ButtonOptionsRandomCategory]);
} }
private void _ShowSongOptionsMedley() private void _ShowSongOptionsMedley()
{ {
Buttons[_ButtonOptionsStartMedley].Visible = true; _Buttons[_ButtonOptionsStartMedley].Visible = true;
SelectSlides[_SelectSlideOptionsNumMedleySongs].Visible = true; _SelectSlides[_SelectSlideOptionsNumMedleySongs].Visible = true;
SelectSlides[_SelectSlideOptionsNumMedleySongs].Clear(); _SelectSlides[_SelectSlideOptionsNumMedleySongs].Clear();
if (CSongs.IsInCategory) if (CSongs.IsInCategory)
{ {
for (int i = 1; i <= CSongs.VisibleSongs.Length; i++) for (int i = 1; i <= CSongs.VisibleSongs.Length; i++)
SelectSlides[_SelectSlideOptionsNumMedleySongs].AddValue(i.ToString()); _SelectSlides[_SelectSlideOptionsNumMedleySongs].AddValue(i.ToString());
} }
else else
{ {
for (int i = 1; i <= CSongs.AllSongs.Length; i++) for (int i = 1; i <= CSongs.AllSongs.Length; i++)
SelectSlides[_SelectSlideOptionsNumMedleySongs].AddValue(i.ToString()); _SelectSlides[_SelectSlideOptionsNumMedleySongs].AddValue(i.ToString());
} }
if (SelectSlides[_SelectSlideOptionsNumMedleySongs].NumValues >= 5) if (_SelectSlides[_SelectSlideOptionsNumMedleySongs].NumValues >= 5)
SelectSlides[_SelectSlideOptionsNumMedleySongs].SetSelectionByValueIndex(4); _SelectSlides[_SelectSlideOptionsNumMedleySongs].SetSelectionByValueIndex(4);
else else
SelectSlides[_SelectSlideOptionsNumMedleySongs].SetSelectionByValueIndex(SelectSlides[_SelectSlideOptionsNumMedleySongs].NumValues - 1); _SelectSlides[_SelectSlideOptionsNumMedleySongs].SetSelectionByValueIndex(_SelectSlides[_SelectSlideOptionsNumMedleySongs].NumValues - 1);
SetInteractionToButton(Buttons[_ButtonOptionsStartMedley]); _SetInteractionToButton(_Buttons[_ButtonOptionsStartMedley]);
} }
#region Playlist Actions #region Playlist Actions
public void CheckPlaylist() public void CheckPlaylist()
{ {
if (Playlists[_Playlist].ActivePlaylistID == -1 && _PlaylistActive) if (_Playlists[_Playlist].ActivePlaylistID == -1 && _PlaylistActive)
_ClosePlaylist(); _ClosePlaylist();
} }
@@ -1197,100 +1197,100 @@ namespace Vocaluxe.Screens
{ {
if (CPlaylists.Playlists.Length > playlistID && playlistID > -1) if (CPlaylists.Playlists.Length > playlistID && playlistID > -1)
{ {
Playlists[_Playlist].LoadPlaylist(playlistID); _Playlists[_Playlist].LoadPlaylist(playlistID);
SongMenus[_SongMenu].SetSmallView(true); _SongMenus[_SongMenu].SetSmallView(true);
Playlists[_Playlist].Visible = true; _Playlists[_Playlist].Visible = true;
} }
} }
private void _ClosePlaylist() private void _ClosePlaylist()
{ {
if (Playlists[_Playlist].Visible || _PlaylistActive) if (_Playlists[_Playlist].Visible || _PlaylistActive)
{ {
SongMenus[_SongMenu].SetSmallView(false); _SongMenus[_SongMenu].SetSmallView(false);
_PlaylistActive = false; _PlaylistActive = false;
Playlists[_Playlist].Selected = _PlaylistActive; _Playlists[_Playlist].Selected = _PlaylistActive;
SongMenus[_SongMenu].SetActive(!_PlaylistActive); _SongMenus[_SongMenu].SetActive(!_PlaylistActive);
Playlists[_Playlist].ClosePlaylist(); _Playlists[_Playlist].ClosePlaylist();
} }
} }
private void _UpdatePlaylistNames() private void _UpdatePlaylistNames()
{ {
SelectSlides[_SelectSlideOptionsPlaylistAdd].Clear(); _SelectSlides[_SelectSlideOptionsPlaylistAdd].Clear();
SelectSlides[_SelectSlideOptionsPlaylistAdd].AddValue("TR_SCREENSONG_NEWPLAYLIST"); _SelectSlides[_SelectSlideOptionsPlaylistAdd].AddValue("TR_SCREENSONG_NEWPLAYLIST");
SelectSlides[_SelectSlideOptionsPlaylistAdd].AddValues(CPlaylists.PlaylistNames); _SelectSlides[_SelectSlideOptionsPlaylistAdd].AddValues(CPlaylists.PlaylistNames);
SelectSlides[_SelectSlideOptionsPlaylistOpen].Clear(); _SelectSlides[_SelectSlideOptionsPlaylistOpen].Clear();
SelectSlides[_SelectSlideOptionsPlaylistOpen].AddValues(CPlaylists.PlaylistNames); _SelectSlides[_SelectSlideOptionsPlaylistOpen].AddValues(CPlaylists.PlaylistNames);
} }
private void _OpenPlaylistAction() private void _OpenPlaylistAction()
{ {
//Open a playlist //Open a playlist
if (Playlists[_Playlist].ActivePlaylistID != SelectSlides[_SelectSlideOptionsPlaylistOpen].Selection) if (_Playlists[_Playlist].ActivePlaylistID != _SelectSlides[_SelectSlideOptionsPlaylistOpen].Selection)
{ {
Playlists[_Playlist].ActivePlaylistID = SelectSlides[_SelectSlideOptionsPlaylistOpen].Selection; _Playlists[_Playlist].ActivePlaylistID = _SelectSlides[_SelectSlideOptionsPlaylistOpen].Selection;
_SetSelectSlidePlaylistToCurrentPlaylist(); _SetSelectSlidePlaylistToCurrentPlaylist();
//Open playlist //Open playlist
_OpenPlaylist(Playlists[_Playlist].ActivePlaylistID); _OpenPlaylist(_Playlists[_Playlist].ActivePlaylistID);
} }
} }
private void _OpenAndAddPlaylistAction() private void _OpenAndAddPlaylistAction()
{ {
//Open an existing playlist and add song //Open an existing playlist and add song
if (Playlists[_Playlist].ActivePlaylistID != (SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection - 1) && if (_Playlists[_Playlist].ActivePlaylistID != (_SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection - 1) &&
(SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection - 1) != -1) (_SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection - 1) != -1)
{ {
//Check selected game-mode //Check selected game-mode
EGameMode gm; EGameMode gm;
if (_AvailableGameModes.Count >= SelectSlides[_SelectSlideOptionsMode].Selection) if (_AvailableGameModes.Count >= _SelectSlides[_SelectSlideOptionsMode].Selection)
gm = _AvailableGameModes[SelectSlides[_SelectSlideOptionsMode].Selection]; gm = _AvailableGameModes[_SelectSlides[_SelectSlideOptionsMode].Selection];
else if (CSongs.VisibleSongs[SongMenus[_SongMenu].GetSelectedSong()].IsDuet) else if (CSongs.VisibleSongs[_SongMenus[_SongMenu].GetSelectedSong()].IsDuet)
gm = EGameMode.TR_GAMEMODE_DUET; gm = EGameMode.TR_GAMEMODE_DUET;
else else
gm = EGameMode.TR_GAMEMODE_NORMAL; gm = EGameMode.TR_GAMEMODE_NORMAL;
//Check if Playlist really exists //Check if Playlist really exists
if (SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection - 1 >= 0) if (_SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection - 1 >= 0)
{ {
Playlists[_Playlist].ActivePlaylistID = SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection - 1; _Playlists[_Playlist].ActivePlaylistID = _SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection - 1;
//Add song to playlist //Add song to playlist
CPlaylists.Playlists[Playlists[_Playlist].ActivePlaylistID].AddSong(CSongs.VisibleSongs[SongMenus[_SongMenu].GetSelectedSong()].ID, gm); CPlaylists.Playlists[_Playlists[_Playlist].ActivePlaylistID].AddSong(CSongs.VisibleSongs[_SongMenus[_SongMenu].GetSelectedSong()].ID, gm);
//Open playlist //Open playlist
_OpenPlaylist(Playlists[_Playlist].ActivePlaylistID); _OpenPlaylist(_Playlists[_Playlist].ActivePlaylistID);
_SetSelectSlidePlaylistToCurrentPlaylist(); _SetSelectSlidePlaylistToCurrentPlaylist();
Playlists[_Playlist].ScrollToBottom(); _Playlists[_Playlist].ScrollToBottom();
} }
} }
//Create a new playlist and add song //Create a new playlist and add song
else if ((SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection - 1) == -1) else if ((_SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection - 1) == -1)
{ {
//Check selected game-mode //Check selected game-mode
EGameMode gm; EGameMode gm;
if (_AvailableGameModes.Count >= SelectSlides[_SelectSlideOptionsMode].Selection) if (_AvailableGameModes.Count >= _SelectSlides[_SelectSlideOptionsMode].Selection)
gm = _AvailableGameModes[SelectSlides[_SelectSlideOptionsMode].Selection]; gm = _AvailableGameModes[_SelectSlides[_SelectSlideOptionsMode].Selection];
else if (CSongs.VisibleSongs[SongMenus[_SongMenu].GetSelectedSong()].IsDuet) else if (CSongs.VisibleSongs[_SongMenus[_SongMenu].GetSelectedSong()].IsDuet)
gm = EGameMode.TR_GAMEMODE_DUET; gm = EGameMode.TR_GAMEMODE_DUET;
else else
gm = EGameMode.TR_GAMEMODE_NORMAL; gm = EGameMode.TR_GAMEMODE_NORMAL;
//Create new playlist //Create new playlist
Playlists[_Playlist].ActivePlaylistID = CPlaylists.NewPlaylist(); _Playlists[_Playlist].ActivePlaylistID = CPlaylists.NewPlaylist();
//Add song to playlist //Add song to playlist
CPlaylists.Playlists[Playlists[_Playlist].ActivePlaylistID].AddSong(CSongs.VisibleSongs[SongMenus[_SongMenu].GetSelectedSong()].ID, gm); CPlaylists.Playlists[_Playlists[_Playlist].ActivePlaylistID].AddSong(CSongs.VisibleSongs[_SongMenus[_SongMenu].GetSelectedSong()].ID, gm);
//Open playlist //Open playlist
_OpenPlaylist(Playlists[_Playlist].ActivePlaylistID); _OpenPlaylist(_Playlists[_Playlist].ActivePlaylistID);
//Add new playlist to select-slide //Add new playlist to select-slide
SelectSlides[_SelectSlideOptionsPlaylistAdd].AddValue(CPlaylists.Playlists[Playlists[_Playlist].ActivePlaylistID].PlaylistName); _SelectSlides[_SelectSlideOptionsPlaylistAdd].AddValue(CPlaylists.Playlists[_Playlists[_Playlist].ActivePlaylistID].PlaylistName);
SelectSlides[_SelectSlideOptionsPlaylistOpen].AddValue(CPlaylists.Playlists[Playlists[_Playlist].ActivePlaylistID].PlaylistName); _SelectSlides[_SelectSlideOptionsPlaylistOpen].AddValue(CPlaylists.Playlists[_Playlists[_Playlist].ActivePlaylistID].PlaylistName);
_SetSelectSlidePlaylistToCurrentPlaylist(); _SetSelectSlidePlaylistToCurrentPlaylist();
} }
@@ -1299,24 +1299,24 @@ namespace Vocaluxe.Screens
{ {
//Check selected game-mode //Check selected game-mode
EGameMode gm; EGameMode gm;
if (_AvailableGameModes.Count >= SelectSlides[_SelectSlideOptionsMode].Selection) if (_AvailableGameModes.Count >= _SelectSlides[_SelectSlideOptionsMode].Selection)
gm = _AvailableGameModes[SelectSlides[_SelectSlideOptionsMode].Selection]; gm = _AvailableGameModes[_SelectSlides[_SelectSlideOptionsMode].Selection];
else if (CSongs.VisibleSongs[SongMenus[_SongMenu].GetSelectedSong()].IsDuet) else if (CSongs.VisibleSongs[_SongMenus[_SongMenu].GetSelectedSong()].IsDuet)
gm = EGameMode.TR_GAMEMODE_DUET; gm = EGameMode.TR_GAMEMODE_DUET;
else else
gm = EGameMode.TR_GAMEMODE_NORMAL; gm = EGameMode.TR_GAMEMODE_NORMAL;
CPlaylists.Playlists[Playlists[_Playlist].ActivePlaylistID].AddSong(CSongs.VisibleSongs[SongMenus[_SongMenu].GetSelectedSong()].ID, gm); CPlaylists.Playlists[_Playlists[_Playlist].ActivePlaylistID].AddSong(CSongs.VisibleSongs[_SongMenus[_SongMenu].GetSelectedSong()].ID, gm);
Playlists[_Playlist].UpdatePlaylist(); _Playlists[_Playlist].UpdatePlaylist();
Playlists[_Playlist].ScrollToBottom(); _Playlists[_Playlist].ScrollToBottom();
} }
} }
private void _SetSelectSlidePlaylistToCurrentPlaylist() private void _SetSelectSlidePlaylistToCurrentPlaylist()
{ {
if (Playlists[_Playlist].ActivePlaylistID > -1) if (_Playlists[_Playlist].ActivePlaylistID > -1)
SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection = Playlists[_Playlist].ActivePlaylistID + 1; _SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection = _Playlists[_Playlist].ActivePlaylistID + 1;
else else
SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection = 0; _SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection = 0;
} }
#endregion Playlist Actions #endregion Playlist Actions
} }
+1 -1
View File
@@ -70,7 +70,7 @@ namespace Vocaluxe.Screens
public override bool HandleMouse(SMouseEvent mouseEvent) public override bool HandleMouse(SMouseEvent mouseEvent)
{ {
if (mouseEvent.LB && IsMouseOver(mouseEvent)) {} if (mouseEvent.LB && _IsMouseOver(mouseEvent)) {}
if (mouseEvent.LB) if (mouseEvent.LB)
CGraphics.FadeTo(EScreens.ScreenMain); CGraphics.FadeTo(EScreens.ScreenMain);
+2 -2
View File
@@ -264,8 +264,8 @@
<None Include="app.config"> <None Include="app.config">
<SubType>Designer</SubType> <SubType>Designer</SubType>
</None> </None>
<Compile Include="Lib\Sound\Portaudio\PortAudio.cs" /> <Compile Include="Lib\Sound\PortAudio\PortAudio.cs" />
<Compile Include="Lib\Sound\Portaudio\PortAudioASIO.cs" /> <Compile Include="Lib\Sound\PortAudio\PortAudioASIO.cs" />
<None Include="Doc\SQLite.NET.chm" /> <None Include="Doc\SQLite.NET.chm" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
+6 -6
View File
@@ -75,11 +75,11 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Type", ref _Theme.Type); _ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Type", ref _Theme.Type);
bool vid = xmlReader.GetValue(item + "/Video", ref _Theme.VideoName, String.Empty); bool vid = xmlReader.GetValue(item + "/Video", out _Theme.VideoName, String.Empty);
bool tex = xmlReader.GetValue(item + "/Skin", ref _Theme.TextureName, String.Empty); bool tex = xmlReader.GetValue(item + "/Skin", out _Theme.TextureName, String.Empty);
_ThemeLoaded &= vid || tex || _Theme.Type == EBackgroundTypes.None; _ThemeLoaded &= vid || tex || _Theme.Type == EBackgroundTypes.None;
if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty)) if (xmlReader.GetValue(item + "/Color", out _Theme.ColorName, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color); _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color);
else else
{ {
@@ -207,7 +207,7 @@ namespace VocaluxeLib.Menu
{ {
RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH()); RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH());
RectangleF rect = new RectangleF(0f, 0f, texture.Width, texture.Height); RectangleF rect = new RectangleF(0f, 0f, texture.Width, texture.Height);
CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, EAspect.Crop); CHelper.SetRect(bounds, out rect, rect.Width / rect.Height, EAspect.Crop);
CBase.Drawing.DrawTexture(texture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4)); CBase.Drawing.DrawTexture(texture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4));
return true; return true;
@@ -222,7 +222,7 @@ namespace VocaluxeLib.Menu
{ {
RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH()); RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH());
RectangleF rect = new RectangleF(0f, 0f, videoTexture.Width, videoTexture.Height); RectangleF rect = new RectangleF(0f, 0f, videoTexture.Width, videoTexture.Height);
CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, EAspect.Crop); CHelper.SetRect(bounds, out rect, rect.Width / rect.Height, EAspect.Crop);
CBase.Drawing.DrawTexture(videoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4)); CBase.Drawing.DrawTexture(videoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4));
return true; return true;
@@ -237,7 +237,7 @@ namespace VocaluxeLib.Menu
{ {
RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH()); RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH());
RectangleF rect = new RectangleF(0f, 0f, videoTexture.Width, videoTexture.Height); RectangleF rect = new RectangleF(0f, 0f, videoTexture.Width, videoTexture.Height);
CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, EAspect.Crop); CHelper.SetRect(bounds, out rect, rect.Width / rect.Height, EAspect.Crop);
CBase.Drawing.DrawTexture(videoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4)); CBase.Drawing.DrawTexture(videoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4));
return true; return true;
+5 -5
View File
@@ -152,8 +152,8 @@ namespace VocaluxeLib.Menu
string item = xmlPath + "/" + elementName; string item = xmlPath + "/" + elementName;
_ThemeLoaded = true; _ThemeLoaded = true;
_ThemeLoaded &= xmlReader.GetValue(item + "/Skin", ref _Theme.TextureName, String.Empty); _ThemeLoaded &= xmlReader.GetValue(item + "/Skin", out _Theme.TextureName, String.Empty);
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinSelected", ref _Theme.SelTextureName, String.Empty); _ThemeLoaded &= xmlReader.GetValue(item + "/SkinSelected", out _Theme.SelTextureName, String.Empty);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/X", ref Rect.X); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/X", ref Rect.X);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Y", ref Rect.Y); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Y", ref Rect.Y);
@@ -161,7 +161,7 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref Rect.W); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref Rect.W);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H);
if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty)) if (xmlReader.GetValue(item + "/Color", out _Theme.ColorName, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color); _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color);
else else
{ {
@@ -171,7 +171,7 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref Color.A); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref Color.A);
} }
if (xmlReader.GetValue(item + "/SColor", ref _Theme.SelColorName, String.Empty)) if (xmlReader.GetValue(item + "/SColor", out _Theme.SelColorName, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelColorName, skinIndex, out SelColor); _ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelColorName, skinIndex, out SelColor);
else else
{ {
@@ -309,7 +309,7 @@ namespace VocaluxeLib.Menu
if (!Visible && CBase.Settings.GetGameState() != EGameState.EditTheme && !forceDraw) if (!Visible && CBase.Settings.GetGameState() != EGameState.EditTheme && !forceDraw)
return; return;
STexture texture = new STexture(-1); STexture texture;
if (!Selected && !Pressed || !Enabled) if (!Selected && !Pressed || !Enabled)
{ {
+3 -3
View File
@@ -91,7 +91,7 @@ namespace VocaluxeLib.Menu
string item = xmlPath + "/" + elementName; string item = xmlPath + "/" + elementName;
_ThemeLoaded = true; _ThemeLoaded = true;
_ThemeLoaded &= xmlReader.GetValue(item + "/Skin", ref _Theme.TextureName, String.Empty); _ThemeLoaded &= xmlReader.GetValue(item + "/Skin", out _Theme.TextureName, String.Empty);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/X", ref Rect.X); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/X", ref Rect.X);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Y", ref Rect.Y); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Y", ref Rect.Y);
@@ -107,7 +107,7 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/DrawNegative", ref _Theme.DrawNegative); _ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/DrawNegative", ref _Theme.DrawNegative);
if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty)) if (xmlReader.GetValue(item + "/Color", out _Theme.ColorName, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color); _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color);
else else
{ {
@@ -117,7 +117,7 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref Color.A); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref Color.A);
} }
if (xmlReader.GetValue(item + "/MaxColor", ref _Theme.MaxColorName, String.Empty)) if (xmlReader.GetValue(item + "/MaxColor", out _Theme.MaxColorName, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color); _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color);
else else
{ {
+8 -14
View File
@@ -68,7 +68,6 @@ namespace VocaluxeLib.Menu
public static int TryReadInt(StreamReader sr) public static int TryReadInt(StreamReader sr)
{ {
char chr = '0';
string value = String.Empty; string value = String.Empty;
try try
@@ -77,7 +76,7 @@ namespace VocaluxeLib.Menu
//Check for ' ', ?, ?, \n, \r //Check for ' ', ?, ?, \n, \r
while (tmp != 32 && tmp != 19 && tmp != 16 && tmp != 13 && tmp != 10) while (tmp != 32 && tmp != 19 && tmp != 16 && tmp != 13 && tmp != 10)
{ {
chr = (char)sr.Read(); char chr = (char)sr.Read();
value += chr.ToString(); value += chr.ToString();
tmp = sr.Peek(); tmp = sr.Peek();
} }
@@ -86,20 +85,18 @@ namespace VocaluxeLib.Menu
{ {
return 0; return 0;
} }
int result = 0; int result;
if (int.TryParse(value, out result)) return int.TryParse(value, out result) ? result : 0;
return result;
return 0;
} }
public static void SetRect(RectangleF bounds, ref RectangleF rect, float rectAspect, EAspect aspect) public static void SetRect(RectangleF bounds, out RectangleF rect, float rectAspect, EAspect aspect)
{ {
float rW = bounds.Right - bounds.Left; float rW = bounds.Right - bounds.Left;
float rH = bounds.Bottom - bounds.Top; float rH = bounds.Bottom - bounds.Top;
float rA = rW / rH; float rA = rW / rH;
float scaledWidth = rW; float scaledWidth;
float scaledHeight = rH; float scaledHeight;
switch (aspect) switch (aspect)
{ {
@@ -161,16 +158,13 @@ namespace VocaluxeLib.Menu
{ {
foreach (FileInfo file in dir.GetFiles(cast)) foreach (FileInfo file in dir.GetFiles(cast))
{ {
if (!fullpath) files.Add(!fullpath ? file.Name : file.FullName);
files.Add(file.Name);
else
files.Add(file.FullName);
} }
if (recursive) if (recursive)
{ {
foreach (DirectoryInfo di in dir.GetDirectories()) foreach (DirectoryInfo di in dir.GetDirectories())
files.AddRange(ListFiles(di.FullName, cast, recursive, fullpath)); files.AddRange(ListFiles(di.FullName, cast, true, fullpath));
} }
} }
catch (Exception) {} catch (Exception) {}
+74 -100
View File
@@ -58,7 +58,6 @@ namespace VocaluxeLib.Menu
private float _H; private float _H;
private float _Width; private float _Width;
private ELyricStyle _Style;
private float _Alpha = 1f; private float _Alpha = 1f;
@@ -70,7 +69,7 @@ namespace VocaluxeLib.Menu
public SRectF Rect public SRectF Rect
{ {
get { return new SRectF(_X, _Y, _MaxW, _H, _Z); } get { return new SRectF(_X, _Y, _MaxW, _H, _Z); }
set private set
{ {
_X = value.X; _X = value.X;
_Y = value.Y; _Y = value.Y;
@@ -80,8 +79,8 @@ namespace VocaluxeLib.Menu
} }
} }
public SColorF Color; private SColorF _Color;
public SColorF ColorProcessed; private SColorF _ColorProcessed;
public bool Selected; public bool Selected;
public bool Visible = true; public bool Visible = true;
@@ -96,19 +95,15 @@ namespace VocaluxeLib.Menu
} }
} }
public ELyricStyle LyricStyle public ELyricStyle LyricStyle { get; set; }
{
get { return _Style; }
set { _Style = value; }
}
public CLyric(int partyModeID) public CLyric(int partyModeID)
{ {
_PartyModeID = partyModeID; _PartyModeID = partyModeID;
_Theme = new SThemeLyrics(); _Theme = new SThemeLyrics();
_ThemeLoaded = false; _ThemeLoaded = false;
Color = new SColorF(); _Color = new SColorF();
ColorProcessed = new SColorF(); _ColorProcessed = new SColorF();
_X = 0f; _X = 0f;
_Y = 0f; _Y = 0f;
@@ -119,7 +114,7 @@ namespace VocaluxeLib.Menu
_Notes = new List<SNote>(); _Notes = new List<SNote>();
_Text = new CText(_PartyModeID); _Text = new CText(_PartyModeID);
_Style = ELyricStyle.Fill; LyricStyle = ELyricStyle.Fill;
} }
public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex) public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex)
@@ -133,31 +128,31 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref _MaxW); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref _MaxW);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref _H); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref _H);
if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty)) if (xmlReader.GetValue(item + "/Color", out _Theme.ColorName, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color); _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out _Color);
else else
{ {
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref Color.R); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref _Color.R);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/G", ref Color.G); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/G", ref _Color.G);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/B", ref Color.B); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/B", ref _Color.B);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref Color.A); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref _Color.A);
} }
if (xmlReader.GetValue(item + "/SColor", ref _Theme.SelColorName, String.Empty)) if (xmlReader.GetValue(item + "/SColor", out _Theme.SelColorName, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelColorName, skinIndex, out ColorProcessed); _ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelColorName, skinIndex, out _ColorProcessed);
else else
{ {
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SR", ref ColorProcessed.R); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SR", ref _ColorProcessed.R);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SG", ref ColorProcessed.G); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SG", ref _ColorProcessed.G);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SB", ref ColorProcessed.B); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SB", ref _ColorProcessed.B);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SA", ref ColorProcessed.A); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SA", ref _ColorProcessed.A);
} }
if (_ThemeLoaded) if (_ThemeLoaded)
{ {
_Theme.Name = elementName; _Theme.Name = elementName;
LoadTextures(); LoadTextures();
_Text = new CText(_X, _Y, _Z, _H, _MaxW, EAlignment.Left, EStyle.Bold, "Normal", Color, String.Empty); _Text = new CText(_X, _Y, _Z, _H, _MaxW, EAlignment.Left, EStyle.Bold, "Normal", _Color, String.Empty);
} }
return _ThemeLoaded; return _ThemeLoaded;
} }
@@ -181,10 +176,10 @@ namespace VocaluxeLib.Menu
writer.WriteElementString("Color", _Theme.ColorName); writer.WriteElementString("Color", _Theme.ColorName);
else else
{ {
writer.WriteElementString("R", Color.R.ToString("#0.00")); writer.WriteElementString("R", _Color.R.ToString("#0.00"));
writer.WriteElementString("G", Color.G.ToString("#0.00")); writer.WriteElementString("G", _Color.G.ToString("#0.00"));
writer.WriteElementString("B", Color.B.ToString("#0.00")); writer.WriteElementString("B", _Color.B.ToString("#0.00"));
writer.WriteElementString("A", Color.A.ToString("#0.00")); writer.WriteElementString("A", _Color.A.ToString("#0.00"));
} }
writer.WriteComment("<SColor>: Highlighted lyric color from ColorScheme (high priority)"); writer.WriteComment("<SColor>: Highlighted lyric color from ColorScheme (high priority)");
@@ -193,10 +188,10 @@ namespace VocaluxeLib.Menu
writer.WriteElementString("SColor", _Theme.SelColorName); writer.WriteElementString("SColor", _Theme.SelColorName);
else else
{ {
writer.WriteElementString("SR", ColorProcessed.R.ToString("#0.00")); writer.WriteElementString("SR", _ColorProcessed.R.ToString("#0.00"));
writer.WriteElementString("SG", ColorProcessed.G.ToString("#0.00")); writer.WriteElementString("SG", _ColorProcessed.G.ToString("#0.00"));
writer.WriteElementString("SB", ColorProcessed.B.ToString("#0.00")); writer.WriteElementString("SB", _ColorProcessed.B.ToString("#0.00"));
writer.WriteElementString("SA", ColorProcessed.A.ToString("#0.00")); writer.WriteElementString("SA", _ColorProcessed.A.ToString("#0.00"));
} }
writer.WriteEndElement(); writer.WriteEndElement();
@@ -213,13 +208,7 @@ namespace VocaluxeLib.Menu
_Width = 0f; _Width = 0f;
foreach (CNote note in line.Notes) foreach (CNote note in line.Notes)
{ {
SNote n = new SNote(); SNote n = new SNote {Text = note.Text, StartBeat = note.StartBeat, EndBeat = note.EndBeat, Duration = note.Duration, Type = note.NoteType};
n.Text = note.Text;
n.StartBeat = note.StartBeat;
n.EndBeat = note.EndBeat;
n.Duration = note.Duration;
n.Type = note.NoteType;
_Text.Text = note.Text; _Text.Text = note.Text;
_Text.Style = EStyle.Bold; _Text.Style = EStyle.Bold;
@@ -248,7 +237,7 @@ namespace VocaluxeLib.Menu
{ {
if (Visible || CBase.Settings.GetGameState() == EGameState.EditTheme) if (Visible || CBase.Settings.GetGameState() == EGameState.EditTheme)
{ {
switch (_Style) switch (LyricStyle)
{ {
case ELyricStyle.Fill: case ELyricStyle.Fill:
_DrawFill(actualBeat); _DrawFill(actualBeat);
@@ -287,28 +276,28 @@ namespace VocaluxeLib.Menu
{ {
if (currentBeat <= note.EndBeat) if (currentBeat <= note.EndBeat)
{ {
_Text.Color = ColorProcessed; _Text.Color = _ColorProcessed;
float diff = note.EndBeat - note.StartBeat; float diff = note.EndBeat - note.StartBeat;
if (diff == 0) if (Math.Abs(diff) < float.Epsilon)
_Text.Draw(0f, 1f); _Text.Draw(0f, 1f);
else else
{ {
_Text.Draw(0f, (currentBeat - note.StartBeat) / diff); _Text.Draw(0f, (currentBeat - note.StartBeat) / diff);
_Text.Color = Color; _Text.Color = _Color;
_Text.Draw((currentBeat - note.StartBeat) / diff, 1f); _Text.Draw((currentBeat - note.StartBeat) / diff, 1f);
} }
} }
else else
{ {
_Text.Color = ColorProcessed; _Text.Color = _ColorProcessed;
_Text.Draw(); _Text.Draw();
} }
} }
else else
{ {
_Text.Color = Color; _Text.Color = _Color;
_Text.Draw(); _Text.Draw();
} }
@@ -344,7 +333,6 @@ namespace VocaluxeLib.Menu
if (currentBeat >= _Notes[note].StartBeat) if (currentBeat >= _Notes[note].StartBeat)
{ {
bool last = note == _Notes.Count - 1;
int endbeat = _Notes[note].EndBeat; int endbeat = _Notes[note].EndBeat;
if (note < _Notes.Count - 1) if (note < _Notes.Count - 1)
endbeat = _Notes[note + 1].StartBeat - 1; endbeat = _Notes[note + 1].StartBeat - 1;
@@ -358,10 +346,7 @@ namespace VocaluxeLib.Menu
else else
{ {
// already passed // already passed
if (note == lastNote) _Text.Color = note == lastNote ? _ColorProcessed : _Color;
_Text.Color = ColorProcessed;
else
_Text.Color = Color;
_Text.Draw(); _Text.Draw();
} }
@@ -369,7 +354,7 @@ namespace VocaluxeLib.Menu
else else
{ {
// not passed // not passed
_Text.Color = Color; _Text.Color = _Color;
_Text.Draw(); _Text.Draw();
} }
@@ -383,7 +368,7 @@ namespace VocaluxeLib.Menu
_Text.X = zoomx; _Text.X = zoomx;
_Text.Text = _Notes[zoomNote].Text; _Text.Text = _Notes[zoomNote].Text;
_Text.Color = ColorProcessed; _Text.Color = _ColorProcessed;
_Text.Style = EStyle.Bold; _Text.Style = EStyle.Bold;
if (_Notes[zoomNote].Type == ENoteType.Freestyle) if (_Notes[zoomNote].Type == ENoteType.Freestyle)
@@ -437,13 +422,13 @@ namespace VocaluxeLib.Menu
if (currentBeat >= note.StartBeat) if (currentBeat >= note.StartBeat)
{ {
_Text.Color = ColorProcessed; _Text.Color = _ColorProcessed;
_Text.Draw(); _Text.Draw();
} }
else else
{ {
// not passed // not passed
_Text.Color = Color; _Text.Color = _Color;
_Text.Draw(); _Text.Draw();
} }
@@ -464,7 +449,6 @@ namespace VocaluxeLib.Menu
} }
int jumpNote = -1; int jumpNote = -1;
int endBeat = -1;
float jumpx = 0f; float jumpx = 0f;
for (int note = 0; note < _Notes.Count; note++) for (int note = 0; note < _Notes.Count; note++)
@@ -479,24 +463,15 @@ namespace VocaluxeLib.Menu
if (currentBeat >= _Notes[note].StartBeat) if (currentBeat >= _Notes[note].StartBeat)
{ {
bool last = note == _Notes.Count - 1;
int endbeat = _Notes[note].EndBeat;
if (note < _Notes.Count - 1)
endbeat = _Notes[note + 1].StartBeat - 1;
if (currentBeat <= _Notes[note].EndBeat) if (currentBeat <= _Notes[note].EndBeat)
{ {
jumpNote = note; jumpNote = note;
endBeat = endbeat;
jumpx = _Text.X; jumpx = _Text.X;
} }
else else
{ {
// already passed // already passed
if (note == lastNote) _Text.Color = note == lastNote ? _ColorProcessed : _Color;
_Text.Color = ColorProcessed;
else
_Text.Color = Color;
_Text.Draw(); _Text.Draw();
} }
@@ -504,45 +479,44 @@ namespace VocaluxeLib.Menu
else else
{ {
// not passed // not passed
_Text.Color = Color; _Text.Color = _Color;
_Text.Draw(); _Text.Draw();
} }
x += rect.Width; x += rect.Width;
} }
if (jumpNote > -1) if (jumpNote < 0)
return;
if (_Notes[jumpNote].Duration == 0)
return;
_Text.X = jumpx;
_Text.Text = _Notes[jumpNote].Text;
_Text.Color = _ColorProcessed;
_Text.Style = EStyle.Bold;
if (_Notes[jumpNote].Type == ENoteType.Freestyle)
_Text.Style = EStyle.BoldItalic;
float diff = _Notes[jumpNote].EndBeat - _Notes[jumpNote].StartBeat;
if (diff <= 0f)
diff = 1f;
float p = (currentBeat - _Notes[jumpNote].StartBeat) / diff;
if (p > 1f)
p = 1f;
p = 1f - p;
if (Math.Abs(diff - 1) < float.Epsilon)
_Text.Draw();
else
{ {
if (_Notes[jumpNote].Duration == 0) float y = _Text.Y;
return; _Text.Y -= _Text.Height * 0.1f * p;
_Text.Draw();
_Text.X = jumpx; _Text.Y = y;
_Text.Text = _Notes[jumpNote].Text;
_Text.Color = ColorProcessed;
_Text.Style = EStyle.Bold;
if (_Notes[jumpNote].Type == ENoteType.Freestyle)
_Text.Style = EStyle.BoldItalic;
float diff = _Notes[jumpNote].EndBeat - _Notes[jumpNote].StartBeat;
if (diff <= 0f)
diff = 1f;
float p = (currentBeat - _Notes[jumpNote].StartBeat) / diff;
if (p > 1f)
p = 1f;
p = 1f - p;
if (diff == 1)
_Text.Draw();
else
{
float y = _Text.Y;
_Text.Y -= _Text.Height * 0.1f * p;
_Text.Draw();
_Text.Y = y;
}
} }
} }
#endregion draw #endregion draw
@@ -552,10 +526,10 @@ namespace VocaluxeLib.Menu
public void LoadTextures() public void LoadTextures()
{ {
if (_Theme.ColorName.Length > 0) if (_Theme.ColorName.Length > 0)
Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID); _Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID);
if (_Theme.SelColorName.Length > 0) if (_Theme.SelColorName.Length > 0)
ColorProcessed = CBase.Theme.GetColor(_Theme.SelColorName, _PartyModeID); _ColorProcessed = CBase.Theme.GetColor(_Theme.SelColorName, _PartyModeID);
} }
public void ReloadTextures() public void ReloadTextures()
+122 -292
View File
@@ -42,35 +42,18 @@ namespace VocaluxeLib.Menu
private string _ThemePath = String.Empty; private string _ThemePath = String.Empty;
protected int _PartyModeID = -1; protected int _PartyModeID = -1;
private COrderedDictionaryLite<CBackground> _Backgrounds;
private COrderedDictionaryLite<CButton> _Buttons;
private COrderedDictionaryLite<CText> _Texts;
private COrderedDictionaryLite<CStatic> _Statics;
private COrderedDictionaryLite<CSelectSlide> _SelectSlides;
private COrderedDictionaryLite<CSongMenu> _SongMenus;
private COrderedDictionaryLite<CLyric> _Lyrics;
private COrderedDictionaryLite<CSingNotes> _SingNotes;
private COrderedDictionaryLite<CNameSelection> _NameSelections;
private COrderedDictionaryLite<CEqualizer> _Equalizers;
private COrderedDictionaryLite<CPlaylist> _Playlists;
private COrderedDictionaryLite<CParticleEffect> _ParticleEffects;
private COrderedDictionaryLite<CScreenSetting> _ScreenSettings;
private int _PrevMouseX; private int _PrevMouseX;
private int _PrevMouseY; private int _PrevMouseY;
protected int _MouseDX; private int _MouseDX;
protected int _MouseDY; private int _MouseDY;
protected bool _Active; protected bool _Active;
protected abstract int _ScreenVersion { get; } protected abstract int _ScreenVersion { get; }
private string _ThemeName; public string ThemeName { get; private set; }
public string ThemeName
{
get { return _ThemeName; }
}
// ReSharper disable MemberCanBePrivate.Global
protected string[] _ThemeBackgrounds; protected string[] _ThemeBackgrounds;
protected string[] _ThemeStatics; protected string[] _ThemeStatics;
protected string[] _ThemeTexts; protected string[] _ThemeTexts;
@@ -85,22 +68,32 @@ namespace VocaluxeLib.Menu
protected string[] _ThemeParticleEffects; protected string[] _ThemeParticleEffects;
protected string[] _ThemeScreenSettings; protected string[] _ThemeScreenSettings;
protected COrderedDictionaryLite<CButton> _Buttons { get; private set; }
protected COrderedDictionaryLite<CText> _Texts { get; private set; }
protected COrderedDictionaryLite<CBackground> _Backgrounds { get; private set; }
protected COrderedDictionaryLite<CStatic> _Statics { get; private set; }
protected COrderedDictionaryLite<CSelectSlide> _SelectSlides { get; private set; }
protected COrderedDictionaryLite<CSongMenu> _SongMenus { get; private set; }
protected COrderedDictionaryLite<CLyric> _Lyrics { get; private set; }
protected COrderedDictionaryLite<CSingNotes> _SingNotes { get; private set; }
protected COrderedDictionaryLite<CNameSelection> _NameSelections { get; private set; }
protected COrderedDictionaryLite<CEqualizer> _Equalizers { get; private set; }
protected COrderedDictionaryLite<CPlaylist> _Playlists { get; private set; }
protected COrderedDictionaryLite<CParticleEffect> _ParticleEffects { get; private set; }
protected COrderedDictionaryLite<CScreenSetting> _ScreenSettings { get; private set; }
// ReSharper restore MemberCanBePrivate.Global
protected SRectF _ScreenArea; protected SRectF _ScreenArea;
public SRectF ScreenArea public SRectF ScreenArea
{ {
get { return _ScreenArea; } get { return _ScreenArea; }
} }
public int ThemeScreenVersion
{
get { return _ScreenVersion; }
}
public virtual void Init() public virtual void Init()
{ {
_ThemeName = GetType().Name; ThemeName = GetType().Name;
if (_ThemeName[0] == 'C' && Char.IsUpper(_ThemeName[1])) if (ThemeName[0] == 'C' && Char.IsUpper(ThemeName[1]))
_ThemeName = _ThemeName.Remove(0, 1); ThemeName = ThemeName.Remove(0, 1);
_Interactions = new List<CInteraction>(); _Interactions = new List<CInteraction>();
_Selection = 0; _Selection = 0;
@@ -149,7 +142,7 @@ namespace VocaluxeLib.Menu
} }
#region ThemeHandler #region ThemeHandler
protected delegate void AddElementHandler<T>(T element, String key); private delegate void AddElementHandler<in T>(T element, String key);
private void _LoadThemeElement<T>(string[] elements, AddElementHandler<T> addElementHandler, CXMLReader xmlReader, int skinIndex) where T : IMenuElement private void _LoadThemeElement<T>(string[] elements, AddElementHandler<T> addElementHandler, CXMLReader xmlReader, int skinIndex) where T : IMenuElement
{ {
@@ -174,8 +167,7 @@ namespace VocaluxeLib.Menu
if (xmlReader == null) if (xmlReader == null)
return; return;
bool versionCheck = false; bool versionCheck = _CheckVersion(_ScreenVersion, xmlReader);
versionCheck = _CheckVersion(_ScreenVersion, xmlReader);
int skinIndex = CBase.Theme.GetSkinIndex(_PartyModeID); int skinIndex = CBase.Theme.GetSkinIndex(_PartyModeID);
@@ -184,19 +176,19 @@ namespace VocaluxeLib.Menu
_ThemePath = xmlPath; _ThemePath = xmlPath;
_LoadThemeBasics(xmlReader, skinIndex); _LoadThemeBasics(xmlReader, skinIndex);
_LoadThemeElement<CBackground>(_ThemeBackgrounds, AddBackground, xmlReader, skinIndex); _LoadThemeElement<CBackground>(_ThemeBackgrounds, _AddBackground, xmlReader, skinIndex);
_LoadThemeElement<CStatic>(_ThemeStatics, AddStatic, xmlReader, skinIndex); _LoadThemeElement<CStatic>(_ThemeStatics, _AddStatic, xmlReader, skinIndex);
_LoadThemeElement<CText>(_ThemeTexts, AddText, xmlReader, skinIndex); _LoadThemeElement<CText>(_ThemeTexts, _AddText, xmlReader, skinIndex);
_LoadThemeElement<CButton>(_ThemeButtons, AddButton, xmlReader, skinIndex); _LoadThemeElement<CButton>(_ThemeButtons, _AddButton, xmlReader, skinIndex);
_LoadThemeElement<CSelectSlide>(_ThemeSelectSlides, AddSelectSlide, xmlReader, skinIndex); _LoadThemeElement<CSelectSlide>(_ThemeSelectSlides, _AddSelectSlide, xmlReader, skinIndex);
_LoadThemeElement<CSongMenu>(_ThemeSongMenus, AddSongMenu, xmlReader, skinIndex); _LoadThemeElement<CSongMenu>(_ThemeSongMenus, _AddSongMenu, xmlReader, skinIndex);
_LoadThemeElement<CLyric>(_ThemeLyrics, AddLyric, xmlReader, skinIndex); _LoadThemeElement<CLyric>(_ThemeLyrics, _AddLyric, xmlReader, skinIndex);
_LoadThemeElement<CSingNotesClassic>(_ThemeSingNotes, AddSingNote, xmlReader, skinIndex); _LoadThemeElement<CSingNotesClassic>(_ThemeSingNotes, _AddSingNote, xmlReader, skinIndex);
_LoadThemeElement<CNameSelection>(_ThemeNameSelections, AddNameSelection, xmlReader, skinIndex); _LoadThemeElement<CNameSelection>(_ThemeNameSelections, _AddNameSelection, xmlReader, skinIndex);
_LoadThemeElement<CEqualizer>(_ThemeEqualizers, AddEqualizer, xmlReader, skinIndex); _LoadThemeElement<CEqualizer>(_ThemeEqualizers, _AddEqualizer, xmlReader, skinIndex);
_LoadThemeElement<CPlaylist>(_ThemePlaylists, AddPlaylist, xmlReader, skinIndex); _LoadThemeElement<CPlaylist>(_ThemePlaylists, _AddPlaylist, xmlReader, skinIndex);
_LoadThemeElement<CParticleEffect>(_ThemeParticleEffects, AddParticleEffect, xmlReader, skinIndex); _LoadThemeElement<CParticleEffect>(_ThemeParticleEffects, _AddParticleEffect, xmlReader, skinIndex);
_LoadThemeElement<CScreenSetting>(_ThemeScreenSettings, AddScreenSetting, xmlReader, skinIndex); _LoadThemeElement<CScreenSetting>(_ThemeScreenSettings, _AddScreenSetting, xmlReader, skinIndex);
} }
} }
@@ -205,10 +197,7 @@ namespace VocaluxeLib.Menu
if (_ThemePath.Length == 0) if (_ThemePath.Length == 0)
return; return;
XmlWriterSettings settings = new XmlWriterSettings(); XmlWriterSettings settings = new XmlWriterSettings {Indent = true, Encoding = Encoding.UTF8, ConformanceLevel = ConformanceLevel.Document};
settings.Indent = true;
settings.Encoding = Encoding.UTF8;
settings.ConformanceLevel = ConformanceLevel.Document;
string file = Path.Combine(_ThemePath, ThemeName + ".xml"); string file = Path.Combine(_ThemePath, ThemeName + ".xml");
using (XmlWriter writer = XmlWriter.Create(file, settings)) using (XmlWriter writer = XmlWriter.Create(file, settings))
@@ -447,12 +436,14 @@ namespace VocaluxeLib.Menu
#region ElementHandler #region ElementHandler
#region Create Elements #region Create Elements
// ReSharper disable UnusedMember.Global
// ReSharper disable MemberCanBeProtected.Global
public CButton GetNewButton() public CButton GetNewButton()
{ {
return new CButton(_PartyModeID); return new CButton(_PartyModeID);
} }
public CButton GetNewButton(CButton button) public static CButton GetNewButton(CButton button)
{ {
return new CButton(button); return new CButton(button);
} }
@@ -462,12 +453,12 @@ namespace VocaluxeLib.Menu
return new CText(_PartyModeID); return new CText(_PartyModeID);
} }
public CText GetNewText(CText text) public static CText GetNewText(CText text)
{ {
return new CText(text); return new CText(text);
} }
public CText GetNewText(float x, float y, float z, float h, float mw, EAlignment align, EStyle style, string font, SColorF col, string text) public static CText GetNewText(float x, float y, float z, float h, float mw, EAlignment align, EStyle style, string font, SColorF col, string text)
{ {
return new CText(x, y, z, h, mw, align, style, font, col, text); return new CText(x, y, z, h, mw, align, style, font, col, text);
} }
@@ -482,7 +473,7 @@ namespace VocaluxeLib.Menu
return new CStatic(_PartyModeID); return new CStatic(_PartyModeID);
} }
public CStatic GetNewStatic(CStatic oldStatic) public static CStatic GetNewStatic(CStatic oldStatic)
{ {
return new CStatic(oldStatic); return new CStatic(oldStatic);
} }
@@ -497,7 +488,7 @@ namespace VocaluxeLib.Menu
return new CSelectSlide(_PartyModeID); return new CSelectSlide(_PartyModeID);
} }
public CSelectSlide GetNewSelectSlide(CSelectSlide slide) public static CSelectSlide GetNewSelectSlide(CSelectSlide slide)
{ {
return new CSelectSlide(slide); return new CSelectSlide(slide);
} }
@@ -536,75 +527,10 @@ namespace VocaluxeLib.Menu
{ {
return new CParticleEffect(_PartyModeID, maxNumber, color, area, texture, size, type); return new CParticleEffect(_PartyModeID, maxNumber, color, area, texture, size, type);
} }
// ReSharper restore MemberCanBeProtected.Global
// ReSharper restore UnusedMember.Global
#endregion Create Elements #endregion Create Elements
#region Get Elements
public COrderedDictionaryLite<CButton> Buttons
{
get { return _Buttons; }
}
public COrderedDictionaryLite<CText> Texts
{
get { return _Texts; }
}
public COrderedDictionaryLite<CBackground> Backgrounds
{
get { return _Backgrounds; }
}
public COrderedDictionaryLite<CStatic> Statics
{
get { return _Statics; }
}
public COrderedDictionaryLite<CSelectSlide> SelectSlides
{
get { return _SelectSlides; }
}
public COrderedDictionaryLite<CSongMenu> SongMenus
{
get { return _SongMenus; }
}
public COrderedDictionaryLite<CLyric> Lyrics
{
get { return _Lyrics; }
}
public COrderedDictionaryLite<CSingNotes> SingNotes
{
get { return _SingNotes; }
}
public COrderedDictionaryLite<CNameSelection> NameSelections
{
get { return _NameSelections; }
}
public COrderedDictionaryLite<CEqualizer> Equalizers
{
get { return _Equalizers; }
}
public COrderedDictionaryLite<CPlaylist> Playlists
{
get { return _Playlists; }
}
public COrderedDictionaryLite<CParticleEffect> ParticleEffects
{
get { return _ParticleEffects; }
}
public COrderedDictionaryLite<CScreenSetting> ScreenSettings
{
get { return _ScreenSettings; }
}
#endregion Get Arrays
#endregion ElementHandler #endregion ElementHandler
#region MenuHandler #region MenuHandler
@@ -826,18 +752,18 @@ namespace VocaluxeLib.Menu
#region Drawing #region Drawing
public virtual bool Draw() public virtual bool Draw()
{ {
DrawBG(); _DrawBG();
DrawFG(); _DrawFG();
return true; return true;
} }
public void DrawBG() protected void _DrawBG()
{ {
foreach (CBackground bg in _Backgrounds) foreach (CBackground bg in _Backgrounds)
bg.Draw(); bg.Draw();
} }
public void DrawFG() protected void _DrawFG()
{ {
if (_Interactions.Count <= 0) if (_Interactions.Count <= 0)
return; return;
@@ -846,29 +772,20 @@ namespace VocaluxeLib.Menu
for (int i = 0; i < _Interactions.Count; i++) for (int i = 0; i < _Interactions.Count; i++)
{ {
if (_IsVisible(i) && ( if (!_IsVisible(i) ||
_Interactions[i].Type == EType.Button || (_Interactions[i].Type != EType.Button && _Interactions[i].Type != EType.SelectSlide && _Interactions[i].Type != EType.Static &&
_Interactions[i].Type == EType.SelectSlide || _Interactions[i].Type != EType.NameSelection && _Interactions[i].Type != EType.Text && _Interactions[i].Type != EType.SongMenu &&
_Interactions[i].Type == EType.Static || _Interactions[i].Type != EType.Equalizer && _Interactions[i].Type != EType.Playlist && _Interactions[i].Type != EType.ParticleEffect))
_Interactions[i].Type == EType.NameSelection || continue;
_Interactions[i].Type == EType.Text || SZSort zs = new SZSort {ID = i, Z = _GetZValue(i)};
_Interactions[i].Type == EType.SongMenu || items.Add(zs);
_Interactions[i].Type == EType.Equalizer ||
_Interactions[i].Type == EType.Playlist ||
_Interactions[i].Type == EType.ParticleEffect))
{
SZSort zs = new SZSort();
zs.ID = i;
zs.Z = _GetZValue(i);
items.Add(zs);
}
} }
if (items.Count <= 0) if (items.Count <= 0)
return; return;
items.Sort(delegate(SZSort s1, SZSort s2) { return s2.Z.CompareTo(s1.Z); }); items.Sort((s1, s2) => s2.Z.CompareTo(s1.Z));
for (int i = 0; i < items.Count; i++) for (int i = 0; i < items.Count; i++)
_DrawInteraction(items[i].ID); _DrawInteraction(items[i].ID);
@@ -876,139 +793,76 @@ namespace VocaluxeLib.Menu
#endregion Drawing #endregion Drawing
#region Elements #region Elements
public void AddBackground(CBackground bg) // ReSharper disable MemberCanBePrivate.Global
{ protected void _AddBackground(CBackground bg, String key = null)
AddBackground(bg, null);
}
public void AddButton(CButton button)
{
AddButton(button, null);
}
public void AddSelectSlide(CSelectSlide slide)
{
AddSelectSlide(slide, null);
}
public void AddStatic(CStatic stat)
{
AddStatic(stat, null);
}
public void AddText(CText text)
{
AddText(text, null);
}
public void AddSongMenu(CSongMenu songmenu)
{
AddSongMenu(songmenu, null);
}
public void AddLyric(CLyric lyric)
{
AddLyric(lyric, null);
}
public void AddSingNote(CSingNotes sn)
{
AddSingNote(sn, null);
}
public void AddNameSelection(CNameSelection ns)
{
AddNameSelection(ns, null);
}
public void AddEqualizer(CEqualizer eq)
{
AddEqualizer(eq, null);
}
public void AddPlaylist(CPlaylist pls)
{
AddPlaylist(pls, null);
}
public void AddParticleEffect(CParticleEffect pe)
{
AddParticleEffect(pe, null);
}
public void AddScreenSetting(CScreenSetting se)
{
AddScreenSetting(se, null);
}
public void AddBackground(CBackground bg, String key)
{ {
_AddInteraction(_Backgrounds.Add(bg, key), EType.Background); _AddInteraction(_Backgrounds.Add(bg, key), EType.Background);
} }
public void AddButton(CButton button, String key) protected void _AddButton(CButton button, String key = null)
{ {
_AddInteraction(_Buttons.Add(button, key), EType.Button); _AddInteraction(_Buttons.Add(button, key), EType.Button);
} }
public void AddSelectSlide(CSelectSlide slide, String key) protected void _AddSelectSlide(CSelectSlide slide, String key = null)
{ {
_AddInteraction(_SelectSlides.Add(slide, key), EType.SelectSlide); _AddInteraction(_SelectSlides.Add(slide, key), EType.SelectSlide);
} }
public void AddStatic(CStatic stat, String key) protected void _AddStatic(CStatic stat, String key = null)
{ {
_AddInteraction(_Statics.Add(stat, key), EType.Static); _AddInteraction(_Statics.Add(stat, key), EType.Static);
} }
public void AddText(CText text, String key) protected void _AddText(CText text, String key = null)
{ {
_AddInteraction(_Texts.Add(text, key), EType.Text); _AddInteraction(_Texts.Add(text, key), EType.Text);
} }
public void AddSongMenu(CSongMenu songmenu, String key) protected void _AddSongMenu(CSongMenu songmenu, String key = null)
{ {
_AddInteraction(_SongMenus.Add(songmenu, key), EType.SongMenu); _AddInteraction(_SongMenus.Add(songmenu, key), EType.SongMenu);
} }
public void AddLyric(CLyric lyric, String key) protected void _AddLyric(CLyric lyric, String key = null)
{ {
_AddInteraction(_Lyrics.Add(lyric, key), EType.Lyric); _AddInteraction(_Lyrics.Add(lyric, key), EType.Lyric);
} }
public void AddSingNote(CSingNotes sn, String key) protected void _AddSingNote(CSingNotes sn, String key = null)
{ {
_AddInteraction(_SingNotes.Add(sn, key), EType.SingNote); _AddInteraction(_SingNotes.Add(sn, key), EType.SingNote);
} }
public void AddNameSelection(CNameSelection ns, String key) protected void _AddNameSelection(CNameSelection ns, String key = null)
{ {
_AddInteraction(_NameSelections.Add(ns, key), EType.NameSelection); _AddInteraction(_NameSelections.Add(ns, key), EType.NameSelection);
} }
public void AddEqualizer(CEqualizer eq, String key) protected void _AddEqualizer(CEqualizer eq, String key = null)
{ {
_AddInteraction(_Equalizers.Add(eq, key), EType.Equalizer); _AddInteraction(_Equalizers.Add(eq, key), EType.Equalizer);
} }
public void AddPlaylist(CPlaylist pls, String key) protected void _AddPlaylist(CPlaylist pls, String key = null)
{ {
_AddInteraction(_Playlists.Add(pls, key), EType.Playlist); _AddInteraction(_Playlists.Add(pls, key), EType.Playlist);
} }
public void AddParticleEffect(CParticleEffect pe, String key) protected void _AddParticleEffect(CParticleEffect pe, String key = null)
{ {
_AddInteraction(_ParticleEffects.Add(pe, key), EType.ParticleEffect); _AddInteraction(_ParticleEffects.Add(pe, key), EType.ParticleEffect);
} }
public void AddScreenSetting(CScreenSetting se, String key) protected void _AddScreenSetting(CScreenSetting se, String key = null)
{ {
_ScreenSettings.Add(se, key); _ScreenSettings.Add(se, key);
} }
// ReSharper restore MemberCanBePrivate.Global
#endregion Elements #endregion Elements
#region InteractionHandling #region InteractionHandling
public void CheckInteraction() protected void _CheckInteraction()
{ {
if (!_IsEnabled(_Selection) || !_IsVisible(_Selection)) if (!_IsEnabled(_Selection) || !_IsVisible(_Selection))
PrevInteraction(); PrevInteraction();
@@ -1050,26 +904,23 @@ namespace VocaluxeLib.Menu
return false; return false;
} }
public bool SetInteractionToButton(CButton button) protected void _SetInteractionToButton(CButton button)
{ {
for (int i = 0; i < _Interactions.Count; i++) for (int i = 0; i < _Interactions.Count; i++)
{ {
if (_Interactions[i].Type == EType.Button) if (_Interactions[i].Type != EType.Button)
{ continue;
if (_Buttons[_Interactions[i].Num] == button) if (_Buttons[_Interactions[i].Num] != button)
{ continue;
_UnsetSelected(); _UnsetSelected();
_UnsetHighlighted(_Selection); _UnsetHighlighted(_Selection);
_Selection = i; _Selection = i;
_SetSelected(); _SetSelected();
return true; return;
}
}
} }
return false;
} }
public bool SetInteractionToSelectSlide(CSelectSlide slide) protected void _SetInteractionToSelectSlide(CSelectSlide slide)
{ {
for (int i = 0; i < _Interactions.Count; i++) for (int i = 0; i < _Interactions.Count; i++)
{ {
@@ -1081,11 +932,10 @@ namespace VocaluxeLib.Menu
_UnsetHighlighted(_Selection); _UnsetHighlighted(_Selection);
_Selection = i; _Selection = i;
_SetSelected(); _SetSelected();
return true; return;
} }
} }
} }
return false;
} }
public void ProcessMouseClick(int x, int y) public void ProcessMouseClick(int x, int y)
@@ -1102,7 +952,7 @@ namespace VocaluxeLib.Menu
public void ProcessMouseMove(int x, int y) public void ProcessMouseMove(int x, int y)
{ {
SelectByMouse(x, y); _SelectByMouse(x, y);
if (_Selection >= _Interactions.Count || _Selection < 0) if (_Selection >= _Interactions.Count || _Selection < 0)
return; return;
@@ -1114,41 +964,35 @@ namespace VocaluxeLib.Menu
} }
} }
public void SelectByMouse(int x, int y) private void _SelectByMouse(int x, int y)
{ {
float z = CBase.Settings.GetZFar(); float z = CBase.Settings.GetZFar();
for (int i = 0; i < _Interactions.Count; i++) for (int i = 0; i < _Interactions.Count; i++)
{ {
if ((CBase.Settings.GetGameState() == EGameState.EditTheme) || (!_Interactions[i].ThemeEditorOnly && _IsVisible(i) && _IsEnabled(i))) if ((CBase.Settings.GetGameState() != EGameState.EditTheme) && (_Interactions[i].ThemeEditorOnly || !_IsVisible(i) || !_IsEnabled(i)))
{ continue;
if (_IsMouseOver(x, y, _Interactions[i])) if (!_IsMouseOver(x, y, _Interactions[i]))
{ continue;
if (_GetZValue(_Interactions[i]) <= z) if (_GetZValue(_Interactions[i]) > z)
{ continue;
z = _GetZValue(_Interactions[i]); z = _GetZValue(_Interactions[i]);
_UnsetSelected(); _UnsetSelected();
_Selection = i; _Selection = i;
_SetSelected(); _SetSelected();
}
}
}
} }
} }
public bool IsMouseOver(SMouseEvent mouseEvent) protected bool _IsMouseOver(SMouseEvent mouseEvent)
{ {
return IsMouseOver(mouseEvent.X, mouseEvent.Y); return _IsMouseOver(mouseEvent.X, mouseEvent.Y);
} }
public bool IsMouseOver(int x, int y) private bool _IsMouseOver(int x, int y)
{ {
if (_Selection >= _Interactions.Count || _Selection < 0) if (_Selection >= _Interactions.Count || _Selection < 0)
return false; return false;
if (_Interactions.Count > 0) return _Interactions.Count > 0 && _IsMouseOver(x, y, _Interactions[_Selection]);
return _IsMouseOver(x, y, _Interactions[_Selection]);
else
return false;
} }
private bool _IsMouseOver(int x, int y, CInteraction interact) private bool _IsMouseOver(int x, int y, CInteraction interact)
@@ -1314,7 +1158,6 @@ namespace VocaluxeLib.Menu
int element = _Selection; int element = _Selection;
int stage = int.MaxValue; int stage = int.MaxValue;
float distance = float.MaxValue;
int direction = -1; int direction = -1;
int mute = -1; int mute = -1;
@@ -1340,7 +1183,6 @@ namespace VocaluxeLib.Menu
{ {
stage = stages[i]; stage = stages[i];
element = elements[i]; element = elements[i];
distance = distances[i];
direction = i; direction = i;
} }
} }
@@ -1469,10 +1311,7 @@ namespace VocaluxeLib.Menu
inDirection = true; inDirection = true;
break; break;
} }
if (!inDirection) return !inDirection ? float.MaxValue : distance;
return float.MaxValue;
else
return distance;
} }
private float _GetDistance180(SKeyEvent key, SRectF actualRect, SRectF targetRect) private float _GetDistance180(SKeyEvent key, SRectF actualRect, SRectF targetRect)
@@ -1505,10 +1344,7 @@ namespace VocaluxeLib.Menu
inDirection = true; inDirection = true;
break; break;
} }
if (!inDirection) return !inDirection ? float.MaxValue : distance;
return float.MaxValue;
else
return distance;
} }
/// <summary> /// <summary>
@@ -1679,6 +1515,7 @@ namespace VocaluxeLib.Menu
} }
} }
// ReSharper disable UnusedMember.Local
private void _ToggleHighlighted() private void _ToggleHighlighted()
{ {
if (_Selection >= _Interactions.Count || _Selection < 0) if (_Selection >= _Interactions.Count || _Selection < 0)
@@ -1693,11 +1530,9 @@ namespace VocaluxeLib.Menu
if (_Selection >= _Interactions.Count || _Selection < 0) if (_Selection >= _Interactions.Count || _Selection < 0)
return false; return false;
if (_Interactions[_Selection].Type == EType.SelectSlide) return _Interactions[_Selection].Type == EType.SelectSlide && _SelectSlides[_Interactions[_Selection].Num].Highlighted;
return _SelectSlides[_Interactions[_Selection].Num].Highlighted;
return false;
} }
// ReSharper restore UnusedMember.Local
private bool _IsVisible(int interaction) private bool _IsVisible(int interaction)
{ {
@@ -1988,30 +1823,25 @@ namespace VocaluxeLib.Menu
if (actualVersion == reqVersion) if (actualVersion == reqVersion)
return true; return true;
string msg = "Can't load screen file of screen \"" + ThemeName + "\", ";
if (actualVersion < reqVersion)
msg += "the file ist outdated! ";
else else
{ msg += "the file is for newer program versions! ";
string msg = "Can't load screen file of screen \"" + ThemeName + "\", ";
if (actualVersion < reqVersion)
msg += "the file ist outdated! ";
else
msg += "the file is for newer program versions! ";
msg += "Current screen version is " + reqVersion.ToString(); msg += "Current screen version is " + reqVersion;
CBase.Log.LogError(msg); CBase.Log.LogError(msg);
}
return false; return false;
} }
private void _LoadThemeBasics(CXMLReader xmlReader, int skinIndex) private void _LoadThemeBasics(CXMLReader xmlReader, int skinIndex)
{ {
string value = String.Empty;
// Backgrounds // Backgrounds
CBackground background = new CBackground(_PartyModeID); CBackground background = new CBackground(_PartyModeID);
int i = 1; int i = 1;
while (background.LoadTheme("//root/" + ThemeName, "Background" + i.ToString(), xmlReader, skinIndex)) while (background.LoadTheme("//root/" + ThemeName, "Background" + i, xmlReader, skinIndex))
{ {
AddBackground(background); _AddBackground(background);
background = new CBackground(_PartyModeID); background = new CBackground(_PartyModeID);
i++; i++;
} }
@@ -2019,9 +1849,9 @@ namespace VocaluxeLib.Menu
// Statics // Statics
CStatic stat = new CStatic(_PartyModeID); CStatic stat = new CStatic(_PartyModeID);
i = 1; i = 1;
while (stat.LoadTheme("//root/" + ThemeName, "Static" + i.ToString(), xmlReader, skinIndex)) while (stat.LoadTheme("//root/" + ThemeName, "Static" + i, xmlReader, skinIndex))
{ {
AddStatic(stat); _AddStatic(stat);
stat = new CStatic(_PartyModeID); stat = new CStatic(_PartyModeID);
i++; i++;
} }
@@ -2029,9 +1859,9 @@ namespace VocaluxeLib.Menu
// Texts // Texts
CText text = new CText(_PartyModeID); CText text = new CText(_PartyModeID);
i = 1; i = 1;
while (text.LoadTheme("//root/" + ThemeName, "Text" + i.ToString(), xmlReader, skinIndex)) while (text.LoadTheme("//root/" + ThemeName, "Text" + i, xmlReader, skinIndex))
{ {
AddText(text); _AddText(text);
text = new CText(_PartyModeID); text = new CText(_PartyModeID);
i++; i++;
} }
@@ -2039,9 +1869,9 @@ namespace VocaluxeLib.Menu
// ParticleEffects // ParticleEffects
CParticleEffect partef = new CParticleEffect(_PartyModeID); CParticleEffect partef = new CParticleEffect(_PartyModeID);
i = 1; i = 1;
while (partef.LoadTheme("//root/" + ThemeName, "ParticleEffect" + i.ToString(), xmlReader, skinIndex)) while (partef.LoadTheme("//root/" + ThemeName, "ParticleEffect" + i, xmlReader, skinIndex))
{ {
AddParticleEffect(partef); _AddParticleEffect(partef);
partef = new CParticleEffect(_PartyModeID); partef = new CParticleEffect(_PartyModeID);
i++; i++;
} }
+8 -12
View File
@@ -46,8 +46,6 @@ namespace VocaluxeLib.Menu
public readonly CStatic Avatar; public readonly CStatic Avatar;
public readonly CText Name; public readonly CText Name;
public CTile() {}
public CTile(CStatic av, CText tex, int pl) public CTile(CStatic av, CText tex, int pl)
{ {
Avatar = av; Avatar = av;
@@ -65,7 +63,7 @@ namespace VocaluxeLib.Menu
return _Theme.Name; return _Theme.Name;
} }
public bool Selected = false; public bool Selected;
public bool Visible = true; public bool Visible = true;
public SRectF Rect; public SRectF Rect;
@@ -85,7 +83,7 @@ namespace VocaluxeLib.Menu
private int _TileW; private int _TileW;
private int _TileH; private int _TileH;
public int Offset = 0; public int Offset;
private int _ActualSelection = -1; private int _ActualSelection = -1;
public int Selection = -1; public int Selection = -1;
@@ -129,9 +127,9 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref Rect.W); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref Rect.W);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H);
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinEmptyTile", ref _Theme.TextureEmptyTileName, String.Empty); _ThemeLoaded &= xmlReader.GetValue(item + "/SkinEmptyTile", out _Theme.TextureEmptyTileName, String.Empty);
if (xmlReader.GetValue(item + "/ColorEmptyTile", ref _Theme.ColorEmptyTileName, String.Empty)) if (xmlReader.GetValue(item + "/ColorEmptyTile", out _Theme.ColorEmptyTileName, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorEmptyTileName, skinIndex, out ColorEmptyTile); _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorEmptyTileName, skinIndex, out ColorEmptyTile);
else else
{ {
@@ -141,7 +139,7 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref ColorEmptyTile.A); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref ColorEmptyTile.A);
} }
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinTileSelected", ref _Theme.TextureTileSelectedName, String.Empty); _ThemeLoaded &= xmlReader.GetValue(item + "/SkinTileSelected", out _Theme.TextureTileSelectedName, String.Empty);
_ThemeLoaded &= xmlReader.TryGetIntValue(item + "/Tiles/W", ref _TileW); _ThemeLoaded &= xmlReader.TryGetIntValue(item + "/Tiles/W", ref _TileW);
_ThemeLoaded &= xmlReader.TryGetIntValue(item + "/Tiles/H", ref _TileH); _ThemeLoaded &= xmlReader.TryGetIntValue(item + "/Tiles/H", ref _TileH);
@@ -151,9 +149,9 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Tiles/SpaceH", ref _SpaceH); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Tiles/SpaceH", ref _SpaceH);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Tiles/Name/Space", ref _Theme.NameSpace); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Tiles/Name/Space", ref _Theme.NameSpace);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Tiles/Name/H", ref _Theme.NameHeight); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Tiles/Name/H", ref _Theme.NameHeight);
_ThemeLoaded &= xmlReader.GetValue(item + "/Tiles/Name/Font", ref _Theme.NameFont, "Normal"); _ThemeLoaded &= xmlReader.GetValue(item + "/Tiles/Name/Font", out _Theme.NameFont, "Normal");
_ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Tiles/Name/Style", ref _Theme.NameStyle); _ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Tiles/Name/Style", ref _Theme.NameStyle);
if (xmlReader.GetValue(item + "/Tiles/Name/Color", ref _Theme.NameColorName, String.Empty)) if (xmlReader.GetValue(item + "/Tiles/Name/Color", out _Theme.NameColorName, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.NameColorName, skinIndex, out _Theme.NameColor); _ThemeLoaded &= CBase.Theme.GetColor(_Theme.NameColorName, skinIndex, out _Theme.NameColor);
else else
{ {
@@ -493,10 +491,8 @@ namespace VocaluxeLib.Menu
_VisibleProfiles.Clear(); _VisibleProfiles.Clear();
for (int i = 0; i < CBase.Profiles.GetProfiles().Length; i++) for (int i = 0; i < CBase.Profiles.GetProfiles().Length; i++)
{ {
bool visible = false; bool visible = CBase.Profiles.GetProfiles()[i].Active == EOffOn.TR_CONFIG_ON;
//Show profile only if active //Show profile only if active
if (CBase.Profiles.GetProfiles()[i].Active == EOffOn.TR_CONFIG_ON)
visible = true;
for (int p = 0; p < CBase.Game.GetNumPlayer(); p++) for (int p = 0; p < CBase.Game.GetNumPlayer(); p++)
{ {
//Don't show profile if is selected, but if selected and guest //Don't show profile if is selected, but if selected and guest
+1 -3
View File
@@ -636,7 +636,6 @@ namespace VocaluxeLib.Menu
int element = _Selection; int element = _Selection;
int stage = int.MaxValue; int stage = int.MaxValue;
float distance = float.MaxValue;
int direction = -1; int direction = -1;
int mute = -1; int mute = -1;
@@ -662,7 +661,6 @@ namespace VocaluxeLib.Menu
{ {
stage = stages[i]; stage = stages[i];
element = elements[i]; element = elements[i];
distance = distances[i];
direction = i; direction = i;
} }
} }
@@ -1039,7 +1037,7 @@ namespace VocaluxeLib.Menu
private void _DrawInteraction(int interaction) private void _DrawInteraction(int interaction)
{ {
bool sel = false; bool sel;
switch (_Interactions[interaction].Type) switch (_Interactions[interaction].Type)
{ {
case EType.Static: case EType.Static:
+2 -2
View File
@@ -385,7 +385,7 @@ namespace VocaluxeLib.Menu
string item = xmlPath + "/" + elementName; string item = xmlPath + "/" + elementName;
_ThemeLoaded = true; _ThemeLoaded = true;
_ThemeLoaded &= xmlReader.GetValue(item + "/Skin", ref _Theme.TextureName, String.Empty); _ThemeLoaded &= xmlReader.GetValue(item + "/Skin", out _Theme.TextureName, String.Empty);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/X", ref Rect.X); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/X", ref Rect.X);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Y", ref Rect.Y); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Y", ref Rect.Y);
@@ -393,7 +393,7 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref Rect.W); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref Rect.W);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H);
if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty)) if (xmlReader.GetValue(item + "/Color", out _Theme.ColorName, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color); _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color);
else else
{ {
+6 -6
View File
@@ -189,7 +189,7 @@ namespace VocaluxeLib.Menu
public EEditMode EditMode; public EEditMode EditMode;
public int ActivePlaylistID = -1; public int ActivePlaylistID = -1;
public int Offset = 0; public int Offset;
public int CurrentPlaylistElement = -1; public int CurrentPlaylistElement = -1;
private CPlaylistElement _ChangeOrderElement; private CPlaylistElement _ChangeOrderElement;
@@ -249,15 +249,15 @@ namespace VocaluxeLib.Menu
string item = xmlPath + "/" + elementName; string item = xmlPath + "/" + elementName;
_ThemeLoaded = true; _ThemeLoaded = true;
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinBackground", ref _Theme.TextureBackgroundName, String.Empty); _ThemeLoaded &= xmlReader.GetValue(item + "/SkinBackground", out _Theme.TextureBackgroundName, String.Empty);
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinBackgroundSelected", ref _Theme.SelTextureBackgroundName, String.Empty); _ThemeLoaded &= xmlReader.GetValue(item + "/SkinBackgroundSelected", out _Theme.SelTextureBackgroundName, String.Empty);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/X", ref Rect.X); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/X", ref Rect.X);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Y", ref Rect.Y); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Y", ref Rect.Y);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Z", ref Rect.Z); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Z", ref Rect.Z);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref Rect.W); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref Rect.W);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H);
if (xmlReader.GetValue(item + "/ColorBackground", ref _Theme.ColorBackgroundName, String.Empty)) if (xmlReader.GetValue(item + "/ColorBackground", out _Theme.ColorBackgroundName, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorBackgroundName, skinIndex, out BackgroundColor); _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorBackgroundName, skinIndex, out BackgroundColor);
else else
{ {
@@ -266,7 +266,7 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/BackgroundB", ref BackgroundColor.B); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/BackgroundB", ref BackgroundColor.B);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/BackgroundA", ref BackgroundColor.A); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/BackgroundA", ref BackgroundColor.A);
} }
if (xmlReader.GetValue(item + "/SColorBackground", ref _Theme.SelColorBackgroundName, String.Empty)) if (xmlReader.GetValue(item + "/SColorBackground", out _Theme.SelColorBackgroundName, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelColorBackgroundName, skinIndex, out BackgroundSelColor); _ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelColorBackgroundName, skinIndex, out BackgroundSelColor);
else else
{ {
@@ -1227,7 +1227,7 @@ namespace VocaluxeLib.Menu
CSong song = CBase.Songs.GetSongByID(pec.SongID); CSong song = CBase.Songs.GetSongByID(pec.SongID);
_PlaylistElements[i].Cover.Texture = song.CoverTextureSmall; _PlaylistElements[i].Cover.Texture = song.CoverTextureSmall;
string t1 = _Theme.Text1.Text.Replace("%a", song.Artist).Replace("%t", song.Title); string t1 = _Theme.Text1.Text.Replace("%a", song.Artist).Replace("%t", song.Title);
_PlaylistElements[i].Text1.Text = /*(Offset + i + 1).ToString() + ") " + */ song.Artist + " - " + song.Title; //TODO: Add text field for the number _PlaylistElements[i].Text1.Text = /*(Offset + i + 1) + ") " + */ song.Artist + " - " + song.Title; //TODO: Add text field for the number
_PlaylistElements[i].SelectSlide.Clear(); _PlaylistElements[i].SelectSlide.Clear();
for (int g = 0; g < pec.Modes.Length; g++) for (int g = 0; g < pec.Modes.Length; g++)
{ {
-2
View File
@@ -18,8 +18,6 @@
#endregion #endregion
using System; using System;
using System.Collections.Generic;
using System.Text;
namespace VocaluxeLib.Menu namespace VocaluxeLib.Menu
{ {
+1 -1
View File
@@ -68,7 +68,7 @@ namespace VocaluxeLib.Menu
string item = xmlPath + "/" + elementName; string item = xmlPath + "/" + elementName;
_ThemeLoaded = true; _ThemeLoaded = true;
_ThemeLoaded &= xmlReader.GetValue(item + "/Value", ref _Theme.Value, String.Empty); _ThemeLoaded &= xmlReader.GetValue(item + "/Value", out _Theme.Value, String.Empty);
_ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Type", ref _Theme.Type); _ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Type", ref _Theme.Type);
if (_ThemeLoaded) if (_ThemeLoaded)
+17 -17
View File
@@ -103,7 +103,7 @@ namespace VocaluxeLib.Menu
} }
public bool Visible = true; public bool Visible = true;
public bool Highlighted = false; public bool Highlighted;
private bool _ArrowLeftSelected; private bool _ArrowLeftSelected;
private bool _ArrowRightSelected; private bool _ArrowRightSelected;
@@ -115,7 +115,7 @@ namespace VocaluxeLib.Menu
private readonly List<SRectF> _ValueBounds = new List<SRectF>(); private readonly List<SRectF> _ValueBounds = new List<SRectF>();
public bool WithTextures = false; public bool WithTextures;
private int _Selection = -1; private int _Selection = -1;
public int Selection public int Selection
@@ -249,15 +249,15 @@ namespace VocaluxeLib.Menu
string item = xmlPath + "/" + elementName; string item = xmlPath + "/" + elementName;
_ThemeLoaded = true; _ThemeLoaded = true;
_ThemeLoaded &= xmlReader.GetValue(item + "/Skin", ref _Theme.TextureName, String.Empty); _ThemeLoaded &= xmlReader.GetValue(item + "/Skin", out _Theme.TextureName, String.Empty);
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinArrowLeft", ref _Theme.TextureArrowLeftName, String.Empty); _ThemeLoaded &= xmlReader.GetValue(item + "/SkinArrowLeft", out _Theme.TextureArrowLeftName, String.Empty);
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinArrowRight", ref _Theme.TextureArrowRightName, String.Empty); _ThemeLoaded &= xmlReader.GetValue(item + "/SkinArrowRight", out _Theme.TextureArrowRightName, String.Empty);
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinSelected", ref _Theme.SelTextureName, String.Empty); _ThemeLoaded &= xmlReader.GetValue(item + "/SkinSelected", out _Theme.SelTextureName, String.Empty);
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinArrowLeftSelected", ref _Theme.SelTextureArrowLeftName, String.Empty); _ThemeLoaded &= xmlReader.GetValue(item + "/SkinArrowLeftSelected", out _Theme.SelTextureArrowLeftName, String.Empty);
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinArrowRightSelected", ref _Theme.SelTextureArrowRightName, String.Empty); _ThemeLoaded &= xmlReader.GetValue(item + "/SkinArrowRightSelected", out _Theme.SelTextureArrowRightName, String.Empty);
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinHighlighted", ref _Theme.HighlightTextureName, String.Empty); _ThemeLoaded &= xmlReader.GetValue(item + "/SkinHighlighted", out _Theme.HighlightTextureName, String.Empty);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/X", ref Rect.X); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/X", ref Rect.X);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Y", ref Rect.Y); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Y", ref Rect.Y);
@@ -265,7 +265,7 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref Rect.W); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref Rect.W);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H);
if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty)) if (xmlReader.GetValue(item + "/Color", out _Theme.ColorName, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color); _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color);
else else
{ {
@@ -275,7 +275,7 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref Color.A); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref Color.A);
} }
if (xmlReader.GetValue(item + "/SColor", ref _Theme.SelColorName, String.Empty)) if (xmlReader.GetValue(item + "/SColor", out _Theme.SelColorName, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelColorName, skinIndex, out SelColor); _ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelColorName, skinIndex, out SelColor);
else else
{ {
@@ -285,7 +285,7 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SA", ref SelColor.A); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SA", ref SelColor.A);
} }
if (xmlReader.GetValue(item + "/HColor", ref _Theme.HighlightColorName, String.Empty)) if (xmlReader.GetValue(item + "/HColor", out _Theme.HighlightColorName, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.HighlightColorName, skinIndex, out HighlightColor); _ThemeLoaded &= CBase.Theme.GetColor(_Theme.HighlightColorName, skinIndex, out HighlightColor);
else else
{ {
@@ -307,7 +307,7 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowRightW", ref RectArrowRight.W); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowRightW", ref RectArrowRight.W);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowRightH", ref RectArrowRight.H); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowRightH", ref RectArrowRight.H);
if (xmlReader.GetValue(item + "/ArrowColor", ref _Theme.ArrowColorName, String.Empty)) if (xmlReader.GetValue(item + "/ArrowColor", out _Theme.ArrowColorName, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ArrowColorName, skinIndex, out ColorArrow); _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ArrowColorName, skinIndex, out ColorArrow);
else else
{ {
@@ -317,7 +317,7 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowA", ref ColorArrow.A); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowA", ref ColorArrow.A);
} }
if (xmlReader.GetValue(item + "/ArrowSColor", ref _Theme.SelArrowColorName, String.Empty)) if (xmlReader.GetValue(item + "/ArrowSColor", out _Theme.SelArrowColorName, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelArrowColorName, skinIndex, out SelColorArrow); _ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelArrowColorName, skinIndex, out SelColorArrow);
else else
{ {
@@ -327,7 +327,7 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowSA", ref SelColorArrow.A); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowSA", ref SelColorArrow.A);
} }
if (xmlReader.GetValue(item + "/TextColor", ref _Theme.TextColorName, String.Empty)) if (xmlReader.GetValue(item + "/TextColor", out _Theme.TextColorName, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.TextColorName, skinIndex, out TextColor); _ThemeLoaded &= CBase.Theme.GetColor(_Theme.TextColorName, skinIndex, out TextColor);
else else
{ {
@@ -337,7 +337,7 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextA", ref TextColor.A); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextA", ref TextColor.A);
} }
if (xmlReader.GetValue(item + "/TextSColor", ref _Theme.SelTextColorName, String.Empty)) if (xmlReader.GetValue(item + "/TextSColor", out _Theme.SelTextColorName, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelTextColorName, skinIndex, out SelTextColor); _ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelTextColorName, skinIndex, out SelTextColor);
else else
{ {
@@ -353,7 +353,7 @@ namespace VocaluxeLib.Menu
if (xmlReader.TryGetFloatValue(item + "/TextRelativeY", ref TextRelativeY)) if (xmlReader.TryGetFloatValue(item + "/TextRelativeY", ref TextRelativeY))
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextRelativeY", ref TextRelativeY); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextRelativeY", ref TextRelativeY);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextMaxW", ref MaxW); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextMaxW", ref MaxW);
_ThemeLoaded &= xmlReader.GetValue(item + "/TextFont", ref _Theme.TextFont, "Normal"); _ThemeLoaded &= xmlReader.GetValue(item + "/TextFont", out _Theme.TextFont, "Normal");
_ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/TextStyle", ref _Theme.TextStyle); _ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/TextStyle", ref _Theme.TextStyle);
_ThemeLoaded &= xmlReader.TryGetIntValue(item + "/NumVisible", ref _NumVisible); _ThemeLoaded &= xmlReader.TryGetIntValue(item + "/NumVisible", ref _NumVisible);
+4 -4
View File
@@ -148,7 +148,7 @@ namespace VocaluxeLib.Menu
string item = xmlPath + "/" + elementName; string item = xmlPath + "/" + elementName;
_ThemeLoaded = true; _ThemeLoaded = true;
_ThemeLoaded &= xmlReader.GetValue(item + "/Skin", ref _Theme.TextureName, String.Empty); _ThemeLoaded &= xmlReader.GetValue(item + "/Skin", out _Theme.TextureName, String.Empty);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/X", ref Rect.X); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/X", ref Rect.X);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Y", ref Rect.Y); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Y", ref Rect.Y);
@@ -156,7 +156,7 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref Rect.W); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref Rect.W);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H);
if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty)) if (xmlReader.GetValue(item + "/Color", out _Theme.ColorName, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color); _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color);
else else
{ {
@@ -268,8 +268,8 @@ namespace VocaluxeLib.Menu
if (aspect != EAspect.Stretch) if (aspect != EAspect.Stretch)
{ {
RectangleF bounds2 = new RectangleF(bounds.X, bounds.Y, bounds.W, bounds.H); RectangleF bounds2 = new RectangleF(bounds.X, bounds.Y, bounds.W, bounds.H);
RectangleF rect2 = new RectangleF(0f, 0f, texture.Width, texture.Height); RectangleF rect2;
CHelper.SetRect(bounds2, ref rect2, texture.Width / texture.Height, aspect); CHelper.SetRect(bounds2, out rect2, texture.Width / texture.Height, aspect);
rect.X = rect2.X; rect.X = rect2.X;
rect.Y = rect2.Y; rect.Y = rect2.Y;
+6 -6
View File
@@ -210,7 +210,7 @@ namespace VocaluxeLib.Menu
public SColorF Color; //normal Color public SColorF Color; //normal Color
public SColorF SelColor; //selected Color for Buttons public SColorF SelColor; //selected Color for Buttons
public bool Reflection = false; public bool Reflection;
public float ReflectionSpace; public float ReflectionSpace;
public float ReflectionHeight; public float ReflectionHeight;
@@ -249,7 +249,7 @@ namespace VocaluxeLib.Menu
} }
} }
public bool Selected = false; public bool Selected;
public bool Visible = true; public bool Visible = true;
private bool _EditMode; private bool _EditMode;
public bool EditMode public bool EditMode
@@ -461,7 +461,7 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref _Height); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref _Height);
xmlReader.TryGetFloatValue(item + "/MaxW", ref _MaxWidth); xmlReader.TryGetFloatValue(item + "/MaxW", ref _MaxWidth);
if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty)) if (xmlReader.GetValue(item + "/Color", out _Theme.ColorName, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color); _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color);
else else
{ {
@@ -471,7 +471,7 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref Color.A); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref Color.A);
} }
if (xmlReader.GetValue(item + "/SColor", ref _Theme.SelColorName, String.Empty)) if (xmlReader.GetValue(item + "/SColor", out _Theme.SelColorName, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelColorName, skinIndex, out SelColor); _ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelColorName, skinIndex, out SelColor);
else else
{ {
@@ -486,9 +486,9 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Align", ref _Align); _ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Align", ref _Align);
xmlReader.TryGetEnumValue(item + "/HAlign", ref _HAlign); xmlReader.TryGetEnumValue(item + "/HAlign", ref _HAlign);
_ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Style", ref _Style); _ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Style", ref _Style);
_ThemeLoaded &= xmlReader.GetValue(item + "/Font", ref _Font, "Normal"); _ThemeLoaded &= xmlReader.GetValue(item + "/Font", out _Font, "Normal");
_ThemeLoaded &= xmlReader.GetValue(item + "/Text", ref _Theme.Text, String.Empty); _ThemeLoaded &= xmlReader.GetValue(item + "/Text", out _Theme.Text, String.Empty);
if (xmlReader.ItemExists(item + "/Reflection") && !buttonText) if (xmlReader.ItemExists(item + "/Reflection") && !buttonText)
{ {
+13 -19
View File
@@ -62,8 +62,8 @@ namespace VocaluxeLib.Menu
public bool TryGetEnumValue<T>(string cast, ref T value) public bool TryGetEnumValue<T>(string cast, ref T value)
where T : struct where T : struct
{ {
string val = String.Empty; string val;
if (GetValue(cast, ref val, Enum.GetName(typeof(T), value))) if (GetValue(cast, out val, Enum.GetName(typeof(T), value)))
{ {
CHelper.TryParse(val, out value, true); CHelper.TryParse(val, out value, true);
return true; return true;
@@ -73,8 +73,8 @@ namespace VocaluxeLib.Menu
public bool TryGetIntValue(string cast, ref int value) public bool TryGetIntValue(string cast, ref int value)
{ {
string val = String.Empty; string val;
if (GetValue(cast, ref val, value.ToString())) if (GetValue(cast, out val, value.ToString()))
return int.TryParse(val, out value); return int.TryParse(val, out value);
return false; return false;
} }
@@ -94,37 +94,31 @@ namespace VocaluxeLib.Menu
public bool TryGetFloatValue(string cast, ref float value) public bool TryGetFloatValue(string cast, ref float value)
{ {
string val = String.Empty; string val;
if (GetValue(cast, ref val, value.ToString())) return GetValue(cast, out val, value.ToString()) && CHelper.TryParse(val, out value);
return CHelper.TryParse(val, out value);
return false;
} }
public bool GetValue(string cast, ref string value, string defaultValue) public bool GetValue(string cast, out string value, string defaultValue)
{ {
XPathNodeIterator iterator; int resultCt = 0;
int results = 0;
string val = string.Empty; string val = string.Empty;
_Navigator.MoveToFirstChild(); _Navigator.MoveToFirstChild();
iterator = _Navigator.Select(cast); XPathNodeIterator iterator = _Navigator.Select(cast);
while (iterator.MoveNext()) while (iterator.MoveNext())
{ {
val = iterator.Current.Value; val = iterator.Current.Value;
results++; resultCt++;
} }
if ((results == 0) || (results > 1)) if (resultCt!=1)
{ {
value = defaultValue; value = defaultValue;
return false; return false;
} }
else value = val;
{ return true;
value = val;
return true;
}
} }
public List<string> GetValues(string cast) public List<string> GetValues(string cast)
+3 -1
View File
@@ -94,7 +94,7 @@ namespace VocaluxeLib.Menu
X32 = 32 X32 = 32
} }
public enum EColorDeep public enum EColorDepth
{ {
Bit8 = 8, Bit8 = 8,
Bit16 = 16, Bit16 = 16,
@@ -136,6 +136,7 @@ namespace VocaluxeLib.Menu
public enum EBufferSize public enum EBufferSize
{ {
// ReSharper disable UnusedMember.Global
B0 = 0, B0 = 0,
B512 = 512, B512 = 512,
B1024 = 1024, B1024 = 1024,
@@ -145,6 +146,7 @@ namespace VocaluxeLib.Menu
B3072 = 3072, B3072 = 3072,
B3584 = 3584, B3584 = 3584,
B4096 = 4096 B4096 = 4096
// ReSharper restore UnusedMember.Global
} }
public enum EPlaybackLib public enum EPlaybackLib
+1 -3
View File
@@ -20,8 +20,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Windows.Forms;
using VocaluxeLib.Menu.SingNotes;
using VocaluxeLib.Menu.SongMenu; using VocaluxeLib.Menu.SongMenu;
using VocaluxeLib.PartyModes; using VocaluxeLib.PartyModes;
@@ -273,7 +271,7 @@ namespace VocaluxeLib.Menu
{ {
int Load(string videoFileName); int Load(string videoFileName);
bool Skip(int videoStream, float startPosition, float videoGap); bool Skip(int videoStream, float startPosition, float videoGap);
bool GetFrame(int videoStream, ref STexture videoTexture, float time, ref float videoTime); bool GetFrame(int videoStream, ref STexture videoTexture, float time, out float videoTime);
bool IsFinished(int videoStream); bool IsFinished(int videoStream);
bool Close(int videoStream); bool Close(int videoStream);
} }
+1 -4
View File
@@ -258,10 +258,7 @@ namespace VocaluxeLib.Menu.SingNotes
#region Methods #region Methods
public bool IsPerfect(CNote compareNote) public bool IsPerfect(CNote compareNote)
{ {
bool result = true; bool result = Hit;
if (!Hit)
result = false;
if (StartBeat != compareNote.StartBeat) if (StartBeat != compareNote.StartBeat)
result = false; result = false;
+11 -11
View File
@@ -100,17 +100,17 @@ namespace VocaluxeLib.Menu.SingNotes
string item = xmlPath + "/" + elementName; string item = xmlPath + "/" + elementName;
_ThemeLoaded = true; _ThemeLoaded = true;
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinLeft", ref _Theme.SkinLeftName, String.Empty); _ThemeLoaded &= xmlReader.GetValue(item + "/SkinLeft", out _Theme.SkinLeftName, String.Empty);
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinMiddle", ref _Theme.SkinMiddleName, String.Empty); _ThemeLoaded &= xmlReader.GetValue(item + "/SkinMiddle", out _Theme.SkinMiddleName, String.Empty);
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinRight", ref _Theme.SkinRightName, String.Empty); _ThemeLoaded &= xmlReader.GetValue(item + "/SkinRight", out _Theme.SkinRightName, String.Empty);
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinBackgroundLeft", ref _Theme.SkinBackgroundLeftName, String.Empty); _ThemeLoaded &= xmlReader.GetValue(item + "/SkinBackgroundLeft", out _Theme.SkinBackgroundLeftName, String.Empty);
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinBackgroundMiddle", ref _Theme.SkinBackgroundMiddleName, String.Empty); _ThemeLoaded &= xmlReader.GetValue(item + "/SkinBackgroundMiddle", out _Theme.SkinBackgroundMiddleName, String.Empty);
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinBackgroundRight", ref _Theme.SkinBackgroundRightName, String.Empty); _ThemeLoaded &= xmlReader.GetValue(item + "/SkinBackgroundRight", out _Theme.SkinBackgroundRightName, String.Empty);
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinGoldenStar", ref _Theme.SkinGoldenStarName, String.Empty); _ThemeLoaded &= xmlReader.GetValue(item + "/SkinGoldenStar", out _Theme.SkinGoldenStarName, String.Empty);
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinToneHelper", ref _Theme.SkinToneHelperName, String.Empty); _ThemeLoaded &= xmlReader.GetValue(item + "/SkinToneHelper", out _Theme.SkinToneHelperName, String.Empty);
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinPerfectNoteStar", ref _Theme.SkinPerfectNoteStarName, String.Empty); _ThemeLoaded &= xmlReader.GetValue(item + "/SkinPerfectNoteStar", out _Theme.SkinPerfectNoteStarName, String.Empty);
_BarPos = new SRectF[CBase.Settings.GetMaxNumPlayer(),CBase.Settings.GetMaxNumPlayer()]; _BarPos = new SRectF[CBase.Settings.GetMaxNumPlayer(),CBase.Settings.GetMaxNumPlayer()];
for (int numplayer = 0; numplayer < CBase.Settings.GetMaxNumPlayer(); numplayer++) for (int numplayer = 0; numplayer < CBase.Settings.GetMaxNumPlayer(); numplayer++)
@@ -120,7 +120,7 @@ namespace VocaluxeLib.Menu.SingNotes
if (player <= numplayer) if (player <= numplayer)
{ {
_BarPos[player, numplayer] = new SRectF(); _BarPos[player, numplayer] = new SRectF();
string target = "/BarPositions/P" + (player + 1).ToString() + "N" + (numplayer + 1).ToString(); string target = "/BarPositions/P" + (player + 1) + "N" + (numplayer + 1);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "X", ref _BarPos[player, numplayer].X); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "X", ref _BarPos[player, numplayer].X);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "Y", ref _BarPos[player, numplayer].Y); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "Y", ref _BarPos[player, numplayer].Y);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "Z", ref _BarPos[player, numplayer].Z); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "Z", ref _BarPos[player, numplayer].Z);
@@ -182,7 +182,7 @@ namespace VocaluxeLib.Menu.SingNotes
{ {
if (player <= numplayer) if (player <= numplayer)
{ {
string target = "P" + (player + 1).ToString() + "N" + (numplayer + 1).ToString(); string target = "P" + (player + 1) + "N" + (numplayer + 1);
writer.WriteElementString(target + "X", _BarPos[player, numplayer].X.ToString("#0")); writer.WriteElementString(target + "X", _BarPos[player, numplayer].X.ToString("#0"));
writer.WriteElementString(target + "Y", _BarPos[player, numplayer].Y.ToString("#0")); writer.WriteElementString(target + "Y", _BarPos[player, numplayer].Y.ToString("#0"));
+217 -238
View File
@@ -127,9 +127,9 @@ namespace VocaluxeLib.Menu.SongMenu
public SMedley Medley = new SMedley(0); public SMedley Medley = new SMedley(0);
public bool CalculateMedley = true; public bool CalculateMedley = true;
public float PreviewStart = 0f; public float PreviewStart;
public int ShortEnd = 0; public int ShortEnd;
public Encoding Encoding = Encoding.Default; public Encoding Encoding = Encoding.Default;
public string Folder = String.Empty; public string Folder = String.Empty;
@@ -179,8 +179,7 @@ namespace VocaluxeLib.Menu.SongMenu
{ {
if (_CoverBigLoaded) if (_CoverBigLoaded)
return _CoverTextureBig; return _CoverTextureBig;
else return _CoverTextureSmall;
return _CoverTextureSmall;
} }
set set
{ {
@@ -195,23 +194,23 @@ namespace VocaluxeLib.Menu.SongMenu
public string TitleSorting = String.Empty; public string TitleSorting = String.Empty;
public string ArtistSorting = String.Empty; public string ArtistSorting = String.Empty;
public float Start = 0f; public float Start;
public float Finish = 0f; public float Finish;
public float BPM = 1f; public float BPM = 1f;
public float Gap = 0f; public float Gap;
public float VideoGap = 0f; public float VideoGap;
public string DuetPart1 = String.Empty; public string DuetPart1 = String.Empty;
public string DuetPart2 = String.Empty; public string DuetPart2 = String.Empty;
public List<string> Comment = new List<string>(); private readonly List<string> _Comment = new List<string>();
// Sorting // Sorting
public int ID; public int ID;
public bool Visible = true; private readonly bool _Visible = true;
public int CatIndex = -1; private readonly int _CatIndex = -1;
public bool Selected = false; private readonly bool _Selected;
public bool IsDuet public bool IsDuet
{ {
get { return Notes.Lines.Length > 1; } get { return Notes.Lines.Length > 1; }
@@ -297,14 +296,14 @@ namespace VocaluxeLib.Menu.SongMenu
Gap = song.Gap; Gap = song.Gap;
VideoGap = song.VideoGap; VideoGap = song.VideoGap;
Comment = new List<string>(); _Comment = new List<string>();
foreach (string value in song.Comment) foreach (string value in song._Comment)
Comment.Add(value); _Comment.Add(value);
ID = song.ID; ID = song.ID;
Visible = song.Visible; _Visible = song._Visible;
CatIndex = song.CatIndex; _CatIndex = song._CatIndex;
Selected = song.Selected; _Selected = song._Selected;
Edition = new List<string>(); Edition = new List<string>();
foreach (string value in song.Edition) foreach (string value in song.Edition)
@@ -339,23 +338,24 @@ namespace VocaluxeLib.Menu.SongMenu
return false; return false;
Folder = Path.GetDirectoryName(filePath); Folder = Path.GetDirectoryName(filePath);
if (Folder == null)
return false;
foreach (string folder in CBase.Config.GetSongFolder()) foreach (string folder in CBase.Config.GetSongFolder())
{ {
if (Folder.Contains(folder)) if (!Folder.Contains(folder))
continue;
if (Folder.Length == folder.Length)
FolderName = "Songs";
else
{ {
if (Folder.Length == folder.Length) FolderName = Folder.Substring(folder.Length + 1, Folder.Length - folder.Length - 1);
FolderName = "Songs";
else
{
FolderName = Folder.Substring(folder.Length + 1, Folder.Length - folder.Length - 1);
int pos = FolderName.IndexOf("\\"); int pos = FolderName.IndexOf("\\", StringComparison.Ordinal);
if (pos >= 0) if (pos >= 0)
FolderName = FolderName.Substring(0, pos); FolderName = FolderName.Substring(0, pos);
}
break;
} }
break;
} }
FileName = Path.GetFileName(filePath); FileName = Path.GetFileName(filePath);
@@ -366,184 +366,176 @@ namespace VocaluxeLib.Menu.SongMenu
{ {
sr = new StreamReader(filePath, Encoding.Default, true); sr = new StreamReader(filePath, Encoding.Default, true);
string line;
int pos = -1;
string identifier = String.Empty;
string value = String.Empty;
while (!sr.EndOfStream) while (!sr.EndOfStream)
{ {
line = sr.ReadLine(); string line = sr.ReadLine();
if (line.Length == 0) if (line.Length == 0)
continue; continue;
if (!line[0].ToString().Equals("#")) if (!line[0].ToString().Equals("#"))
break; break;
pos = line.IndexOf(":"); int pos = line.IndexOf(":", StringComparison.Ordinal);
if (pos > 0) if (pos <= 0)
continue;
string identifier = line.Substring(1, pos - 1).Trim().ToUpper();
string value = line.Substring(pos + 1, line.Length - pos - 1).Trim();
if (value.Length > 0)
{ {
identifier = line.Substring(1, pos - 1).Trim().ToUpper(); switch (identifier)
value = line.Substring(pos + 1, line.Length - pos - 1).Trim();
if (value.Length > 0)
{ {
switch (identifier) case "ENCODING":
{ Encoding = CEncoding.GetEncoding(value);
case "ENCODING": sr.Dispose();
Encoding = CEncoding.GetEncoding(value); sr = null;
sr.Dispose(); sr = new StreamReader(filePath, Encoding);
sr = null;
sr = new StreamReader(filePath, Encoding);
identifier = String.Empty;
//Scip everything till encoding //Scip everything till encoding
while (!sr.EndOfStream) while (!sr.EndOfStream)
{
line = sr.ReadLine();
if (line.Length == 0)
continue;
if (!line[0].ToString().Equals("#"))
break;
pos = line.IndexOf(":", StringComparison.Ordinal);
if (pos > 0)
{ {
line = sr.ReadLine(); identifier = line.Substring(1, pos - 1).Trim().ToUpper();
if (line.Length == 0) if (identifier == "ENCODING")
continue;
if (!line[0].ToString().Equals("#"))
break; break;
pos = line.IndexOf(":");
if (pos > 0)
{
identifier = line.Substring(1, pos - 1).Trim().ToUpper();
if (identifier == "ENCODING")
break;
}
}
break;
case "TITLE":
if (value.Length > 0)
{
Title = value;
headerFlags |= EHeaderFlags.Title;
}
break;
case "ARTIST":
if (value.Length > 0)
{
Artist = value;
headerFlags |= EHeaderFlags.Artist;
}
break;
case "TITLE-ON-SORTING":
if (value.Length > 0)
TitleSorting = value;
break;
case "ARTIST-ON-SORTING":
if (value.Length > 0)
ArtistSorting = value;
break;
case "P1":
if (value.Length > 0)
DuetPart1 = value;
break;
case "P2":
if (value.Length > 0)
DuetPart2 = value;
break;
case "MP3":
if (File.Exists(Path.Combine(Folder, value)))
{
MP3FileName = value;
headerFlags |= EHeaderFlags.MP3;
} }
}
break;
case "TITLE":
if (value.Length > 0)
{
Title = value;
headerFlags |= EHeaderFlags.Title;
}
break;
case "ARTIST":
if (value.Length > 0)
{
Artist = value;
headerFlags |= EHeaderFlags.Artist;
}
break;
case "TITLE-ON-SORTING":
if (value.Length > 0)
TitleSorting = value;
break;
case "ARTIST-ON-SORTING":
if (value.Length > 0)
ArtistSorting = value;
break;
case "P1":
if (value.Length > 0)
DuetPart1 = value;
break;
case "P2":
if (value.Length > 0)
DuetPart2 = value;
break;
case "MP3":
if (File.Exists(Path.Combine(Folder, value)))
{
MP3FileName = value;
headerFlags |= EHeaderFlags.MP3;
}
else
{
CBase.Log.LogError("Can't find audio file: " + Path.Combine(Folder, value));
return false;
}
break;
case "BPM":
if (CHelper.TryParse(value, out BPM))
{
BPM *= 4;
headerFlags |= EHeaderFlags.BPM;
}
break;
case "EDITION":
if (value.Length > 1)
Edition.Add(value);
break;
case "GENRE":
if (value.Length > 1)
Genre.Add(value);
break;
case "YEAR":
int num;
if (value.Length == 4 && int.TryParse(value, out num) && num != 0)
Year = value;
break;
case "LANGUAGE":
if (value.Length > 1)
Language.Add(value);
break;
case "COMMENT":
if (value.Length > 1)
_Comment.Add(value);
break;
case "GAP":
if (CHelper.TryParse(value, out Gap))
Gap /= 1000f;
break;
case "COVER":
if (File.Exists(Path.Combine(Folder, value)))
CoverFileName = value;
break;
case "BACKGROUND":
if (File.Exists(Path.Combine(Folder, value)))
BackgroundFileName = value;
break;
case "VIDEO":
if (File.Exists(Path.Combine(Folder, value)))
VideoFileName = value;
else
CBase.Log.LogError("Can't find video file: " + Path.Combine(Folder, value));
break;
case "VIDEOGAP":
CHelper.TryParse(value, out VideoGap);
break;
case "VIDEOASPECT":
CHelper.TryParse(value, out VideoAspect, true);
break;
case "START":
CHelper.TryParse(value, out Start);
break;
case "END":
if (CHelper.TryParse(value, out Finish))
Finish /= 1000f;
break;
case "PREVIEWSTART":
if (CHelper.TryParse(value, out PreviewStart))
{
if (PreviewStart < 0f)
PreviewStart = 0f;
else else
{ headerFlags |= EHeaderFlags.PreviewStart;
CBase.Log.LogError("Can't find audio file: " + Path.Combine(Folder, value)); }
return false; break;
} case "MEDLEYSTARTBEAT":
break; if (int.TryParse(value, out Medley.StartBeat))
case "BPM": headerFlags |= EHeaderFlags.MedleyStartBeat;
if (CHelper.TryParse(value, out BPM)) break;
{ case "MEDLEYENDBEAT":
BPM *= 4; if (int.TryParse(value, out Medley.EndBeat))
headerFlags |= EHeaderFlags.BPM; headerFlags |= EHeaderFlags.MedleyEndBeat;
} break;
break; case "CALCMEDLEY":
case "EDITION": if (value.ToUpper() == "OFF")
if (value.Length > 1) CalculateMedley = false;
Edition.Add(value); break;
break; case "RELATIVE":
case "GENRE": if (value.ToUpper() == "YES" && value.ToUpper() != "NO")
if (value.Length > 1) Relative = EOffOn.TR_CONFIG_ON;
Genre.Add(value); break;
break;
case "YEAR":
int num = 0;
if (value.Length == 4 && int.TryParse(value, out num) && num != 0)
Year = value;
break;
case "LANGUAGE":
if (value.Length > 1)
Language.Add(value);
break;
case "COMMENT":
if (value.Length > 1)
Comment.Add(value);
break;
case "GAP":
if (CHelper.TryParse(value, out Gap))
Gap /= 1000f;
break;
case "COVER":
if (File.Exists(Path.Combine(Folder, value)))
CoverFileName = value;
break;
case "BACKGROUND":
if (File.Exists(Path.Combine(Folder, value)))
BackgroundFileName = value;
break;
case "VIDEO":
if (File.Exists(Path.Combine(Folder, value)))
VideoFileName = value;
else
CBase.Log.LogError("Can't find video file: " + Path.Combine(Folder, value));
break;
case "VIDEOGAP":
CHelper.TryParse(value, out VideoGap);
break;
case "VIDEOASPECT":
CHelper.TryParse(value, out VideoAspect, true);
break;
case "START":
CHelper.TryParse(value, out Start);
break;
case "END":
if (CHelper.TryParse(value, out Finish))
Finish /= 1000f;
break;
case "PREVIEWSTART":
if (CHelper.TryParse(value, out PreviewStart))
{
if (PreviewStart < 0f)
PreviewStart = 0f;
else
headerFlags |= EHeaderFlags.PreviewStart;
}
break;
case "MEDLEYSTARTBEAT":
if (int.TryParse(value, out Medley.StartBeat))
headerFlags |= EHeaderFlags.MedleyStartBeat;
break;
case "MEDLEYENDBEAT":
if (int.TryParse(value, out Medley.EndBeat))
headerFlags |= EHeaderFlags.MedleyEndBeat;
break;
case "CALCMEDLEY":
if (value.ToUpper() == "OFF")
CalculateMedley = false;
break;
case "RELATIVE":
if (value.ToUpper() == "YES" && value.ToUpper() != "NO")
Relative = EOffOn.TR_CONFIG_ON;
break;
}
} }
} }
} //end of while } //end of while
@@ -589,15 +581,10 @@ namespace VocaluxeLib.Menu.SongMenu
} }
} }
if ((headerFlags & EHeaderFlags.PreviewStart) == 0 || PreviewStart == 0f) if ((headerFlags & EHeaderFlags.PreviewStart) == 0 || Math.Abs(PreviewStart) < float.Epsilon)
{ {
//PreviewStart is not set or <=0 //PreviewStart is not set or <=0
if ((headerFlags & EHeaderFlags.MedleyStartBeat) != 0) PreviewStart = (headerFlags & EHeaderFlags.MedleyStartBeat) != 0 ? CBase.Game.GetTimeFromBeats(Medley.StartBeat, BPM) : 0f;
//fallback to MedleyStart
PreviewStart = CBase.Game.GetTimeFromBeats(Medley.StartBeat, BPM);
else
//else set to 0, it will be set in FindRefrainStart
PreviewStart = 0f;
} }
if ((headerFlags & EHeaderFlags.MedleyStartBeat) != 0 && (headerFlags & EHeaderFlags.MedleyEndBeat) != 0) if ((headerFlags & EHeaderFlags.MedleyStartBeat) != 0 && (headerFlags & EHeaderFlags.MedleyEndBeat) != 0)
@@ -648,14 +635,9 @@ namespace VocaluxeLib.Menu.SongMenu
} }
char tempC = char.MinValue; char tempC = char.MinValue;
int param1 = 0;
int param2 = 0;
int param3 = 0;
int currentPos = 0; int currentPos = 0;
string paramS = String.Empty;
bool isNewSentence = false; bool isNewSentence = false;
string line = String.Empty;
int player = 0; int player = 0;
int fileLineNo = 0; int fileLineNo = 0;
@@ -669,7 +651,7 @@ namespace VocaluxeLib.Menu.SongMenu
//Search for Note Beginning //Search for Note Beginning
while (!sr.EndOfStream) while (!sr.EndOfStream)
{ {
line = sr.ReadLine(); sr.ReadLine();
fileLineNo++; fileLineNo++;
tempC = (char)sr.Peek(); tempC = (char)sr.Peek();
@@ -684,16 +666,18 @@ namespace VocaluxeLib.Menu.SongMenu
if (sr.EndOfStream) if (sr.EndOfStream)
{ {
CBase.Log.LogError("Error loading song. Line No.: " + fileLineNo.ToString() + ". No lyrics/notes found: " + filePath); CBase.Log.LogError("Error loading song. Line No.: " + fileLineNo + ". No lyrics/notes found: " + filePath);
return false; return false;
} }
do do
{ {
char chr; int param2;
int param1;
switch (tempC) switch (tempC)
{ {
case 'P': case 'P':
char chr;
while ((chr = (char)sr.Read()) == ' ') {} while ((chr = (char)sr.Read()) == ' ') {}
int.TryParse(chr.ToString(), out param1); int.TryParse(chr.ToString(), out param1);
@@ -705,7 +689,7 @@ namespace VocaluxeLib.Menu.SongMenu
player = 2; player = 2;
else else
{ {
CBase.Log.LogError("Error loading song. Line No.: " + fileLineNo.ToString() + ". Wrong or missing number after \"P\": " + filePath); CBase.Log.LogError("Error loading song. Line No.: " + fileLineNo + ". Wrong or missing number after \"P\": " + filePath);
return false; return false;
} }
sr.ReadLine(); sr.ReadLine();
@@ -720,10 +704,10 @@ namespace VocaluxeLib.Menu.SongMenu
param2 = CHelper.TryReadInt(sr); param2 = CHelper.TryReadInt(sr);
sr.Read(); sr.Read();
param3 = CHelper.TryReadInt(sr); int param3 = CHelper.TryReadInt(sr);
sr.Read(); sr.Read();
paramS = sr.ReadLine(); string paramS = sr.ReadLine();
ENoteType noteType; ENoteType noteType;
@@ -751,7 +735,7 @@ namespace VocaluxeLib.Menu.SongMenu
case '-': case '-':
if (isNewSentence) if (isNewSentence)
{ {
CBase.Log.LogError("Error loading song. Line No.: " + fileLineNo.ToString() + ". Double sentence break: " + filePath); CBase.Log.LogError("Error loading song. Line No.: " + fileLineNo + ". Double sentence break: " + filePath);
return false; return false;
} }
sr.Read(); sr.Read();
@@ -779,10 +763,10 @@ namespace VocaluxeLib.Menu.SongMenu
sr.ReadLine(); sr.ReadLine();
break; break;
default: default:
CBase.Log.LogError("Error loading song. Line No.: " + fileLineNo.ToString() + ". Unexpected or missing character (" + tempC + "): " + filePath); CBase.Log.LogError("Error loading song. Line No.: " + fileLineNo + ". Unexpected or missing character (" + tempC + "): " + filePath);
return false; return false;
} }
int c = 0; int c;
do do
{ {
c = sr.Read(); c = sr.Read();
@@ -796,7 +780,7 @@ namespace VocaluxeLib.Menu.SongMenu
} }
catch (Exception e) catch (Exception e)
{ {
CBase.Log.LogError("Error loading song. Line No.: " + fileLineNo.ToString() + ". An unhandled exception occured (" + e.Message + "): " + filePath); CBase.Log.LogError("Error loading song. Line No.: " + fileLineNo + ". An unhandled exception occured (" + e.Message + "): " + filePath);
if (sr != null) if (sr != null)
sr.Dispose(); sr.Dispose();
return false; return false;
@@ -919,29 +903,26 @@ namespace VocaluxeLib.Menu.SongMenu
{ {
for (int j = i + 1; j < lines.LineCount; j++) for (int j = i + 1; j < lines.LineCount; j++)
{ {
if (sentences[i] == sentences[j] && sentences[i].Length > 0) if (sentences[i] != sentences[j] || sentences[i] == "")
continue;
SSeries tempSeries = new SSeries {Start = i, End = i};
int max;
if (j + j - i > lines.LineCount)
max = lines.LineCount - 1 - j;
else
max = j - i - 1;
for (int k = 1; k <= max; k++)
{ {
SSeries tempSeries = new SSeries(); if (sentences[i + k] == sentences[j + k] && sentences[i + k]!="")
tempSeries.Start = i; tempSeries.End = i + k;
tempSeries.End = i;
int max = 0;
if (j + j - i - 1 > lines.LineCount - 1)
max = lines.LineCount - 1 - j;
else else
max = j - i - 1; break;
for (int k = 1; k <= max; k++)
{
if (sentences[i + k] == sentences[j + k] && sentences[i + k].Length > 0)
tempSeries.End = i + k;
else
break;
}
tempSeries.Length = tempSeries.End - tempSeries.Start + 1;
series.Add(tempSeries);
} }
tempSeries.Length = tempSeries.End - tempSeries.Start + 1;
series.Add(tempSeries);
} }
} }
return series; return series;
@@ -981,12 +962,10 @@ namespace VocaluxeLib.Menu.SongMenu
Medley.StartBeat = lines.Line[series[longest].Start].FirstNoteBeat; Medley.StartBeat = lines.Line[series[longest].Start].FirstNoteBeat;
Medley.EndBeat = lines.Line[series[longest].End].LastNoteBeat; Medley.EndBeat = lines.Line[series[longest].End].LastNoteBeat;
bool foundEnd = false; bool foundEnd = CBase.Game.GetTimeFromBeats(Medley.StartBeat, BPM) + CBase.Settings.GetMedleyMinDuration() >
CBase.Game.GetTimeFromBeats(Medley.EndBeat, BPM);
// set end if duration > MedleyMinDuration // set end if duration > MedleyMinDuration
if (CBase.Game.GetTimeFromBeats(Medley.StartBeat, BPM) + CBase.Settings.GetMedleyMinDuration() >
CBase.Game.GetTimeFromBeats(Medley.EndBeat, BPM))
foundEnd = true;
if (!foundEnd) if (!foundEnd)
{ {
@@ -44,6 +44,7 @@ namespace VocaluxeLib.Menu.SongMenu
public CSongMenuDreidel(int partyModeID) public CSongMenuDreidel(int partyModeID)
: base(partyModeID) {} : base(partyModeID) {}
// ReSharper disable RedundantOverridenMember
public override void Init() public override void Init()
{ {
base.Init(); base.Init();
@@ -58,5 +59,6 @@ namespace VocaluxeLib.Menu.SongMenu
_SongLength = _Theme.songMenuDreidel.TextSongLength; _SongLength = _Theme.songMenuDreidel.TextSongLength;
**/ **/
} }
// ReSharper restore RedundantOverridenMember
} }
} }
+14 -24
View File
@@ -112,19 +112,19 @@ namespace VocaluxeLib.Menu.SongMenu
private int _Actsongstream = -1; private int _Actsongstream = -1;
protected STexture _Vidtex = new STexture(-1); protected STexture _Vidtex = new STexture(-1);
protected bool _Initialized = false; protected bool _Initialized;
protected int _LastKnownNumSongs = 0; protected int _LastKnownNumSongs;
protected int _LastKnownCategory = -1; protected int _LastKnownCategory = -1;
protected SRectF _Rect = new SRectF(); protected SRectF _Rect;
protected SColorF _Color = new SColorF(); protected SColorF _Color;
private int _SelectedInternal = -1; private int _SelectedInternal = -1;
private int _SelectedPending = -1; private int _SelectedPending = -1;
protected long _PendingTime = 500L; protected long _PendingTime = 500L;
private int _LockedInternal = -1; private int _LockedInternal = -1;
protected bool _Active = false; protected bool _Active;
protected float _MaxVolume = 100f; protected float _MaxVolume = 100f;
@@ -269,14 +269,14 @@ namespace VocaluxeLib.Menu.SongMenu
string item = xmlPath + "/" + elementName; string item = xmlPath + "/" + elementName;
_ThemeLoaded = true; _ThemeLoaded = true;
_ThemeLoaded &= xmlReader.GetValue(item + "/CoverBackground", ref _Theme.CoverBackgroundName, String.Empty); _ThemeLoaded &= xmlReader.GetValue(item + "/CoverBackground", out _Theme.CoverBackgroundName, String.Empty);
_ThemeLoaded &= xmlReader.GetValue(item + "/CoverBigBackground", ref _Theme.CoverBigBackgroundName, String.Empty); _ThemeLoaded &= xmlReader.GetValue(item + "/CoverBigBackground", out _Theme.CoverBigBackgroundName, String.Empty);
_ThemeLoaded &= xmlReader.GetValue(item + "/DuetIcon", ref _Theme.DuetIconName, String.Empty); _ThemeLoaded &= xmlReader.GetValue(item + "/DuetIcon", out _Theme.DuetIconName, String.Empty);
_ThemeLoaded &= xmlReader.GetValue(item + "/VideoIcon", ref _Theme.VideoIconName, String.Empty); _ThemeLoaded &= xmlReader.GetValue(item + "/VideoIcon", out _Theme.VideoIconName, String.Empty);
_ThemeLoaded &= xmlReader.GetValue(item + "/MedleyCalcIcon", ref _Theme.MedleyCalcIcon, String.Empty); _ThemeLoaded &= xmlReader.GetValue(item + "/MedleyCalcIcon", out _Theme.MedleyCalcIcon, String.Empty);
_ThemeLoaded &= xmlReader.GetValue(item + "/MedleyTagIcon", ref _Theme.MedleyTagIcon, String.Empty); _ThemeLoaded &= xmlReader.GetValue(item + "/MedleyTagIcon", out _Theme.MedleyTagIcon, String.Empty);
if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty)) if (xmlReader.GetValue(item + "/Color", out _Theme.ColorName, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out _Color); _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out _Color);
else else
{ {
@@ -453,8 +453,8 @@ namespace VocaluxeLib.Menu.SongMenu
float time = CBase.Sound.GetPosition(_Actsongstream); float time = CBase.Sound.GetPosition(_Actsongstream);
float vtime = 0f; float vtime;
CBase.Video.GetFrame(_Video, ref _Vidtex, time, ref vtime); CBase.Video.GetFrame(_Video, ref _Vidtex, time, out vtime);
if (_VideoFadeTimer.ElapsedMilliseconds <= 3000L) if (_VideoFadeTimer.ElapsedMilliseconds <= 3000L)
_Vidtex.Color.A = _VideoFadeTimer.ElapsedMilliseconds / 3000f; _Vidtex.Color.A = _VideoFadeTimer.ElapsedMilliseconds / 3000f;
else else
@@ -489,14 +489,10 @@ namespace VocaluxeLib.Menu.SongMenu
public virtual void HandleInput(ref SKeyEvent keyEvent, SScreenSongOptions songOptions) public virtual void HandleInput(ref SKeyEvent keyEvent, SScreenSongOptions songOptions)
{ {
if (!_Initialized)
return;
} }
public virtual void HandleMouse(ref SMouseEvent mouseEvent, SScreenSongOptions songOptions) public virtual void HandleMouse(ref SMouseEvent mouseEvent, SScreenSongOptions songOptions)
{ {
if (!_Initialized)
return;
} }
public virtual void Draw() public virtual void Draw()
@@ -543,20 +539,14 @@ namespace VocaluxeLib.Menu.SongMenu
public virtual void SetSelectedSong(int visibleSongNr) public virtual void SetSelectedSong(int visibleSongNr)
{ {
if (!_Initialized)
return;
} }
public virtual void SetSelectedCategory(int categoryNr) public virtual void SetSelectedCategory(int categoryNr)
{ {
if (!_Initialized)
return;
} }
public virtual void SetSmallView(bool smallView) public virtual void SetSmallView(bool smallView)
{ {
if (!_Initialized)
return;
} }
public virtual bool IsSmallView() public virtual bool IsSmallView()
@@ -463,7 +463,7 @@ namespace VocaluxeLib.Menu.SongMenu
_CoverBig.Draw(1f, EAspect.Crop); _CoverBig.Draw(1f, EAspect.Crop);
RectangleF bounds = new RectangleF(_CoverBig.Rect.X, _CoverBig.Rect.Y, _CoverBig.Rect.W, _CoverBig.Rect.H); RectangleF bounds = new RectangleF(_CoverBig.Rect.X, _CoverBig.Rect.Y, _CoverBig.Rect.W, _CoverBig.Rect.H);
RectangleF rect = new RectangleF(0f, 0f, _Vidtex.Width, _Vidtex.Height); RectangleF rect = new RectangleF(0f, 0f, _Vidtex.Width, _Vidtex.Height);
CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, EAspect.Crop); CHelper.SetRect(bounds, out rect, rect.Width / rect.Height, EAspect.Crop);
SRectF vidRect = new SRectF(rect.X, rect.Y, rect.Width, rect.Height, _CoverBig.Rect.Z); SRectF vidRect = new SRectF(rect.X, rect.Y, rect.Width, rect.Height, _CoverBig.Rect.Z);
SRectF vidRectBounds = new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f); SRectF vidRectBounds = new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f);
+2 -2
View File
@@ -42,7 +42,7 @@ namespace VocaluxeLib.PartyModes
_Warning.Color = new SColorF(1f, 0f, 0f, 1f); _Warning.Color = new SColorF(1f, 0f, 0f, 1f);
_Warning.SelColor = new SColorF(1f, 0f, 0f, 1f); _Warning.SelColor = new SColorF(1f, 0f, 0f, 1f);
_Warning.Text = "SOMETHING WENT WRONG!"; _Warning.Text = "SOMETHING WENT WRONG!";
AddText(_Warning); _AddText(_Warning);
} }
public override void ReloadTheme(string xmlPath) {} public override void ReloadTheme(string xmlPath) {}
@@ -75,7 +75,7 @@ namespace VocaluxeLib.PartyModes
{ {
base.HandleMouse(mouseEvent); base.HandleMouse(mouseEvent);
if (mouseEvent.LB && IsMouseOver(mouseEvent)) {} if (mouseEvent.LB && _IsMouseOver(mouseEvent)) {}
if (mouseEvent.RB) if (mouseEvent.RB)
_FadeTo(EScreens.ScreenParty); _FadeTo(EScreens.ScreenParty);