mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 06:03:08 +08:00
Make it possible to change colours before load()
This commit is contained in:
parent
bbd1a7059e
commit
44141a38b8
@ -17,10 +17,15 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
{
|
{
|
||||||
private const float button_size = 30;
|
private const float button_size = 30;
|
||||||
|
|
||||||
|
private Color4? flashColour;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The colour that should be flashed when the <see cref="IconButton"/> is clicked.
|
/// The colour that should be flashed when the <see cref="IconButton"/> is clicked.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Color4 FlashColour;
|
public Color4 FlashColour
|
||||||
|
{
|
||||||
|
get { return flashColour ?? Color4.White; }
|
||||||
|
set { flashColour = value; }
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The icon colour. This does not affect <see cref="IconButton.Colour"/>.
|
/// The icon colour. This does not affect <see cref="IconButton.Colour"/>.
|
||||||
@ -31,6 +36,20 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
set { icon.Colour = value; }
|
set { icon.Colour = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Color4? hoverColour;
|
||||||
|
/// <summary>
|
||||||
|
/// The background colour of the <see cref="IconButton"/> while it is hovered.
|
||||||
|
/// </summary>
|
||||||
|
public Color4 HoverColour
|
||||||
|
{
|
||||||
|
get { return hoverColour ?? Color4.White; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
hoverColour = value;
|
||||||
|
hover.Colour = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The icon.
|
/// The icon.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -58,16 +77,6 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
set { content.Size = value; }
|
set { content.Size = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The background colour of the <see cref="IconButton"/> while it is hovered.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public Color4 HoverColour
|
|
||||||
{
|
|
||||||
get { return hover.Colour; }
|
|
||||||
set { hover.Colour = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly Container content;
|
private readonly Container content;
|
||||||
private readonly SpriteIcon icon;
|
private readonly SpriteIcon icon;
|
||||||
private readonly Box hover;
|
private readonly Box hover;
|
||||||
@ -112,8 +121,11 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
HoverColour = colours.Yellow.Opacity(0.6f);
|
if (hoverColour == null)
|
||||||
FlashColour = colours.Yellow;
|
hoverColour = colours.Yellow.Opacity(0.6f);
|
||||||
|
|
||||||
|
if (flashColour == null)
|
||||||
|
flashColour = colours.Yellow;
|
||||||
|
|
||||||
Enabled.ValueChanged += enabled => this.FadeColour(enabled ? Color4.White : colours.Gray9, 200, Easing.OutQuint);
|
Enabled.ValueChanged += enabled => this.FadeColour(enabled ? Color4.White : colours.Gray9, 200, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user