From a2f6d8a3e68a2c7b4c014d80e3c5e282cd231c29 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 11 May 2017 18:14:48 +0900 Subject: [PATCH 1/2] Fix broken test cases, remove some recursive lookup methods. --- osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs | 2 +- osu.Game/Database/BeatmapDatabase.cs | 3 +++ osu.Game/Database/Database.cs | 8 +++----- osu.Game/Screens/Menu/MainMenu.cs | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs index e259f700b1..0e456941a1 100644 --- a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs @@ -142,7 +142,7 @@ namespace osu.Game.Tests.Beatmaps.IO Assert.IsTrue(waitAction.BeginInvoke(null, null).AsyncWaitHandle.WaitOne(timeout), @"Beatmaps did not import to the database in allocated time"); - var set = host.Dependencies.Get().GetChildren(resultSets.First(), true); + var set = host.Dependencies.Get().GetChildren(resultSets.First()); Assert.IsTrue(set.Beatmaps.Count == resultBeatmaps.Count(), $@"Incorrect database beatmap count post-import ({resultBeatmaps.Count()} but should be {set.Beatmaps.Count})."); diff --git a/osu.Game/Database/BeatmapDatabase.cs b/osu.Game/Database/BeatmapDatabase.cs index 760b7ae353..de570d3e7e 100644 --- a/osu.Game/Database/BeatmapDatabase.cs +++ b/osu.Game/Database/BeatmapDatabase.cs @@ -267,6 +267,9 @@ namespace osu.Game.Database public WorkingBeatmap GetWorkingBeatmap(BeatmapInfo beatmapInfo, WorkingBeatmap previous = null, bool withStoryboard = false) { + if (beatmapInfo.BeatmapSet == null) + beatmapInfo = GetChildren(beatmapInfo, true); + if (beatmapInfo.BeatmapSet == null) throw new InvalidOperationException($@"Beatmap set {beatmapInfo.BeatmapSetInfoID} is not in the local database."); diff --git a/osu.Game/Database/Database.cs b/osu.Game/Database/Database.cs index 9b49583875..a55c0f570b 100644 --- a/osu.Game/Database/Database.cs +++ b/osu.Game/Database/Database.cs @@ -48,11 +48,9 @@ namespace osu.Game.Database return Connection.Table(); } - public T GetWithChildren(object id, bool recursive = false) where T : class - { - return Connection.GetWithChildren(id, recursive); - } - + /// + /// This is expensive. Use with caution. + /// public List GetAllWithChildren(Expression> filter = null, bool recursive = true) where T : class { diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index f8b8882d3d..c8a00e0671 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -79,7 +79,7 @@ namespace osu.Game.Screens.Menu if (count > 0) { var beatmap = query.ElementAt(RNG.Next(0, count - 1)); - beatmaps.GetChildren(beatmap, true); + beatmaps.GetChildren(beatmap); Beatmap = beatmaps.GetWorkingBeatmap(beatmap.Beatmaps[0]); } } From b258109a9ee1c9e98299a0543a7e99bfec18d2fe Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 11 May 2017 18:27:14 +0900 Subject: [PATCH 2/2] Fix chat input box not always keeping focus as expected --- osu.Game/Overlays/ChatOverlay.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 457611dfab..dc586bd363 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -110,12 +110,18 @@ namespace osu.Game.Overlays { MoveToY(0, transition_length, EasingTypes.OutQuint); FadeIn(transition_length, EasingTypes.OutQuint); + + inputTextBox.HoldFocus = true; + base.PopIn(); } protected override void PopOut() { MoveToY(DrawSize.Y, transition_length, EasingTypes.InSine); FadeOut(transition_length, EasingTypes.InSine); + + inputTextBox.HoldFocus = false; + base.PopOut(); } [BackgroundDependencyLoader]