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