Change signature of getDBScores
This commit is contained in:
1 parent
c27ae20b77
commit
074a1ba82d
3 files changed
+15
-20
No files matched your search
@@ -247,21 +247,20 @@ namespace Vocaluxe.Base
|
||||
return lastInsertID;
|
||||
}
|
||||
|
||||
public static void LoadScore(out List<SDBScoreEntry> scores, int songID, EGameMode gameMode)
|
||||
public static List<SDBScoreEntry> LoadScore(int songID, EGameMode gameMode)
|
||||
{
|
||||
var scores = new List<SDBScoreEntry>();
|
||||
using (var connection = new SQLiteConnection())
|
||||
{
|
||||
connection.ConnectionString = "Data Source=" + _HighscoreFilePath;
|
||||
|
||||
scores = new List<SDBScoreEntry>();
|
||||
|
||||
try
|
||||
{
|
||||
connection.Open();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return;
|
||||
return scores;
|
||||
}
|
||||
|
||||
using (var command = new SQLiteCommand(connection))
|
||||
@@ -284,7 +283,7 @@ namespace Vocaluxe.Base
|
||||
|
||||
int dataBaseSongID = _GetDataBaseSongID(songID, command);
|
||||
if (dataBaseSongID < 0)
|
||||
return;
|
||||
return scores;
|
||||
|
||||
command.CommandText = "SELECT PlayerName, Score, Date, Difficulty, LineNr, id FROM Scores " +
|
||||
"WHERE [SongID] = @SongID AND [Medley] = @Medley AND [Duet] = @Duet AND [ShortSong] = @ShortSong " +
|
||||
@@ -315,6 +314,7 @@ namespace Vocaluxe.Base
|
||||
}
|
||||
}
|
||||
}
|
||||
return scores;
|
||||
}
|
||||
|
||||
private static void _IncreaseSongCounter(int dataBaseSongID, SQLiteCommand command)
|
||||
|
||||
@@ -149,14 +149,14 @@ namespace Vocaluxe.Base
|
||||
return _SongQueue.GetSong();
|
||||
}
|
||||
|
||||
public static CSong GetSong(int num)
|
||||
public static CSong GetSong(int round)
|
||||
{
|
||||
return _SongQueue.GetSong(num);
|
||||
return _SongQueue.GetSong(round);
|
||||
}
|
||||
|
||||
public static EGameMode GetGameMode(int num)
|
||||
public static EGameMode GetGameMode(int round)
|
||||
{
|
||||
return _SongQueue.GetGameMode(num);
|
||||
return _SongQueue.GetGameMode(round);
|
||||
}
|
||||
|
||||
public static int GetNumSongs()
|
||||
|
||||
@@ -194,10 +194,6 @@ namespace Vocaluxe.Screens
|
||||
base.OnShow();
|
||||
_Round = 0;
|
||||
_Pos = 0;
|
||||
CPoints points = CGame.GetPoints();
|
||||
_Scores = new List<SDBScoreEntry>[points.NumRounds];
|
||||
for (int i = 0; i < _Scores.Length; i++)
|
||||
_Scores[i] = new List<SDBScoreEntry>();
|
||||
_NewEntryIDs.Clear();
|
||||
_AddScoresToDB();
|
||||
_LoadScores();
|
||||
@@ -231,15 +227,14 @@ namespace Vocaluxe.Screens
|
||||
|
||||
private void _LoadScores()
|
||||
{
|
||||
CPoints points = CGame.GetPoints();
|
||||
if (points == null)
|
||||
return;
|
||||
|
||||
_Pos = 0;
|
||||
for (int round = 0; round < points.NumRounds; round++)
|
||||
int rounds = CGame.NumRounds;
|
||||
_Scores = new List<SDBScoreEntry>[rounds];
|
||||
for (int round = 0; round < rounds; round++)
|
||||
{
|
||||
SPlayer player = points.GetPlayer(round, CGame.NumPlayer)[0];
|
||||
CDataBase.LoadScore(out _Scores[round], player.SongID, player.GameMode);
|
||||
int songID = CGame.GetSong(round).ID;
|
||||
EGameMode gameMode = CGame.GetGameMode(round);
|
||||
_Scores[round] = CDataBase.LoadScore(songID, gameMode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user