mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 15:07:44 +08:00
Add MultiplayerScreen base class.
This commit is contained in:
parent
9b307f0e12
commit
1210368e29
@ -10,6 +10,7 @@ using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Overlays.SearchableList;
|
||||
using osu.Game.Screens.Multi.Screens;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
@ -85,7 +86,7 @@ namespace osu.Game.Screens.Multi
|
||||
},
|
||||
};
|
||||
|
||||
breadcrumbs.Current.ValueChanged += s => screenTitle.Text = s.ToString();
|
||||
breadcrumbs.Current.ValueChanged += s => screenTitle.Text = s is MultiplayerScreen m ? m.Title : s.ToString();
|
||||
breadcrumbs.Current.TriggerChange();
|
||||
}
|
||||
|
||||
|
57
osu.Game/Screens/Multi/Screens/MultiplayerScreen.cs
Normal file
57
osu.Game/Screens/Multi/Screens/MultiplayerScreen.cs
Normal file
@ -0,0 +1,57 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Screens.Multi.Screens
|
||||
{
|
||||
public abstract class MultiplayerScreen : OsuScreen
|
||||
{
|
||||
private const Easing in_easing = Easing.OutQuint;
|
||||
private const Easing out_easing = Easing.InSine;
|
||||
|
||||
protected virtual Container<Drawable> TransitionContent => Content;
|
||||
|
||||
public abstract string Title { get; }
|
||||
public abstract string Name { get; }
|
||||
|
||||
public override string ToString() => Name;
|
||||
|
||||
protected override void OnEntering(Screen last)
|
||||
{
|
||||
base.OnEntering(last);
|
||||
|
||||
TransitionContent.MoveToX(200);
|
||||
|
||||
TransitionContent.FadeInFromZero(WaveContainer.APPEAR_DURATION, in_easing);
|
||||
TransitionContent.MoveToX(0, WaveContainer.APPEAR_DURATION, in_easing);
|
||||
}
|
||||
|
||||
protected override bool OnExiting(Screen next)
|
||||
{
|
||||
Content.FadeOut(WaveContainer.DISAPPEAR_DURATION, out_easing);
|
||||
TransitionContent.MoveToX(200, WaveContainer.DISAPPEAR_DURATION, out_easing);
|
||||
|
||||
return base.OnExiting(next);
|
||||
}
|
||||
|
||||
protected override void OnResuming(Screen last)
|
||||
{
|
||||
base.OnResuming(last);
|
||||
|
||||
Content.FadeIn(WaveContainer.APPEAR_DURATION, in_easing);
|
||||
TransitionContent.MoveToX(0, WaveContainer.APPEAR_DURATION, in_easing);
|
||||
}
|
||||
|
||||
protected override void OnSuspending(Screen next)
|
||||
{
|
||||
base.OnSuspending(next);
|
||||
|
||||
Content.FadeOut(WaveContainer.DISAPPEAR_DURATION, out_easing);
|
||||
TransitionContent.MoveToX(-200, WaveContainer.DISAPPEAR_DURATION, out_easing);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user