1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 06:57:39 +08:00

Add star rating display underneath the beatmap metadata

This commit is contained in:
Salman Ahmed 2021-05-08 11:44:29 +03:00
parent fc04b88e1a
commit 0f08c2a479

View File

@ -12,8 +12,10 @@ using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
using osu.Game.Screens.Play.HUD;
using osu.Game.Screens.Ranking.Expanded;
using osuTK;
namespace osu.Game.Screens.Play
@ -30,6 +32,9 @@ namespace osu.Game.Screens.Play
public IBindable<IReadOnlyList<Mod>> Mods => mods;
[Resolved]
private IBindable<RulesetInfo> ruleset { get; set; }
public bool Loading
{
set
@ -51,10 +56,12 @@ namespace osu.Game.Screens.Play
}
[BackgroundDependencyLoader]
private void load()
private void load(BeatmapDifficultyCache difficultyCache)
{
var metadata = beatmap.BeatmapInfo?.Metadata ?? new BeatmapMetadata();
var starDifficulty = difficultyCache.GetDifficultyAsync(beatmap.BeatmapInfo, ruleset.Value, mods.Value).Result;
AutoSizeAxes = Axes.Both;
Children = new Drawable[]
{
@ -107,16 +114,29 @@ namespace osu.Game.Screens.Play
loading = new LoadingLayer(true)
}
},
new OsuSpriteText
new FillFlowContainer
{
Text = beatmap?.BeatmapInfo?.Version,
Font = OsuFont.GetFont(size: 26, italics: true),
Origin = Anchor.TopCentre,
AutoSizeAxes = Axes.Both,
Anchor = Anchor.TopCentre,
Margin = new MarginPadding
Origin = Anchor.TopCentre,
Direction = FillDirection.Vertical,
Spacing = new Vector2(5f),
Margin = new MarginPadding { Bottom = 40 },
Children = new Drawable[]
{
Bottom = 40
},
new OsuSpriteText
{
Text = beatmap?.BeatmapInfo?.Version,
Font = OsuFont.GetFont(size: 26, italics: true),
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
},
new StarRatingDisplay(starDifficulty)
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
}
}
},
new GridContainer
{