1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-14 15:07:52 +08:00

Add mod controls to scoring test scene

This commit is contained in:
Bartłomiej Dach 2023-09-26 08:11:53 +02:00
parent b3d3ae87be
commit 55064c387d
No known key found for this signature in database

View File

@ -18,6 +18,9 @@ using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Overlays;
using osu.Game.Overlays.Mods;
using osu.Game.Overlays.Settings;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Scoring;
@ -53,6 +56,10 @@ namespace osu.Game.Tests.Visual.Gameplay
private readonly BindableBool scoreV1Visible = new BindableBool(true);
private readonly BindableBool scoreV2Visible = new BindableBool(true);
private RoundedButton changeModsButton = null!;
private OsuSpriteText modsText = null!;
private TestModSelectOverlay modSelect = null!;
[Resolved]
private OsuColour colours { get; set; } = null!;
@ -83,6 +90,7 @@ namespace osu.Game.Tests.Visual.Gameplay
new Dimension(),
new Dimension(GridSizeMode.AutoSize),
new Dimension(GridSizeMode.AutoSize),
new Dimension(GridSizeMode.AutoSize),
},
Content = new[]
{
@ -104,6 +112,47 @@ namespace osu.Game.Tests.Visual.Gameplay
},
},
new Drawable[]
{
new Container
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Horizontal = 20 },
Children = new Drawable[]
{
new OsuSpriteText
{
Text = "Selected mods",
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
},
new FillFlowContainer
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(10),
Children = new Drawable[]
{
changeModsButton = new RoundedButton
{
Text = "Change",
Width = 100,
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
},
modsText = new OsuSpriteText
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
},
}
}
}
}
},
new Drawable[]
{
new FillFlowContainer
{
@ -139,6 +188,11 @@ namespace osu.Game.Tests.Visual.Gameplay
},
},
}
},
modSelect = new TestModSelectOverlay
{
RelativeSizeAxes = Axes.Both,
SelectedMods = { BindTarget = SelectedMods }
}
};
@ -159,6 +213,9 @@ namespace osu.Game.Tests.Visual.Gameplay
graphs.MaxCombo.BindTo(sliderMaxCombo.Current);
changeModsButton.Action = () => modSelect.Show();
SelectedMods.BindValueChanged(mods => Rerun());
Rerun();
});
}
@ -168,6 +225,10 @@ namespace osu.Game.Tests.Visual.Gameplay
graphs.Clear();
legend.Clear();
modsText.Text = SelectedMods.Value.Any()
? string.Join(", ", SelectedMods.Value.Select(mod => mod.Acronym))
: "(none)";
runForProcessor("lazer-standardised", colours.Green1, ScoringMode.Standardised, standardisedVisible);
runForProcessor("lazer-classic", colours.Blue1, ScoringMode.Classic, classicVisible);
@ -592,5 +653,16 @@ namespace osu.Game.Tests.Visual.Gameplay
lineGraph.Alpha = Visible.Value ? 1 : 0;
}
}
private partial class TestModSelectOverlay : UserModSelectOverlay
{
protected override bool ShowModEffects => true;
protected override bool ShowPresets => false;
public TestModSelectOverlay()
: base(OverlayColourScheme.Aquamarine)
{
}
}
}
}