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