1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-30 05:09:42 +08:00
osu-lazer/osu.Game.Tests/Visual/UserInterface/TestSceneModsEffectDisplay.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

61 lines
1.7 KiB
C#
Raw Normal View History

2022-08-28 01:12:45 +08:00
// 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.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Localisation;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Overlays;
using osu.Game.Overlays.Mods;
namespace osu.Game.Tests.Visual.UserInterface
{
public class TestSceneModsEffectDisplay : OsuTestScene
{
[Cached]
private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Green);
[Test]
public void TestEffectDisplay()
{
TestDisplay dsp;
Add(dsp = new TestDisplay
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre
});
AddSliderStep("value", 40, 60, 50, i => dsp.Value = i);
}
private class TestDisplay : ModsEffectDisplay
{
private readonly OsuSpriteText text;
protected override LocalisableString Label => "Test display";
public int Value
{
set
{
text.Text = value.ToString();
SetColours(value.CompareTo(50));
}
}
public TestDisplay()
{
Add(text = new OsuSpriteText
{
Font = OsuFont.Default.With(size: 17, weight: FontWeight.SemiBold),
Text = "50"
});
}
[BackgroundDependencyLoader]
private void load() => SetColours(0);
}
}
}