mirror of
https://github.com/ppy/osu.git
synced 2025-01-29 06:43:02 +08:00
added hover effects to panels in social
at least partially QQ
This commit is contained in:
parent
d0c9d71ee7
commit
bf64b8fc69
@ -13,8 +13,12 @@ namespace osu.Game.Tests.Visual
|
|||||||
{
|
{
|
||||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||||
{
|
{
|
||||||
|
typeof(UserPanel),
|
||||||
|
typeof(SocialPanel),
|
||||||
typeof(FilterControl),
|
typeof(FilterControl),
|
||||||
typeof(SocialOverlay)
|
typeof(SocialOverlay),
|
||||||
|
typeof(SocialGridPanel),
|
||||||
|
typeof(SocialListPanel)
|
||||||
};
|
};
|
||||||
|
|
||||||
public TestCaseSocial()
|
public TestCaseSocial()
|
||||||
|
15
osu.Game/Overlays/Social/SocialGridPanel.cs
Normal file
15
osu.Game/Overlays/Social/SocialGridPanel.cs
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
16
osu.Game/Overlays/Social/SocialListPanel.cs
Normal file
16
osu.Game/Overlays/Social/SocialListPanel.cs
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
60
osu.Game/Overlays/Social/SocialPanel.cs
Normal file
60
osu.Game/Overlays/Social/SocialPanel.cs
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -22,7 +22,7 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
private APIAccess api;
|
private APIAccess api;
|
||||||
private readonly LoadingAnimation loading;
|
private readonly LoadingAnimation loading;
|
||||||
private FillFlowContainer<UserPanel> panels;
|
private FillFlowContainer<SocialPanel> panels;
|
||||||
|
|
||||||
protected override Color4 BackgroundColour => OsuColour.FromHex(@"60284b");
|
protected override Color4 BackgroundColour => OsuColour.FromHex(@"60284b");
|
||||||
protected override Color4 TrianglesColourLight => OsuColour.FromHex(@"672b51");
|
protected override Color4 TrianglesColourLight => OsuColour.FromHex(@"672b51");
|
||||||
@ -121,7 +121,7 @@ namespace osu.Game.Overlays
|
|||||||
if (Users == null)
|
if (Users == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var newPanels = new FillFlowContainer<UserPanel>
|
var newPanels = new FillFlowContainer<SocialPanel>
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
@ -129,18 +129,18 @@ namespace osu.Game.Overlays
|
|||||||
Margin = new MarginPadding { Top = 10 },
|
Margin = new MarginPadding { Top = 10 },
|
||||||
ChildrenEnumerable = Users.Select(u =>
|
ChildrenEnumerable = Users.Select(u =>
|
||||||
{
|
{
|
||||||
UserPanel panel = new UserPanel(u)
|
SocialPanel panel;
|
||||||
|
switch (displayStyle)
|
||||||
|
{
|
||||||
|
case PanelDisplayStyle.Grid:
|
||||||
|
panel = new SocialGridPanel(u)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Origin = Anchor.TopCentre
|
Origin = Anchor.TopCentre
|
||||||
};
|
};
|
||||||
switch (displayStyle)
|
|
||||||
{
|
|
||||||
case PanelDisplayStyle.Grid:
|
|
||||||
panel.Width = 300;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
panel.RelativeSizeAxes = Axes.X;
|
panel = new SocialListPanel(u);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
panel.Status.BindTo(u.Status);
|
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()
|
private void clearPanels()
|
||||||
{
|
{
|
||||||
if (panels != null)
|
if (panels != null)
|
||||||
{
|
{
|
||||||
ScrollFlow.Remove(panels);
|
panels.FadeOut(200);
|
||||||
panels.Expire();
|
panels.Expire();
|
||||||
panels = null;
|
panels = null;
|
||||||
}
|
}
|
||||||
@ -185,7 +191,7 @@ namespace osu.Game.Overlays
|
|||||||
switch (Header.Tabs.Current.Value)
|
switch (Header.Tabs.Current.Value)
|
||||||
{
|
{
|
||||||
case SocialTab.OnlineFriends:
|
case SocialTab.OnlineFriends:
|
||||||
var friendRequest = new GetFriendsRequest(); // TODO filter???
|
var friendRequest = new GetFriendsRequest();
|
||||||
friendRequest.Success += updateUsers;
|
friendRequest.Success += updateUsers;
|
||||||
api.Queue(getUsersRequest = friendRequest);
|
api.Queue(getUsersRequest = friendRequest);
|
||||||
break;
|
break;
|
||||||
|
@ -44,7 +44,7 @@ namespace osu.Game.Users
|
|||||||
new Avatar(user)
|
new Avatar(user)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
OnLoadComplete = d => d.FadeInFromZero(200),
|
OnLoadComplete = d => d.FadeInFromZero(400, Easing.Out),
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -65,8 +65,8 @@ namespace osu.Game.Users
|
|||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
FillMode = FillMode.Fill,
|
FillMode = FillMode.Fill,
|
||||||
OnLoadComplete = d => d.FadeInFromZero(200),
|
OnLoadComplete = d => d.FadeInFromZero(400, Easing.Out)
|
||||||
}, 0) { RelativeSizeAxes = Axes.Both },
|
}, 300) { RelativeSizeAxes = Axes.Both },
|
||||||
new Box
|
new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
@ -76,7 +76,7 @@ namespace osu.Game.Users
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
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[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new UpdateableAvatar
|
new UpdateableAvatar
|
||||||
@ -167,12 +167,14 @@ namespace osu.Game.Users
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (user.IsSupporter)
|
if (user.IsSupporter)
|
||||||
|
{
|
||||||
infoContainer.Add(new SupporterIcon
|
infoContainer.Add(new SupporterIcon
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Y,
|
RelativeSizeAxes = Axes.Y,
|
||||||
Width = 20f,
|
Width = 20f,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader(permitNulls: true)]
|
[BackgroundDependencyLoader(permitNulls: true)]
|
||||||
private void load(OsuColour colours, UserProfileOverlay profile)
|
private void load(OsuColour colours, UserProfileOverlay profile)
|
||||||
|
@ -311,6 +311,9 @@
|
|||||||
<Compile Include="Overlays\Profile\Sections\Ranks\DrawableTotalScore.cs" />
|
<Compile Include="Overlays\Profile\Sections\Ranks\DrawableTotalScore.cs" />
|
||||||
<Compile Include="Overlays\Profile\Sections\Ranks\ScoreModsContainer.cs" />
|
<Compile Include="Overlays\Profile\Sections\Ranks\ScoreModsContainer.cs" />
|
||||||
<Compile Include="Overlays\Settings\Sections\Maintenance\DeleteAllBeatmapsDialog.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="Rulesets\Mods\IApplicableToDrawableHitObject.cs" />
|
||||||
<Compile Include="Screens\Select\ImportFromStablePopup.cs" />
|
<Compile Include="Screens\Select\ImportFromStablePopup.cs" />
|
||||||
<Compile Include="Overlays\Settings\SettingsButton.cs" />
|
<Compile Include="Overlays\Settings\SettingsButton.cs" />
|
||||||
|
Loading…
Reference in New Issue
Block a user