Merge pull request #29560 from peppy/fix-daily-challenge-intro-mod-display

Fix mod icons potentially showing incorrectly at daily challenge intro
This commit is contained in:
Bartłomiej Dach 2024-08-27 09:37:11 +02:00 committed by GitHub
commit 8d7053d367
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

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