1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 04:02:57 +08:00

Reduce animations of osu!direct list mode

The panels' content was flying around and felt really shocking. This fixes elements in place to provide a better experience.
This commit is contained in:
Dean Herbert 2018-08-05 14:36:09 +09:00
parent 78eabce35a
commit 6d6fea47ab
2 changed files with 43 additions and 39 deletions

View File

@ -12,7 +12,6 @@ using osu.Game.Graphics.Sprites;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Localisation; using osu.Framework.Localisation;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.States;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
namespace osu.Game.Overlays.Direct namespace osu.Game.Overlays.Direct
@ -26,12 +25,14 @@ namespace osu.Game.Overlays.Direct
private PlayButton playButton; private PlayButton playButton;
private Box progressBar; private Box progressBar;
private Container downloadContainer;
protected override bool FadePlayButton => false;
protected override PlayButton PlayButton => playButton; protected override PlayButton PlayButton => playButton;
protected override Box PreviewBar => progressBar; protected override Box PreviewBar => progressBar;
public DirectListPanel(BeatmapSetInfo beatmap) : base(beatmap) public DirectListPanel(BeatmapSetInfo beatmap)
: base(beatmap)
{ {
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
Height = height; Height = height;
@ -66,30 +67,45 @@ namespace osu.Game.Overlays.Direct
Spacing = new Vector2(10, 0), Spacing = new Vector2(10, 0),
Children = new Drawable[] Children = new Drawable[]
{ {
playButton = new PlayButton(SetInfo)
{
Origin = Anchor.CentreLeft,
Anchor = Anchor.CentreLeft,
Size = new Vector2(height / 2),
FillMode = FillMode.Fit,
Alpha = 0,
},
new FillFlowContainer new FillFlowContainer
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
Children = new Drawable[] Children = new Drawable[]
{ {
new OsuSpriteText new FillFlowContainer
{ {
Current = localisation.GetUnicodePreference(SetInfo.Metadata.TitleUnicode, SetInfo.Metadata.Title), AutoSizeAxes = Axes.Both,
TextSize = 18, Direction = FillDirection.Horizontal,
Font = @"Exo2.0-BoldItalic", Children = new Drawable[]
}, {
new OsuSpriteText playButton = new PlayButton(SetInfo)
{ {
Current = localisation.GetUnicodePreference(SetInfo.Metadata.ArtistUnicode, SetInfo.Metadata.Artist), Origin = Anchor.CentreLeft,
Font = @"Exo2.0-BoldItalic", Anchor = Anchor.CentreLeft,
Size = new Vector2(height / 2),
FillMode = FillMode.Fit,
},
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
new OsuSpriteText
{
Current = localisation.GetUnicodePreference(SetInfo.Metadata.TitleUnicode, SetInfo.Metadata.Title),
TextSize = 18,
Font = @"Exo2.0-BoldItalic",
},
new OsuSpriteText
{
Current = localisation.GetUnicodePreference(SetInfo.Metadata.ArtistUnicode, SetInfo.Metadata.Artist),
Font = @"Exo2.0-BoldItalic",
},
}
},
}
}, },
new FillFlowContainer new FillFlowContainer
{ {
@ -108,16 +124,13 @@ namespace osu.Game.Overlays.Direct
Origin = Anchor.TopRight, Origin = Anchor.TopRight,
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal, Direction = FillDirection.Horizontal,
LayoutEasing = Easing.OutQuint,
LayoutDuration = transition_duration,
Children = new Drawable[] Children = new Drawable[]
{ {
downloadContainer = new Container new Container
{ {
Anchor = Anchor.TopRight, Anchor = Anchor.CentreRight,
Origin = Anchor.TopRight, Origin = Anchor.CentreRight,
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Alpha = 0,
Child = new DownloadButton(SetInfo) Child = new DownloadButton(SetInfo)
{ {
Size = new Vector2(height - vertical_padding * 3), Size = new Vector2(height - vertical_padding * 3),
@ -184,17 +197,5 @@ namespace osu.Game.Overlays.Direct
}, },
}); });
} }
protected override bool OnHover(InputState state)
{
downloadContainer.FadeIn(transition_duration, Easing.InOutQuint);
return base.OnHover(state);
}
protected override void OnHoverLost(InputState state)
{
downloadContainer.FadeOut(transition_duration, Easing.InOutQuint);
base.OnHoverLost(state);
}
} }
} }

View File

@ -40,6 +40,8 @@ namespace osu.Game.Overlays.Direct
protected abstract PlayButton PlayButton { get; } protected abstract PlayButton PlayButton { get; }
protected abstract Box PreviewBar { get; } protected abstract Box PreviewBar { get; }
protected virtual bool FadePlayButton => true;
protected override Container<Drawable> Content => content; protected override Container<Drawable> Content => content;
protected DirectPanel(BeatmapSetInfo setInfo) protected DirectPanel(BeatmapSetInfo setInfo)
@ -125,6 +127,7 @@ namespace osu.Game.Overlays.Direct
{ {
content.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);
if (FadePlayButton)
PlayButton.FadeIn(120, Easing.InOutQuint); PlayButton.FadeIn(120, Easing.InOutQuint);
return base.OnHover(state); return base.OnHover(state);
@ -134,7 +137,7 @@ namespace osu.Game.Overlays.Direct
{ {
content.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);
if (!PreviewPlaying) if (FadePlayButton && !PreviewPlaying)
PlayButton.FadeOut(120, Easing.InOutQuint); PlayButton.FadeOut(120, Easing.InOutQuint);
base.OnHoverLost(state); base.OnHoverLost(state);