1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 02:32:55 +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,126 +48,138 @@ 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;
EdgeEffect = new EdgeEffectParameters
{ {
Type = EdgeEffectType.Shadow, RelativeSizeAxes = Axes.Both,
Colour = Color4.Black.Opacity(0.25f), Masking = true,
Radius = 4, CornerRadius = 5,
}; EdgeEffect = new EdgeEffectParameters
Children = new Drawable[]
{
new DelayedLoadWrapper(new UserCoverBackground(user)
{ {
RelativeSizeAxes = Axes.Both, Type = EdgeEffectType.Shadow,
Anchor = Anchor.Centre, Colour = Color4.Black.Opacity(0.25f),
Origin = Anchor.Centre, Radius = 4,
FillMode = FillMode.Fill,
OnLoadComplete = d => d.FadeInFromZero(400, Easing.Out)
}, 300) { RelativeSizeAxes = Axes.Both },
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black.Opacity(0.7f),
}, },
new Container
Children = new Drawable[]
{ {
RelativeSizeAxes = Axes.X, new DelayedLoadWrapper(new UserCoverBackground(user)
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Top = content_padding, Horizontal = content_padding },
Children = new Drawable[]
{ {
new UpdateableAvatar RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
FillMode = FillMode.Fill,
OnLoadComplete = d => d.FadeInFromZero(400, Easing.Out)
}, 300) { RelativeSizeAxes = Axes.Both },
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black.Opacity(0.7f),
},
new Container
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Top = content_padding, Horizontal = content_padding },
Children = new Drawable[]
{ {
Size = new Vector2(height - status_height - content_padding * 2), new UpdateableAvatar
User = user,
Masking = true,
CornerRadius = 5,
EdgeEffect = new EdgeEffectParameters
{ {
Type = EdgeEffectType.Shadow, Size = new Vector2(height - status_height - content_padding * 2),
Colour = Color4.Black.Opacity(0.25f), User = user,
Radius = 4, Masking = true,
}, CornerRadius = 5,
}, EdgeEffect = new EdgeEffectParameters
new Container
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Left = height - status_height - content_padding },
Children = new Drawable[]
{
new OsuSpriteText
{ {
Text = user.Username, Type = EdgeEffectType.Shadow,
TextSize = 18, Colour = Color4.Black.Opacity(0.25f),
Font = @"Exo2.0-SemiBoldItalic", Radius = 4,
}, },
infoContainer = new FillFlowContainer },
new Container
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Left = height - status_height - content_padding },
Children = new Drawable[]
{ {
Anchor = Anchor.BottomLeft, new OsuSpriteText
Origin = Anchor.BottomLeft,
AutoSizeAxes = Axes.X,
Height = 20f,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(5f, 0f),
Children = new Drawable[]
{ {
new DrawableFlag(user.Country) Text = user.Username,
TextSize = 18,
Font = @"Exo2.0-SemiBoldItalic",
},
infoContainer = new FillFlowContainer
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
AutoSizeAxes = Axes.X,
Height = 20f,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(5f, 0f),
Children = new Drawable[]
{ {
Width = 30f, new DrawableFlag(user.Country)
RelativeSizeAxes = Axes.Y, {
Width = 30f,
RelativeSizeAxes = Axes.Y,
},
}, },
}, },
}, },
}, },
}, },
}, },
}, statusBar = new Container
statusBar = new Container
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
RelativeSizeAxes = Axes.X,
Alpha = 0f,
Children = new Drawable[]
{ {
statusBg = new Box Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
RelativeSizeAxes = Axes.X,
Alpha = 0f,
Children = new Drawable[]
{ {
RelativeSizeAxes = Axes.Both, statusBg = new Box
Alpha = 0.5f,
},
new FillFlowContainer
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
AutoSizeAxes = Axes.Both,
Spacing = new Vector2(5f, 0f),
Children = new Drawable[]
{ {
new SpriteIcon RelativeSizeAxes = Axes.Both,
Alpha = 0.5f,
},
new FillFlowContainer
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
AutoSizeAxes = Axes.Both,
Spacing = new Vector2(5f, 0f),
Children = new Drawable[]
{ {
Anchor = Anchor.CentreLeft, new SpriteIcon
Origin = Anchor.CentreLeft, {
Icon = FontAwesome.fa_circle_o, Anchor = Anchor.CentreLeft,
Shadow = true, Origin = Anchor.CentreLeft,
Size = new Vector2(14), Icon = FontAwesome.fa_circle_o,
}, Shadow = true,
statusMessage = new OsuSpriteText Size = new Vector2(14),
{ },
Anchor = Anchor.CentreLeft, statusMessage = new OsuSpriteText
Origin = Anchor.CentreLeft, {
Font = @"Exo2.0-Semibold", Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Font = @"Exo2.0-Semibold",
},
}, },
}, },
}, },
}, },
}, }
}; });
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);