mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Add support for custom colour prefixes
This commit is contained in:
@ -25,6 +25,8 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
if (component.Colours.Count > 0)
|
if (component.Colours.Count > 0)
|
||||||
component.Colours.RemoveAt(RNG.Next(component.Colours.Count));
|
component.Colours.RemoveAt(RNG.Next(component.Colours.Count));
|
||||||
}, 5);
|
}, 5);
|
||||||
|
|
||||||
|
AddStep("set custom prefix", () => component.ColourNamePrefix = "Combo");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createColourPalette(bool hasDescription = false)
|
private void createColourPalette(bool hasDescription = false)
|
||||||
@ -41,6 +43,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
|
ColourNamePrefix = "My colour #"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -14,6 +14,23 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
|||||||
{
|
{
|
||||||
public BindableList<Color4> Colours { get; } = new BindableList<Color4>();
|
public BindableList<Color4> Colours { get; } = new BindableList<Color4>();
|
||||||
|
|
||||||
|
private string colourNamePrefix = "Colour";
|
||||||
|
|
||||||
|
public string ColourNamePrefix
|
||||||
|
{
|
||||||
|
get => colourNamePrefix;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (colourNamePrefix == value)
|
||||||
|
return;
|
||||||
|
|
||||||
|
colourNamePrefix = value;
|
||||||
|
|
||||||
|
if (IsLoaded)
|
||||||
|
reindexItems();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private FillFlowContainer<ColourDisplay> palette;
|
private FillFlowContainer<ColourDisplay> palette;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -59,7 +76,7 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
|||||||
|
|
||||||
foreach (var colour in palette)
|
foreach (var colour in palette)
|
||||||
{
|
{
|
||||||
colour.ColourName = $"Colour {index}";
|
colour.ColourName = $"{colourNamePrefix} {index}";
|
||||||
index += 1;
|
index += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,12 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
|||||||
|
|
||||||
public BindableList<Color4> Colours => Component.Colours;
|
public BindableList<Color4> Colours => Component.Colours;
|
||||||
|
|
||||||
|
public string ColourNamePrefix
|
||||||
|
{
|
||||||
|
get => Component.ColourNamePrefix;
|
||||||
|
set => Component.ColourNamePrefix = value;
|
||||||
|
}
|
||||||
|
|
||||||
protected override ColourPalette CreateComponent() => new ColourPalette();
|
protected override ColourPalette CreateComponent() => new ColourPalette();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user