mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 04:02:59 +08:00
Remove MultiplayerSubScreen and fix multiplayer crashes
This commit is contained in:
parent
f0e0088f43
commit
15100632f1
@ -17,13 +17,15 @@ namespace osu.Game.Graphics.UserInterface
|
||||
stack.ScreenPushed += onPushed;
|
||||
stack.ScreenExited += onExited;
|
||||
|
||||
onPushed(null, stack.CurrentScreen);
|
||||
|
||||
Current.ValueChanged += newScreen => newScreen.MakeCurrent();
|
||||
}
|
||||
|
||||
private void onPushed(IScreen lastScreen, IScreen newScreen)
|
||||
{
|
||||
Current.Value = newScreen;
|
||||
AddItem(newScreen);
|
||||
Current.Value = newScreen;
|
||||
}
|
||||
|
||||
private void onExited(IScreen lastScreen, IScreen newScreen)
|
||||
|
@ -5,6 +5,8 @@ namespace osu.Game.Screens.Multi
|
||||
{
|
||||
public interface IMultiplayerSubScreen : IOsuScreen
|
||||
{
|
||||
string Title { get; }
|
||||
|
||||
string ShortTitle { get; }
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
using osu.Game.Overlays.SearchableList;
|
||||
@ -15,8 +16,20 @@ using osu.Game.Screens.Multi.Match;
|
||||
|
||||
namespace osu.Game.Screens.Multi.Lounge
|
||||
{
|
||||
public class LoungeSubScreen : MultiplayerSubScreen
|
||||
public class LoungeSubScreen : CompositeDrawable, IMultiplayerSubScreen
|
||||
{
|
||||
public bool AllowBeatmapRulesetChange => true;
|
||||
public bool AllowExternalScreenChange => true;
|
||||
public bool CursorVisible => true;
|
||||
|
||||
public string Title => "Lounge";
|
||||
public string ShortTitle => Title;
|
||||
|
||||
public bool ValidForResume { get; set; } = true;
|
||||
public bool ValidForPush { get; set; } = true;
|
||||
|
||||
public override bool RemoveWhenNotAlive => false;
|
||||
|
||||
protected readonly FilterControl Filter;
|
||||
|
||||
private readonly Container content;
|
||||
@ -27,14 +40,12 @@ namespace osu.Game.Screens.Multi.Lounge
|
||||
[Resolved(CanBeNull = true)]
|
||||
private IRoomManager roomManager { get; set; }
|
||||
|
||||
public override string Title => "Lounge";
|
||||
|
||||
protected override Drawable TransitionContent => content;
|
||||
|
||||
public LoungeSubScreen(Action<Screen> pushGameplayScreen)
|
||||
{
|
||||
this.pushGameplayScreen = pushGameplayScreen;
|
||||
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
|
||||
RoomInspector inspector;
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
@ -101,22 +112,36 @@ namespace osu.Game.Screens.Multi.Lounge
|
||||
GetContainingInputManager().ChangeFocus(Filter.Search);
|
||||
}
|
||||
|
||||
public override void OnEntering(IScreen last)
|
||||
public void OnEntering(IScreen last)
|
||||
{
|
||||
base.OnEntering(last);
|
||||
this.FadeInFromZero(WaveContainer.APPEAR_DURATION, Easing.OutQuint);
|
||||
this.FadeInFromZero(WaveContainer.APPEAR_DURATION, Easing.OutQuint);
|
||||
this.MoveToX(200).MoveToX(0, WaveContainer.APPEAR_DURATION, Easing.OutQuint);
|
||||
|
||||
Filter.Search.HoldFocus = true;
|
||||
}
|
||||
|
||||
public override bool OnExiting(IScreen next)
|
||||
public bool OnExiting(IScreen next)
|
||||
{
|
||||
this.FadeOut(WaveContainer.DISAPPEAR_DURATION, Easing.OutQuint);
|
||||
this.MoveToX(200, WaveContainer.DISAPPEAR_DURATION, Easing.OutQuint);
|
||||
|
||||
Filter.Search.HoldFocus = false;
|
||||
// no base call; don't animate
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void OnSuspending(IScreen next)
|
||||
public void OnResuming(IScreen last)
|
||||
{
|
||||
base.OnSuspending(next);
|
||||
this.FadeIn(WaveContainer.APPEAR_DURATION, Easing.OutQuint);
|
||||
this.MoveToX(0, WaveContainer.APPEAR_DURATION, Easing.OutQuint);
|
||||
}
|
||||
|
||||
public void OnSuspending(IScreen next)
|
||||
{
|
||||
this.FadeOut(WaveContainer.DISAPPEAR_DURATION, Easing.OutQuint);
|
||||
this.MoveToX(-200, WaveContainer.DISAPPEAR_DURATION, Easing.OutQuint);
|
||||
|
||||
Filter.Search.HoldFocus = false;
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
using osu.Game.Online.Multiplayer.GameTypes;
|
||||
using osu.Game.Rulesets;
|
||||
@ -18,11 +19,19 @@ using osu.Game.Screens.Select;
|
||||
|
||||
namespace osu.Game.Screens.Multi.Match
|
||||
{
|
||||
public class MatchSubScreen : MultiplayerSubScreen
|
||||
public class MatchSubScreen : CompositeDrawable, IMultiplayerSubScreen
|
||||
{
|
||||
public override bool AllowBeatmapRulesetChange => false;
|
||||
public override string Title => room.RoomID.Value == null ? "New room" : room.Name.Value;
|
||||
public override string ShortTitle => "room";
|
||||
public bool AllowBeatmapRulesetChange => false;
|
||||
public bool AllowExternalScreenChange => true;
|
||||
public bool CursorVisible => true;
|
||||
|
||||
public string Title => room.RoomID.Value == null ? "New room" : room.Name.Value;
|
||||
public string ShortTitle => "room";
|
||||
|
||||
public bool ValidForResume { get; set; } = true;
|
||||
public bool ValidForPush { get; set; } = true;
|
||||
|
||||
public override bool RemoveWhenNotAlive => false;
|
||||
|
||||
private readonly RoomBindings bindings = new RoomBindings();
|
||||
|
||||
@ -33,6 +42,9 @@ namespace osu.Game.Screens.Multi.Match
|
||||
[Cached]
|
||||
private readonly Room room;
|
||||
|
||||
[Resolved]
|
||||
private IBindableBeatmap beatmap { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private BeatmapManager beatmapManager { get; set; }
|
||||
|
||||
@ -47,6 +59,8 @@ namespace osu.Game.Screens.Multi.Match
|
||||
this.room = room;
|
||||
this.pushGameplayScreen = pushGameplayScreen;
|
||||
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
|
||||
bindings.Room = room;
|
||||
|
||||
MatchChatDisplay chat;
|
||||
@ -135,10 +149,33 @@ namespace osu.Game.Screens.Multi.Match
|
||||
beatmapManager.ItemAdded += beatmapAdded;
|
||||
}
|
||||
|
||||
public override bool OnExiting(IScreen next)
|
||||
public void OnEntering(IScreen last)
|
||||
{
|
||||
this.FadeInFromZero(WaveContainer.APPEAR_DURATION, Easing.OutQuint);
|
||||
this.FadeInFromZero(WaveContainer.APPEAR_DURATION, Easing.OutQuint);
|
||||
this.MoveToX(200).MoveToX(0, WaveContainer.APPEAR_DURATION, Easing.OutQuint);
|
||||
}
|
||||
|
||||
public bool OnExiting(IScreen next)
|
||||
{
|
||||
manager?.PartRoom();
|
||||
return base.OnExiting(next);
|
||||
|
||||
this.FadeOut(WaveContainer.DISAPPEAR_DURATION, Easing.OutQuint);
|
||||
this.MoveToX(200, WaveContainer.DISAPPEAR_DURATION, Easing.OutQuint);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void OnResuming(IScreen last)
|
||||
{
|
||||
this.FadeIn(WaveContainer.APPEAR_DURATION, Easing.OutQuint);
|
||||
this.MoveToX(0, WaveContainer.APPEAR_DURATION, Easing.OutQuint);
|
||||
}
|
||||
|
||||
public void OnSuspending(IScreen next)
|
||||
{
|
||||
this.FadeOut(WaveContainer.DISAPPEAR_DURATION, Easing.OutQuint);
|
||||
this.MoveToX(-200, WaveContainer.DISAPPEAR_DURATION, Easing.OutQuint);
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
@ -167,7 +204,7 @@ namespace osu.Game.Screens.Multi.Match
|
||||
|
||||
private void beatmapAdded(BeatmapSetInfo model, bool existing, bool silent) => Schedule(() =>
|
||||
{
|
||||
if (Beatmap.Value != beatmapManager.DefaultBeatmap)
|
||||
if (beatmap.Value != beatmapManager.DefaultBeatmap)
|
||||
return;
|
||||
|
||||
if (bindings.CurrentBeatmap.Value == null)
|
||||
@ -188,7 +225,7 @@ namespace osu.Game.Screens.Multi.Match
|
||||
|
||||
private void onStart()
|
||||
{
|
||||
Beatmap.Value.Mods.Value = bindings.CurrentMods.Value.ToArray();
|
||||
beatmap.Value.Mods.Value = bindings.CurrentMods.Value.ToArray();
|
||||
|
||||
switch (bindings.Type.Value)
|
||||
{
|
||||
|
@ -1,49 +0,0 @@
|
||||
// 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.Screens;
|
||||
using osu.Game.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Screens.Multi
|
||||
{
|
||||
public abstract class MultiplayerSubScreen : OsuScreen, IMultiplayerSubScreen
|
||||
{
|
||||
protected virtual Drawable TransitionContent => this;
|
||||
|
||||
public virtual string ShortTitle => Title;
|
||||
|
||||
public override void OnEntering(IScreen last)
|
||||
{
|
||||
base.OnEntering(last);
|
||||
|
||||
this.FadeInFromZero(WaveContainer.APPEAR_DURATION, Easing.OutQuint);
|
||||
TransitionContent.FadeInFromZero(WaveContainer.APPEAR_DURATION, Easing.OutQuint);
|
||||
TransitionContent.MoveToX(200).MoveToX(0, WaveContainer.APPEAR_DURATION, Easing.OutQuint);
|
||||
}
|
||||
|
||||
public override bool OnExiting(IScreen next)
|
||||
{
|
||||
this.FadeOut(WaveContainer.DISAPPEAR_DURATION, Easing.OutQuint);
|
||||
TransitionContent.MoveToX(200, WaveContainer.DISAPPEAR_DURATION, Easing.OutQuint);
|
||||
|
||||
return base.OnExiting(next);
|
||||
}
|
||||
|
||||
public override void OnResuming(IScreen last)
|
||||
{
|
||||
base.OnResuming(last);
|
||||
|
||||
this.FadeIn(WaveContainer.APPEAR_DURATION, Easing.OutQuint);
|
||||
TransitionContent.MoveToX(0, WaveContainer.APPEAR_DURATION, Easing.OutQuint);
|
||||
}
|
||||
|
||||
public override void OnSuspending(IScreen next)
|
||||
{
|
||||
base.OnSuspending(next);
|
||||
|
||||
this.FadeOut(WaveContainer.DISAPPEAR_DURATION, Easing.OutQuint);
|
||||
TransitionContent.MoveToX(-200, WaveContainer.DISAPPEAR_DURATION, Easing.OutQuint);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user