mirror of
https://github.com/ppy/osu.git
synced 2025-03-05 07:42:54 +08:00
Pass ruleset info to constructor instead
Follows the way working beatmap is passed, not sure why mods are passed as a bindable though, don't wanna bother too much with that.
This commit is contained in:
parent
169a283402
commit
b4801faf32
@ -32,7 +32,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
|
||||
private void createDisplay(Func<WorkingBeatmap> getBeatmap)
|
||||
{
|
||||
AddStep("setup display", () => Child = display = new BeatmapMetadataDisplay(getBeatmap(), new Bindable<IReadOnlyList<Mod>>(randomMods), null)
|
||||
AddStep("setup display", () => Child = display = new BeatmapMetadataDisplay(getBeatmap(), Ruleset.Value, new Bindable<IReadOnlyList<Mod>>(randomMods), null)
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
|
@ -27,15 +27,13 @@ namespace osu.Game.Screens.Play
|
||||
public class BeatmapMetadataDisplay : Container
|
||||
{
|
||||
private readonly WorkingBeatmap beatmap;
|
||||
private readonly RulesetInfo ruleset;
|
||||
private readonly Bindable<IReadOnlyList<Mod>> mods;
|
||||
private readonly Drawable logoFacade;
|
||||
private LoadingSpinner loading;
|
||||
|
||||
public IBindable<IReadOnlyList<Mod>> Mods => mods;
|
||||
|
||||
[Resolved]
|
||||
private IBindable<RulesetInfo> ruleset { get; set; }
|
||||
|
||||
public bool Loading
|
||||
{
|
||||
set
|
||||
@ -47,9 +45,10 @@ namespace osu.Game.Screens.Play
|
||||
}
|
||||
}
|
||||
|
||||
public BeatmapMetadataDisplay(WorkingBeatmap beatmap, Bindable<IReadOnlyList<Mod>> mods, [CanBeNull] Drawable logoFacade)
|
||||
public BeatmapMetadataDisplay(WorkingBeatmap beatmap, RulesetInfo ruleset, Bindable<IReadOnlyList<Mod>> mods, [CanBeNull] Drawable logoFacade)
|
||||
{
|
||||
this.beatmap = beatmap;
|
||||
this.ruleset = ruleset;
|
||||
this.logoFacade = logoFacade;
|
||||
|
||||
this.mods = new Bindable<IReadOnlyList<Mod>>();
|
||||
@ -61,7 +60,7 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
var metadata = beatmap.BeatmapInfo?.Metadata ?? new BeatmapMetadata();
|
||||
|
||||
var starDifficulty = difficultyCache.GetDifficultyAsync(beatmap.BeatmapInfo, ruleset.Value, mods.Value).Result;
|
||||
var starDifficulty = difficultyCache.GetDifficultyAsync(beatmap.BeatmapInfo, ruleset, mods.Value).Result;
|
||||
|
||||
AutoSizeAxes = Axes.Both;
|
||||
Children = new Drawable[]
|
||||
|
@ -134,7 +134,7 @@ namespace osu.Game.Screens.Play
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
}).WithChildren(new Drawable[]
|
||||
{
|
||||
MetadataInfo = new BeatmapMetadataDisplay(Beatmap.Value, Mods, content.LogoFacade)
|
||||
MetadataInfo = new BeatmapMetadataDisplay(Beatmap.Value, Ruleset.Value, Mods, content.LogoFacade)
|
||||
{
|
||||
Alpha = 0,
|
||||
Anchor = Anchor.Centre,
|
||||
|
Loading…
Reference in New Issue
Block a user