Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mod icons potentially showing incorrectly at daily challenge intro #29560

Merged
merged 2 commits into from
Aug 27, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions osu.Game/Screens/OnlinePlay/DailyChallenge/DailyChallengeIntro.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,15 @@ public DailyChallengeIntro(Room room)
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() ?? Ruleset.Value.CreateInstance();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this still fallback to Ruleset.Value.CreateInstance()? I don't see the point, it can literally be only more wrong than the left half of this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think the mods just shouldn't show in this case? Because I think that would be the closest alternative (we need a ruleset to show the ?? mods).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd just delete the fallback here and be done with it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. I guess it's always going to be an official ruleset anyway.


InternalChildren = new Drawable[]
{
beatmapAvailabilityTracker,
Expand Down Expand Up @@ -242,13 +243,13 @@ private void load(BeatmapDifficultyCache difficultyCache, BeatmapModelDownloader
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),
Expand All @@ -257,7 +258,7 @@ private void load(BeatmapDifficultyCache difficultyCache, BeatmapModelDownloader
},
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),
Expand Down Expand Up @@ -309,14 +310,14 @@ private void load(BeatmapDifficultyCache difficultyCache, BeatmapModelDownloader
}
};

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,
Expand All @@ -334,8 +335,8 @@ private void load(BeatmapDifficultyCache difficultyCache, BeatmapModelDownloader

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");
Expand Down
Loading