From eba3cfc96e0e812a764cf70103905f4d7aff0874 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 9 Nov 2021 12:37:12 +0100 Subject: [PATCH] Move `ScoreInfo` string representation to extension method --- osu.Game/Scoring/ScoreInfo.cs | 2 +- osu.Game/Scoring/ScoreInfoExtensions.cs | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 osu.Game/Scoring/ScoreInfoExtensions.cs diff --git a/osu.Game/Scoring/ScoreInfo.cs b/osu.Game/Scoring/ScoreInfo.cs index e5b050fc01..736a939a59 100644 --- a/osu.Game/Scoring/ScoreInfo.cs +++ b/osu.Game/Scoring/ScoreInfo.cs @@ -225,7 +225,7 @@ namespace osu.Game.Scoring return clone; } - public override string ToString() => $"{User} playing {BeatmapInfo}"; + public override string ToString() => this.GetDisplayTitle(); public bool Equals(ScoreInfo other) { diff --git a/osu.Game/Scoring/ScoreInfoExtensions.cs b/osu.Game/Scoring/ScoreInfoExtensions.cs new file mode 100644 index 0000000000..2279337fef --- /dev/null +++ b/osu.Game/Scoring/ScoreInfoExtensions.cs @@ -0,0 +1,15 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Game.Beatmaps; + +namespace osu.Game.Scoring +{ + public static class ScoreInfoExtensions + { + /// + /// A user-presentable display title representing this score. + /// + public static string GetDisplayTitle(this IScoreInfo scoreInfo) => $"{scoreInfo.User.Username} playing {scoreInfo.Beatmap.GetDisplayTitle()}"; + } +}