1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 20:23:00 +08:00

fix hover effects on social panels

This commit is contained in:
Aergwyn 2018-01-06 11:27:17 +01:00
parent a61666d2a7
commit d9866a2052
2 changed files with 114 additions and 106 deletions

View File

@ -37,16 +37,16 @@ namespace osu.Game.Overlays.Social
protected override bool OnHover(InputState state) protected override bool OnHover(InputState state)
{ {
TweenEdgeEffectTo(edgeEffectHovered, hover_transition_time, Easing.OutQuint); Content.TweenEdgeEffectTo(edgeEffectHovered, hover_transition_time, Easing.OutQuint);
//Content.MoveToY(-4, hover_transition_time, Easing.OutQuint); Content.MoveToY(-4, hover_transition_time, Easing.OutQuint);
return base.OnHover(state); return base.OnHover(state);
} }
protected override void OnHoverLost(InputState state) protected override void OnHoverLost(InputState state)
{ {
TweenEdgeEffectTo(edgeEffectNormal, hover_transition_time, Easing.OutQuint); Content.TweenEdgeEffectTo(edgeEffectNormal, hover_transition_time, Easing.OutQuint);
//Content.MoveToY(0, hover_transition_time, Easing.OutQuint); Content.MoveToY(0, hover_transition_time, Easing.OutQuint);
base.OnHoverLost(state); base.OnHoverLost(state);
} }

View File

@ -28,9 +28,12 @@ namespace osu.Game.Users
private const float content_padding = 10; private const float content_padding = 10;
private const float status_height = 30; private const float status_height = 30;
private readonly Container statusBar; private Container statusBar;
private readonly Box statusBg; private Box statusBg;
private readonly OsuSpriteText statusMessage; private OsuSpriteText statusMessage;
private Container content;
protected override Container<Drawable> Content => content;
public readonly Bindable<UserStatus> Status = new Bindable<UserStatus>(); public readonly Bindable<UserStatus> Status = new Bindable<UserStatus>();
@ -45,17 +48,28 @@ namespace osu.Game.Users
this.user = user; this.user = user;
Height = height - status_height;
}
[BackgroundDependencyLoader(permitNulls: true)]
private void load(OsuColour colours, UserProfileOverlay profile)
{
if (colours == null)
throw new ArgumentNullException(nameof(colours));
FillFlowContainer infoContainer; FillFlowContainer infoContainer;
Height = height - status_height; AddInternal(content = new Container
Masking = true; {
CornerRadius = 5; RelativeSizeAxes = Axes.Both,
Masking = true,
CornerRadius = 5,
EdgeEffect = new EdgeEffectParameters EdgeEffect = new EdgeEffectParameters
{ {
Type = EdgeEffectType.Shadow, Type = EdgeEffectType.Shadow,
Colour = Color4.Black.Opacity(0.25f), Colour = Color4.Black.Opacity(0.25f),
Radius = 4, Radius = 4,
}; },
Children = new Drawable[] Children = new Drawable[]
{ {
@ -164,7 +178,8 @@ namespace osu.Game.Users
}, },
}, },
}, },
}; }
});
if (user.IsSupporter) if (user.IsSupporter)
{ {
@ -174,13 +189,6 @@ namespace osu.Game.Users
Width = 20f, Width = 20f,
}); });
} }
}
[BackgroundDependencyLoader(permitNulls: true)]
private void load(OsuColour colours, UserProfileOverlay profile)
{
if (colours == null)
throw new ArgumentNullException(nameof(colours));
Status.ValueChanged += displayStatus; Status.ValueChanged += displayStatus;
Status.ValueChanged += status => statusBg.FadeColour(status?.GetAppropriateColour(colours) ?? colours.Gray5, 500, Easing.OutQuint); Status.ValueChanged += status => statusBg.FadeColour(status?.GetAppropriateColour(colours) ?? colours.Gray5, 500, Easing.OutQuint);