Fixed scoring in challenge-modes.

This commit is contained in:
Florian Küpper committed 2014-12-19 09:45:19 +01:00
1 parent 3d088fa407
commit deb885ced5
3 files changed
+76 -79

No files matched your search

@@ -436,44 +436,42 @@ namespace VocaluxeLib.PartyModes.Challenge
GameData.Results[i, j] = 0; GameData.Results[i, j] = 0;
} }
} }
else SPlayer[] results = CBase.Game.GetPlayers();
if (results == null)
return;
if (results.Length < GameData.NumPlayerAtOnce)
return;
for (int j = 0; j < GameData.NumPlayerAtOnce; j++)
GameData.Results[GameData.CurrentRoundNr - 2, j] = (int)Math.Round(results[j].Points);
List<SStats> points = _GetPointsForPlayer(results);
for (int i = 0; i < GameData.NumPlayerAtOnce; i++)
{ {
SPlayer[] results = CBase.Game.GetPlayers(); int index = -1;
if (results == null) for (int j = 0; j < GameData.ResultTable.Count; j++)
return;
if (results.Length < GameData.NumPlayerAtOnce)
return;
for (int j = 0; j < GameData.NumPlayerAtOnce; j++)
GameData.Results[GameData.CurrentRoundNr - 2, j] = (int)Math.Round(results[j].Points);
List<SStats> points = _GetPointsForPlayer(results);
for (int i = 0; i < GameData.NumPlayerAtOnce; i++)
{ {
int index = -1; if (points[i].ProfileID == GameData.ResultTable[j].PlayerID)
for (int j = 0; j < GameData.ResultTable.Count; j++)
{ {
if (points[i].ProfileID == GameData.ResultTable[j].PlayerID) index = j;
{ break;
index = j;
break;
}
} }
if (index == -1)
continue;
CResultTableRow row = GameData.ResultTable[index];
row.NumPlayed++;
row.NumWon += points[i].Won;
row.NumSingPoints += points[i].SingPoints;
row.NumGamePoints += points[i].GamePoints;
GameData.ResultTable[index] = row;
} }
if (index == -1)
continue;
CResultTableRow row = GameData.ResultTable[index];
row.NumPlayed++;
row.NumWon += points[i].Won;
row.NumSingPoints += points[i].SingPoints;
row.NumGamePoints += points[i].GamePoints;
GameData.ResultTable[index] = row;
} }
GameData.ResultTable.Sort(); GameData.ResultTable.Sort();
@@ -196,7 +196,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
case EStage.Main: case EStage.Main:
return _Screens["CPartyScreenChallengeMedleyMain"]; return _Screens["CPartyScreenChallengeMedleyMain"];
case EStage.Singing: case EStage.Singing:
return CBase.Graphics.GetScreen(EScreen.Song); return CBase.Graphics.GetScreen(EScreen.Sing);
default: default:
throw new ArgumentException("Invalid stage: " + _Stage); throw new ArgumentException("Invalid stage: " + _Stage);
} }
@@ -508,60 +508,58 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
GameData.Results[i, j] = 0; GameData.Results[i, j] = 0;
} }
} }
else
CPoints gamePoints = CBase.Game.GetPoints();
if (gamePoints == null || gamePoints.NumPlayer < GameData.NumPlayerAtOnce)
return;
SPlayer[] results = gamePoints.GetPlayer(0, GameData.NumPlayerAtOnce);
if (results == null)
return;
if (results.Length < GameData.NumPlayerAtOnce)
return;
if (gamePoints.NumRounds == 0)
return;
for (int i = 1; i < gamePoints.NumRounds; i++)
{ {
CPoints gamePoints = CBase.Game.GetPoints(); SPlayer[] temp = gamePoints.GetPlayer(i, GameData.NumPlayerAtOnce);
if (gamePoints == null || gamePoints.NumPlayer < GameData.NumPlayerAtOnce) for (int p = 0; p < GameData.NumPlayerAtOnce; p++)
return; results[p].Points += temp[p].Points;
}
SPlayer[] results = gamePoints.GetPlayer(0, GameData.NumPlayerAtOnce); for (int j = 0; j < GameData.NumPlayerAtOnce; j++)
if (results == null) {
return; results[j].Points = results[j].Points / gamePoints.NumRounds;
GameData.Results[GameData.CurrentRoundNr - 2, j] = (int)Math.Round(results[j].Points);
}
if (results.Length < GameData.NumPlayerAtOnce) List<SStats> points = _GetPointsForPlayer(results);
return;
if (gamePoints.NumRounds == 0) for (int i = 0; i < GameData.NumPlayerAtOnce; i++)
return; {
int index = -1;
for (int i = 1; i < gamePoints.NumRounds; i++) for (int j = 0; j < GameData.ResultTable.Count; j++)
{ {
SPlayer[] temp = gamePoints.GetPlayer(i, GameData.NumPlayerAtOnce); if (points[i].ProfileID == GameData.ResultTable[j].PlayerID)
for (int p = 0; p < GameData.NumPlayerAtOnce; p++) {
results[p].Points += temp[p].Points; index = j;
break;
}
} }
for (int j = 0; j < GameData.NumPlayerAtOnce; j++) if (index != -1)
{ {
results[j].Points = results[j].Points / gamePoints.NumRounds; CResultTableRow row = GameData.ResultTable[index];
GameData.Results[GameData.CurrentRoundNr - 2, j] = (int)Math.Round(results[j].Points);
}
List<SStats> points = _GetPointsForPlayer(results); row.NumPlayed++;
row.NumWon += points[i].Won;
row.NumSingPoints += points[i].SingPoints;
row.NumGamePoints += points[i].GamePoints;
for (int i = 0; i < GameData.NumPlayerAtOnce; i++) GameData.ResultTable[index] = row;
{
int index = -1;
for (int j = 0; j < GameData.ResultTable.Count; j++)
{
if (points[i].ProfileID == GameData.ResultTable[j].PlayerID)
{
index = j;
break;
}
}
if (index != -1)
{
CResultTableRow row = GameData.ResultTable[index];
row.NumPlayed++;
row.NumWon += points[i].Won;
row.NumSingPoints += points[i].SingPoints;
row.NumGamePoints += points[i].GamePoints;
GameData.ResultTable[index] = row;
}
} }
} }
+3 -2
View File
@@ -629,10 +629,11 @@ namespace Vocaluxe.Screens
_SongMenu.OnShow(); _SongMenu.OnShow();
if (_Sso.Selection.PartyMode) if (_Sso.Selection.PartyMode)
{
_PlaylistActive = false; _PlaylistActive = false;
if (_Sso.Selection.PartyMode)
_ToggleSongOptions(ESongOptionsView.None); _ToggleSongOptions(ESongOptionsView.None);
_SelectElement(_Buttons[_ButtonStart]);
}
_SongMenu.Selected = !_PlaylistActive; _SongMenu.Selected = !_PlaylistActive;
_SongMenu.SmallView = _Playlist.Visible; _SongMenu.SmallView = _Playlist.Visible;