From 5de6e29294d07dac6823673d6e9c6d3146f913c4 Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Wed, 6 Mar 2019 17:13:41 +0900 Subject: [PATCH 1/3] Reset currentRoom state when cancelling room creation --- osu.Game/Screens/Multi/Match/MatchSubScreen.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/osu.Game/Screens/Multi/Match/MatchSubScreen.cs b/osu.Game/Screens/Multi/Match/MatchSubScreen.cs index a71106872e..902a8c1c57 100644 --- a/osu.Game/Screens/Multi/Match/MatchSubScreen.cs +++ b/osu.Game/Screens/Multi/Match/MatchSubScreen.cs @@ -53,6 +53,9 @@ namespace osu.Game.Screens.Multi.Match private MatchLeaderboard leaderboard; + [Resolved] + private Bindable currentRoom { get; set; } + public MatchSubScreen(Room room) { Title = room.RoomID.Value == null ? "New room" : room.Name.Value; @@ -182,6 +185,10 @@ namespace osu.Game.Screens.Multi.Match public override bool OnExiting(IScreen next) { RoomManager?.PartRoom(); + + if (roomId.Value == null) + currentRoom.Value = new Room(); + return base.OnExiting(next); } From 6e5ea78ca258e4a22e4ed36041959cc615126d5e Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Wed, 6 Mar 2019 17:13:28 +0900 Subject: [PATCH 2/3] Fix some nullref crashes when escaping out of new room creation --- osu.Game/Screens/Multi/Match/Components/Header.cs | 4 +++- osu.Game/Screens/Select/MatchSongSelect.cs | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Multi/Match/Components/Header.cs b/osu.Game/Screens/Multi/Match/Components/Header.cs index 6a6a1f274c..e1592532a3 100644 --- a/osu.Game/Screens/Multi/Match/Components/Header.cs +++ b/osu.Game/Screens/Multi/Match/Components/Header.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; @@ -13,6 +14,7 @@ using osu.Game.Beatmaps.Drawables; using osu.Game.Graphics; using osu.Game.Online.Multiplayer; using osu.Game.Overlays.SearchableList; +using osu.Game.Rulesets.Mods; using osu.Game.Screens.Multi.Components; using osu.Game.Screens.Play.HUD; using osuTK; @@ -108,7 +110,7 @@ namespace osu.Game.Screens.Multi.Match.Components }, }; - CurrentItem.BindValueChanged(item => modDisplay.Current.Value = item.NewValue?.RequiredMods, true); + CurrentItem.BindValueChanged(item => modDisplay.Current.Value = item.NewValue?.RequiredMods ?? Enumerable.Empty(), true); beatmapButton.Action = () => RequestBeatmapSelection?.Invoke(); } diff --git a/osu.Game/Screens/Select/MatchSongSelect.cs b/osu.Game/Screens/Select/MatchSongSelect.cs index f6d758df29..fcd07384e4 100644 --- a/osu.Game/Screens/Select/MatchSongSelect.cs +++ b/osu.Game/Screens/Select/MatchSongSelect.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Linq; using Humanizer; using osu.Framework.Allocation; using osu.Framework.Bindables; @@ -61,7 +62,7 @@ namespace osu.Game.Screens.Select return true; Beatmap.Value = beatmaps.GetWorkingBeatmap(CurrentItem.Value?.Beatmap); - Beatmap.Value.Mods.Value = selectedMods.Value = CurrentItem.Value?.RequiredMods; + Beatmap.Value.Mods.Value = selectedMods.Value = CurrentItem.Value?.RequiredMods ?? Enumerable.Empty(); Ruleset.Value = CurrentItem.Value?.Ruleset; Beatmap.Disabled = true; From 50c1b3a576c0e1a86edd4b86cd1d6b6c47b561a5 Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Thu, 7 Mar 2019 16:49:48 +0900 Subject: [PATCH 3/3] Move room resetting logic from MatchSubScreen to LoungeSubScreen --- osu.Game/Screens/Multi/Lounge/LoungeSubScreen.cs | 8 ++++++++ osu.Game/Screens/Multi/Match/MatchSubScreen.cs | 7 ------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/osu.Game/Screens/Multi/Lounge/LoungeSubScreen.cs b/osu.Game/Screens/Multi/Lounge/LoungeSubScreen.cs index dd1e060125..7cbae611ea 100644 --- a/osu.Game/Screens/Multi/Lounge/LoungeSubScreen.cs +++ b/osu.Game/Screens/Multi/Lounge/LoungeSubScreen.cs @@ -107,6 +107,14 @@ namespace osu.Game.Screens.Multi.Lounge Filter.Search.HoldFocus = false; } + public override void OnResuming(IScreen last) + { + base.OnResuming(last); + + if (currentRoom.Value?.RoomID.Value == null) + currentRoom.Value = new Room(); + } + private void joinRequested(Room room) { processingOverlay.Show(); diff --git a/osu.Game/Screens/Multi/Match/MatchSubScreen.cs b/osu.Game/Screens/Multi/Match/MatchSubScreen.cs index 902a8c1c57..a71106872e 100644 --- a/osu.Game/Screens/Multi/Match/MatchSubScreen.cs +++ b/osu.Game/Screens/Multi/Match/MatchSubScreen.cs @@ -53,9 +53,6 @@ namespace osu.Game.Screens.Multi.Match private MatchLeaderboard leaderboard; - [Resolved] - private Bindable currentRoom { get; set; } - public MatchSubScreen(Room room) { Title = room.RoomID.Value == null ? "New room" : room.Name.Value; @@ -185,10 +182,6 @@ namespace osu.Game.Screens.Multi.Match public override bool OnExiting(IScreen next) { RoomManager?.PartRoom(); - - if (roomId.Value == null) - currentRoom.Value = new Room(); - return base.OnExiting(next); }