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
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user