Many cleanups according to ReSharper suggestions (Mostly redundant code)
Minor Bug fixes
This commit is contained in:
1 parent
9aa81b7ba2
commit
dcbbc5caf3
96 files changed
+2702
-3322
No files matched your search
@@ -211,7 +211,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
|
||||
public override void DataFromScreen(string screenName, Object data)
|
||||
{
|
||||
SDataFromScreen dataFrom = new SDataFromScreen();
|
||||
SDataFromScreen dataFrom;
|
||||
switch (screenName)
|
||||
{
|
||||
case "PartyScreenChallengeConfig":
|
||||
@@ -371,10 +371,11 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
return _ScreenSongOptions;
|
||||
}
|
||||
|
||||
// ReSharper disable RedundantAssignment
|
||||
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)
|
||||
{
|
||||
@@ -391,7 +392,9 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
screenSongOptions = _ScreenSongOptions;
|
||||
}
|
||||
|
||||
// ReSharper disable RedundantAssignment
|
||||
public override void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions)
|
||||
// ReSharper restore RedundantAssignment
|
||||
{
|
||||
if (_GameData.CatSongIndices != null && categoryIndex != -1)
|
||||
{
|
||||
|
||||
@@ -60,11 +60,9 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
|
||||
public override void DataToScreen(object receivedData)
|
||||
{
|
||||
SDataToScreenConfig config = new SDataToScreenConfig();
|
||||
|
||||
try
|
||||
{
|
||||
config = (SDataToScreenConfig)receivedData;
|
||||
SDataToScreenConfig config = (SDataToScreenConfig)receivedData;
|
||||
_Data.ScreenConfig.NumPlayer = config.NumPlayer;
|
||||
_Data.ScreenConfig.NumPlayerAtOnce = config.NumPlayerAtOnce;
|
||||
_Data.ScreenConfig.NumRounds = config.NumRounds;
|
||||
@@ -92,10 +90,10 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
case Keys.Enter:
|
||||
_UpdateSlides();
|
||||
|
||||
if (Buttons[_ButtonBack].Selected)
|
||||
if (_Buttons[_ButtonBack].Selected)
|
||||
_Back();
|
||||
|
||||
if (Buttons[_ButtonNext].Selected)
|
||||
if (_Buttons[_ButtonNext].Selected)
|
||||
_Next();
|
||||
break;
|
||||
|
||||
@@ -115,13 +113,13 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
base.HandleMouse(mouseEvent);
|
||||
|
||||
if (mouseEvent.LB && IsMouseOver(mouseEvent))
|
||||
if (mouseEvent.LB && _IsMouseOver(mouseEvent))
|
||||
{
|
||||
_UpdateSlides();
|
||||
if (Buttons[_ButtonBack].Selected)
|
||||
if (_Buttons[_ButtonBack].Selected)
|
||||
_Back();
|
||||
|
||||
if (Buttons[_ButtonNext].Selected)
|
||||
if (_Buttons[_ButtonNext].Selected)
|
||||
_Next();
|
||||
}
|
||||
|
||||
@@ -158,10 +156,10 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
private void _RebuildSlides()
|
||||
{
|
||||
// build num player slide (min player ... max player);
|
||||
SelectSlides[_SelectSlideNumPlayers].Clear();
|
||||
_SelectSlides[_SelectSlideNumPlayers].Clear();
|
||||
for (int i = _PartyMode.GetMinPlayer(); i <= _PartyMode.GetMaxPlayer(); i++)
|
||||
SelectSlides[_SelectSlideNumPlayers].AddValue(i.ToString());
|
||||
SelectSlides[_SelectSlideNumPlayers].Selection = _Data.ScreenConfig.NumPlayer - _PartyMode.GetMinPlayer();
|
||||
_SelectSlides[_SelectSlideNumPlayers].AddValue(i.ToString());
|
||||
_SelectSlides[_SelectSlideNumPlayers].Selection = _Data.ScreenConfig.NumPlayer - _PartyMode.GetMinPlayer();
|
||||
|
||||
_UpdateMicsAtOnce();
|
||||
_SetRoundSteps();
|
||||
@@ -172,9 +170,9 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
int player = _Data.ScreenConfig.NumPlayer;
|
||||
int mics = _Data.ScreenConfig.NumPlayerAtOnce;
|
||||
_Data.ScreenConfig.NumPlayer = SelectSlides[_SelectSlideNumPlayers].Selection + _PartyMode.GetMinPlayer();
|
||||
_Data.ScreenConfig.NumPlayerAtOnce = SelectSlides[_SelectSlideNumMics].Selection + _PartyMode.GetMinPlayer();
|
||||
_Data.ScreenConfig.NumRounds = (SelectSlides[_SelectSlideNumRounds].Selection + 1) * _RoundSteps;
|
||||
_Data.ScreenConfig.NumPlayer = _SelectSlides[_SelectSlideNumPlayers].Selection + _PartyMode.GetMinPlayer();
|
||||
_Data.ScreenConfig.NumPlayerAtOnce = _SelectSlides[_SelectSlideNumMics].Selection + _PartyMode.GetMinPlayer();
|
||||
_Data.ScreenConfig.NumRounds = (_SelectSlides[_SelectSlideNumRounds].Selection + 1) * _RoundSteps;
|
||||
|
||||
_UpdateMicsAtOnce();
|
||||
_SetRoundSteps();
|
||||
@@ -201,19 +199,19 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
_Data.ScreenConfig.NumPlayerAtOnce = maxNum;
|
||||
|
||||
// build mics at once slide
|
||||
SelectSlides[_SelectSlideNumMics].Clear();
|
||||
_SelectSlides[_SelectSlideNumMics].Clear();
|
||||
for (int i = 1; i <= maxNum; i++)
|
||||
SelectSlides[_SelectSlideNumMics].AddValue(i.ToString());
|
||||
SelectSlides[_SelectSlideNumMics].Selection = _Data.ScreenConfig.NumPlayerAtOnce - _PartyMode.GetMinPlayer();
|
||||
_SelectSlides[_SelectSlideNumMics].AddValue(i.ToString());
|
||||
_SelectSlides[_SelectSlideNumMics].Selection = _Data.ScreenConfig.NumPlayerAtOnce - _PartyMode.GetMinPlayer();
|
||||
}
|
||||
|
||||
private void _UpdateSlideRounds()
|
||||
{
|
||||
// build num rounds slide
|
||||
SelectSlides[_SelectSlideNumRounds].Clear();
|
||||
_SelectSlides[_SelectSlideNumRounds].Clear();
|
||||
for (int i = _RoundSteps; i <= _MaxNumRounds; i += _RoundSteps)
|
||||
SelectSlides[_SelectSlideNumRounds].AddValue(i.ToString());
|
||||
SelectSlides[_SelectSlideNumRounds].Selection = _Data.ScreenConfig.NumRounds / _RoundSteps - 1;
|
||||
_SelectSlides[_SelectSlideNumRounds].AddValue(i.ToString());
|
||||
_SelectSlides[_SelectSlideNumRounds].Selection = _Data.ScreenConfig.NumRounds / _RoundSteps - 1;
|
||||
}
|
||||
|
||||
private void _SetRoundSteps()
|
||||
|
||||
@@ -130,20 +130,18 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
|
||||
for (int i = 0; i < _PartyMode.GetMaxPlayer(); i++)
|
||||
{
|
||||
_NextPlayerTexts.Add(GetNewText(Texts[_TextNextPlayer]));
|
||||
AddText(_NextPlayerTexts[_NextPlayerTexts.Count - 1]);
|
||||
_NextPlayerStatics.Add(GetNewStatic(Statics[_StaticNextPlayer]));
|
||||
AddStatic(_NextPlayerStatics[_NextPlayerStatics.Count - 1]);
|
||||
_NextPlayerTexts.Add(GetNewText(_Texts[_TextNextPlayer]));
|
||||
_AddText(_NextPlayerTexts[_NextPlayerTexts.Count - 1]);
|
||||
_NextPlayerStatics.Add(GetNewStatic(_Statics[_StaticNextPlayer]));
|
||||
_AddStatic(_NextPlayerStatics[_NextPlayerStatics.Count - 1]);
|
||||
}
|
||||
}
|
||||
|
||||
public override void DataToScreen(object receivedData)
|
||||
{
|
||||
SDataToScreenMain data = new SDataToScreenMain();
|
||||
|
||||
try
|
||||
{
|
||||
data = (SDataToScreenMain)receivedData;
|
||||
SDataToScreenMain data = (SDataToScreenMain)receivedData;
|
||||
_GameState = data;
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -177,26 +175,26 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
case Keys.Enter:
|
||||
if (!_ExitPopupVisible)
|
||||
{
|
||||
if (Buttons[_ButtonNextRound].Selected)
|
||||
if (_Buttons[_ButtonNextRound].Selected)
|
||||
_NextRound();
|
||||
if (Buttons[_ButtonBack].Selected && _GameState.CurrentRoundNr == 1)
|
||||
if (_Buttons[_ButtonBack].Selected && _GameState.CurrentRoundNr == 1)
|
||||
_Back();
|
||||
if (Buttons[_ButtonExit].Selected && _GameState.CurrentRoundNr > 1)
|
||||
if (_Buttons[_ButtonExit].Selected && _GameState.CurrentRoundNr > 1)
|
||||
_ShowPopup(true);
|
||||
if (Buttons[_ButtonPlayerScrollUp].Selected)
|
||||
if (_Buttons[_ButtonPlayerScrollUp].Selected)
|
||||
_ScrollPlayerTable(-1);
|
||||
if (Buttons[_ButtonPlayerScrollDown].Selected)
|
||||
if (_Buttons[_ButtonPlayerScrollDown].Selected)
|
||||
_ScrollPlayerTable(1);
|
||||
if (Buttons[_ButtonRoundsScrollUp].Selected)
|
||||
if (_Buttons[_ButtonRoundsScrollUp].Selected)
|
||||
_ScrollRoundsTable(-1);
|
||||
if (Buttons[_ButtonRoundsScrollDown].Selected)
|
||||
if (_Buttons[_ButtonRoundsScrollDown].Selected)
|
||||
_ScrollRoundsTable(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Buttons[_ButtonPopupYes].Selected)
|
||||
if (_Buttons[_ButtonPopupYes].Selected)
|
||||
_EndParty();
|
||||
if (Buttons[_ButtonPopupNo].Selected)
|
||||
if (_Buttons[_ButtonPopupNo].Selected)
|
||||
_ShowPopup(false);
|
||||
}
|
||||
break;
|
||||
@@ -209,30 +207,30 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
base.HandleMouse(mouseEvent);
|
||||
|
||||
if (mouseEvent.LB && IsMouseOver(mouseEvent))
|
||||
if (mouseEvent.LB && _IsMouseOver(mouseEvent))
|
||||
{
|
||||
if (!_ExitPopupVisible)
|
||||
{
|
||||
if (Buttons[_ButtonNextRound].Selected)
|
||||
if (_Buttons[_ButtonNextRound].Selected)
|
||||
_NextRound();
|
||||
if (Buttons[_ButtonBack].Selected && _GameState.CurrentRoundNr == 1)
|
||||
if (_Buttons[_ButtonBack].Selected && _GameState.CurrentRoundNr == 1)
|
||||
_Back();
|
||||
if (Buttons[_ButtonExit].Selected && _GameState.CurrentRoundNr > 1)
|
||||
if (_Buttons[_ButtonExit].Selected && _GameState.CurrentRoundNr > 1)
|
||||
_ShowPopup(true);
|
||||
if (Buttons[_ButtonPlayerScrollUp].Selected)
|
||||
if (_Buttons[_ButtonPlayerScrollUp].Selected)
|
||||
_ScrollPlayerTable(-1);
|
||||
if (Buttons[_ButtonPlayerScrollDown].Selected)
|
||||
if (_Buttons[_ButtonPlayerScrollDown].Selected)
|
||||
_ScrollPlayerTable(1);
|
||||
if (Buttons[_ButtonRoundsScrollUp].Selected)
|
||||
if (_Buttons[_ButtonRoundsScrollUp].Selected)
|
||||
_ScrollRoundsTable(-1);
|
||||
if (Buttons[_ButtonRoundsScrollDown].Selected)
|
||||
if (_Buttons[_ButtonRoundsScrollDown].Selected)
|
||||
_ScrollRoundsTable(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Buttons[_ButtonPopupYes].Selected)
|
||||
if (_Buttons[_ButtonPopupYes].Selected)
|
||||
_EndParty();
|
||||
if (Buttons[_ButtonPopupNo].Selected)
|
||||
if (_Buttons[_ButtonPopupNo].Selected)
|
||||
_ShowPopup(false);
|
||||
}
|
||||
}
|
||||
@@ -279,29 +277,29 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
|
||||
if (_GameState.CurrentRoundNr == 1)
|
||||
{
|
||||
Buttons[_ButtonBack].Visible = true;
|
||||
Buttons[_ButtonExit].Visible = false;
|
||||
_Buttons[_ButtonBack].Visible = true;
|
||||
_Buttons[_ButtonExit].Visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Buttons[_ButtonBack].Visible = false;
|
||||
Buttons[_ButtonExit].Visible = true;
|
||||
_Buttons[_ButtonBack].Visible = false;
|
||||
_Buttons[_ButtonExit].Visible = true;
|
||||
}
|
||||
|
||||
if (_GameState.CurrentRoundNr <= _GameState.Combs.Count)
|
||||
{
|
||||
Buttons[_ButtonNextRound].Visible = true;
|
||||
Texts[_TextFinishMessage].Visible = false;
|
||||
Texts[_TextFinishPlayerWin].Visible = false;
|
||||
SetInteractionToButton(Buttons[_ButtonNextRound]);
|
||||
_Buttons[_ButtonNextRound].Visible = true;
|
||||
_Texts[_TextFinishMessage].Visible = false;
|
||||
_Texts[_TextFinishPlayerWin].Visible = false;
|
||||
_SetInteractionToButton(_Buttons[_ButtonNextRound]);
|
||||
}
|
||||
else
|
||||
{
|
||||
Buttons[_ButtonNextRound].Visible = false;
|
||||
Texts[_TextFinishMessage].Visible = true;
|
||||
Texts[_TextFinishPlayerWin].Visible = true;
|
||||
Texts[_TextFinishPlayerWin].Text = _GetPlayerWinString();
|
||||
SetInteractionToButton(Buttons[_ButtonExit]);
|
||||
_Buttons[_ButtonNextRound].Visible = false;
|
||||
_Texts[_TextFinishMessage].Visible = true;
|
||||
_Texts[_TextFinishPlayerWin].Visible = true;
|
||||
_Texts[_TextFinishPlayerWin].Text = _GetPlayerWinString();
|
||||
_SetInteractionToButton(_Buttons[_ButtonExit]);
|
||||
}
|
||||
|
||||
_ShowPopup(false);
|
||||
@@ -334,13 +332,13 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
_ExitPopupVisible = visible;
|
||||
|
||||
Statics[_StaticPopupBG].Visible = _ExitPopupVisible;
|
||||
Texts[_TextPopupReallyExit].Visible = _ExitPopupVisible;
|
||||
Buttons[_ButtonPopupYes].Visible = _ExitPopupVisible;
|
||||
Buttons[_ButtonPopupNo].Visible = _ExitPopupVisible;
|
||||
_Statics[_StaticPopupBG].Visible = _ExitPopupVisible;
|
||||
_Texts[_TextPopupReallyExit].Visible = _ExitPopupVisible;
|
||||
_Buttons[_ButtonPopupYes].Visible = _ExitPopupVisible;
|
||||
_Buttons[_ButtonPopupNo].Visible = _ExitPopupVisible;
|
||||
|
||||
if (_ExitPopupVisible)
|
||||
SetInteractionToButton(Buttons[_ButtonPopupNo]);
|
||||
_SetInteractionToButton(_Buttons[_ButtonPopupNo]);
|
||||
}
|
||||
|
||||
private void _Back()
|
||||
@@ -352,7 +350,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
|
||||
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 textY = 550;
|
||||
for (int i = 0; i < _GameState.NumPlayerAtOnce; i++)
|
||||
@@ -362,11 +360,11 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
_NextPlayerStatics[i].Rect.Y = staticY;
|
||||
_NextPlayerStatics[i].Visible = true;
|
||||
//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].Visible = true;
|
||||
|
||||
x += Statics[_StaticNextPlayer].Rect.W + 15;
|
||||
x += _Statics[_StaticNextPlayer].Rect.W + 15;
|
||||
}
|
||||
for (int i = _GameState.NumPlayerAtOnce; i < _PartyMode.GetMaxPlayer(); i++)
|
||||
{
|
||||
@@ -379,7 +377,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
if (_GameState.CurrentRoundNr <= _GameState.Combs.Count)
|
||||
{
|
||||
Texts[_TextNextPlayerMessage].Visible = true;
|
||||
_Texts[_TextNextPlayerMessage].Visible = true;
|
||||
SProfile[] profiles = CBase.Profiles.GetProfiles();
|
||||
for (int i = 0; i < _GameState.NumPlayerAtOnce; i++)
|
||||
{
|
||||
@@ -391,7 +389,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
}
|
||||
else
|
||||
{
|
||||
Texts[_TextNextPlayerMessage].Visible = false;
|
||||
_Texts[_TextNextPlayerMessage].Visible = false;
|
||||
for (int i = 0; i < _GameState.NumPlayerAtOnce; i++)
|
||||
{
|
||||
_NextPlayerStatics[i].Visible = false;
|
||||
@@ -415,20 +413,20 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
for (int round = 0; round < _RoundsTable.Count; round++)
|
||||
{
|
||||
//Round-number
|
||||
CText text = GetNewText(Texts[_TextRoundNumber]);
|
||||
AddText(text);
|
||||
CText text = GetNewText(_Texts[_TextRoundNumber]);
|
||||
_AddText(text);
|
||||
_RoundsTable[round].Number = text;
|
||||
for (int row = 0; row < 2; row++)
|
||||
{
|
||||
for (int column = 0; column < 3; column++)
|
||||
{
|
||||
//Player
|
||||
text = GetNewText(Texts[_TextRoundPlayer]);
|
||||
AddText(text);
|
||||
text = GetNewText(_Texts[_TextRoundPlayer]);
|
||||
_AddText(text);
|
||||
_RoundsTable[round].TextPlayer.Add(text);
|
||||
//Score
|
||||
text = GetNewText(Texts[_TextRoundScore]);
|
||||
AddText(text);
|
||||
text = GetNewText(_Texts[_TextRoundScore]);
|
||||
_AddText(text);
|
||||
_RoundsTable[round].TextScores.Add(text);
|
||||
}
|
||||
}
|
||||
@@ -448,14 +446,14 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
if (_NumRoundsVisible > _GameState.Combs.Count)
|
||||
_NumRoundsVisible = _GameState.Combs.Count;
|
||||
|
||||
float numberX = Texts[_TextRoundNumber].X;
|
||||
float numberY = Texts[_TextRoundNumber].Y;
|
||||
float numberX = _Texts[_TextRoundNumber].X;
|
||||
float numberY = _Texts[_TextRoundNumber].Y;
|
||||
|
||||
_RoundsTableScrollArea.X = numberX;
|
||||
_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
|
||||
for (int round = 0; round < _RoundsTable.Count; round++)
|
||||
@@ -476,9 +474,9 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
for (int column = row * numPlayerInOneRow; column < num; column++)
|
||||
{
|
||||
//Player
|
||||
float x = numberX + 15 + (CBase.Settings.GetRenderW() - Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow * (column - row * numPlayerInOneRow) +
|
||||
((CBase.Settings.GetRenderW() - Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow) / 2;
|
||||
float maxw = ((CBase.Settings.GetRenderW() - Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow) / 2 - 5;
|
||||
float x = numberX + 15 + (CBase.Settings.GetRenderW() - _Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow * (column - row * numPlayerInOneRow) +
|
||||
((CBase.Settings.GetRenderW() - _Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow) / 2;
|
||||
float maxw = ((CBase.Settings.GetRenderW() - _Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow) / 2 - 5;
|
||||
_RoundsTable[round].TextPlayer[column].X = x;
|
||||
_RoundsTable[round].TextPlayer[column].Y = numberY;
|
||||
_RoundsTable[round].TextPlayer[column].MaxWidth = maxw;
|
||||
@@ -507,7 +505,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
_RoundsTable[i].Number.Visible = true;
|
||||
_RoundsTable[i].TextPlayer[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]];
|
||||
_RoundsTable[i].TextPlayer[p].Text = profile[pID].PlayerName;
|
||||
if ((_GameState.CurrentRoundNr - 1) > i + _RoundsTableOffset)
|
||||
@@ -532,19 +530,19 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
}
|
||||
}
|
||||
|
||||
Buttons[_ButtonRoundsScrollUp].Visible = _RoundsTableOffset > 0;
|
||||
Buttons[_ButtonRoundsScrollDown].Visible = _GameState.Combs.Count - _NumRoundsVisible - _RoundsTableOffset > 0;
|
||||
_Buttons[_ButtonRoundsScrollUp].Visible = _RoundsTableOffset > 0;
|
||||
_Buttons[_ButtonRoundsScrollDown].Visible = _GameState.Combs.Count - _NumRoundsVisible - _RoundsTableOffset > 0;
|
||||
}
|
||||
|
||||
private void _BuildPlayerTable()
|
||||
{
|
||||
_PlayerTableScrollArea = new SRectF();
|
||||
_PlayerTableScrollArea.X = Texts[_TextPosition].X;
|
||||
_PlayerTableScrollArea.Y = Texts[_TextPosition].Y;
|
||||
_PlayerTableScrollArea.W = Texts[_TextGamePoints].X - Texts[_TextPosition].X;
|
||||
_PlayerTableScrollArea.X = _Texts[_TextPosition].X;
|
||||
_PlayerTableScrollArea.Y = _Texts[_TextPosition].Y;
|
||||
_PlayerTableScrollArea.W = _Texts[_TextGamePoints].X - _Texts[_TextPosition].X;
|
||||
|
||||
_PlayerTable = new List<STableRow>();
|
||||
float delta = Texts[_TextPosition].Height * 1.2f;
|
||||
float delta = _Texts[_TextPosition].Height * 1.2f;
|
||||
|
||||
float h = 0;
|
||||
|
||||
@@ -552,12 +550,12 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
STableRow row = new STableRow();
|
||||
|
||||
row.Pos = GetNewText(Texts[_TextPosition]);
|
||||
row.Name = GetNewText(Texts[_TextPlayerName]);
|
||||
row.Rounds = GetNewText(Texts[_TextNumPlayed]);
|
||||
row.Won = GetNewText(Texts[_TextWon]);
|
||||
row.SingPoints = GetNewText(Texts[_TextSingPoints]);
|
||||
row.GamePoints = GetNewText(Texts[_TextGamePoints]);
|
||||
row.Pos = GetNewText(_Texts[_TextPosition]);
|
||||
row.Name = GetNewText(_Texts[_TextPlayerName]);
|
||||
row.Rounds = GetNewText(_Texts[_TextNumPlayed]);
|
||||
row.Won = GetNewText(_Texts[_TextWon]);
|
||||
row.SingPoints = GetNewText(_Texts[_TextSingPoints]);
|
||||
row.GamePoints = GetNewText(_Texts[_TextGamePoints]);
|
||||
|
||||
row.Pos.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.GamePoints.Y += delta * (i + 1);
|
||||
|
||||
row.Pos.Text = (i + 1).ToString() + ".";
|
||||
row.Pos.Text = (i + 1) + ".";
|
||||
|
||||
row.Pos.Visible = false;
|
||||
row.Name.Visible = false;
|
||||
@@ -575,12 +573,12 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
row.SingPoints.Visible = false;
|
||||
row.GamePoints.Visible = false;
|
||||
|
||||
AddText(row.Pos);
|
||||
AddText(row.Name);
|
||||
AddText(row.Rounds);
|
||||
AddText(row.Won);
|
||||
AddText(row.SingPoints);
|
||||
AddText(row.GamePoints);
|
||||
_AddText(row.Pos);
|
||||
_AddText(row.Name);
|
||||
_AddText(row.Rounds);
|
||||
_AddText(row.Won);
|
||||
_AddText(row.SingPoints);
|
||||
_AddText(row.GamePoints);
|
||||
|
||||
_PlayerTable.Add(row);
|
||||
|
||||
@@ -606,7 +604,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
row.SingPoints.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.Rounds.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumRounds.ToString();
|
||||
row.Won.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumWon.ToString();
|
||||
@@ -624,8 +622,8 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
}
|
||||
}
|
||||
|
||||
Buttons[_ButtonPlayerScrollUp].Visible = _PlayerTableOffset > 0;
|
||||
Buttons[_ButtonPlayerScrollDown].Visible = _GameState.ProfileIDs.Count - _NumPlayerVisible - _PlayerTableOffset > 0;
|
||||
_Buttons[_ButtonPlayerScrollUp].Visible = _PlayerTableOffset > 0;
|
||||
_Buttons[_ButtonPlayerScrollDown].Visible = _GameState.ProfileIDs.Count - _NumPlayerVisible - _PlayerTableOffset > 0;
|
||||
}
|
||||
|
||||
private void _ScrollPlayerTable(int offset)
|
||||
|
||||
@@ -19,12 +19,15 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using VocaluxeLib.Menu;
|
||||
|
||||
namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
// ReSharper disable UnusedMember.Global
|
||||
public class CPartyScreenChallengeNames : CMenuParty
|
||||
// ReSharper restore UnusedMember.Global
|
||||
{
|
||||
// Version number for theme files. Increment it, if you've changed something on the theme files!
|
||||
protected override int _ScreenVersion
|
||||
@@ -41,7 +44,6 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
private List<CButton> _PlayerDestinationButtons;
|
||||
//PlayerDestinationButtons-Option
|
||||
private const int _PlayerDestinationButtonsNumH = 3;
|
||||
private const int _PlayerDestinationButtonsNumW = 4;
|
||||
private const int _PlayerDestinationButtonsFirstX = 900;
|
||||
private const int _PlayerDestinationButtonsFirstY = 105;
|
||||
private const int _PlayerDestinationButtonsSpaceH = 15;
|
||||
@@ -54,7 +56,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
private const int _PlayerChooseButtonsFirstY = 105;
|
||||
private const int _PlayerChooseButtonsSpaceH = 15;
|
||||
private const int _PlayerChooseButtonsSpaceW = 25;
|
||||
private int _PlayerChooseButtonsOffset = 0;
|
||||
private const int _PlayerChooseButtonsOffset = 0;
|
||||
|
||||
private CStatic _ChooseAvatarStatic;
|
||||
private bool _SelectingMouseActive;
|
||||
@@ -84,27 +86,19 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
|
||||
_Data.ScreenNames.ProfileIDs = new List<int>();
|
||||
|
||||
List<string> buttons = new List<string>();
|
||||
_ThemeButtons = new string[] {_ButtonBack, _ButtonNext, _ButtonPlayerDestination, _ButtonPlayerChoose};
|
||||
|
||||
_Data = new SDataFromScreen();
|
||||
SFromScreenNames names = new SFromScreenNames();
|
||||
names.FadeToConfig = false;
|
||||
names.FadeToMain = false;
|
||||
names.ProfileIDs = new List<int>();
|
||||
SFromScreenNames names = new SFromScreenNames {FadeToConfig = false, FadeToMain = false, ProfileIDs = new List<int>()};
|
||||
_Data.ScreenNames = names;
|
||||
}
|
||||
|
||||
public override void DataToScreen(object receivedData)
|
||||
{
|
||||
SDataToScreenNames config = new SDataToScreenNames();
|
||||
|
||||
try
|
||||
{
|
||||
config = (SDataToScreenNames)receivedData;
|
||||
_Data.ScreenNames.ProfileIDs = config.ProfileIDs;
|
||||
if (_Data.ScreenNames.ProfileIDs == null)
|
||||
_Data.ScreenNames.ProfileIDs = new List<int>();
|
||||
SDataToScreenNames config = (SDataToScreenNames)receivedData;
|
||||
_Data.ScreenNames.ProfileIDs = config.ProfileIDs ?? new List<int>();
|
||||
|
||||
_NumPlayer = config.NumPlayer;
|
||||
|
||||
@@ -132,10 +126,10 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
break;
|
||||
|
||||
case Keys.Enter:
|
||||
if (Buttons[_ButtonBack].Selected)
|
||||
if (_Buttons[_ButtonBack].Selected)
|
||||
_Back();
|
||||
|
||||
if (Buttons[_ButtonNext].Selected)
|
||||
if (_Buttons[_ButtonNext].Selected)
|
||||
_Next();
|
||||
|
||||
if (!_OnAdd())
|
||||
@@ -237,12 +231,12 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
_ChooseAvatarStatic.Visible = false;
|
||||
}
|
||||
|
||||
if (mouseEvent.LB && IsMouseOver(mouseEvent))
|
||||
if (mouseEvent.LB && _IsMouseOver(mouseEvent))
|
||||
{
|
||||
if (Buttons[_ButtonBack].Selected)
|
||||
if (_Buttons[_ButtonBack].Selected)
|
||||
_Back();
|
||||
|
||||
if (Buttons[_ButtonNext].Selected)
|
||||
if (_Buttons[_ButtonNext].Selected)
|
||||
_Next();
|
||||
|
||||
if (!_OnAdd())
|
||||
@@ -287,13 +281,13 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
|
||||
private void _AddButtonPlayerDestination()
|
||||
{
|
||||
Buttons[_ButtonPlayerDestination].Visible = false;
|
||||
_Buttons[_ButtonPlayerDestination].Visible = false;
|
||||
_PlayerDestinationButtons = new List<CButton>();
|
||||
int row = 0;
|
||||
int column = 0;
|
||||
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.Y = _PlayerDestinationButtonsFirstY + row * (b.Rect.H + _PlayerDestinationButtonsSpaceW);
|
||||
_PlayerDestinationButtons.Add(b);
|
||||
@@ -305,24 +299,22 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
}
|
||||
b.Visible = true;
|
||||
b.Enabled = false;
|
||||
AddButton(b);
|
||||
_AddButton(b);
|
||||
}
|
||||
}
|
||||
|
||||
private void _AddButtonPlayerChoose()
|
||||
{
|
||||
Buttons[_ButtonPlayerChoose].Visible = false;
|
||||
_Buttons[_ButtonPlayerChoose].Visible = false;
|
||||
_PlayerChooseButtons = new List<CPlayerChooseButton>();
|
||||
int row = 0;
|
||||
int column = 0;
|
||||
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.Y = _PlayerChooseButtonsFirstY + row * (b.Rect.H + _PlayerChooseButtonsSpaceW);
|
||||
CPlayerChooseButton pcb = new CPlayerChooseButton();
|
||||
pcb.Button = b;
|
||||
pcb.ProfileID = -1;
|
||||
CPlayerChooseButton pcb = new CPlayerChooseButton {Button = b, ProfileID = -1};
|
||||
_PlayerChooseButtons.Add(pcb);
|
||||
column++;
|
||||
if (column >= _PlayerChooseButtonsNumH)
|
||||
@@ -332,7 +324,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
}
|
||||
b.Visible = true;
|
||||
b.Enabled = false;
|
||||
AddButton(b);
|
||||
_AddButton(b);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -348,7 +340,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
|
||||
private void _UpdateButtonPlayerChoose(int offset)
|
||||
{
|
||||
int numButtonPlayerChoose = _PlayerChooseButtonsNumW * _PlayerChooseButtonsNumH;
|
||||
const int numButtonPlayerChoose = _PlayerChooseButtonsNumW * _PlayerChooseButtonsNumH;
|
||||
if (offset < 0)
|
||||
offset = 0;
|
||||
|
||||
@@ -372,10 +364,10 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
_PlayerChooseButtons[i].ProfileID = -1;
|
||||
_PlayerChooseButtons[i].Button.Text.Text = String.Empty;
|
||||
_PlayerChooseButtons[i].Button.Texture = Buttons[_ButtonPlayerChoose].Texture;
|
||||
_PlayerChooseButtons[i].Button.SelTexture = Buttons[_ButtonPlayerChoose].SelTexture;
|
||||
_PlayerChooseButtons[i].Button.Color = Buttons[_ButtonPlayerChoose].Color;
|
||||
_PlayerChooseButtons[i].Button.SelColor = Buttons[_ButtonPlayerChoose].SelColor;
|
||||
_PlayerChooseButtons[i].Button.Texture = _Buttons[_ButtonPlayerChoose].Texture;
|
||||
_PlayerChooseButtons[i].Button.SelTexture = _Buttons[_ButtonPlayerChoose].SelTexture;
|
||||
_PlayerChooseButtons[i].Button.Color = _Buttons[_ButtonPlayerChoose].Color;
|
||||
_PlayerChooseButtons[i].Button.SelColor = _Buttons[_ButtonPlayerChoose].SelColor;
|
||||
_PlayerChooseButtons[i].Button.Enabled = false;
|
||||
}
|
||||
}
|
||||
@@ -391,17 +383,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
//Show profile only if active
|
||||
if (CBase.Profiles.GetProfiles()[i].Active == EOffOn.TR_CONFIG_ON)
|
||||
{
|
||||
visible = true;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
visible = _Data.ScreenNames.ProfileIDs.All(profileID => profileID != i);
|
||||
}
|
||||
if (visible)
|
||||
_PlayerChooseButtonsVisibleProfiles.Add(i);
|
||||
@@ -439,10 +421,10 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
}
|
||||
else
|
||||
{
|
||||
_PlayerDestinationButtons[i].Color = Buttons[_ButtonPlayerDestination].Color;
|
||||
_PlayerDestinationButtons[i].SelColor = Buttons[_ButtonPlayerDestination].SelColor;
|
||||
_PlayerDestinationButtons[i].Texture = Buttons[_ButtonPlayerDestination].Texture;
|
||||
_PlayerDestinationButtons[i].SelTexture = Buttons[_ButtonPlayerDestination].SelTexture;
|
||||
_PlayerDestinationButtons[i].Color = _Buttons[_ButtonPlayerDestination].Color;
|
||||
_PlayerDestinationButtons[i].SelColor = _Buttons[_ButtonPlayerDestination].SelColor;
|
||||
_PlayerDestinationButtons[i].Texture = _Buttons[_ButtonPlayerDestination].Texture;
|
||||
_PlayerDestinationButtons[i].SelTexture = _Buttons[_ButtonPlayerDestination].SelTexture;
|
||||
_PlayerDestinationButtons[i].Text.Text = String.Empty;
|
||||
_PlayerDestinationButtons[i].Enabled = false;
|
||||
}
|
||||
@@ -453,59 +435,52 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
if (_Data.ScreenNames.ProfileIDs.Count == _NumPlayer)
|
||||
{
|
||||
Buttons[_ButtonNext].Visible = true;
|
||||
SetInteractionToButton(Buttons[_ButtonNext]);
|
||||
_Buttons[_ButtonNext].Visible = true;
|
||||
_SetInteractionToButton(_Buttons[_ButtonNext]);
|
||||
}
|
||||
else
|
||||
Buttons[_ButtonNext].Visible = false;
|
||||
_Buttons[_ButtonNext].Visible = false;
|
||||
}
|
||||
|
||||
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 (_Data.ScreenNames.ProfileIDs.Count < _NumPlayer)
|
||||
{
|
||||
_Data.ScreenNames.ProfileIDs.Add(_PlayerChooseButtons[i].ProfileID);
|
||||
int added = _Data.ScreenNames.ProfileIDs.Count - 1;
|
||||
_UpdateButtonNext();
|
||||
//Update texture and name
|
||||
_PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f);
|
||||
_PlayerDestinationButtons[added].SelColor = new SColorF(1, 1, 1, 1);
|
||||
_PlayerDestinationButtons[added].Texture = CBase.Profiles.GetProfiles()[_PlayerChooseButtons[i].ProfileID].Avatar.Texture;
|
||||
_PlayerDestinationButtons[added].SelTexture = CBase.Profiles.GetProfiles()[_PlayerChooseButtons[i].ProfileID].Avatar.Texture;
|
||||
_PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[_PlayerChooseButtons[i].ProfileID].PlayerName;
|
||||
_PlayerDestinationButtons[added].Enabled = true;
|
||||
//Update Tiles-List
|
||||
_UpdateButtonPlayerChoose();
|
||||
CheckInteraction();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (!button.Button.Selected || button.ProfileID == -1 || _Data.ScreenNames.ProfileIDs.Count >= _NumPlayer)
|
||||
continue;
|
||||
_Data.ScreenNames.ProfileIDs.Add(button.ProfileID);
|
||||
int added = _Data.ScreenNames.ProfileIDs.Count - 1;
|
||||
_UpdateButtonNext();
|
||||
//Update texture and name
|
||||
_PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f);
|
||||
_PlayerDestinationButtons[added].SelColor = new SColorF(1, 1, 1, 1);
|
||||
_PlayerDestinationButtons[added].Texture = CBase.Profiles.GetProfiles()[button.ProfileID].Avatar.Texture;
|
||||
_PlayerDestinationButtons[added].SelTexture = CBase.Profiles.GetProfiles()[button.ProfileID].Avatar.Texture;
|
||||
_PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[button.ProfileID].PlayerName;
|
||||
_PlayerDestinationButtons[added].Enabled = true;
|
||||
//Update Tiles-List
|
||||
_UpdateButtonPlayerChoose();
|
||||
_CheckInteraction();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool _OnRemove()
|
||||
private void _OnRemove()
|
||||
{
|
||||
for (int i = 0; i < _PlayerDestinationButtons.Count; i++)
|
||||
{
|
||||
if (_PlayerDestinationButtons[i].Selected)
|
||||
{
|
||||
if ((i + 1) <= _Data.ScreenNames.ProfileIDs.Count)
|
||||
{
|
||||
_Data.ScreenNames.ProfileIDs.RemoveAt(i);
|
||||
_UpdateButtonNext();
|
||||
_UpdateButtonPlayerDestination();
|
||||
_UpdateButtonPlayerChoose();
|
||||
CheckInteraction();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (!_PlayerDestinationButtons[i].Selected)
|
||||
continue;
|
||||
if ((i + 1) > _Data.ScreenNames.ProfileIDs.Count)
|
||||
continue;
|
||||
_Data.ScreenNames.ProfileIDs.RemoveAt(i);
|
||||
_UpdateButtonNext();
|
||||
_UpdateButtonPlayerDestination();
|
||||
_UpdateButtonPlayerChoose();
|
||||
_CheckInteraction();
|
||||
return;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void _Back()
|
||||
|
||||
Reference in new issue
Block a user