1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 20:25:39 +08:00

Apply simple transforms to star rating display when ready if not

This commit is contained in:
Salman Ahmed 2021-05-14 15:55:26 +03:00
parent db361efecf
commit 0dc3bfd0c1

View File

@ -53,11 +53,12 @@ namespace osu.Game.Screens.Play
private IBindable<StarDifficulty?> starDifficulty; private IBindable<StarDifficulty?> starDifficulty;
private FillFlowContainer versionFlow;
private StarRatingDisplay starRatingDisplay;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(BeatmapDifficultyCache difficultyCache) private void load(BeatmapDifficultyCache difficultyCache)
{ {
StarRatingDisplay starRatingDisplay;
var metadata = beatmap.BeatmapInfo?.Metadata ?? new BeatmapMetadata(); var metadata = beatmap.BeatmapInfo?.Metadata ?? new BeatmapMetadata();
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
@ -112,7 +113,7 @@ namespace osu.Game.Screens.Play
loading = new LoadingLayer(true) loading = new LoadingLayer(true)
} }
}, },
new FillFlowContainer versionFlow = new FillFlowContainer
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
@ -178,11 +179,32 @@ namespace osu.Game.Screens.Play
}; };
starDifficulty = difficultyCache.GetBindableDifficulty(beatmap.BeatmapInfo); starDifficulty = difficultyCache.GetBindableDifficulty(beatmap.BeatmapInfo);
starDifficulty.BindValueChanged(d => starRatingDisplay.Current.Value = d.NewValue, true);
Loading = true; Loading = true;
} }
protected override void LoadComplete()
{
base.LoadComplete();
if (starDifficulty.Value != null)
starRatingDisplay.Current.Value = starDifficulty.Value;
else
{
starRatingDisplay.Hide();
starDifficulty.ValueChanged += d =>
{
starRatingDisplay.Current.Value = d.NewValue;
versionFlow.AutoSizeDuration = 300;
versionFlow.AutoSizeEasing = Easing.OutQuint;
starRatingDisplay.FadeIn(300, Easing.InQuint);
};
}
}
private class MetadataLineLabel : OsuSpriteText private class MetadataLineLabel : OsuSpriteText
{ {
public MetadataLineLabel(string text) public MetadataLineLabel(string text)