From 566e09083f06b87591c7745d82adf0d831a6066f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 15 Nov 2016 16:25:41 +0900 Subject: [PATCH] Add gradient overlay when hovering toolbar to make tooltips more visible. Also adjusts opacity of toolbar. --- osu.Game/Overlays/Toolbar.cs | 30 +++++++++++++++++++++++++++++- osu.Game/Overlays/ToolbarButton.cs | 2 +- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Toolbar.cs b/osu.Game/Overlays/Toolbar.cs index 0e343a05dd..1af23757f0 100644 --- a/osu.Game/Overlays/Toolbar.cs +++ b/osu.Game/Overlays/Toolbar.cs @@ -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 { diff --git a/osu.Game/Overlays/ToolbarButton.cs b/osu.Game/Overlays/ToolbarButton.cs index d03ed8061b..04925b044f 100644 --- a/osu.Game/Overlays/ToolbarButton.cs +++ b/osu.Game/Overlays/ToolbarButton.cs @@ -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)