1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-17 11:12:55 +08:00
osu-lazer/osu.Game/Screens/Multi/MultiplayerSubScreen.cs

79 lines
2.5 KiB
C#
Raw Normal View History

// 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 18:32:37 +08:00
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Input.Bindings;
using osu.Framework.Screens;
using osu.Game.Graphics.Containers;
using osu.Game.Input.Bindings;
namespace osu.Game.Screens.Multi
{
2019-02-11 18:11:34 +08:00
public abstract class MultiplayerSubScreen : OsuScreen, IMultiplayerSubScreen, IKeyBindingHandler<GlobalAction>
2019-01-25 18:32:37 +08:00
{
2019-02-11 18:11:34 +08:00
public override bool DisallowExternalBeatmapRulesetChanges => false;
2019-01-25 18:32:37 +08:00
public override bool RemoveWhenNotAlive => false;
public virtual string ShortTitle => Title;
[Resolved(CanBeNull = true)]
protected OsuGame Game { get; private set; }
[Resolved(CanBeNull = true)]
2019-02-11 18:11:34 +08:00
protected IRoomManager RoomManager { get; private set; }
2019-01-25 18:32:37 +08:00
protected MultiplayerSubScreen()
{
2019-01-25 19:47:31 +08:00
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
2019-01-25 18:32:37 +08:00
RelativeSizeAxes = Axes.Both;
}
2019-02-11 18:11:34 +08:00
public override void OnEntering(IScreen last)
2019-01-25 18:32:37 +08:00
{
this.FadeInFromZero(WaveContainer.APPEAR_DURATION, Easing.OutQuint);
this.FadeInFromZero(WaveContainer.APPEAR_DURATION, Easing.OutQuint);
this.MoveToX(200).MoveToX(0, WaveContainer.APPEAR_DURATION, Easing.OutQuint);
}
2019-02-11 18:11:34 +08:00
public override bool OnExiting(IScreen next)
2019-01-25 18:32:37 +08:00
{
this.FadeOut(WaveContainer.DISAPPEAR_DURATION, Easing.OutQuint);
this.MoveToX(200, WaveContainer.DISAPPEAR_DURATION, Easing.OutQuint);
return false;
}
2019-02-11 18:11:34 +08:00
public override void OnResuming(IScreen last)
2019-01-25 18:32:37 +08:00
{
this.FadeIn(WaveContainer.APPEAR_DURATION, Easing.OutQuint);
this.MoveToX(0, WaveContainer.APPEAR_DURATION, Easing.OutQuint);
}
2019-02-11 18:11:34 +08:00
public override void OnSuspending(IScreen next)
2019-01-25 18:32:37 +08:00
{
this.FadeOut(WaveContainer.DISAPPEAR_DURATION, Easing.OutQuint);
this.MoveToX(-200, WaveContainer.DISAPPEAR_DURATION, Easing.OutQuint);
}
2019-02-11 18:11:34 +08:00
public override bool OnPressed(GlobalAction action)
2019-01-25 18:32:37 +08:00
{
if (!this.IsCurrentScreen()) return false;
if (action == GlobalAction.Back)
{
this.Exit();
return true;
}
return false;
}
public bool OnReleased(GlobalAction action) => action == GlobalAction.Back;
public override string ToString() => Title;
}
}