mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 20:13:22 +08:00
Fix logo animation stuttering when entering mode from initial s… (#4813)
Fix logo animation stuttering when entering mode from initial state Co-authored-by: Dean Herbert <pe@ppy.sh>
This commit is contained in:
commit
d80c7f9b1a
@ -9,6 +9,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Colour;
|
using osu.Framework.Graphics.Colour;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Game.Screens.Menu;
|
using osu.Game.Screens.Menu;
|
||||||
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.UserInterface
|
namespace osu.Game.Tests.Visual.UserInterface
|
||||||
@ -23,11 +24,12 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
typeof(Button)
|
typeof(Button)
|
||||||
};
|
};
|
||||||
|
|
||||||
public TestSceneButtonSystem()
|
private OsuLogo logo;
|
||||||
{
|
private ButtonSystem buttons;
|
||||||
OsuLogo logo;
|
|
||||||
ButtonSystem buttons;
|
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public void SetUp() => Schedule(() =>
|
||||||
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
new Box
|
||||||
@ -36,13 +38,47 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
},
|
},
|
||||||
buttons = new ButtonSystem(),
|
buttons = new ButtonSystem(),
|
||||||
logo = new OsuLogo { RelativePositionAxes = Axes.Both }
|
logo = new OsuLogo
|
||||||
|
{
|
||||||
|
RelativePositionAxes = Axes.Both,
|
||||||
|
Position = new Vector2(0.5f)
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
buttons.SetOsuLogo(logo);
|
buttons.SetOsuLogo(logo);
|
||||||
|
});
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestAllStates()
|
||||||
|
{
|
||||||
foreach (var s in Enum.GetValues(typeof(ButtonSystemState)).OfType<ButtonSystemState>().Skip(1))
|
foreach (var s in Enum.GetValues(typeof(ButtonSystemState)).OfType<ButtonSystemState>().Skip(1))
|
||||||
AddStep($"State to {s}", () => buttons.State = s);
|
AddStep($"State to {s}", () => buttons.State = s);
|
||||||
|
|
||||||
|
AddStep("Enter mode", performEnterMode);
|
||||||
|
|
||||||
|
AddStep("Return to menu", () =>
|
||||||
|
{
|
||||||
|
buttons.State = ButtonSystemState.Play;
|
||||||
|
buttons.FadeIn(MainMenu.FADE_IN_DURATION, Easing.OutQuint);
|
||||||
|
buttons.MoveTo(new Vector2(0), MainMenu.FADE_IN_DURATION, Easing.OutQuint);
|
||||||
|
logo.FadeColour(Color4.White, 100, Easing.OutQuint);
|
||||||
|
logo.FadeIn(100, Easing.OutQuint);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestSmoothExit()
|
||||||
|
{
|
||||||
|
AddStep("Enter mode", performEnterMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void performEnterMode()
|
||||||
|
{
|
||||||
|
buttons.State = ButtonSystemState.EnteringMode;
|
||||||
|
buttons.FadeOut(MainMenu.FADE_OUT_DURATION, Easing.InSine);
|
||||||
|
buttons.MoveTo(new Vector2(-800, 0), MainMenu.FADE_OUT_DURATION, Easing.InSine);
|
||||||
|
logo.FadeOut(300, Easing.InSine)
|
||||||
|
.ScaleTo(0.2f, 300, Easing.InSine);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -332,7 +332,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ButtonSystemState.EnteringMode:
|
case ButtonSystemState.EnteringMode:
|
||||||
logoTrackingContainer.StartTracking(logo, 0, Easing.In);
|
logoTrackingContainer.StartTracking(logo, lastState == ButtonSystemState.Initial ? MainMenu.FADE_OUT_DURATION : 0, Easing.InSine);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,9 @@ namespace osu.Game.Screens.Menu
|
|||||||
{
|
{
|
||||||
public class MainMenu : OsuScreen
|
public class MainMenu : OsuScreen
|
||||||
{
|
{
|
||||||
private ButtonSystem buttons;
|
public const float FADE_IN_DURATION = 300;
|
||||||
|
|
||||||
|
public const float FADE_OUT_DURATION = 400;
|
||||||
|
|
||||||
public override bool HideOverlaysOnEnter => buttons == null || buttons.State == ButtonSystemState.Initial;
|
public override bool HideOverlaysOnEnter => buttons == null || buttons.State == ButtonSystemState.Initial;
|
||||||
|
|
||||||
@ -35,6 +37,8 @@ namespace osu.Game.Screens.Menu
|
|||||||
|
|
||||||
private MenuSideFlashes sideFlashes;
|
private MenuSideFlashes sideFlashes;
|
||||||
|
|
||||||
|
private ButtonSystem buttons;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private GameHost host { get; set; }
|
private GameHost host { get; set; }
|
||||||
|
|
||||||
@ -141,12 +145,10 @@ namespace osu.Game.Screens.Menu
|
|||||||
{
|
{
|
||||||
buttons.State = ButtonSystemState.TopLevel;
|
buttons.State = ButtonSystemState.TopLevel;
|
||||||
|
|
||||||
const float length = 300;
|
this.FadeIn(FADE_IN_DURATION, Easing.OutQuint);
|
||||||
|
this.MoveTo(new Vector2(0, 0), FADE_IN_DURATION, Easing.OutQuint);
|
||||||
|
|
||||||
this.FadeIn(length, Easing.OutQuint);
|
sideFlashes.Delay(FADE_IN_DURATION).FadeIn(64, Easing.InQuint);
|
||||||
this.MoveTo(new Vector2(0, 0), length, Easing.OutQuint);
|
|
||||||
|
|
||||||
sideFlashes.Delay(length).FadeIn(64, Easing.InQuint);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -171,12 +173,10 @@ namespace osu.Game.Screens.Menu
|
|||||||
{
|
{
|
||||||
base.OnSuspending(next);
|
base.OnSuspending(next);
|
||||||
|
|
||||||
const float length = 400;
|
|
||||||
|
|
||||||
buttons.State = ButtonSystemState.EnteringMode;
|
buttons.State = ButtonSystemState.EnteringMode;
|
||||||
|
|
||||||
this.FadeOut(length, Easing.InSine);
|
this.FadeOut(FADE_OUT_DURATION, Easing.InSine);
|
||||||
this.MoveTo(new Vector2(-800, 0), length, Easing.InSine);
|
this.MoveTo(new Vector2(-800, 0), FADE_OUT_DURATION, Easing.InSine);
|
||||||
|
|
||||||
sideFlashes.FadeOut(64, Easing.OutQuint);
|
sideFlashes.FadeOut(64, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user