diff --git a/osu.Game.Tests/Visual/TestCaseLoungeRoomsContainer.cs b/osu.Game.Tests/Visual/TestCaseLoungeRoomsContainer.cs index 916468ae2f..dd7e8f7fac 100644 --- a/osu.Game.Tests/Visual/TestCaseLoungeRoomsContainer.cs +++ b/osu.Game.Tests/Visual/TestCaseLoungeRoomsContainer.cs @@ -71,14 +71,14 @@ namespace osu.Game.Tests.Visual private class TestRoomManager : IRoomManager { - public event Action OpenRequested; + public event Action RoomJoined; public readonly BindableCollection Rooms = new BindableCollection(); IBindableCollection IRoomManager.Rooms => Rooms; public void CreateRoom(Room room) => Rooms.Add(room); - public void JoinRoom(Room room) => OpenRequested?.Invoke(room); + public void JoinRoom(Room room) => RoomJoined?.Invoke(room); public void PartRoom() { diff --git a/osu.Game.Tests/Visual/TestCaseMatchSettingsOverlay.cs b/osu.Game.Tests/Visual/TestCaseMatchSettingsOverlay.cs index 322ff5bc07..3c41fd6920 100644 --- a/osu.Game.Tests/Visual/TestCaseMatchSettingsOverlay.cs +++ b/osu.Game.Tests/Visual/TestCaseMatchSettingsOverlay.cs @@ -102,7 +102,7 @@ namespace osu.Game.Tests.Visual { public Action CreateRequested; - public event Action OpenRequested; + public event Action RoomJoined; public IBindableCollection Rooms { get; } = null; diff --git a/osu.Game.Tests/Visual/TestCaseMultiHeader.cs b/osu.Game.Tests/Visual/TestCaseMultiHeader.cs index 2005c707b1..602108d078 100644 --- a/osu.Game.Tests/Visual/TestCaseMultiHeader.cs +++ b/osu.Game.Tests/Visual/TestCaseMultiHeader.cs @@ -15,7 +15,7 @@ namespace osu.Game.Tests.Visual { int index = 0; - OsuScreen currentScreen = new TestMultiplayerScreen(index); + OsuScreen currentScreen = new TestMultiplayerSubScreen(index); Children = new Drawable[] { @@ -23,16 +23,16 @@ namespace osu.Game.Tests.Visual new Header(currentScreen) }; - AddStep("push multi screen", () => currentScreen.Push(currentScreen = new TestMultiplayerScreen(++index))); + AddStep("push multi screen", () => currentScreen.Push(currentScreen = new TestMultiplayerSubScreen(++index))); } - private class TestMultiplayerScreen : OsuScreen, IMultiplayerScreen + private class TestMultiplayerSubScreen : OsuScreen, IMultiplayerSubScreen { private readonly int index; public string ShortTitle => $"Screen {index}"; - public TestMultiplayerScreen(int index) + public TestMultiplayerSubScreen(int index) { this.index = index; } diff --git a/osu.Game.Tests/Visual/TestCaseMultiResults.cs b/osu.Game.Tests/Visual/TestCaseMultiResults.cs index 38027e0bc3..8991782835 100644 --- a/osu.Game.Tests/Visual/TestCaseMultiResults.cs +++ b/osu.Game.Tests/Visual/TestCaseMultiResults.cs @@ -23,7 +23,7 @@ namespace osu.Game.Tests.Visual { public override IReadOnlyList RequiredTypes => new[] { - typeof(MultiResults), + typeof(MatchResults), typeof(RoomLeaderboardPageInfo), typeof(RoomRankingResultsPage) }; @@ -38,22 +38,22 @@ namespace osu.Game.Tests.Visual if (beatmapInfo != null) Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmapInfo); - Child = new TestMultiResults(new ScoreInfo + Child = new TestMatchResults(new ScoreInfo { User = new User { Id = 10 }, }); } - private class TestMultiResults : MultiResults + private class TestMatchResults : MatchResults { private readonly Room room; - public TestMultiResults(ScoreInfo score) + public TestMatchResults(ScoreInfo score) : this(score, new Room()) { } - public TestMultiResults(ScoreInfo score, Room room) + public TestMatchResults(ScoreInfo score, Room room) : base(score, room) { this.room = room; diff --git a/osu.Game.Tests/Visual/TestCaseMultiScreen.cs b/osu.Game.Tests/Visual/TestCaseMultiScreen.cs index c65ab4e3e3..88265d146f 100644 --- a/osu.Game.Tests/Visual/TestCaseMultiScreen.cs +++ b/osu.Game.Tests/Visual/TestCaseMultiScreen.cs @@ -16,7 +16,7 @@ namespace osu.Game.Tests.Visual public override IReadOnlyList RequiredTypes => new[] { typeof(Multiplayer), - typeof(LoungeScreen), + typeof(LoungeSubScreen), typeof(FilterControl) }; diff --git a/osu.Game/Screens/Multi/Header.cs b/osu.Game/Screens/Multi/Header.cs index 849be44f4f..2849fd89e0 100644 --- a/osu.Game/Screens/Multi/Header.cs +++ b/osu.Game/Screens/Multi/Header.cs @@ -87,7 +87,7 @@ namespace osu.Game.Screens.Multi breadcrumbs.Current.ValueChanged += s => { - if (s is IMultiplayerScreen mpScreen) + if (s is IMultiplayerSubScreen mpScreen) screenType.Text = mpScreen.ShortTitle.ToLowerInvariant(); }; diff --git a/osu.Game/Screens/Multi/IMultiplayerScreen.cs b/osu.Game/Screens/Multi/IMultiplayerSubScreen.cs similarity index 84% rename from osu.Game/Screens/Multi/IMultiplayerScreen.cs rename to osu.Game/Screens/Multi/IMultiplayerSubScreen.cs index c1f43fa30d..4796ffc05c 100644 --- a/osu.Game/Screens/Multi/IMultiplayerScreen.cs +++ b/osu.Game/Screens/Multi/IMultiplayerSubScreen.cs @@ -3,7 +3,7 @@ namespace osu.Game.Screens.Multi { - public interface IMultiplayerScreen + public interface IMultiplayerSubScreen { string ShortTitle { get; } } diff --git a/osu.Game/Screens/Multi/IRoomManager.cs b/osu.Game/Screens/Multi/IRoomManager.cs index f09f360ea2..b94df93581 100644 --- a/osu.Game/Screens/Multi/IRoomManager.cs +++ b/osu.Game/Screens/Multi/IRoomManager.cs @@ -11,9 +11,9 @@ namespace osu.Game.Screens.Multi public interface IRoomManager { /// - /// Invoked when this requests a to be opened. + /// Invoked when a room is joined. /// - event Action OpenRequested; + event Action RoomJoined; /// /// All the active s. diff --git a/osu.Game/Screens/Multi/Lounge/LoungeScreen.cs b/osu.Game/Screens/Multi/Lounge/LoungeSubScreen.cs similarity index 92% rename from osu.Game/Screens/Multi/Lounge/LoungeScreen.cs rename to osu.Game/Screens/Multi/Lounge/LoungeSubScreen.cs index cb8591be9e..c49cfc6b9c 100644 --- a/osu.Game/Screens/Multi/Lounge/LoungeScreen.cs +++ b/osu.Game/Screens/Multi/Lounge/LoungeSubScreen.cs @@ -14,7 +14,7 @@ using osu.Game.Screens.Multi.Match; namespace osu.Game.Screens.Multi.Lounge { - public class LoungeScreen : MultiplayerScreen + public class LoungeSubScreen : MultiplayerSubScreen { protected readonly FilterControl Filter; @@ -29,7 +29,7 @@ namespace osu.Game.Screens.Multi.Lounge protected override Drawable TransitionContent => content; - public LoungeScreen(Action pushGameplayScreen) + public LoungeSubScreen(Action pushGameplayScreen) { this.pushGameplayScreen = pushGameplayScreen; @@ -78,7 +78,7 @@ namespace osu.Game.Screens.Multi.Lounge private void load() { if (roomManager != null) - roomManager.OpenRequested += Open; + roomManager.RoomJoined += Open; } protected override void UpdateAfterChildren() @@ -109,7 +109,8 @@ namespace osu.Game.Screens.Multi.Lounge roomManager?.PartRoom(); Filter.Search.HoldFocus = false; - return base.OnExiting(next); + // no base call; don't animate + return false; } protected override void OnResuming(Screen last) @@ -137,7 +138,7 @@ namespace osu.Game.Screens.Multi.Lounge if (!IsCurrentScreen) return; - Push(new MatchScreen(room, s => pushGameplayScreen?.Invoke(s))); + Push(new MatchSubScreen(room, s => pushGameplayScreen?.Invoke(s))); } protected override void Dispose(bool isDisposing) @@ -145,7 +146,7 @@ namespace osu.Game.Screens.Multi.Lounge base.Dispose(isDisposing); if (roomManager != null) - roomManager.OpenRequested -= Open; + roomManager.RoomJoined -= Open; } } } diff --git a/osu.Game/Screens/Multi/Match/MatchScreen.cs b/osu.Game/Screens/Multi/Match/MatchSubScreen.cs similarity index 95% rename from osu.Game/Screens/Multi/Match/MatchScreen.cs rename to osu.Game/Screens/Multi/Match/MatchSubScreen.cs index c784a27b99..982f54f7c8 100644 --- a/osu.Game/Screens/Multi/Match/MatchScreen.cs +++ b/osu.Game/Screens/Multi/Match/MatchSubScreen.cs @@ -20,7 +20,7 @@ using osu.Game.Screens.Select; namespace osu.Game.Screens.Multi.Match { - public class MatchScreen : MultiplayerScreen + public class MatchSubScreen : MultiplayerSubScreen { public override bool AllowBeatmapRulesetChange => false; public override string Title => room.RoomID.Value == null ? "New room" : room.Name.Value; @@ -44,7 +44,7 @@ namespace osu.Game.Screens.Multi.Match [Resolved(CanBeNull = true)] private IRoomManager manager { get; set; } - public MatchScreen(Room room, Action pushGameplayScreen) + public MatchSubScreen(Room room, Action pushGameplayScreen) { this.room = room; this.pushGameplayScreen = pushGameplayScreen; @@ -119,6 +119,12 @@ namespace osu.Game.Screens.Multi.Match chat.Exit += Exit; } + protected override bool OnExiting(Screen next) + { + manager?.PartRoom(); + return base.OnExiting(next); + } + protected override void LoadComplete() { base.LoadComplete(); diff --git a/osu.Game/Screens/Multi/Multiplayer.cs b/osu.Game/Screens/Multi/Multiplayer.cs index b9b86fbfc7..b105024a24 100644 --- a/osu.Game/Screens/Multi/Multiplayer.cs +++ b/osu.Game/Screens/Multi/Multiplayer.cs @@ -28,7 +28,7 @@ namespace osu.Game.Screens.Multi public override bool AllowBeatmapRulesetChange => currentScreen?.AllowBeatmapRulesetChange ?? base.AllowBeatmapRulesetChange; private readonly OsuButton createButton; - private readonly LoungeScreen loungeScreen; + private readonly LoungeSubScreen loungeSubScreen; private OsuScreen currentScreen; @@ -71,9 +71,9 @@ namespace osu.Game.Screens.Multi { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Top = Header.HEIGHT }, - Child = loungeScreen = new LoungeScreen(Push), + Child = loungeSubScreen = new LoungeSubScreen(Push), }, - new Header(loungeScreen), + new Header(loungeSubScreen), createButton = new HeaderButton { Anchor = Anchor.TopRight, @@ -86,19 +86,22 @@ namespace osu.Game.Screens.Multi Right = 10, }, Text = "Create room", - Action = () => loungeScreen.Open(new Room + Action = () => loungeSubScreen.Open(new Room { Name = { Value = $"{api.LocalUser}'s awesome room" } }), }, roomManager = new RoomManager() }); - screenAdded(loungeScreen); - loungeScreen.Exited += s => Exit(); + + screenAdded(loungeSubScreen); + loungeSubScreen.Exited += _ => Exit(); } protected override void OnEntering(Screen last) { + Content.FadeIn(); + base.OnEntering(last); waves.Show(); } @@ -107,12 +110,13 @@ namespace osu.Game.Screens.Multi { waves.Hide(); + Content.Delay(WaveContainer.DISAPPEAR_DURATION).FadeOut(); + var track = Beatmap.Value.Track; if (track != null) track.Looping = false; - loungeScreen.MakeCurrent(); - loungeScreen.Exit(); + loungeSubScreen.MakeCurrent(); return base.OnExiting(next); } @@ -144,7 +148,7 @@ namespace osu.Game.Screens.Multi { base.Update(); - if (currentScreen is MatchScreen) + if (currentScreen is MatchSubScreen) { var track = Beatmap.Value.Track; if (track != null) @@ -161,7 +165,7 @@ namespace osu.Game.Screens.Multi createButton.Hide(); } - else if (currentScreen is LoungeScreen) + else if (currentScreen is LoungeSubScreen) createButton.Show(); } @@ -175,7 +179,7 @@ namespace osu.Game.Screens.Multi private void screenRemoved(Screen newScreen) { - if (currentScreen is MatchScreen) + if (currentScreen is MatchSubScreen) { var track = Beatmap.Value.Track; if (track != null) diff --git a/osu.Game/Screens/Multi/MultiplayerScreen.cs b/osu.Game/Screens/Multi/MultiplayerSubScreen.cs similarity index 95% rename from osu.Game/Screens/Multi/MultiplayerScreen.cs rename to osu.Game/Screens/Multi/MultiplayerSubScreen.cs index da9a2b3051..5a7eaafba5 100644 --- a/osu.Game/Screens/Multi/MultiplayerScreen.cs +++ b/osu.Game/Screens/Multi/MultiplayerSubScreen.cs @@ -7,7 +7,7 @@ using osu.Game.Graphics.Containers; namespace osu.Game.Screens.Multi { - public abstract class MultiplayerScreen : OsuScreen, IMultiplayerScreen + public abstract class MultiplayerSubScreen : OsuScreen, IMultiplayerSubScreen { protected virtual Drawable TransitionContent => Content; diff --git a/osu.Game/Screens/Multi/Play/TimeshiftPlayer.cs b/osu.Game/Screens/Multi/Play/TimeshiftPlayer.cs index f33159f69b..0a7c11ecc5 100644 --- a/osu.Game/Screens/Multi/Play/TimeshiftPlayer.cs +++ b/osu.Game/Screens/Multi/Play/TimeshiftPlayer.cs @@ -72,6 +72,6 @@ namespace osu.Game.Screens.Multi.Play return score; } - protected override Results CreateResults(ScoreInfo score) => new MultiResults(score, room); + protected override Results CreateResults(ScoreInfo score) => new MatchResults(score, room); } } diff --git a/osu.Game/Screens/Multi/Ranking/MultiResults.cs b/osu.Game/Screens/Multi/Ranking/MatchResults.cs similarity index 89% rename from osu.Game/Screens/Multi/Ranking/MultiResults.cs rename to osu.Game/Screens/Multi/Ranking/MatchResults.cs index 0fffe250bf..c0544540c4 100644 --- a/osu.Game/Screens/Multi/Ranking/MultiResults.cs +++ b/osu.Game/Screens/Multi/Ranking/MatchResults.cs @@ -10,11 +10,11 @@ using osu.Game.Screens.Ranking.Types; namespace osu.Game.Screens.Multi.Ranking { - public class MultiResults : Results + public class MatchResults : Results { private readonly Room room; - public MultiResults(ScoreInfo score, Room room) + public MatchResults(ScoreInfo score, Room room) : base(score) { this.room = room; diff --git a/osu.Game/Screens/Multi/RoomManager.cs b/osu.Game/Screens/Multi/RoomManager.cs index 4bd9307bfb..68a11c0ba8 100644 --- a/osu.Game/Screens/Multi/RoomManager.cs +++ b/osu.Game/Screens/Multi/RoomManager.cs @@ -19,7 +19,7 @@ namespace osu.Game.Screens.Multi { public class RoomManager : PollingComponent, IRoomManager { - public event Action OpenRequested; + public event Action RoomJoined; private readonly BindableCollection rooms = new BindableCollection(); public IBindableCollection Rooms => rooms; @@ -64,7 +64,7 @@ namespace osu.Game.Screens.Multi currentJoinRoomRequest.Success += () => { currentRoom = room; - OpenRequested?.Invoke(room); + RoomJoined?.Invoke(room); }; currentJoinRoomRequest.Failure += exception => Logger.Log($"Failed to join room: {exception}"); diff --git a/osu.Game/Screens/Select/MatchSongSelect.cs b/osu.Game/Screens/Select/MatchSongSelect.cs index f5ce34ea25..5763b84e89 100644 --- a/osu.Game/Screens/Select/MatchSongSelect.cs +++ b/osu.Game/Screens/Select/MatchSongSelect.cs @@ -8,7 +8,7 @@ using osu.Game.Screens.Multi; namespace osu.Game.Screens.Select { - public class MatchSongSelect : SongSelect, IMultiplayerScreen + public class MatchSongSelect : SongSelect, IMultiplayerSubScreen { public Action Selected;