Skip to content

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
qubqub committed Nov 12, 2023
1 parent 9c343e2 commit 070b6b9
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Controls/Grid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ private void CustomToolStripSeparator_Paint(Object sender, PaintEventArgs e) {
e.Graphics.DrawLine(new Pen(this.Theme == MetroThemeStyle.Light ? Color.Black : Color.DarkGray), 30, separator.Height / 2, separator.Width - 4, separator.Height / 2); // CUSTOM_COLOR_FOREGROUND
}

public void SetComtextMenuTheme() {
public void SetContextMenuTheme() {
foreach (object item in this.CMenu.Items) {
if (item is ToolStripMenuItem tsi) {
tsi.BackColor = this.Theme == MetroThemeStyle.Light ? Color.White : Color.FromArgb(17, 17, 17);
Expand Down
23 changes: 20 additions & 3 deletions Views/LeaderboardDisplay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ private void SetTheme(MetroThemeStyle theme) {
this.dataGridViewCellStyle2.SelectionBackColor = theme == MetroThemeStyle.Light ? Color.DeepSkyBlue : Color.SpringGreen;
this.dataGridViewCellStyle2.SelectionForeColor = Color.Black;

this.gridDetails.SetComtextMenuTheme();
this.gridDetails.SetContextMenuTheme();

this.mlVisitFallalytics.Theme = theme;
this.mlVisitFallalytics.Text = $@" {Multilingual.GetWord("leaderboard_see_full_rankings_in_fallalytics")}";
Expand Down Expand Up @@ -259,7 +259,7 @@ private void gridDetails_CellFormatting(object sender, DataGridViewCellFormattin
e.Value = Multilingual.GetShowName((string)e.Value) ?? e.Value;
}
} else if (this.gridDetails.Columns[e.ColumnIndex].Name == "flag") {
e.Value = info.isAnonymous ? null : (string.IsNullOrEmpty(info.country) ? Properties.Resources.country_unknown_icon : (Image)Properties.Resources.ResourceManager.GetObject($"country_{info.country.ToLower()}_shiny_icon"));
e.Value = info.isAnonymous ? Properties.Resources.country_unknown_shiny_icon : (string.IsNullOrEmpty(info.country) ? Properties.Resources.country_unknown_shiny_icon : (Image)Properties.Resources.ResourceManager.GetObject($"country_{info.country.ToLower()}_shiny_icon"));
} else if (this.gridDetails.Columns[e.ColumnIndex].Name == "platform") {
e.Value = info.isAnonymous ? null : (info.onlineServiceType == "0" ? Properties.Resources.epic_grid_icon : Properties.Resources.steam_grid_icon);
} else if (this.gridDetails.Columns[e.ColumnIndex].Name == "medal") {
Expand All @@ -275,7 +275,24 @@ private void gridDetails_CellFormatting(object sender, DataGridViewCellFormattin
e.Value = Properties.Resources.medal_pink_grid_icon;
}
}
// } else if (this.gridDetails.Columns[e.ColumnIndex].Name == "onlineServiceNickname") {
} else if (this.gridDetails.Columns[e.ColumnIndex].Name == "onlineServiceNickname") {
if (info.rank == 1) { e.CellStyle.ForeColor = Color.FromArgb(165, 124, 0); }
// else {
// double percentage = ((double)(info.rank - 1) / (this.totalPlayers - 1)) * 100;
// if (percentage <= 20) {
// // e.CellStyle.ForeColor = Color.FromArgb(199, 209, 218);
// e.CellStyle.ForeColor = this.Theme == MetroThemeStyle.Light ? Color.Black : Color.DarkGray;
// } else if (percentage <= 50) {
// e.CellStyle.ForeColor = Color.FromArgb(136, 84, 11);
// } else {
// e.CellStyle.ForeColor = Color.FromArgb(217, 152, 160);
// }
// }

// if (info.isAnonymous) {
// // e.CellStyle.ForeColor = Color.Yellow;
// e.CellStyle.Font = Overlay.GetMainFont(14f, FontStyle.Bold);
// }
} else if (this.gridDetails.Columns[e.ColumnIndex].Name == "record") {
e.Value = Utils.FormatTime((double)e.Value);
} else if (this.gridDetails.Columns[e.ColumnIndex].Name == "finish") {
Expand Down
2 changes: 1 addition & 1 deletion Views/LevelDetails.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ private void LevelDetails_Load(object sender, EventArgs e) {
this.gridDetails.CMenu.Items.Add(this.gridDetails.UpdateCreativeShows);
}

this.gridDetails.SetComtextMenuTheme();
this.gridDetails.SetContextMenuTheme();
}

private void LevelDetails_Shown(object sender, EventArgs e) {
Expand Down
2 changes: 1 addition & 1 deletion Views/Stats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,7 @@ private void SetTheme(MetroThemeStyle theme) {
}

this.gridDetails.Theme = theme;
this.gridDetails.SetComtextMenuTheme();
this.gridDetails.SetContextMenuTheme();
this.gridDetails.BackgroundColor = theme == MetroThemeStyle.Light ? Color.White : Color.FromArgb(17, 17, 17);
this.dataGridViewCellStyle1.BackColor = theme == MetroThemeStyle.Light ? Color.LightGray : Color.FromArgb(2, 2, 2);
this.dataGridViewCellStyle1.ForeColor = theme == MetroThemeStyle.Light ? Color.Black : Color.DarkGray;
Expand Down

0 comments on commit 070b6b9

Please sign in to comment.