mirror of
https://github.com/ppy/osu
synced 2025-01-24 14:53:18 +00:00
Use BeatmapDifficultyCache.GetBindableDifficulty(...)
instead
This commit is contained in:
parent
0410edecaf
commit
43090067da
@ -55,12 +55,14 @@ namespace osu.Game.Screens.Play
|
||||
this.mods.BindTo(mods);
|
||||
}
|
||||
|
||||
private IBindable<StarDifficulty?> starDifficulty;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(BeatmapDifficultyCache difficultyCache)
|
||||
{
|
||||
var metadata = beatmap.BeatmapInfo?.Metadata ?? new BeatmapMetadata();
|
||||
StarRatingDisplay starRatingDisplay;
|
||||
|
||||
var starDifficulty = difficultyCache.GetDifficultyAsync(beatmap.BeatmapInfo, ruleset, mods.Value).Result;
|
||||
var metadata = beatmap.BeatmapInfo?.Metadata ?? new BeatmapMetadata();
|
||||
|
||||
AutoSizeAxes = Axes.Both;
|
||||
Children = new Drawable[]
|
||||
@ -131,7 +133,7 @@ namespace osu.Game.Screens.Play
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
},
|
||||
new StarRatingDisplay(starDifficulty)
|
||||
starRatingDisplay = new StarRatingDisplay
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
@ -179,6 +181,13 @@ namespace osu.Game.Screens.Play
|
||||
}
|
||||
};
|
||||
|
||||
starDifficulty = difficultyCache.GetBindableDifficulty(beatmap.BeatmapInfo);
|
||||
starDifficulty.BindValueChanged(difficulty =>
|
||||
{
|
||||
if (difficulty.NewValue is StarDifficulty diff)
|
||||
starRatingDisplay.Current.Value = diff;
|
||||
}, true);
|
||||
|
||||
Loading = true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user