mirror of
https://github.com/ppy/osu
synced 2025-02-04 04:11:54 +00:00
Fix RestoreDefaultValueButton
's colour weirdness
This commit is contained in:
parent
212842c537
commit
bc86bafc08
@ -36,6 +36,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
public Color4 BackgroundColour
|
public Color4 BackgroundColour
|
||||||
{
|
{
|
||||||
|
get => backgroundColour ?? Color4.White;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
backgroundColour = value;
|
backgroundColour = value;
|
||||||
|
@ -45,8 +45,6 @@ namespace osu.Game.Overlays
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Color4 buttonColour;
|
|
||||||
|
|
||||||
private bool hovering;
|
private bool hovering;
|
||||||
|
|
||||||
public RestoreDefaultValueButton()
|
public RestoreDefaultValueButton()
|
||||||
@ -61,12 +59,11 @@ namespace osu.Game.Overlays
|
|||||||
private void load(OsuColour colour)
|
private void load(OsuColour colour)
|
||||||
{
|
{
|
||||||
BackgroundColour = colour.Yellow;
|
BackgroundColour = colour.Yellow;
|
||||||
buttonColour = colour.Yellow;
|
|
||||||
Content.Width = 0.33f;
|
Content.Width = 0.33f;
|
||||||
Content.CornerRadius = 3;
|
Content.CornerRadius = 3;
|
||||||
Content.EdgeEffect = new EdgeEffectParameters
|
Content.EdgeEffect = new EdgeEffectParameters
|
||||||
{
|
{
|
||||||
Colour = buttonColour.Opacity(0.1f),
|
Colour = BackgroundColour.Opacity(0.1f),
|
||||||
Type = EdgeEffectType.Glow,
|
Type = EdgeEffectType.Glow,
|
||||||
Radius = 2,
|
Radius = 2,
|
||||||
};
|
};
|
||||||
@ -87,7 +84,7 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
// avoid unnecessary transforms on first display.
|
// avoid unnecessary transforms on first display.
|
||||||
Alpha = currentAlpha;
|
Alpha = currentAlpha;
|
||||||
Colour = currentColour;
|
Background.Colour = currentColour;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LocalisableString TooltipText => "revert to default";
|
public LocalisableString TooltipText => "revert to default";
|
||||||
@ -108,7 +105,7 @@ namespace osu.Game.Overlays
|
|||||||
public void UpdateState() => Scheduler.AddOnce(updateState);
|
public void UpdateState() => Scheduler.AddOnce(updateState);
|
||||||
|
|
||||||
private float currentAlpha => current.IsDefault ? 0f : hovering && !current.Disabled ? 1f : 0.65f;
|
private float currentAlpha => current.IsDefault ? 0f : hovering && !current.Disabled ? 1f : 0.65f;
|
||||||
private ColourInfo currentColour => current.Disabled ? Color4.Gray : buttonColour;
|
private ColourInfo currentColour => current.Disabled ? Color4.Gray : BackgroundColour;
|
||||||
|
|
||||||
private void updateState()
|
private void updateState()
|
||||||
{
|
{
|
||||||
@ -116,7 +113,7 @@ namespace osu.Game.Overlays
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
this.FadeTo(currentAlpha, 200, Easing.OutQuint);
|
this.FadeTo(currentAlpha, 200, Easing.OutQuint);
|
||||||
this.FadeColour(currentColour, 200, Easing.OutQuint);
|
Background.FadeColour(currentColour, 200, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user