2019-01-24 08:43:03 +00:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
2019-01-25 10:32:37 +00:00
|
|
|
|
|
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Screens;
|
|
|
|
|
|
2020-12-25 15:50:00 +00:00
|
|
|
|
namespace osu.Game.Screens.OnlinePlay
|
2019-01-25 10:32:37 +00:00
|
|
|
|
{
|
2020-12-25 16:05:29 +00:00
|
|
|
|
public abstract class OnlinePlaySubScreen : OsuScreen, IOnlinePlaySubScreen
|
2019-01-25 10:32:37 +00:00
|
|
|
|
{
|
2019-02-11 10:11:34 +00:00
|
|
|
|
public override bool DisallowExternalBeatmapRulesetChanges => false;
|
2019-01-25 10:32:37 +00:00
|
|
|
|
|
|
|
|
|
public virtual string ShortTitle => Title;
|
|
|
|
|
|
|
|
|
|
[Resolved(CanBeNull = true)]
|
2019-02-11 10:11:34 +00:00
|
|
|
|
protected IRoomManager RoomManager { get; private set; }
|
2019-01-25 10:32:37 +00:00
|
|
|
|
|
2020-12-25 16:02:35 +00:00
|
|
|
|
protected OnlinePlaySubScreen()
|
2019-01-25 10:32:37 +00:00
|
|
|
|
{
|
2019-01-25 11:47:31 +00:00
|
|
|
|
Anchor = Anchor.Centre;
|
|
|
|
|
Origin = Anchor.Centre;
|
2019-01-25 10:32:37 +00:00
|
|
|
|
RelativeSizeAxes = Axes.Both;
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-20 09:03:53 +00:00
|
|
|
|
public const float X_SHIFT = 200;
|
|
|
|
|
|
|
|
|
|
public const double X_MOVE_DURATION = 800;
|
|
|
|
|
|
|
|
|
|
public const double RESUME_TRANSITION_DELAY = DISAPPEAR_DURATION / 2;
|
|
|
|
|
|
|
|
|
|
public const double APPEAR_DURATION = 800;
|
|
|
|
|
|
|
|
|
|
public const double DISAPPEAR_DURATION = 500;
|
|
|
|
|
|
2019-02-11 10:11:34 +00:00
|
|
|
|
public override void OnEntering(IScreen last)
|
2019-01-25 10:32:37 +00:00
|
|
|
|
{
|
2020-02-20 09:03:53 +00:00
|
|
|
|
this.FadeInFromZero(APPEAR_DURATION, Easing.OutQuint);
|
|
|
|
|
this.FadeInFromZero(APPEAR_DURATION, Easing.OutQuint);
|
|
|
|
|
this.MoveToX(X_SHIFT).MoveToX(0, X_MOVE_DURATION, Easing.OutQuint);
|
2019-01-25 10:32:37 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-02-11 10:11:34 +00:00
|
|
|
|
public override bool OnExiting(IScreen next)
|
2019-01-25 10:32:37 +00:00
|
|
|
|
{
|
2020-02-20 09:03:53 +00:00
|
|
|
|
this.FadeOut(DISAPPEAR_DURATION, Easing.OutQuint);
|
|
|
|
|
this.MoveToX(X_SHIFT, X_MOVE_DURATION, Easing.OutQuint);
|
2019-01-25 10:32:37 +00:00
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2019-02-11 10:11:34 +00:00
|
|
|
|
public override void OnResuming(IScreen last)
|
2019-01-25 10:32:37 +00:00
|
|
|
|
{
|
2020-02-20 09:03:53 +00:00
|
|
|
|
this.Delay(RESUME_TRANSITION_DELAY).FadeIn(APPEAR_DURATION, Easing.OutQuint);
|
|
|
|
|
this.MoveToX(0, X_MOVE_DURATION, Easing.OutQuint);
|
2019-01-25 10:32:37 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-02-11 10:11:34 +00:00
|
|
|
|
public override void OnSuspending(IScreen next)
|
2019-01-25 10:32:37 +00:00
|
|
|
|
{
|
2020-02-20 09:03:53 +00:00
|
|
|
|
this.FadeOut(DISAPPEAR_DURATION, Easing.OutQuint);
|
|
|
|
|
this.MoveToX(-X_SHIFT, X_MOVE_DURATION, Easing.OutQuint);
|
2019-01-25 10:32:37 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override string ToString() => Title;
|
|
|
|
|
}
|
|
|
|
|
}
|