1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-20 00:52:56 +08:00

Add DrawableRuleset to the skin editor test to get a hit error meter to display

This commit is contained in:
Dean Herbert 2021-04-28 19:00:16 +09:00
parent 4f9e1e4945
commit 74c6fdc4b8

View File

@ -2,10 +2,15 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Testing;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Scoring;
using osu.Game.Screens.Play;
using osu.Game.Skinning.Editor;
using osuTK.Input;
@ -21,13 +26,32 @@ namespace osu.Game.Tests.Visual.Gameplay
{
SetContents(() =>
{
var hudOverlay = new HUDOverlay(null, null, null, Array.Empty<Mod>());
var ruleset = new OsuRuleset();
var working = CreateWorkingBeatmap(ruleset.RulesetInfo);
var beatmap = working.GetPlayableBeatmap(ruleset.RulesetInfo);
ScoreProcessor scoreProcessor = new ScoreProcessor();
var drawableRuleset = ruleset.CreateDrawableRulesetWith(beatmap);
var hudOverlay = new HUDOverlay(scoreProcessor, null, drawableRuleset, Array.Empty<Mod>());
// Add any key just to display the key counter visually.
hudOverlay.KeyCounter.Add(new KeyCounterKeyboard(Key.Space));
hudOverlay.ComboCounter.Current.Value = 1;
return new SkinEditor(hudOverlay);
// Apply a miss judgement
scoreProcessor.ApplyResult(new JudgementResult(new HitObject(), new Judgement()) { Type = HitResult.Good });
return new Container
{
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
drawableRuleset,
new SkinEditor(hudOverlay),
}
};
});
});
}