1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 04:07:25 +08:00

added hover effects to panels in social

at least partially QQ
This commit is contained in:
Aergwyn 2018-01-04 11:41:06 +01:00
parent d0c9d71ee7
commit bf64b8fc69
8 changed files with 123 additions and 17 deletions

View File

@ -13,8 +13,12 @@ namespace osu.Game.Tests.Visual
{
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(UserPanel),
typeof(SocialPanel),
typeof(FilterControl),
typeof(SocialOverlay)
typeof(SocialOverlay),
typeof(SocialGridPanel),
typeof(SocialListPanel)
};
public TestCaseSocial()

View File

@ -0,0 +1,15 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Users;
namespace osu.Game.Overlays.Social
{
public class SocialGridPanel : SocialPanel
{
public SocialGridPanel(User user) : base(user)
{
Width = 300;
}
}
}

View File

@ -0,0 +1,16 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
using osu.Game.Users;
namespace osu.Game.Overlays.Social
{
public class SocialListPanel : SocialPanel
{
public SocialListPanel(User user) : base(user)
{
RelativeSizeAxes = Axes.X;
}
}
}

View File

@ -0,0 +1,60 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// 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)
{
TweenEdgeEffectTo(edgeEffectHovered, hover_transition_time, Easing.OutQuint);
//Content.MoveToY(-4, hover_transition_time, Easing.OutQuint);
return base.OnHover(state);
}
protected override void OnHoverLost(InputState state)
{
TweenEdgeEffectTo(edgeEffectNormal, hover_transition_time, Easing.OutQuint);
//Content.MoveToY(0, hover_transition_time, Easing.OutQuint);
base.OnHoverLost(state);
}
protected override void LoadComplete()
{
base.LoadComplete();
this.FadeInFromZero(200, Easing.Out);
}
}
}

View File

@ -22,7 +22,7 @@ namespace osu.Game.Overlays
{
private APIAccess api;
private readonly LoadingAnimation loading;
private FillFlowContainer<UserPanel> panels;
private FillFlowContainer<SocialPanel> panels;
protected override Color4 BackgroundColour => OsuColour.FromHex(@"60284b");
protected override Color4 TrianglesColourLight => OsuColour.FromHex(@"672b51");
@ -121,7 +121,7 @@ namespace osu.Game.Overlays
if (Users == null)
return;
var newPanels = new FillFlowContainer<UserPanel>
var newPanels = new FillFlowContainer<SocialPanel>
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
@ -129,18 +129,18 @@ namespace osu.Game.Overlays
Margin = new MarginPadding { Top = 10 },
ChildrenEnumerable = Users.Select(u =>
{
UserPanel panel = new UserPanel(u)
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre
};
SocialPanel panel;
switch (displayStyle)
{
case PanelDisplayStyle.Grid:
panel.Width = 300;
panel = new SocialGridPanel(u)
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre
};
break;
default:
panel.RelativeSizeAxes = Axes.X;
panel = new SocialListPanel(u);
break;
}
panel.Status.BindTo(u.Status);
@ -148,14 +148,20 @@ namespace osu.Game.Overlays
})
};
LoadComponentAsync(newPanels, p => ScrollFlow.Add(panels = newPanels));
LoadComponentAsync(newPanels, p =>
{
if(panels != null)
ScrollFlow.Remove(panels);
ScrollFlow.Add(panels = newPanels);
});
}
private void clearPanels()
{
if (panels != null)
{
ScrollFlow.Remove(panels);
panels.FadeOut(200);
panels.Expire();
panels = null;
}
@ -185,7 +191,7 @@ namespace osu.Game.Overlays
switch (Header.Tabs.Current.Value)
{
case SocialTab.OnlineFriends:
var friendRequest = new GetFriendsRequest(); // TODO filter???
var friendRequest = new GetFriendsRequest();
friendRequest.Success += updateUsers;
api.Queue(getUsersRequest = friendRequest);
break;

View File

@ -44,7 +44,7 @@ namespace osu.Game.Users
new Avatar(user)
{
RelativeSizeAxes = Axes.Both,
OnLoadComplete = d => d.FadeInFromZero(200),
OnLoadComplete = d => d.FadeInFromZero(400, Easing.Out),
})
);
}

View File

@ -65,8 +65,8 @@ namespace osu.Game.Users
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
FillMode = FillMode.Fill,
OnLoadComplete = d => d.FadeInFromZero(200),
}, 0) { RelativeSizeAxes = Axes.Both },
OnLoadComplete = d => d.FadeInFromZero(400, Easing.Out)
}, 300) { RelativeSizeAxes = Axes.Both },
new Box
{
RelativeSizeAxes = Axes.Both,
@ -76,7 +76,7 @@ namespace osu.Game.Users
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Top = content_padding, Left = content_padding, Right = content_padding },
Padding = new MarginPadding { Top = content_padding, Horizontal = content_padding },
Children = new Drawable[]
{
new UpdateableAvatar
@ -167,11 +167,13 @@ namespace osu.Game.Users
};
if (user.IsSupporter)
{
infoContainer.Add(new SupporterIcon
{
RelativeSizeAxes = Axes.Y,
Width = 20f,
});
}
}
[BackgroundDependencyLoader(permitNulls: true)]

View File

@ -311,6 +311,9 @@
<Compile Include="Overlays\Profile\Sections\Ranks\DrawableTotalScore.cs" />
<Compile Include="Overlays\Profile\Sections\Ranks\ScoreModsContainer.cs" />
<Compile Include="Overlays\Settings\Sections\Maintenance\DeleteAllBeatmapsDialog.cs" />
<Compile Include="Overlays\Social\SocialGridPanel.cs" />
<Compile Include="Overlays\Social\SocialListPanel.cs" />
<Compile Include="Overlays\Social\SocialPanel.cs" />
<Compile Include="Rulesets\Mods\IApplicableToDrawableHitObject.cs" />
<Compile Include="Screens\Select\ImportFromStablePopup.cs" />
<Compile Include="Overlays\Settings\SettingsButton.cs" />