Skip to content

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
qubqub committed Nov 10, 2023
1 parent ac3ba0d commit 5d73c02
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 7 deletions.
8 changes: 7 additions & 1 deletion Entities/Multilingual.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ public static class Multilingual {
{"level_no_statistical_data", " No statistical data"},

{"leaderboard_menu_title", "Leaderboard"},
{"leaderboard_choose_a_round", "Choose a round"},
{"leaderboard_total_players_prefix", ""},
{"leaderboard_total_players_suffix", " total players"},
{"leaderboard_see_full_rankings_in_fallalytics", "See full rankings in FALLALYTICS"},
Expand Down Expand Up @@ -666,6 +667,7 @@ public static class Multilingual {
{"level_no_statistical_data", " Aucune donnée statistique"},

{"leaderboard_menu_title", "Classement"},
{"leaderboard_choose_a_round", "Choisissez un manche"},
{"leaderboard_total_players_prefix", ""},
{"leaderboard_total_players_suffix", " joueurs au total"},
{"leaderboard_see_full_rankings_in_fallalytics", "Voir le classement complet dans FALLALYTICS"},
Expand Down Expand Up @@ -774,7 +776,7 @@ public static class Multilingual {
{"message_check_internet_connection", "S'il vous plait, vérifiez votre connexion internet."},
{"message_changelog_caption", "journal des modifications"},
{"message_changelog_bugfix_and_program_optimization", "Correction de bugs et optimisation du programme"},
{"message_changelog_updated_new_show_and_round_names", "Nouveaux noms de spectacles et de rondes mis à jour"},
{"message_changelog_updated_new_show_and_round_names", "Nouveaux noms de spectacles et de manche mis à jour"},
{"message_changelog_overlay_display_improvements", "Améliorations de l'affichage en l'overlay"},
{"message_changelog_added_and_improved_win_per_day_graph_feature", "Fonctionnalité graphique des victoire par jour ajoutée et améliorée"},
{"message_changelog_released_the_fallalytics_speedrun_leaderboard", "Publication du classement du speedrun FALLALYTICS"},
Expand Down Expand Up @@ -1155,6 +1157,7 @@ public static class Multilingual {
{"level_no_statistical_data", " 통계 데이터 없음"},

{"leaderboard_menu_title", "리더보드"},
{"leaderboard_choose_a_round", "라운드를 선택하세요"},
{"leaderboard_total_players_prefix", "총 "},
{"leaderboard_total_players_suffix", " 명의 플레이어"},
{"leaderboard_see_full_rankings_in_fallalytics", "폴라리틱스에서 전체 순위 보기"},
Expand Down Expand Up @@ -1644,6 +1647,7 @@ public static class Multilingual {
{"level_no_statistical_data", " 統計データなし"},

{"leaderboard_menu_title", "リーダーボード"},
{"leaderboard_choose_a_round", "ラウンドを選択してください。"},
{"leaderboard_total_players_prefix", "合計"},
{"leaderboard_total_players_suffix", "人のプレイヤー"},
{"leaderboard_see_full_rankings_in_fallalytics", "FALLALYTICS で完全なランキングを見る"},
Expand Down Expand Up @@ -2133,6 +2137,7 @@ public static class Multilingual {
{"level_no_statistical_data", " 无统计数据"},

{"leaderboard_menu_title", "排行榜"},
{"leaderboard_choose_a_round", "选择一轮。"},
{"leaderboard_total_players_prefix", "总共 "},
{"leaderboard_total_players_suffix", " 名玩家"},
{"leaderboard_see_full_rankings_in_fallalytics", "请参阅 FALLALYTICS 中的完整排名"},
Expand Down Expand Up @@ -2622,6 +2627,7 @@ public static class Multilingual {
{"level_no_statistical_data", " 無統計數據"},

{"leaderboard_menu_title", "排行榜"},
{"leaderboard_choose_a_round", "選擇一輪。"},
{"leaderboard_total_players_prefix", "總共 "},
{"leaderboard_total_players_suffix", " 名玩家"},
{"leaderboard_see_full_rankings_in_fallalytics", "請參閱 FALLALYTICS 中的完整排名"},
Expand Down
15 changes: 15 additions & 0 deletions Views/LeaderboardDisplay.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 13 additions & 5 deletions Views/LeaderboardDisplay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public partial class LeaderboardDisplay : MetroFramework.Forms.MetroForm {
DataGridViewCellStyle dataGridViewCellStyle2 = new DataGridViewCellStyle();
private readonly string LEADERBOARD_API_URL = "https://data.fallalytics.com/api/leaderboard";
private string key = String.Empty;
private int totalRank = 0;
private int totalPlayers;
private List<RankRound> roundlist;
private List<RankInfo> recordholders;
private List<RankInfo> nodata = new List<RankInfo>();
Expand All @@ -41,12 +41,16 @@ private void LeaderboardDisplay_Shown(object sender, EventArgs e) {

private void LeaderboardDisplay_Resize(object sender, EventArgs e) {
this.mpsSpinner.Location = new Point((this.ClientSize.Width - this.mpsSpinner.Width) / 2, (this.ClientSize.Height - this.mpsSpinner.Height) / 2);
this.lblSearchDescription.Location = new Point((this.ClientSize.Width - this.lblSearchDescription.Width) / 2, (this.ClientSize.Height - this.lblSearchDescription.Height) / 2);
}

private void SetTheme(MetroThemeStyle theme) {
this.SuspendLayout();
this.lblTotalPlayers.Theme = theme;
this.lblTotalPlayers.Location = new Point(this.cboRoundList.Right + 15, this.cboRoundList.Location.Y);
this.lblSearchDescription.Theme = theme;
this.lblSearchDescription.Text = $"{Multilingual.GetWord("leaderboard_choose_a_round")}";
this.lblSearchDescription.Location = new Point((this.ClientSize.Width - this.lblSearchDescription.Width) / 2, (this.ClientSize.Height - this.lblSearchDescription.Height) / 2);
this.mpsSpinner.BackColor = theme == MetroThemeStyle.Light ? Color.White : Color.FromArgb(17, 17, 17);
// this.mpsSpinner.Location = new Point(this.cboRoundList.Right + 15, this.cboRoundList.Location.Y);
this.mpsSpinner.Location = new Point((this.ClientSize.Width - this.mpsSpinner.Width) / 2, (this.ClientSize.Height - this.mpsSpinner.Height) / 2);
Expand Down Expand Up @@ -123,6 +127,7 @@ private void cboRoundList_SelectedIndexChanged(object sender, EventArgs e) {
this.key = ((ImageItem)((ImageComboBox)sender).SelectedItem).DataArray[0];
this.lblTotalPlayers.Visible = false;
this.lblTotalPlayers.Text = "";
this.lblSearchDescription.Visible = false;
this.mpsSpinner.Visible = true;
this.gridDetails.DataSource = null;
Task.Run(() => this.DataLoad(this.key)).ContinueWith(prevTask => {
Expand All @@ -131,7 +136,8 @@ private void cboRoundList_SelectedIndexChanged(object sender, EventArgs e) {
this.Text = $@" {Multilingual.GetWord("leaderboard_menu_title")} - {((ImageItem)((ImageComboBox)sender).SelectedItem).Text}";
this.mpsSpinner.Visible = false;
this.gridDetails.DataSource = this.recordholders;
this.lblTotalPlayers.Text = $"{Multilingual.GetWord("leaderboard_total_players_prefix")}{this.totalRank}{Multilingual.GetWord("leaderboard_total_players_suffix")}";
// this.lblTotalPlayers.Location = new Point(this.cboRoundList.Right + 15, this.cboRoundList.Location.Y);
this.lblTotalPlayers.Text = $"{Multilingual.GetWord("leaderboard_total_players_prefix")}{this.totalPlayers}{Multilingual.GetWord("leaderboard_total_players_suffix")}";
this.lblTotalPlayers.Visible = true;
this.mlVisitFallalytics.Visible = true;
this.Refresh();
Expand All @@ -141,6 +147,7 @@ private void cboRoundList_SelectedIndexChanged(object sender, EventArgs e) {
this.gridDetails.DataSource = this.nodata;
this.lblTotalPlayers.Visible = false;
this.mlVisitFallalytics.Visible = false;
this.lblSearchDescription.Visible = true;
this.Refresh();
}
});
Expand All @@ -155,6 +162,7 @@ private void SetRoundList() {
this.BeginInvoke((MethodInvoker)delegate {
if (prevTask.Result) {
this.mpsSpinner.Visible = false;
this.lblSearchDescription.Visible = true;
List<ImageItem> roundItemList = new List<ImageItem>();
foreach (RankRound round in this.roundlist) {
foreach (var id in round.ids) {
Expand Down Expand Up @@ -193,13 +201,13 @@ private bool DataLoad(string round = null) {
Leaderboard leaderboard = JsonSerializer.Deserialize<Leaderboard>(json, options);
result = leaderboard.found;
if (result) {
this.totalRank = leaderboard.total;
this.totalPlayers = leaderboard.total;
for (var i = 0; i < leaderboard.recordholders.Count; i++) {
leaderboard.recordholders[i].rank = i + 1;
}
this.recordholders = leaderboard.recordholders;
} else {
this.totalRank = 0;
this.totalPlayers = 0;
}
}
}
Expand Down Expand Up @@ -304,7 +312,7 @@ private void gridDetails_CellFormatting(object sender, DataGridViewCellFormattin
if (info.rank == 1) {
e.Value = Properties.Resources.medal_gold_grid_icon;
} else {
double percentage = ((double)(info.rank - 1) / (this.totalRank - 1)) * 100;
double percentage = ((double)(info.rank - 1) / (this.totalPlayers - 1)) * 100;
if (percentage <= 20) {
e.Value = Properties.Resources.medal_silver_grid_icon;
} else if (percentage <= 50) {
Expand Down
2 changes: 1 addition & 1 deletion Views/Stats.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5d73c02

Please sign in to comment.