-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix difficulty icon tooltip not displaying duration above 1 hour correctly #30613
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can't always show the hour. Please modify the pull request such that it doesn't always show the hour.
yes |
i believe this is what you meant? |
This should use |
ok |
@@ -146,7 +146,10 @@ public void SetContent(DifficultyIconTooltipContent content) | |||
approachRate.Text = @" AR: " + adjustedDifficulty.ApproachRate.ToString(@"0.##"); | |||
overallDifficulty.Text = @" OD: " + adjustedDifficulty.OverallDifficulty.ToString(@"0.##"); | |||
|
|||
length.Text = "Length: " + TimeSpan.FromMilliseconds(displayedContent.BeatmapInfo.Length / rate).ToString(@"mm\:ss"); | |||
TimeSpan lengthTimeSpan = TimeSpan.FromMilliseconds(displayedContent.BeatmapInfo.Length / rate); | |||
length.Text = "Length: " + (lengthTimeSpan.Hours > 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not correct. Counterexample: try any timespan which is a multiple of 24 hours. You would want
length.Text = "Length: " + (lengthTimeSpan.Hours > 0 | |
length.Text = "Length: " + (lengthTimeSpan.TotalHours >= 1 |
See docs to understand the difference.
Then again, as above, there's an established helper for this already.
@@ -146,7 +146,10 @@ public void SetContent(DifficultyIconTooltipContent content) | |||
approachRate.Text = @" AR: " + adjustedDifficulty.ApproachRate.ToString(@"0.##"); | |||
overallDifficulty.Text = @" OD: " + adjustedDifficulty.OverallDifficulty.ToString(@"0.##"); | |||
|
|||
length.Text = "Length: " + TimeSpan.FromMilliseconds(displayedContent.BeatmapInfo.Length / rate).ToString(@"mm\:ss"); | |||
TimeSpan lengthTimeSpan = TimeSpan.FromMilliseconds(displayedContent.BeatmapInfo.Length / rate); | |||
length.Text = "Length: " + (lengthTimeSpan.Hours > 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
something like this would be cleaner
length.Text = "Length: " + lengthTimeSpan.ToString(lengthTimeSpan.TotalHours >= 1 ? @"hh\:mm\:ss" : @"mm\:ss");
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will fix #30612, but as a downside, it will always show the hour.