2021-06-06 11:05:26 +00: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.
|
|
|
|
|
2022-06-17 07:37:17 +00:00
|
|
|
#nullable disable
|
|
|
|
|
2021-06-06 11:05:26 +00:00
|
|
|
using osu.Framework.Allocation;
|
2021-07-02 08:24:15 +00:00
|
|
|
using osu.Framework.Bindables;
|
2021-06-06 11:05:26 +00:00
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Framework.Testing;
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
using osu.Game.Graphics.Sprites;
|
|
|
|
using osu.Game.Graphics.UserInterfaceV2;
|
|
|
|
using osu.Game.Overlays;
|
|
|
|
|
|
|
|
namespace osu.Game.Tests.Visual.UserInterface
|
|
|
|
{
|
|
|
|
public partial class TestSceneColourPicker : OsuTestScene
|
|
|
|
{
|
2021-07-02 08:24:15 +00:00
|
|
|
private readonly Bindable<Colour4> colour = new Bindable<Colour4>(Colour4.Aquamarine);
|
|
|
|
|
2021-06-06 11:05:26 +00:00
|
|
|
[SetUpSteps]
|
|
|
|
public void SetUpSteps()
|
|
|
|
{
|
|
|
|
AddStep("create pickers", () => Child = new GridContainer
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
ColumnDimensions = new[]
|
|
|
|
{
|
|
|
|
new Dimension(),
|
|
|
|
new Dimension()
|
|
|
|
},
|
|
|
|
Content = new[]
|
|
|
|
{
|
|
|
|
new Drawable[]
|
|
|
|
{
|
|
|
|
new Container
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
|
|
|
new OsuSpriteText
|
|
|
|
{
|
|
|
|
Text = @"No OverlayColourProvider",
|
|
|
|
Font = OsuFont.Default.With(size: 40)
|
|
|
|
},
|
|
|
|
new OsuColourPicker
|
|
|
|
{
|
|
|
|
Anchor = Anchor.Centre,
|
2021-07-02 08:24:15 +00:00
|
|
|
Origin = Anchor.Centre,
|
|
|
|
Current = { BindTarget = colour },
|
2021-06-06 11:05:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
new ColourProvidingContainer(OverlayColourScheme.Blue)
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
|
|
|
new OsuSpriteText
|
|
|
|
{
|
|
|
|
Text = @"With blue OverlayColourProvider",
|
|
|
|
Font = OsuFont.Default.With(size: 40)
|
|
|
|
},
|
|
|
|
new OsuColourPicker
|
|
|
|
{
|
|
|
|
Anchor = Anchor.Centre,
|
2021-07-02 08:24:15 +00:00
|
|
|
Origin = Anchor.Centre,
|
|
|
|
Current = { BindTarget = colour },
|
2021-06-06 11:05:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2021-07-02 08:24:15 +00:00
|
|
|
|
|
|
|
AddStep("set green", () => colour.Value = Colour4.LimeGreen);
|
|
|
|
AddStep("set white", () => colour.Value = Colour4.White);
|
|
|
|
AddStep("set red", () => colour.Value = Colour4.Red);
|
2021-06-06 11:05:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private partial class ColourProvidingContainer : Container
|
|
|
|
{
|
|
|
|
[Cached]
|
|
|
|
private OverlayColourProvider provider { get; }
|
|
|
|
|
|
|
|
public ColourProvidingContainer(OverlayColourScheme colourScheme)
|
|
|
|
{
|
|
|
|
provider = new OverlayColourProvider(colourScheme);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|