From 31ade986a707fd41880ccea73a3ab5bf932cb0b9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 30 Mar 2018 14:57:13 +0900 Subject: [PATCH 01/15] Scren async changes in line with framework changes Makes editor not stutter on load, amongst other screens. --- osu-framework | 2 +- osu.Game/Screens/BackgroundScreen.cs | 6 ++---- osu.Game/Screens/Edit/Editor.cs | 2 +- osu.Game/Screens/Play/PlayerLoader.cs | 13 +++++-------- 4 files changed, 9 insertions(+), 14 deletions(-) diff --git a/osu-framework b/osu-framework index 85b3494117..d4cb1117fb 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 85b3494117ccef1b396b70957e1cffaba06e2b54 +Subproject commit d4cb1117fb23453c20e7a8116f1c1f99d9a13611 diff --git a/osu.Game/Screens/BackgroundScreen.cs b/osu.Game/Screens/BackgroundScreen.cs index c5e5883b99..b232cc25cf 100644 --- a/osu.Game/Screens/BackgroundScreen.cs +++ b/osu.Game/Screens/BackgroundScreen.cs @@ -26,14 +26,14 @@ namespace osu.Game.Screens return false; } - public override bool Push(Screen screen) + public override void Push(Screen screen) { // When trying to push a non-loaded screen, load it asynchronously and re-invoke Push // once it's done. if (screen.LoadState == LoadState.NotLoaded) { LoadComponentAsync(screen, d => Push((BackgroundScreen)d)); - return true; + return; } // Make sure the in-progress loading is complete before pushing the screen. @@ -41,8 +41,6 @@ namespace osu.Game.Screens Thread.Sleep(1); base.Push(screen); - - return true; } protected override void Update() diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 8b651000fd..0fcdd79916 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -173,7 +173,7 @@ namespace osu.Game.Screens.Edit } currentScreen.Beatmap.BindTo(Beatmap); - screenContainer.Add(currentScreen); + LoadComponentAsync(currentScreen, screenContainer.Add); } protected override void OnResuming(Screen last) diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 6d55cdb9ca..9ec8f0a52e 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -159,14 +159,11 @@ namespace osu.Game.Screens.Play loadTask = null; - if (!Push(player)) - Exit(); - else - { - //By default, we want to load the player and never be returned to. - //Note that this may change if the player we load requested a re-run. - ValidForResume = false; - } + //By default, we want to load the player and never be returned to. + //Note that this may change if the player we load requested a re-run. + ValidForResume = false; + + Push(player); }); }, 500); } From 0b993561d807a74969e5f76df9afddb91d4e0391 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 20 Apr 2018 16:05:34 +0900 Subject: [PATCH 02/15] Fix BadgeContainer being unsable to handle null badges This fixes a failing test (hidden becaues the test wasn't being run). - [ ] Merge osu-framework#1530 first. --- .../Overlays/Profile/Header/BadgeContainer.cs | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/osu.Game/Overlays/Profile/Header/BadgeContainer.cs b/osu.Game/Overlays/Profile/Header/BadgeContainer.cs index 291db45e97..36a9a9b01a 100644 --- a/osu.Game/Overlays/Profile/Header/BadgeContainer.cs +++ b/osu.Game/Overlays/Profile/Header/BadgeContainer.cs @@ -92,22 +92,18 @@ namespace osu.Game.Overlays.Profile.Header public void ShowBadges(Badge[] badges) { - switch (badges.Length) + if (badges == null || badges.Length == 0) { - case 0: - Hide(); - return; - case 1: - badgeCountText.Hide(); - break; - default: - badgeCountText.Show(); - badgeCountText.Text = $"{badges.Length} badges"; - break; + Hide(); + return; } - Show(); badgeCount = badges.Length; + + badgeCountText.FadeTo(badgeCount > 1 ? 1 : 0); + badgeCountText.Text = $"{badges.Length} badges"; + + Show(); visibleBadge = 0; badgeFlowContainer.Clear(); From 8bf25542cbdff7e9aed769ed7ded18f1991fde15 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 20 Apr 2018 17:30:27 +0900 Subject: [PATCH 03/15] Add PlayerLoader TestCase and fix dummy beatmap load procedure --- osu.Game.Tests/Visual/TestCasePlayerLoader.cs | 24 +++++++++++++++++++ osu.Game/Screens/Play/Player.cs | 16 ++++++------- osu.Game/Screens/Play/PlayerLoader.cs | 5 +++- 3 files changed, 35 insertions(+), 10 deletions(-) create mode 100644 osu.Game.Tests/Visual/TestCasePlayerLoader.cs diff --git a/osu.Game.Tests/Visual/TestCasePlayerLoader.cs b/osu.Game.Tests/Visual/TestCasePlayerLoader.cs new file mode 100644 index 0000000000..1e7618232d --- /dev/null +++ b/osu.Game.Tests/Visual/TestCasePlayerLoader.cs @@ -0,0 +1,24 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Game.Beatmaps; +using osu.Game.Screens.Play; + +namespace osu.Game.Tests.Visual +{ + public class TestCasePlayerLoader : OsuTestCase + { + [BackgroundDependencyLoader] + private void load(OsuGameBase game) + { + AddStep("load dummy beatmap", () => Add(new PlayerLoader(new Player + { + InitialBeatmap = new DummyWorkingBeatmap(game), + AllowPause = false, + AllowLeadIn = false, + AllowResults = false, + }))); + } + } +} diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index ec7c1a1009..83958b2912 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -77,7 +77,7 @@ namespace osu.Game.Screens.Play private DrawableStoryboard storyboard; private Container storyboardContainer; - private bool loadedSuccessfully => RulesetContainer?.Objects.Any() == true; + public bool LoadedBeatmapSuccessfully => RulesetContainer?.Objects.Any() == true; [BackgroundDependencyLoader] private void load(AudioManager audio, APIAccess api, OsuConfigManager config) @@ -86,10 +86,7 @@ namespace osu.Game.Screens.Play WorkingBeatmap working = Beatmap.Value; if (working is DummyWorkingBeatmap) - { - Exit(); return; - } sampleRestart = audio.Sample.Get(@"Gameplay/restart"); @@ -122,14 +119,15 @@ namespace osu.Game.Screens.Play } if (!RulesetContainer.Objects.Any()) - throw new InvalidOperationException("Beatmap contains no hit objects!"); + { + Logger.Error(new InvalidOperationException("Beatmap contains no hit objects!"), "Beatmap contains no hit objects!"); + return; + } } catch (Exception e) { Logger.Error(e, "Could not load beatmap sucessfully!"); - //couldn't load, hard abort! - Exit(); return; } @@ -293,7 +291,7 @@ namespace osu.Game.Screens.Play { base.OnEntering(last); - if (!loadedSuccessfully) + if (!LoadedBeatmapSuccessfully) return; Content.Alpha = 0; @@ -343,7 +341,7 @@ namespace osu.Game.Screens.Play return base.OnExiting(next); } - if (loadedSuccessfully) + if (LoadedBeatmapSuccessfully) pauseContainer?.Pause(); return true; diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index c31c64a95d..56fbd7b6e7 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -163,7 +163,10 @@ namespace osu.Game.Screens.Play //Note that this may change if the player we load requested a re-run. ValidForResume = false; - Push(player); + if (player.LoadedBeatmapSuccessfully) + Push(player); + else + Exit(); }); }, 500); } From b16e25c3e98b1d4cea1f88a532578cc36debf79c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 20 Apr 2018 18:32:24 +0900 Subject: [PATCH 04/15] Add error handling on a per-line level in LegacyDecoder Resolves #2306. --- osu.Game/Beatmaps/Formats/Decoder.cs | 2 +- osu.Game/Beatmaps/Formats/JsonBeatmapDecoder.cs | 8 ++++---- osu.Game/Beatmaps/Formats/LegacyDecoder.cs | 13 ++++++++++--- osu.Game/Skinning/LegacySkinDecoder.cs | 8 ++++---- 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/osu.Game/Beatmaps/Formats/Decoder.cs b/osu.Game/Beatmaps/Formats/Decoder.cs index bcd11f1fc8..2927654f62 100644 --- a/osu.Game/Beatmaps/Formats/Decoder.cs +++ b/osu.Game/Beatmaps/Formats/Decoder.cs @@ -21,7 +21,7 @@ namespace osu.Game.Beatmaps.Formats return output; } - protected abstract void ParseStreamInto(StreamReader stream, TOutput beatmap); + protected abstract void ParseStreamInto(StreamReader stream, TOutput output); } public abstract class Decoder diff --git a/osu.Game/Beatmaps/Formats/JsonBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/JsonBeatmapDecoder.cs index e5574cd82e..fba89b8ac1 100644 --- a/osu.Game/Beatmaps/Formats/JsonBeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/JsonBeatmapDecoder.cs @@ -13,15 +13,15 @@ namespace osu.Game.Beatmaps.Formats AddDecoder("{", m => new JsonBeatmapDecoder()); } - protected override void ParseStreamInto(StreamReader stream, Beatmap beatmap) + protected override void ParseStreamInto(StreamReader stream, Beatmap output) { stream.BaseStream.Position = 0; stream.DiscardBufferedData(); - stream.ReadToEnd().DeserializeInto(beatmap); + stream.ReadToEnd().DeserializeInto(output); - foreach (var hitObject in beatmap.HitObjects) - hitObject.ApplyDefaults(beatmap.ControlPointInfo, beatmap.BeatmapInfo.BaseDifficulty); + foreach (var hitObject in output.HitObjects) + hitObject.ApplyDefaults(output.ControlPointInfo, output.BeatmapInfo.BaseDifficulty); } } } diff --git a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs index 06160a87e0..e77efd8508 100644 --- a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs @@ -19,7 +19,7 @@ namespace osu.Game.Beatmaps.Formats FormatVersion = version; } - protected override void ParseStreamInto(StreamReader stream, T beatmap) + protected override void ParseStreamInto(StreamReader stream, T output) { Section section = Section.None; @@ -33,14 +33,21 @@ namespace osu.Game.Beatmaps.Formats { if (!Enum.TryParse(line.Substring(1, line.Length - 2), out section)) { - Logger.Log($"Unknown section \"{line}\" in {beatmap}"); + Logger.Log($"Unknown section \"{line}\" in {output}"); section = Section.None; } continue; } - ParseLine(beatmap, section, line); + try + { + ParseLine(output, section, line); + } + catch (Exception e) + { + Logger.Error(e, $"Failed to process line \"{line}\" into {output}"); + } } } diff --git a/osu.Game/Skinning/LegacySkinDecoder.cs b/osu.Game/Skinning/LegacySkinDecoder.cs index 995518af0a..0ef54c7310 100644 --- a/osu.Game/Skinning/LegacySkinDecoder.cs +++ b/osu.Game/Skinning/LegacySkinDecoder.cs @@ -12,7 +12,7 @@ namespace osu.Game.Skinning { } - protected override void ParseLine(SkinConfiguration output, Section section, string line) + protected override void ParseLine(SkinConfiguration skin, Section section, string line) { switch (section) { @@ -22,17 +22,17 @@ namespace osu.Game.Skinning switch (pair.Key) { case @"Name": - output.SkinInfo.Name = pair.Value; + skin.SkinInfo.Name = pair.Value; break; case @"Author": - output.SkinInfo.Creator = pair.Value; + skin.SkinInfo.Creator = pair.Value; break; } break; } - base.ParseLine(output, section, line); + base.ParseLine(skin, section, line); } } } From 2c9b2aa0e7bdcbe34f6cd4c35487339dcbbe1884 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 22 Apr 2018 02:42:48 +0900 Subject: [PATCH 05/15] Fix intro setting beatmap in background thread causing race conditions --- osu.Game/Screens/Menu/Intro.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index c62a622c3c..68b94ac7f9 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -39,6 +39,7 @@ namespace osu.Game.Screens.Menu private Bindable menuVoice; private Bindable menuMusic; private Track track; + private WorkingBeatmap beatmap; [BackgroundDependencyLoader] private void load(AudioManager audio, OsuConfigManager config, BeatmapManager beatmaps, Framework.Game game) @@ -69,8 +70,7 @@ namespace osu.Game.Screens.Menu } } - Beatmap.Value = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]); - + beatmap = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]); track = Beatmap.Value.Track; welcome = audio.Sample.Get(@"welcome"); @@ -81,6 +81,8 @@ namespace osu.Game.Screens.Menu { base.OnEntering(last); + Game.Beatmap.Value = beatmap; + if (menuVoice) welcome.Play(); From 44a9aa529a734b0f1c7d95a8f26a09ed50a4193f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 21 Apr 2018 18:15:27 +0900 Subject: [PATCH 06/15] Test CI run with new changes --- osu-framework | 2 +- osu.Game/IO/Archives/ArchiveReader.cs | 3 +-- osu.Game/Skinning/LegacySkin.cs | 25 +++++++++++++++++++++++++ osu.Game/Tests/Visual/OsuTestCase.cs | 9 +-------- 4 files changed, 28 insertions(+), 11 deletions(-) diff --git a/osu-framework b/osu-framework index 10597927c0..54bdeda01d 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 10597927c0eac1b1ea263598088ffc5b2f520953 +Subproject commit 54bdeda01dc9ec356037b63c002dbce282226e90 diff --git a/osu.Game/IO/Archives/ArchiveReader.cs b/osu.Game/IO/Archives/ArchiveReader.cs index d14080de5b..808ce159bb 100644 --- a/osu.Game/IO/Archives/ArchiveReader.cs +++ b/osu.Game/IO/Archives/ArchiveReader.cs @@ -1,14 +1,13 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using System.Collections.Generic; using System.IO; using osu.Framework.IO.Stores; namespace osu.Game.IO.Archives { - public abstract class ArchiveReader : IDisposable, IResourceStore + public abstract class ArchiveReader : IResourceStore { /// /// Opens a stream for reading a specific file from this archive. diff --git a/osu.Game/Skinning/LegacySkin.cs b/osu.Game/Skinning/LegacySkin.cs index 0a05137a87..45c6ec80aa 100644 --- a/osu.Game/Skinning/LegacySkin.cs +++ b/osu.Game/Skinning/LegacySkin.cs @@ -113,6 +113,31 @@ namespace osu.Game.Skinning string path = getPathForFile(name); return path == null ? null : underlyingStore.Get(path); } + + #region IDisposable Support + + private bool isDisposed; + + protected virtual void Dispose(bool disposing) + { + if (!isDisposed) + { + isDisposed = true; + } + } + + ~LegacySkinResourceStore() + { + Dispose(false); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + #endregion } } } diff --git a/osu.Game/Tests/Visual/OsuTestCase.cs b/osu.Game/Tests/Visual/OsuTestCase.cs index 02f425c296..1b01c9c95d 100644 --- a/osu.Game/Tests/Visual/OsuTestCase.cs +++ b/osu.Game/Tests/Visual/OsuTestCase.cs @@ -19,14 +19,7 @@ namespace osu.Game.Tests.Visual public OsuTestCaseTestRunner() { - runner = new TestCaseTestRunner.TestRunner(); - } - - protected override void LoadComplete() - { - base.LoadComplete(); - - Add(runner); + Add(runner = new TestCaseTestRunner.TestRunner()); } public void RunTestBlocking(TestCase test) => runner.RunTestBlocking(test); From 64ddee56461ea3cab27a5f55f2870ea0c6bd394c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 22 Apr 2018 04:10:06 +0900 Subject: [PATCH 07/15] Change load order to ensure runner is loaded before blocking op --- osu-framework | 2 +- osu.Game/OsuGameBase.cs | 28 ++++++++++++++-------------- osu.Game/Tests/Visual/OsuTestCase.cs | 7 +++++-- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/osu-framework b/osu-framework index 54bdeda01d..9c9faa2f10 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 54bdeda01dc9ec356037b63c002dbce282226e90 +Subproject commit 9c9faa2f10870c63ed3bc1b7f81f5c3098f9b37a diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index b76510ea1e..487cb50c9a 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -188,6 +188,20 @@ namespace osu.Game FileStore.Cleanup(); AddInternal(api); + + GlobalActionContainer globalBinding; + + CursorOverrideContainer = new CursorOverrideContainer { RelativeSizeAxes = Axes.Both }; + CursorOverrideContainer.Child = globalBinding = new GlobalActionContainer(this) + { + RelativeSizeAxes = Axes.Both, + Child = content = new OsuTooltipContainer(CursorOverrideContainer.Cursor) { RelativeSizeAxes = Axes.Both } + }; + + base.Content.Add(new DrawSizePreservingFillContainer { Child = CursorOverrideContainer }); + + KeyBindingStore.Register(globalBinding); + dependencies.Cache(globalBinding); } private void runMigrations() @@ -217,20 +231,6 @@ namespace osu.Game { base.LoadComplete(); - GlobalActionContainer globalBinding; - - CursorOverrideContainer = new CursorOverrideContainer { RelativeSizeAxes = Axes.Both }; - CursorOverrideContainer.Child = globalBinding = new GlobalActionContainer(this) - { - RelativeSizeAxes = Axes.Both, - Child = content = new OsuTooltipContainer(CursorOverrideContainer.Cursor) { RelativeSizeAxes = Axes.Both } - }; - - base.Content.Add(new DrawSizePreservingFillContainer { Child = CursorOverrideContainer }); - - KeyBindingStore.Register(globalBinding); - dependencies.Cache(globalBinding); - // TODO: This is temporary until we reimplement the local FPS display. // It's just to allow end-users to access the framework FPS display without knowing the shortcut key. fpsDisplayVisible = LocalConfig.GetBindable(OsuSetting.ShowFpsDisplay); diff --git a/osu.Game/Tests/Visual/OsuTestCase.cs b/osu.Game/Tests/Visual/OsuTestCase.cs index 1b01c9c95d..2b677f1f42 100644 --- a/osu.Game/Tests/Visual/OsuTestCase.cs +++ b/osu.Game/Tests/Visual/OsuTestCase.cs @@ -15,10 +15,13 @@ namespace osu.Game.Tests.Visual { protected override string MainResourceFile => File.Exists(base.MainResourceFile) ? base.MainResourceFile : Assembly.GetExecutingAssembly().Location; - private readonly TestCaseTestRunner.TestRunner runner; + private TestCaseTestRunner.TestRunner runner; - public OsuTestCaseTestRunner() + protected override void LoadAsyncComplete() { + // this has to be run here rather than LoadComplete because + // TestCase.cs is checking the IsLoaded state (on another thread) and expects + // the runner to be loaded at that point. Add(runner = new TestCaseTestRunner.TestRunner()); } From 36a671e306a6a10b03118c2e175981d1ddab19cb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 23 Apr 2018 14:56:45 +0900 Subject: [PATCH 08/15] Fix new detections in rider 2018.1 --- osu.Game/Online/API/Requests/GetMessagesRequest.cs | 2 +- osu.Game/Online/API/Requests/GetUserRequest.cs | 2 +- osu.Game/Screens/Ranking/ResultsPageScore.cs | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Game/Online/API/Requests/GetMessagesRequest.cs b/osu.Game/Online/API/Requests/GetMessagesRequest.cs index d600f40716..68de194bae 100644 --- a/osu.Game/Online/API/Requests/GetMessagesRequest.cs +++ b/osu.Game/Online/API/Requests/GetMessagesRequest.cs @@ -11,7 +11,7 @@ namespace osu.Game.Online.API.Requests public class GetMessagesRequest : APIRequest> { private readonly List channels; - private long? since; + private readonly long? since; public GetMessagesRequest(List channels, long? sinceId) { diff --git a/osu.Game/Online/API/Requests/GetUserRequest.cs b/osu.Game/Online/API/Requests/GetUserRequest.cs index 9026d10334..607e8e5127 100644 --- a/osu.Game/Online/API/Requests/GetUserRequest.cs +++ b/osu.Game/Online/API/Requests/GetUserRequest.cs @@ -7,7 +7,7 @@ namespace osu.Game.Online.API.Requests { public class GetUserRequest : APIRequest { - private long? userId; + private readonly long? userId; public GetUserRequest(long? userId = null) { diff --git a/osu.Game/Screens/Ranking/ResultsPageScore.cs b/osu.Game/Screens/Ranking/ResultsPageScore.cs index 9d92439a4b..42d8af07b9 100644 --- a/osu.Game/Screens/Ranking/ResultsPageScore.cs +++ b/osu.Game/Screens/Ranking/ResultsPageScore.cs @@ -223,11 +223,11 @@ namespace osu.Game.Screens.Ranking private class DateTimeDisplay : Container { - private DateTime datetime; + private readonly DateTime date; - public DateTimeDisplay(DateTime datetime) + public DateTimeDisplay(DateTime date) { - this.datetime = datetime; + this.date = date; AutoSizeAxes = Axes.Y; @@ -251,7 +251,7 @@ namespace osu.Game.Screens.Ranking { Origin = Anchor.CentreLeft, Anchor = Anchor.CentreLeft, - Text = datetime.ToShortDateString(), + Text = date.ToShortDateString(), Padding = new MarginPadding { Horizontal = 10, Vertical = 5 }, Colour = Color4.White, }, @@ -259,7 +259,7 @@ namespace osu.Game.Screens.Ranking { Origin = Anchor.CentreRight, Anchor = Anchor.CentreRight, - Text = datetime.ToShortTimeString(), + Text = date.ToShortTimeString(), Padding = new MarginPadding { Horizontal = 10, Vertical = 5 }, Colour = Color4.White, } From 6e16f2a3c3c5dd187eca42e3c49ae81e375599f2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 23 Apr 2018 15:03:41 +0900 Subject: [PATCH 09/15] Add assert to appease rider/r# --- .../Screens/Edit/Screens/Compose/Layers/MaskContainer.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs index 6d75b8dc15..7caece2b3e 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -43,6 +44,9 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers public override void Add(HitObjectMask drawable) { + // Rider 2018.1 requires this (roslyn analyser issue?) + Debug.Assert(drawable != null); + base.Add(drawable); drawable.Selected += onMaskSelected; @@ -53,6 +57,9 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers public override bool Remove(HitObjectMask drawable) { + // Rider 2018.1 requires this (roslyn analyser issue?) + Debug.Assert(drawable != null); + var result = base.Remove(drawable); if (result) From 2d82c0b5cdadeea5409734efc85a511dd63fecc9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 23 Apr 2018 16:41:15 +0900 Subject: [PATCH 10/15] Fix logical regression --- osu.Game/Screens/Menu/Intro.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index 68b94ac7f9..4de76e530a 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -71,7 +71,7 @@ namespace osu.Game.Screens.Menu } beatmap = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]); - track = Beatmap.Value.Track; + track = beatmap.Track; welcome = audio.Sample.Get(@"welcome"); seeya = audio.Sample.Get(@"seeya"); From 194992936d92a9e6765630a610603cf86608fdfd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 23 Apr 2018 17:57:32 +0900 Subject: [PATCH 11/15] Use exceptions --- .../Edit/Screens/Compose/Layers/MaskContainer.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs index 7caece2b3e..993594f1d2 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs @@ -3,8 +3,8 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.Linq; +using JetBrains.Annotations; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input; @@ -44,8 +44,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers public override void Add(HitObjectMask drawable) { - // Rider 2018.1 requires this (roslyn analyser issue?) - Debug.Assert(drawable != null); + if (drawable == null) throw new ArgumentNullException(nameof(drawable)); base.Add(drawable); @@ -55,10 +54,9 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers drawable.DragRequested += onDragRequested; } - public override bool Remove(HitObjectMask drawable) + public override bool Remove([NotNull] HitObjectMask drawable) { - // Rider 2018.1 requires this (roslyn analyser issue?) - Debug.Assert(drawable != null); + if (drawable == null) throw new ArgumentNullException(nameof(drawable)); var result = base.Remove(drawable); From 8b1b605c09f2fc2f9e73f7f99da45739ee5da241 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 23 Apr 2018 18:32:32 +0900 Subject: [PATCH 12/15] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 9c9faa2f10..61e676094d 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 9c9faa2f10870c63ed3bc1b7f81f5c3098f9b37a +Subproject commit 61e676094d25436bb9e8858946f65c43d15d8e01 From 2d1cef79d6f66544abfe88e394fd3df483ed72a8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 23 Apr 2018 19:01:01 +0900 Subject: [PATCH 13/15] Fix instability in carousel item sorting --- osu.Game/Screens/Select/Carousel/CarouselGroup.cs | 7 +++++++ osu.Game/Screens/Select/Carousel/CarouselItem.cs | 9 ++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/Carousel/CarouselGroup.cs b/osu.Game/Screens/Select/Carousel/CarouselGroup.cs index 7ea6e7c82b..a1f44763d6 100644 --- a/osu.Game/Screens/Select/Carousel/CarouselGroup.cs +++ b/osu.Game/Screens/Select/Carousel/CarouselGroup.cs @@ -16,6 +16,12 @@ namespace osu.Game.Screens.Select.Carousel protected List InternalChildren = new List(); + /// + /// Used to assign a monotonically increasing ID to children as they are added. This member is + /// incremented whenever a child is added. + /// + private ulong currentChildID; + public override List Drawables { get @@ -39,6 +45,7 @@ namespace osu.Game.Screens.Select.Carousel public virtual void AddChild(CarouselItem i) { i.State.ValueChanged += v => ChildItemStateChanged(i, v); + i.ChildID = ++currentChildID; InternalChildren.Add(i); } diff --git a/osu.Game/Screens/Select/Carousel/CarouselItem.cs b/osu.Game/Screens/Select/Carousel/CarouselItem.cs index 2efc928984..0de32c12f1 100644 --- a/osu.Game/Screens/Select/Carousel/CarouselItem.cs +++ b/osu.Game/Screens/Select/Carousel/CarouselItem.cs @@ -31,6 +31,8 @@ namespace osu.Game.Screens.Select.Carousel } } + private int creationOrder; + protected CarouselItem() { drawableRepresentation = new Lazy(CreateDrawableRepresentation); @@ -44,13 +46,18 @@ namespace osu.Game.Screens.Select.Carousel private readonly Lazy drawableRepresentation; + /// + /// Used as a default sort method for s of differing types. + /// + internal ulong ChildID; + protected abstract DrawableCarouselItem CreateDrawableRepresentation(); public virtual void Filter(FilterCriteria criteria) { } - public virtual int CompareTo(FilterCriteria criteria, CarouselItem other) => GetHashCode().CompareTo(other.GetHashCode()); + public virtual int CompareTo(FilterCriteria criteria, CarouselItem other) => ChildID.CompareTo(other.ChildID); } public enum CarouselItemState From 7d09a3926294736988df2713e3bf39d24de6b3ad Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 23 Apr 2018 20:50:16 +0900 Subject: [PATCH 14/15] Fix remaining broken test --- osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs b/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs index 790c4cedc3..51a8bacd2e 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs +++ b/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs @@ -110,11 +110,13 @@ namespace osu.Game.Tests.Visual private void selectBeatmap(string name) { - var infoBefore = infoWedge.Info; + BeatmapInfoWedge.BufferedWedgeInfo infoBefore = null; AddStep($"select {name} beatmap", () => { - beatmap.Value = new TestWorkingBeatmap(beatmaps.First(b => b.BeatmapInfo.Ruleset.ShortName == name)); + infoBefore = infoWedge.Info; + WorkingBeatmap bm = new TestWorkingBeatmap(beatmaps.First(b => b.BeatmapInfo.Ruleset.ShortName == name)); + beatmap.Value = bm; infoWedge.UpdateBeatmap(beatmap); }); From 9551b6914be52e935e0bd81d68f374e784553d28 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 23 Apr 2018 21:41:51 +0900 Subject: [PATCH 15/15] Fix UserProfile test failing when not logged in --- osu.Game.Tests/Visual/TestCaseUserProfile.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseUserProfile.cs b/osu.Game.Tests/Visual/TestCaseUserProfile.cs index 0fdc01a974..aca832110a 100644 --- a/osu.Game.Tests/Visual/TestCaseUserProfile.cs +++ b/osu.Game.Tests/Visual/TestCaseUserProfile.cs @@ -5,7 +5,9 @@ using System; using System.Collections.Generic; using System.Linq; using NUnit.Framework; +using osu.Framework.Allocation; using osu.Game.Graphics.UserInterface; +using osu.Game.Online.API; using osu.Game.Overlays; using osu.Game.Overlays.Profile; using osu.Game.Overlays.Profile.Header; @@ -17,6 +19,7 @@ namespace osu.Game.Tests.Visual public class TestCaseUserProfile : OsuTestCase { private readonly TestUserProfileOverlay profile; + private APIAccess api; public override IReadOnlyList RequiredTypes => new[] { @@ -32,6 +35,12 @@ namespace osu.Game.Tests.Visual Add(profile = new TestUserProfileOverlay()); } + [BackgroundDependencyLoader] + private void load(APIAccess api) + { + this.api = api; + } + protected override void LoadComplete() { base.LoadComplete(); @@ -79,9 +88,10 @@ namespace osu.Game.Tests.Visual { Username = @"peppy", Id = 2, + IsSupporter = true, Country = new Country { FullName = @"Australia", FlagName = @"AU" }, CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg" - })); + }, api.IsLoggedIn)); checkSupporterTag(true); @@ -91,7 +101,7 @@ namespace osu.Game.Tests.Visual Id = 3103765, Country = new Country { FullName = @"Japan", FlagName = @"JP" }, CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c6.jpg" - })); + }, api.IsLoggedIn)); AddStep("Hide", profile.Hide); AddStep("Show without reload", profile.Show);