mirror of
https://github.com/ppy/osu.git
synced 2024-12-16 03:42:58 +08:00
Improve animation when showing/hiding first run overlay
This commit is contained in:
parent
5fd64a4c78
commit
02f8367d66
@ -36,8 +36,8 @@ namespace osu.Game.Overlays
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private IPerformFromScreenRunner performer { get; set; } = null!;
|
private IPerformFromScreenRunner performer { get; set; } = null!;
|
||||||
|
|
||||||
[Resolved(canBeNull: true)]
|
[Resolved]
|
||||||
private NotificationOverlay notificationOverlay { get; set; } = null!;
|
private INotificationOverlay notificationOverlay { get; set; } = null!;
|
||||||
|
|
||||||
private ScreenStack stack = null!;
|
private ScreenStack stack = null!;
|
||||||
|
|
||||||
@ -49,6 +49,8 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
private int? currentStepIndex;
|
private int? currentStepIndex;
|
||||||
|
|
||||||
|
private const float scale_when_hidden = 0.9f;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The currently displayed screen, if any.
|
/// The currently displayed screen, if any.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -212,15 +214,6 @@ namespace osu.Game.Overlays
|
|||||||
performer.PerformFromScreen(_ => { Show(); }, new[] { typeof(MainMenu) });
|
performer.PerformFromScreen(_ => { Show(); }, new[] { typeof(MainMenu) });
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void PopIn()
|
|
||||||
{
|
|
||||||
base.PopIn();
|
|
||||||
this.FadeIn(400, Easing.OutQuint);
|
|
||||||
|
|
||||||
if (currentStepIndex == null)
|
|
||||||
showNextStep();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void showLastStep()
|
private void showLastStep()
|
||||||
{
|
{
|
||||||
Debug.Assert(currentStepIndex > 0);
|
Debug.Assert(currentStepIndex > 0);
|
||||||
@ -257,9 +250,6 @@ namespace osu.Game.Overlays
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
stack.FadeOut(500);
|
|
||||||
stack.Expire();
|
|
||||||
|
|
||||||
currentStepIndex = null;
|
currentStepIndex = null;
|
||||||
Hide();
|
Hide();
|
||||||
}
|
}
|
||||||
@ -274,11 +264,24 @@ namespace osu.Game.Overlays
|
|||||||
: "Finish";
|
: "Finish";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void PopIn()
|
||||||
|
{
|
||||||
|
base.PopIn();
|
||||||
|
|
||||||
|
this.ScaleTo(scale_when_hidden)
|
||||||
|
.ScaleTo(1, 400, Easing.OutElasticHalf);
|
||||||
|
|
||||||
|
this.FadeIn(400, Easing.OutQuint);
|
||||||
|
|
||||||
|
if (currentStepIndex == null)
|
||||||
|
showNextStep();
|
||||||
|
}
|
||||||
|
|
||||||
protected override void PopOut()
|
protected override void PopOut()
|
||||||
{
|
{
|
||||||
if (currentStepIndex != null)
|
if (currentStepIndex != null)
|
||||||
{
|
{
|
||||||
notificationOverlay?.Post(new SimpleNotification
|
notificationOverlay.Post(new SimpleNotification
|
||||||
{
|
{
|
||||||
Text = "Click here to resume initial setup at any point",
|
Text = "Click here to resume initial setup at any point",
|
||||||
Icon = FontAwesome.Solid.Horse,
|
Icon = FontAwesome.Solid.Horse,
|
||||||
@ -289,9 +292,17 @@ namespace osu.Game.Overlays
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
stack?
|
||||||
|
.FadeOut(100)
|
||||||
|
.Expire();
|
||||||
|
}
|
||||||
|
|
||||||
base.PopOut();
|
base.PopOut();
|
||||||
this.FadeOut(100);
|
|
||||||
|
this.ScaleTo(0.96f, 400, Easing.OutQuint);
|
||||||
|
this.FadeOut(200, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class FirstRunStep
|
private class FirstRunStep
|
||||||
|
Loading…
Reference in New Issue
Block a user