Switch Colour{Display,Palette} to use Colour4

This commit is contained in:
Bartłomiej Dach 2021-06-20 19:37:09 +02:00
parent e3e36e0a12
commit 0691c0dd63
No known key found for this signature in database
GPG Key ID: BCECCD4FA41F6497
5 changed files with 13 additions and 15 deletions

View File

@ -53,15 +53,15 @@ namespace osu.Game.Tests.Visual.UserInterface
component.Colours.AddRange(new[]
{
Color4.DarkRed,
Color4.Aquamarine,
Color4.Goldenrod,
Color4.Gainsboro
Colour4.DarkRed,
Colour4.Aquamarine,
Colour4.Goldenrod,
Colour4.Gainsboro
});
});
}
private Color4 randomColour() => new Color4(
private Colour4 randomColour() => new Color4(
RNG.NextSingle(),
RNG.NextSingle(),
RNG.NextSingle(),

View File

@ -3,7 +3,6 @@
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
@ -11,22 +10,21 @@ using osu.Framework.Graphics.UserInterface;
using osu.Framework.Localisation;
using osu.Game.Graphics.Sprites;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Graphics.UserInterfaceV2
{
/// <summary>
/// A component which displays a colour along with related description text.
/// </summary>
public class ColourDisplay : CompositeDrawable, IHasCurrentValue<Color4>
public class ColourDisplay : CompositeDrawable, IHasCurrentValue<Colour4>
{
private readonly BindableWithCurrent<Color4> current = new BindableWithCurrent<Color4>();
private readonly BindableWithCurrent<Colour4> current = new BindableWithCurrent<Colour4>();
private Box fill;
private OsuSpriteText colourHexCode;
private OsuSpriteText colourName;
public Bindable<Color4> Current
public Bindable<Colour4> Current
{
get => current.Current;
set => current.Current = value;

View File

@ -8,7 +8,6 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Graphics.UserInterfaceV2
{
@ -17,7 +16,7 @@ namespace osu.Game.Graphics.UserInterfaceV2
/// </summary>
public class ColourPalette : CompositeDrawable
{
public BindableList<Color4> Colours { get; } = new BindableList<Color4>();
public BindableList<Colour4> Colours { get; } = new BindableList<Colour4>();
private string colourNamePrefix = "Colour";

View File

@ -2,7 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Bindables;
using osuTK.Graphics;
using osu.Framework.Graphics;
namespace osu.Game.Graphics.UserInterfaceV2
{
@ -13,7 +13,7 @@ namespace osu.Game.Graphics.UserInterfaceV2
{
}
public BindableList<Color4> Colours => Component.Colours;
public BindableList<Colour4> Colours => Component.Colours;
public string ColourNamePrefix
{

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Localisation;
@ -32,7 +33,7 @@ namespace osu.Game.Screens.Edit.Setup
var colours = Beatmap.BeatmapSkin?.GetConfig<GlobalSkinColours, IReadOnlyList<Color4>>(GlobalSkinColours.ComboColours)?.Value;
if (colours != null)
comboColours.Colours.AddRange(colours);
comboColours.Colours.AddRange(colours.Select(c => (Colour4)c));
}
}
}