2018-01-06 17:54:53 +08:00
|
|
|
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
2018-01-04 18:41:06 +08:00
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
|
|
|
|
using OpenTK;
|
|
|
|
|
using OpenTK.Graphics;
|
|
|
|
|
using osu.Framework.Extensions.Color4Extensions;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Input;
|
|
|
|
|
using osu.Game.Users;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Overlays.Social
|
|
|
|
|
{
|
|
|
|
|
public class SocialPanel : UserPanel
|
|
|
|
|
{
|
|
|
|
|
private const double hover_transition_time = 400;
|
|
|
|
|
|
|
|
|
|
public SocialPanel(User user) : base(user)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private readonly EdgeEffectParameters edgeEffectNormal = new EdgeEffectParameters
|
|
|
|
|
{
|
|
|
|
|
Type = EdgeEffectType.Shadow,
|
|
|
|
|
Offset = new Vector2(0f, 1f),
|
|
|
|
|
Radius = 2f,
|
|
|
|
|
Colour = Color4.Black.Opacity(0.25f),
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
private readonly EdgeEffectParameters edgeEffectHovered = new EdgeEffectParameters
|
|
|
|
|
{
|
|
|
|
|
Type = EdgeEffectType.Shadow,
|
|
|
|
|
Offset = new Vector2(0f, 5f),
|
|
|
|
|
Radius = 10f,
|
|
|
|
|
Colour = Color4.Black.Opacity(0.3f),
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
protected override bool OnHover(InputState state)
|
|
|
|
|
{
|
2018-01-06 18:27:17 +08:00
|
|
|
|
Content.TweenEdgeEffectTo(edgeEffectHovered, hover_transition_time, Easing.OutQuint);
|
|
|
|
|
Content.MoveToY(-4, hover_transition_time, Easing.OutQuint);
|
2018-01-04 18:41:06 +08:00
|
|
|
|
|
|
|
|
|
return base.OnHover(state);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnHoverLost(InputState state)
|
|
|
|
|
{
|
2018-01-06 18:27:17 +08:00
|
|
|
|
Content.TweenEdgeEffectTo(edgeEffectNormal, hover_transition_time, Easing.OutQuint);
|
|
|
|
|
Content.MoveToY(0, hover_transition_time, Easing.OutQuint);
|
2018-01-04 18:41:06 +08:00
|
|
|
|
|
|
|
|
|
base.OnHoverLost(state);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void LoadComplete()
|
|
|
|
|
{
|
|
|
|
|
base.LoadComplete();
|
|
|
|
|
this.FadeInFromZero(200, Easing.Out);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|