Code quality improvements

This commit is contained in:
dekrain 2022-02-01 07:10:00 +01:00
parent fd287e06f2
commit d7b939277e
No known key found for this signature in database
GPG Key ID: E20077A4AB510334

View File

@ -19,10 +19,10 @@ namespace osu.Game.Online.Leaderboards
{ {
public class LeaderboardScoreTooltip : VisibilityContainer, ITooltip<ScoreInfo> public class LeaderboardScoreTooltip : VisibilityContainer, ITooltip<ScoreInfo>
{ {
private OsuSpriteText timestampLabel; private readonly OsuSpriteText timestampLabel;
private FillFlowContainer<HitResultCell> topScoreStatistics; private readonly FillFlowContainer<HitResultCell> topScoreStatistics;
private FillFlowContainer<HitResultCell> bottomScoreStatistics; private readonly FillFlowContainer<HitResultCell> bottomScoreStatistics;
private FillFlowContainer<ModCell> modStatistics; private readonly FillFlowContainer<ModCell> modStatistics;
public LeaderboardScoreTooltip() public LeaderboardScoreTooltip()
{ {
@ -58,7 +58,7 @@ namespace osu.Game.Online.Leaderboards
// Info row // Info row
new Drawable[] new Drawable[]
{ {
timestampLabel = new OsuSpriteText() timestampLabel = new OsuSpriteText
{ {
Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold), Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold),
} }
@ -98,8 +98,9 @@ namespace osu.Game.Online.Leaderboards
public void SetContent(ScoreInfo score) public void SetContent(ScoreInfo score)
{ {
if (currentScore == score) if (currentScore.Equals(score))
return; return;
currentScore = score; currentScore = score;
timestampLabel.Text = $"Played on {score.Date.ToLocalTime():d MMMM yyyy HH:mm}"; timestampLabel.Text = $"Played on {score.Date.ToLocalTime():d MMMM yyyy HH:mm}";
@ -116,9 +117,9 @@ namespace osu.Game.Online.Leaderboards
foreach (var result in score.GetStatisticsForDisplay()) foreach (var result in score.GetStatisticsForDisplay())
{ {
(result.Result > HitResult.Perfect (result.Result > HitResult.Perfect
? bottomScoreStatistics ? bottomScoreStatistics
: topScoreStatistics : topScoreStatistics
).Add(new HitResultCell(result)); ).Add(new HitResultCell(result));
} }
} }
@ -129,9 +130,9 @@ namespace osu.Game.Online.Leaderboards
private class HitResultCell : CompositeDrawable private class HitResultCell : CompositeDrawable
{ {
readonly private string DisplayName; private readonly string DisplayName;
readonly private HitResult Result; private readonly HitResult Result;
readonly private int Count; private readonly int Count;
public HitResultCell(HitResultDisplayStatistic stat) public HitResultCell(HitResultDisplayStatistic stat)
{ {
@ -190,7 +191,7 @@ namespace osu.Game.Online.Leaderboards
private class ModCell : CompositeDrawable private class ModCell : CompositeDrawable
{ {
readonly private Mod Mod; private readonly Mod Mod;
public ModCell(Mod mod) public ModCell(Mod mod)
{ {