mirror of https://github.com/ppy/osu
Minimum viable changes for ruleset-specific scoring test scenes
This commit is contained in:
parent
1ae8665a08
commit
45751dd1f2
|
@ -0,0 +1,33 @@
|
|||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using NUnit.Framework;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Osu.Beatmaps;
|
||||
using osu.Game.Rulesets.Osu.Judgements;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osu.Game.Rulesets.Osu.Scoring;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Tests.Visual.Gameplay;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public partial class TestSceneScoring : ScoringTestScene
|
||||
{
|
||||
protected override ScoreProcessor CreateScoreProcessor() => new OsuScoreProcessor();
|
||||
|
||||
protected override IBeatmap CreateBeatmap(int maxCombo)
|
||||
{
|
||||
var beatmap = new OsuBeatmap();
|
||||
for (int i = 0; i < maxCombo; i++)
|
||||
beatmap.HitObjects.Add(new HitCircle());
|
||||
return beatmap;
|
||||
}
|
||||
|
||||
protected override JudgementResult CreatePerfectJudgementResult() => new OsuJudgementResult(new HitCircle(), new OsuJudgement()) { Type = HitResult.Great };
|
||||
protected override JudgementResult CreateNonPerfectJudgementResult() => new OsuJudgementResult(new HitCircle(), new OsuJudgement()) { Type = HitResult.Ok };
|
||||
protected override JudgementResult CreateMissJudgementResult() => new OsuJudgementResult(new HitCircle(), new OsuJudgement()) { Type = HitResult.Miss };
|
||||
}
|
||||
}
|
|
@ -14,15 +14,13 @@
|
|||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Overlays.Settings;
|
||||
using osu.Game.Rulesets.Osu.Scoring;
|
||||
using osu.Game.Rulesets.Osu.Beatmaps;
|
||||
using osu.Game.Rulesets.Osu.Judgements;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Scoring.Legacy;
|
||||
using osuTK;
|
||||
|
@ -31,8 +29,14 @@
|
|||
|
||||
namespace osu.Game.Tests.Visual.Gameplay
|
||||
{
|
||||
public partial class TestSceneScoring : OsuTestScene
|
||||
public abstract partial class ScoringTestScene : OsuTestScene
|
||||
{
|
||||
protected abstract ScoreProcessor CreateScoreProcessor();
|
||||
protected abstract IBeatmap CreateBeatmap(int maxCombo);
|
||||
protected abstract JudgementResult CreatePerfectJudgementResult();
|
||||
protected abstract JudgementResult CreateNonPerfectJudgementResult();
|
||||
protected abstract JudgementResult CreateMissJudgementResult();
|
||||
|
||||
private GraphContainer graphs = null!;
|
||||
private SettingsSlider<int> sliderMaxCombo = null!;
|
||||
private SettingsCheckbox scaleToMax = null!;
|
||||
|
@ -152,8 +156,8 @@ private void rerun()
|
|||
graphs.Clear();
|
||||
legend.Clear();
|
||||
|
||||
runForProcessor("lazer-standardised", colours.Green1, new OsuScoreProcessor(), ScoringMode.Standardised, standardisedVisible);
|
||||
runForProcessor("lazer-classic", colours.Blue1, new OsuScoreProcessor(), ScoringMode.Classic, classicVisible);
|
||||
runForProcessor("lazer-standardised", colours.Green1, CreateScoreProcessor(), ScoringMode.Standardised, standardisedVisible);
|
||||
runForProcessor("lazer-classic", colours.Blue1, CreateScoreProcessor(), ScoringMode.Classic, classicVisible);
|
||||
|
||||
runScoreV1();
|
||||
runScoreV2();
|
||||
|
@ -274,20 +278,16 @@ void applyHitV2(int baseScore)
|
|||
private void runForProcessor(string name, Color4 colour, ScoreProcessor processor, ScoringMode mode, BindableBool visibility)
|
||||
{
|
||||
int maxCombo = sliderMaxCombo.Current.Value;
|
||||
|
||||
var beatmap = new OsuBeatmap();
|
||||
for (int i = 0; i < maxCombo; i++)
|
||||
beatmap.HitObjects.Add(new HitCircle());
|
||||
|
||||
var beatmap = CreateBeatmap(maxCombo);
|
||||
processor.ApplyBeatmap(beatmap);
|
||||
|
||||
runForAlgorithm(new ScoringAlgorithm
|
||||
{
|
||||
Name = name,
|
||||
Colour = colour,
|
||||
ApplyHit = () => processor.ApplyResult(new OsuJudgementResult(new HitCircle(), new OsuJudgement()) { Type = HitResult.Great }),
|
||||
ApplyNonPerfect = () => processor.ApplyResult(new OsuJudgementResult(new HitCircle(), new OsuJudgement()) { Type = HitResult.Ok }),
|
||||
ApplyMiss = () => processor.ApplyResult(new OsuJudgementResult(new HitCircle(), new OsuJudgement()) { Type = HitResult.Miss }),
|
||||
ApplyHit = () => processor.ApplyResult(CreatePerfectJudgementResult()),
|
||||
ApplyNonPerfect = () => processor.ApplyResult(CreateNonPerfectJudgementResult()),
|
||||
ApplyMiss = () => processor.ApplyResult(CreateMissJudgementResult()),
|
||||
GetTotalScore = () => processor.GetDisplayScore(mode),
|
||||
Visible = visibility
|
||||
});
|
||||
|
@ -327,9 +327,8 @@ private void runForAlgorithm(ScoringAlgorithm scoringAlgorithm)
|
|||
AccentColour = scoringAlgorithm.Colour,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public class ScoringAlgorithm
|
||||
private class ScoringAlgorithm
|
||||
{
|
||||
public string Name { get; init; } = null!;
|
||||
public Color4 Colour { get; init; }
|
||||
|
@ -559,7 +558,7 @@ public void SetContent(IEnumerable<LineGraph> content)
|
|||
}
|
||||
}
|
||||
|
||||
public partial class LegendEntry : OsuClickableContainer, IHasAccentColour
|
||||
private partial class LegendEntry : OsuClickableContainer, IHasAccentColour
|
||||
{
|
||||
public Color4 AccentColour { get; set; }
|
||||
|
||||
|
@ -634,3 +633,4 @@ private void updateState()
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue