Add MultiplayerScreen base class.

This commit is contained in:
DrabWeb 2018-05-21 23:00:02 -03:00
parent 9b307f0e12
commit 1210368e29
2 changed files with 59 additions and 1 deletions

View File

@ -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();
}

View 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);
}
}
}