push changes i have

This commit is contained in:
SilicaAndPina 2021-03-16 23:42:47 +13:00
parent 6256c38414
commit 7686680c09
7 changed files with 244 additions and 5 deletions

View file

@ -846,6 +846,8 @@ namespace HISP.Game
public static string GameBestTimeHeaderFormat;
public static string GameHighScoreHeaderFormat;
public static string GameHighScoreFormat;
public static string GameWinLooseHeaderFormat;
public static string GameWinLooseFormat;
// Awards
@ -2170,6 +2172,14 @@ namespace HISP.Game
{
return GameBestTimeFormat.Replace("%RANKING%", ranking.ToString("N0", CultureInfo.InvariantCulture)).Replace("%SCORE%", score.ToString().Insert(score.ToString().Length - 2, ".")).Replace("%USERNAME%", username).Replace("%TOTALPLAYS%", totalplays.ToString("N0", CultureInfo.InvariantCulture));
}
public static string FormatWinlooseHeader(string gameName)
{
return GameWinLooseHeaderFormat.Replace("%GAMETITLE%", gameName);
}
public static string FormatWinlooseListEntry(int ranking, int wins, int loose, string username, int totalplays)
{
return GameWinLooseHeaderFormat.Replace("%RANKING%", ranking.ToString("N0", CultureInfo.InvariantCulture)).Replace("%WINS%", wins.ToString("N0", CultureInfo.InvariantCulture)).Replace("%LOSES%", loose.ToString("N0", CultureInfo.InvariantCulture)).Replace("%USERNAME%", username).Replace("%TOTALPLAYS%", totalplays.ToString("N0", CultureInfo.InvariantCulture));
}
public static string FormatHighscoreHeader(string gameName)
{
return GameHighScoreHeaderFormat.Replace("%GAMETITLE%", gameName);

View file

@ -870,6 +870,23 @@ namespace HISP.Game
message += Messages.MetaTerminator;
return message;
}
public static string BuildTopWinners(string gameName)
{
Highscore.HighscoreTableEntry[] scores = Database.GetTopWinners(gameName, 20);
if (scores.Length <= 0)
return "No wins recorded.";
string message = "";
message += Messages.FormatWinlooseHeader(gameName);
for (int i = 0; i < scores.Length; i++)
{
message += Messages.FormatWinlooseListEntry(i + 1, scores[i].Wins, scores[i].Looses, Database.GetUsername(scores[i].UserId), scores[i].TimesPlayed);
}
message += Messages.BackToMap;
message += Messages.MetaTerminator;
return message;
}
public static string BuildTopTimes(string gameName)
{
Highscore.HighscoreTableEntry[] scores = Database.GetTopScores(gameName, 20);