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;
|
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())
|
using (var connection = new SQLiteConnection())
|
||||||
{
|
{
|
||||||
connection.ConnectionString = "Data Source=" + _HighscoreFilePath;
|
connection.ConnectionString = "Data Source=" + _HighscoreFilePath;
|
||||||
|
|
||||||
scores = new List<SDBScoreEntry>();
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
connection.Open();
|
connection.Open();
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
return;
|
return scores;
|
||||||
}
|
}
|
||||||
|
|
||||||
using (var command = new SQLiteCommand(connection))
|
using (var command = new SQLiteCommand(connection))
|
||||||
@@ -284,7 +283,7 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
int dataBaseSongID = _GetDataBaseSongID(songID, command);
|
int dataBaseSongID = _GetDataBaseSongID(songID, command);
|
||||||
if (dataBaseSongID < 0)
|
if (dataBaseSongID < 0)
|
||||||
return;
|
return scores;
|
||||||
|
|
||||||
command.CommandText = "SELECT PlayerName, Score, Date, Difficulty, LineNr, id FROM Scores " +
|
command.CommandText = "SELECT PlayerName, Score, Date, Difficulty, LineNr, id FROM Scores " +
|
||||||
"WHERE [SongID] = @SongID AND [Medley] = @Medley AND [Duet] = @Duet AND [ShortSong] = @ShortSong " +
|
"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)
|
private static void _IncreaseSongCounter(int dataBaseSongID, SQLiteCommand command)
|
||||||
|
|||||||
@@ -149,14 +149,14 @@ namespace Vocaluxe.Base
|
|||||||
return _SongQueue.GetSong();
|
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()
|
public static int GetNumSongs()
|
||||||
|
|||||||
@@ -194,10 +194,6 @@ namespace Vocaluxe.Screens
|
|||||||
base.OnShow();
|
base.OnShow();
|
||||||
_Round = 0;
|
_Round = 0;
|
||||||
_Pos = 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();
|
_NewEntryIDs.Clear();
|
||||||
_AddScoresToDB();
|
_AddScoresToDB();
|
||||||
_LoadScores();
|
_LoadScores();
|
||||||
@@ -231,15 +227,14 @@ namespace Vocaluxe.Screens
|
|||||||
|
|
||||||
private void _LoadScores()
|
private void _LoadScores()
|
||||||
{
|
{
|
||||||
CPoints points = CGame.GetPoints();
|
|
||||||
if (points == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
_Pos = 0;
|
_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];
|
int songID = CGame.GetSong(round).ID;
|
||||||
CDataBase.LoadScore(out _Scores[round], player.SongID, player.GameMode);
|
EGameMode gameMode = CGame.GetGameMode(round);
|
||||||
|
_Scores[round] = CDataBase.LoadScore(songID, gameMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user