Skip to content

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
qutrits committed May 2, 2024
1 parent 9092168 commit a744a84
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 17 deletions.
29 changes: 14 additions & 15 deletions Views/LevelStatsDisplay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ private void RoundStatsDisplay_Load(object sender, EventArgs e) {
this.cboRoundList.ValueMember = "Key";

this.formsPlot.Plot.Legend(location: Alignment.UpperRight);
this.SetGraph();
this.SetGraph(this.cboRoundList.SelectedItem);
this.isInitComplete = true;
}

Expand Down Expand Up @@ -80,16 +80,15 @@ private void SetTheme(MetroThemeStyle theme) {
this.ResumeLayout();
}

private void SetGraph() {
private void SetGraph(object selectedItem) {
//this.formsPlot.Plot.Grid(false);
//this.formsPlot.Plot.Frameless();
KeyValuePair<string, string> selectedRoundPair = (KeyValuePair<string, string>)this.cboRoundList.SelectedItem;
//string roundId = (string)this.cboRoundList.SelectedValue;
string roundId = selectedRoundPair.Key;
KeyValuePair<string, string> selectedRoundPair = (KeyValuePair<string, string>)selectedItem;
string levelId = selectedRoundPair.Key;

MatchCollection matches = Regex.Matches(roundId, @"^\d{4}-\d{4}-\d{4}$");
MatchCollection matches = Regex.Matches(levelId, @"^\d{4}-\d{4}-\d{4}$");
if (matches.Count > 0) {
List<RoundInfo> info = this.StatsForm.AllStats.FindAll(r => r.UseShareCode && string.Equals(r.Name, roundId));
List<RoundInfo> info = this.StatsForm.AllStats.FindAll(r => r.UseShareCode && string.Equals(r.Name, levelId));
this.picRoundIcon.Size = Properties.Resources.round_creative_big_icon.Size;
this.picRoundIcon.Image = Properties.Resources.round_creative_big_icon;
this.formsPlot.Plot.Title(selectedRoundPair.Value);
Expand Down Expand Up @@ -127,8 +126,8 @@ private void SetGraph() {
this.lblRoundType.Text = Multilingual.GetWord("level_detail_team");
this.lblRoundType.borderColor = Color.FromArgb(248, 82, 0);
this.lblRoundType.backColor = Color.FromArgb(248, 82, 0);
this.lblBestRecord.Text = $"{Multilingual.GetWord("overlay_high_score")} : {this.levelScoreInfo[roundId][0]}";
this.lblWorstRecord.Text = $"{Multilingual.GetWord("overlay_low_score")} : {this.levelScoreInfo[roundId][1]}";
this.lblBestRecord.Text = $"{Multilingual.GetWord("overlay_high_score")} : {this.levelScoreInfo[levelId][0]}";
this.lblWorstRecord.Text = $"{Multilingual.GetWord("overlay_low_score")} : {this.levelScoreInfo[levelId][1]}";
break;
default:
this.lblRoundType.Text = "UNKNOWN";
Expand All @@ -143,7 +142,7 @@ private void SetGraph() {
this.lblBestRecord.Left = this.lblRoundType.Right + 12;
this.lblWorstRecord.Left = this.lblRoundType.Right + 12;
} else {
if (this.StatsForm.StatLookup.TryGetValue(roundId, out LevelStats level)) {
if (this.StatsForm.StatLookup.TryGetValue(levelId, out LevelStats level)) {
this.picRoundIcon.Size = level.RoundBigIcon.Size;
this.picRoundIcon.Image = level.RoundBigIcon;
this.formsPlot.Plot.Title(level.Name);
Expand All @@ -165,8 +164,8 @@ private void SetGraph() {
this.lblWorstRecord.Text = $"{Multilingual.GetWord("overlay_fastest")} : {level.Fastest:m\\:ss\\.fff}";
break;
case BestRecordType.HighScore:
this.lblBestRecord.Text = $"{Multilingual.GetWord("overlay_high_score")} : {this.levelScoreInfo[roundId][0]}";
this.lblWorstRecord.Text = $"{Multilingual.GetWord("overlay_low_score")} : {this.levelScoreInfo[roundId][1]}";
this.lblBestRecord.Text = $"{Multilingual.GetWord("overlay_high_score")} : {this.levelScoreInfo[levelId][0]}";
this.lblWorstRecord.Text = $"{Multilingual.GetWord("overlay_low_score")} : {this.levelScoreInfo[levelId][1]}";
break;
default:
this.lblBestRecord.Text = @"-";
Expand All @@ -176,9 +175,9 @@ private void SetGraph() {
}
}

TimeSpan playTime = this.levelTotalPlayTime[roundId];
TimeSpan playTime = this.levelTotalPlayTime[levelId];
this.lblRoundTime.Text = $@"{Multilingual.GetWord("level_round_played_prefix")} {(int)playTime.TotalHours}{Multilingual.GetWord("main_hour")}{playTime:mm}{Multilingual.GetWord("main_min")}{playTime:ss}{Multilingual.GetWord("main_sec")} {Multilingual.GetWord("level_round_played_suffix")}";
double[] values = this.levelMedalInfo[roundId];
double[] values = this.levelMedalInfo[levelId];

this.formsPlot.Plot.Palette = new CustomPalette();

Expand Down Expand Up @@ -253,7 +252,7 @@ private void Medal_MouseClick(object sender, EventArgs e) {
private void cboRoundList_SelectedIndexChanged(object sender, EventArgs e) {
if (this.isInitComplete) {
this.formsPlot.Plot.Clear();
this.SetGraph();
this.SetGraph(((MetroComboBox)sender).SelectedItem);
}
}

Expand Down
2 changes: 1 addition & 1 deletion Views/Stats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3729,7 +3729,7 @@ private void LogFile_OnPersonalBestNotification(string showNameId, string roundI
: $" ⏱️{timeDiff.Seconds}.{timeDiff.Milliseconds}{Multilingual.GetWord("message_new_personal_best_timediff_by_second")}";
}
string levelName = this.StatLookup.TryGetValue(roundId, out LevelStats l1) ? l1.Name : roundId;
string showName = $"{(string.Equals(Multilingual.GetShowName(this.GetAlternateShowId(showNameId)), levelName) ? $"({levelName})" : $"({Multilingual.GetShowName(this.GetAlternateShowId(showNameId))}{levelName})")}";
string showName = $"{(string.Equals(Multilingual.GetShowName(showNameId), levelName) ? $"({levelName})" : $"({Multilingual.GetShowName(showNameId)}{levelName})")}";
string description = $"{Multilingual.GetWord("message_new_personal_best_prefix")}{showName}{Multilingual.GetWord("message_new_personal_best_suffix")}{timeDiffContent}";
ToastPosition toastPosition = Enum.TryParse(this.CurrentSettings.NotificationWindowPosition.ToString(), out ToastPosition position) ? position : ToastPosition.BottomRight;
ToastTheme toastTheme = this.Theme == MetroThemeStyle.Light ? ToastTheme.Light : ToastTheme.Dark;
Expand Down
2 changes: 1 addition & 1 deletion Views/WinStatsDisplay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ private void WinStatsDisplay_Load(object sender, EventArgs e) {
this.formsPlot.Plot.Legend(location: Alignment.UpperRight);
this.formsPlot.Plot.XAxis.DateTimeFormat(true);

this.formsPlot.Plot.XAxis.ManualTickSpacing((this.manualSpacing <= 0 ? 1 : this.manualSpacing), ScottPlot.Ticks.DateTimeUnit.Day);
this.formsPlot.Plot.XAxis.ManualTickSpacing(Math.Max(1, this.manualSpacing), ScottPlot.Ticks.DateTimeUnit.Day);
this.formsPlot.Plot.XAxis.TickLabelStyle(rotation: 45);
//this.formsPlot.Plot.XAxis.SetSizeLimit(min: 50);
this.formsPlot.Plot.SetAxisLimits(
Expand Down

0 comments on commit a744a84

Please sign in to comment.