Add gradient overlay when hovering toolbar to make tooltips more visible.

Also adjusts opacity of toolbar.
This commit is contained in:
Dean Herbert 2016-11-15 16:25:41 +09:00
parent 4b6c139c3e
commit 566e09083f
2 changed files with 30 additions and 2 deletions

View File

@ -12,8 +12,10 @@
using osu.Game.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Colour;
using osu.Game.Modes;
using osu.Game.Screens.Play;
using osu.Framework.Input;
namespace osu.Game.Overlays
{
@ -28,6 +30,7 @@ public class Toolbar : OverlayContainer
private ToolbarModeSelector modeSelector;
private ToolbarButton userButton;
private Box gradientBackground;
private const int transition_time = 200;
@ -43,6 +46,18 @@ protected override void PopOut()
FadeOut(transition_time, EasingTypes.InQuint);
}
protected override bool OnHover(InputState state)
{
gradientBackground.FadeIn(200);
return base.OnHover(state);
}
protected override void OnHoverLost(InputState state)
{
gradientBackground.FadeOut(200);
base.OnHoverLost(state);
}
public Toolbar()
{
Children = new Drawable[]
@ -50,7 +65,20 @@ public Toolbar()
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = new Color4(0.1f, 0.1f, 0.1f, 0.4f)
Colour = new Color4(0.1f, 0.1f, 0.1f, 0.6f)
},
gradientBackground = new Box
{
RelativeSizeAxes = Axes.X,
Anchor = Anchor.BottomLeft,
Alpha = 0,
Height = 90,
ColourInfo = new ColourInfo {
TopLeft = new Color4(0.1f, 0.1f, 0.1f, 0.5f),
TopRight = new Color4(0.1f, 0.1f, 0.1f, 0.5f),
BottomLeft = new Color4(0.1f, 0.1f, 0.1f, 0f),
BottomRight = new Color4(0.1f, 0.1f, 0.1f, 0f),
},
},
new FlowContainer
{

View File

@ -138,7 +138,7 @@ protected override bool OnHover(InputState state)
{
HoverBackground.FadeTo(0.4f, 200);
tooltipContainer.FadeIn(100);
return true;
return false;
}
protected override void OnHoverLost(InputState state)