1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 13:22:57 +08:00

Add ruleset to now playing string

This commit is contained in:
Dean Herbert 2022-11-30 14:47:16 +09:00
parent b453eecebe
commit 8bf5d6884d

View File

@ -10,6 +10,7 @@ using osu.Framework.Graphics;
using osu.Framework.Localisation;
using osu.Game.Beatmaps;
using osu.Game.Online.API;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
using osu.Game.Users;
@ -29,6 +30,9 @@ namespace osu.Game.Online.Chat
[Resolved]
private Bindable<IReadOnlyList<Mod>> selectedMods { get; set; } = null!;
[Resolved]
private IBindable<RulesetInfo> currentRuleset { get; set; } = null!;
[Resolved]
private LocalisationManager localisation { get; set; } = null!;
@ -73,6 +77,7 @@ namespace osu.Game.Online.Chat
"is",
verb,
getBeatmapPart(),
getRulesetPart(),
getModPart(),
};
@ -86,6 +91,13 @@ namespace osu.Game.Online.Chat
return beatmapInfo.OnlineID > 0 ? $"[{api.WebsiteRootUrl}/b/{beatmapInfo.OnlineID} {beatmapInfoString}]" : beatmapInfoString;
}
string getRulesetPart()
{
if (api.Activity.Value is not UserActivity.InGame) return string.Empty;
return $"<{currentRuleset.Value.Name}>";
}
string getModPart()
{
if (api.Activity.Value is not UserActivity.InGame) return string.Empty;