1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-17 08:02:54 +08:00

Fix mod icons potentially showing incorrectly at daily challenge intro

Prefer using the beatmap's rulesets over the current user selection.

Closes https://github.com/ppy/osu/issues/29559.
This commit is contained in:
Dean Herbert 2024-08-22 13:57:19 +09:00
parent 502192ff6f
commit 7f5f3a4589
No known key found for this signature in database

View File

@ -93,14 +93,15 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge
protected override BackgroundScreen CreateBackground() => new DailyChallengeIntroBackgroundScreen(colourProvider); protected override BackgroundScreen CreateBackground() => new DailyChallengeIntroBackgroundScreen(colourProvider);
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(BeatmapDifficultyCache difficultyCache, BeatmapModelDownloader beatmapDownloader, OsuConfigManager config, AudioManager audio) private void load(RulesetStore rulesets, BeatmapDifficultyCache difficultyCache, BeatmapModelDownloader beatmapDownloader, OsuConfigManager config, AudioManager audio)
{ {
const float horizontal_info_size = 500f; const float horizontal_info_size = 500f;
Ruleset ruleset = Ruleset.Value.CreateInstance();
StarRatingDisplay starRatingDisplay; StarRatingDisplay starRatingDisplay;
IBeatmapInfo beatmap = item.Beatmap;
Ruleset ruleset = rulesets.GetRuleset(item.Beatmap.Ruleset.ShortName)?.CreateInstance() ?? Ruleset.Value.CreateInstance();
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
beatmapAvailabilityTracker, beatmapAvailabilityTracker,
@ -242,13 +243,13 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Shear = new Vector2(-OsuGame.SHEAR, 0f), Shear = new Vector2(-OsuGame.SHEAR, 0f),
MaxWidth = horizontal_info_size, MaxWidth = horizontal_info_size,
Text = item.Beatmap.BeatmapSet!.Metadata.GetDisplayTitleRomanisable(false), Text = beatmap.BeatmapSet!.Metadata.GetDisplayTitleRomanisable(false),
Padding = new MarginPadding { Horizontal = 5f }, Padding = new MarginPadding { Horizontal = 5f },
Font = OsuFont.GetFont(size: 26), Font = OsuFont.GetFont(size: 26),
}, },
new TruncatingSpriteText new TruncatingSpriteText
{ {
Text = $"Difficulty: {item.Beatmap.DifficultyName}", Text = $"Difficulty: {beatmap.DifficultyName}",
Font = OsuFont.GetFont(size: 20, italics: true), Font = OsuFont.GetFont(size: 20, italics: true),
MaxWidth = horizontal_info_size, MaxWidth = horizontal_info_size,
Shear = new Vector2(-OsuGame.SHEAR, 0f), Shear = new Vector2(-OsuGame.SHEAR, 0f),
@ -257,7 +258,7 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge
}, },
new TruncatingSpriteText new TruncatingSpriteText
{ {
Text = $"by {item.Beatmap.Metadata.Author.Username}", Text = $"by {beatmap.Metadata.Author.Username}",
Font = OsuFont.GetFont(size: 16, italics: true), Font = OsuFont.GetFont(size: 16, italics: true),
MaxWidth = horizontal_info_size, MaxWidth = horizontal_info_size,
Shear = new Vector2(-OsuGame.SHEAR, 0f), Shear = new Vector2(-OsuGame.SHEAR, 0f),
@ -309,14 +310,14 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge
} }
}; };
starDifficulty = difficultyCache.GetBindableDifficulty(item.Beatmap); starDifficulty = difficultyCache.GetBindableDifficulty(beatmap);
starDifficulty.BindValueChanged(star => starDifficulty.BindValueChanged(star =>
{ {
if (star.NewValue != null) if (star.NewValue != null)
starRatingDisplay.Current.Value = star.NewValue.Value; starRatingDisplay.Current.Value = star.NewValue.Value;
}, true); }, true);
LoadComponentAsync(new OnlineBeatmapSetCover(item.Beatmap.BeatmapSet as IBeatmapSetOnlineInfo) LoadComponentAsync(new OnlineBeatmapSetCover(beatmap.BeatmapSet as IBeatmapSetOnlineInfo)
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
@ -334,8 +335,8 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge
if (config.Get<bool>(OsuSetting.AutomaticallyDownloadMissingBeatmaps)) if (config.Get<bool>(OsuSetting.AutomaticallyDownloadMissingBeatmaps))
{ {
if (!beatmapManager.IsAvailableLocally(new BeatmapSetInfo { OnlineID = item.Beatmap.BeatmapSet!.OnlineID })) if (!beatmapManager.IsAvailableLocally(new BeatmapSetInfo { OnlineID = beatmap.BeatmapSet!.OnlineID }))
beatmapDownloader.Download(item.Beatmap.BeatmapSet!, config.Get<bool>(OsuSetting.PreferNoVideo)); beatmapDownloader.Download(beatmap.BeatmapSet!, config.Get<bool>(OsuSetting.PreferNoVideo));
} }
dateWindupSample = audio.Samples.Get(@"DailyChallenge/date-windup"); dateWindupSample = audio.Samples.Get(@"DailyChallenge/date-windup");