This commit is contained in:
mk56-spn 2022-12-12 11:53:07 +01:00
parent 58bf081096
commit 4d592184ca
3 changed files with 18 additions and 5 deletions

View File

@ -34,13 +34,16 @@ public void SetupSteps() => AddStep("Create components", () =>
{
var ruleset = CreateRuleset();
var r = ruleset.CreateBeatmapConverter(Beatmap.Value.Beatmap);
var n = r.Convert().BeatmapInfo.Ruleset.CreateInstance();
Debug.Assert(ruleset != null);
scoreProcessor = new ScoreProcessor(ruleset);
scoreProcessor = new ScoreProcessor(n);
Child = new DependencyProvidingContainer
{
RelativeSizeAxes = Axes.Both,
CachedDependencies = new (Type, object)[] { (typeof(ScoreProcessor), scoreProcessor), (typeof(Ruleset), ruleset) },
CachedDependencies = new (Type, object)[] { (typeof(ScoreProcessor), scoreProcessor), (typeof(Ruleset), n) },
Children = new Drawable[]
{
judgementTally = new JudgementTally(),

View File

@ -9,6 +9,7 @@
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.UI;
namespace osu.Game.Screens.Play.HUD.JudgementCounter
{
@ -29,7 +30,7 @@ public JudgementCounter(JudgementCounterInfo result)
private JudgementRollingCounter counter = null!;
[BackgroundDependencyLoader]
private void load(OsuColour colours)
private void load(OsuColour colours, DrawableRuleset ruleset)
{
AutoSizeAxes = Axes.Both;
InternalChild = flowContainer = new FillFlowContainer
@ -44,7 +45,7 @@ private void load(OsuColour colours)
ResultName = new OsuSpriteText
{
Font = OsuFont.Numeric.With(size: 8),
Text = Result.ResultInfo.Displayname
Text = ruleset.Ruleset.GetDisplayNameForHitResult(Result.ResultInfo.Type)
}
}
};

View File

@ -7,6 +7,7 @@
using osu.Framework.Bindables;
using osu.Framework.Graphics.Containers;
using osu.Game.Beatmaps;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Screens.Play.HUD.JudgementCounter
@ -21,7 +22,7 @@ public partial class JudgementTally : CompositeDrawable
[BackgroundDependencyLoader]
private void load(IBindable<WorkingBeatmap> working)
{
foreach (var result in working.Value.BeatmapInfo.Ruleset.CreateInstance().GetHitResults())
foreach (var result in getRuleset(working).GetHitResults())
{
Results.Add(new JudgementCounterInfo
{
@ -31,6 +32,14 @@ private void load(IBindable<WorkingBeatmap> working)
}
}
private Ruleset getRuleset(IBindable<WorkingBeatmap> working)
{
var ruleset = working.Value.BeatmapInfo.Ruleset.CreateInstance();
var converter = ruleset.RulesetInfo.CreateInstance().CreateBeatmapConverter(working.Value.Beatmap);
return converter.CanConvert() ? converter.Convert().BeatmapInfo.Ruleset.CreateInstance() : ruleset;
}
protected override void LoadComplete()
{
base.LoadComplete();