Merge pull request #509 from peppy/fix-beatmap-options

Fix beatmap options overlay inconsistencies
This commit is contained in:
Thomas Müller 2017-03-19 09:37:59 +01:00 committed by GitHub
commit 139dd456fb
2 changed files with 16 additions and 11 deletions

View File

@ -1,7 +1,10 @@
// 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.Graphics;
using OpenTK.Input;
using osu.Framework.Screens.Testing;
using osu.Game.Graphics;
using osu.Game.Screens.Select.Options;
namespace osu.Desktop.VisualTests.Tests
@ -16,6 +19,11 @@ public override void Reset()
var overlay = new BeatmapOptionsOverlay();
overlay.AddButton(@"Remove", @"from unplayed", FontAwesome.fa_times_circle_o, Color4.Purple, null, Key.Number1);
overlay.AddButton(@"Clear", @"local scores", FontAwesome.fa_eraser, Color4.Purple, null, Key.Number2);
overlay.AddButton(@"Edit", @"Beatmap", FontAwesome.fa_pencil, Color4.Yellow, null, Key.Number3);
overlay.AddButton(@"Delete", @"Beatmap", FontAwesome.fa_trash, Color4.Pink, null, Key.Number4, float.MaxValue);
Add(overlay);
AddButton(@"Toggle", overlay.ToggleVisibility);

View File

@ -19,7 +19,8 @@ namespace osu.Game.Screens.Select.Options
public class BeatmapOptionsOverlay : FocusedOverlayContainer
{
private const float transition_duration = 500;
private const float x_position = 290;
private const float x_position = 0.2f;
private const float x_movement = 0.8f;
private const float height = 100;
@ -30,10 +31,10 @@ protected override void PopIn()
{
base.PopIn();
if (buttonsContainer.Position.X >= DrawWidth || buttonsContainer.Alpha <= 0)
buttonsContainer.MoveToX(-buttonsContainer.DrawWidth);
FadeIn(transition_duration, EasingTypes.OutQuint);
buttonsContainer.Alpha = 1;
if (buttonsContainer.Position.X == 1 || Alpha == 0)
buttonsContainer.MoveToX(x_position - x_movement);
holder.ScaleTo(new Vector2(1, 1), transition_duration / 2, EasingTypes.OutQuint);
@ -47,15 +48,10 @@ protected override void PopOut()
holder.ScaleTo(new Vector2(1, 0), transition_duration / 2, EasingTypes.InSine);
buttonsContainer.MoveToX(DrawWidth, transition_duration, EasingTypes.InSine);
buttonsContainer.MoveToX(x_position + x_movement, transition_duration, EasingTypes.InSine);
buttonsContainer.TransformSpacingTo(new Vector2(200f, 0f), transition_duration, EasingTypes.InSine);
Delay(transition_duration);
Schedule(() =>
{
if (State == Visibility.Hidden)
buttonsContainer.Alpha = 0;
});
FadeOut(transition_duration, EasingTypes.InQuint);
}
public BeatmapOptionsOverlay()
@ -79,6 +75,7 @@ public BeatmapOptionsOverlay()
buttonsContainer = new ButtonFlow
{
Height = height,
RelativePositionAxes = Axes.X,
AutoSizeAxes = Axes.X,
Origin = Anchor.BottomLeft,
Anchor = Anchor.BottomLeft,