From 94eacbca5dde273bec3a0f2073af9e0ce5cb3097 Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Fri, 27 Sep 2019 09:22:25 +0300 Subject: [PATCH 01/16] Fix Bot users have all the profile sections in ProfileOverlay --- osu.Game/Overlays/UserProfileOverlay.cs | 5 ++++- osu.Game/Users/User.cs | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/UserProfileOverlay.cs b/osu.Game/Overlays/UserProfileOverlay.cs index b924b3302f..bc16711ea8 100644 --- a/osu.Game/Overlays/UserProfileOverlay.cs +++ b/osu.Game/Overlays/UserProfileOverlay.cs @@ -44,7 +44,7 @@ public void ShowUser(User user, bool fetchOnline = true) Clear(); lastSection = null; - sections = new ProfileSection[] + sections = !user.IsBot ? new ProfileSection[] { //new AboutSection(), new RecentSection(), @@ -53,6 +53,9 @@ public void ShowUser(User user, bool fetchOnline = true) new HistoricalSection(), new BeatmapsSection(), new KudosuSection() + } : new ProfileSection[] + { + //new AboutSection(), }; tabs = new ProfileTabControl diff --git a/osu.Game/Users/User.cs b/osu.Game/Users/User.cs index 9986f70557..1cb395fd75 100644 --- a/osu.Game/Users/User.cs +++ b/osu.Game/Users/User.cs @@ -78,6 +78,9 @@ public class UserCover [JsonProperty(@"is_bng")] public bool IsBNG; + [JsonProperty(@"is_bot")] + public bool IsBot; + [JsonProperty(@"is_active")] public bool Active; From 475455d7cd5f02275ceeed31e34baf63a9bc465a Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Fri, 27 Sep 2019 09:32:46 +0300 Subject: [PATCH 02/16] Add missing line breaks --- osu.Game/Overlays/UserProfileOverlay.cs | 28 +++++++++++++------------ 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/osu.Game/Overlays/UserProfileOverlay.cs b/osu.Game/Overlays/UserProfileOverlay.cs index bc16711ea8..57b9b6c965 100644 --- a/osu.Game/Overlays/UserProfileOverlay.cs +++ b/osu.Game/Overlays/UserProfileOverlay.cs @@ -44,19 +44,21 @@ public void ShowUser(User user, bool fetchOnline = true) Clear(); lastSection = null; - sections = !user.IsBot ? new ProfileSection[] - { - //new AboutSection(), - new RecentSection(), - new RanksSection(), - //new MedalsSection(), - new HistoricalSection(), - new BeatmapsSection(), - new KudosuSection() - } : new ProfileSection[] - { - //new AboutSection(), - }; + sections = !user.IsBot ? + new ProfileSection[] + { + //new AboutSection(), + new RecentSection(), + new RanksSection(), + //new MedalsSection(), + new HistoricalSection(), + new BeatmapsSection(), + new KudosuSection() + } : + new ProfileSection[] + { + //new AboutSection(), + }; tabs = new ProfileTabControl { From 4908cb826b78d964025708865cc695adb7202a4e Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Fri, 27 Sep 2019 09:46:11 +0300 Subject: [PATCH 03/16] Fix line breaks --- osu.Game/Overlays/UserProfileOverlay.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/UserProfileOverlay.cs b/osu.Game/Overlays/UserProfileOverlay.cs index 57b9b6c965..468eb22b01 100644 --- a/osu.Game/Overlays/UserProfileOverlay.cs +++ b/osu.Game/Overlays/UserProfileOverlay.cs @@ -44,8 +44,8 @@ public void ShowUser(User user, bool fetchOnline = true) Clear(); lastSection = null; - sections = !user.IsBot ? - new ProfileSection[] + sections = !user.IsBot + ? new ProfileSection[] { //new AboutSection(), new RecentSection(), @@ -54,8 +54,8 @@ public void ShowUser(User user, bool fetchOnline = true) new HistoricalSection(), new BeatmapsSection(), new KudosuSection() - } : - new ProfileSection[] + } + : new ProfileSection[] { //new AboutSection(), }; From 2487d4f0f208524b433dff5dd6395b61268498a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sat, 28 Sep 2019 11:58:27 +0200 Subject: [PATCH 04/16] Migrate beatmap carousel test to AddUntilStep Due to non-deterministic test failures in TestSceneBeatmapCarousel, migrate the checkSelected helper step from AddAssert to AddUntilStep. This adds more leniency for performance-related issues while still checking the desired behaviour. --- osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapCarousel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapCarousel.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapCarousel.cs index f12a613bf1..51dc11ebf8 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapCarousel.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapCarousel.cs @@ -83,7 +83,7 @@ private void ensureRandomFetchSuccess() => AddAssert("ensure prev random fetch worked", () => selectedSets.Peek() == carousel.SelectedBeatmapSet); private void checkSelected(int set, int? diff = null) => - AddAssert($"selected is set{set}{(diff.HasValue ? $" diff{diff.Value}" : "")}", () => + AddUntilStep($"selected is set{set}{(diff.HasValue ? $" diff{diff.Value}" : "")}", () => { if (diff != null) return carousel.SelectedBeatmap == carousel.BeatmapSets.Skip(set - 1).First().Beatmaps.Skip(diff.Value - 1).First(); From 52b044b7f60b055df4baccedbc902eb7142788eb Mon Sep 17 00:00:00 2001 From: V1ntagezTV Date: Sun, 29 Sep 2019 00:10:17 +0500 Subject: [PATCH 05/16] Add random intro! --- osu.Game/Configuration/IntroSequence.cs | 3 ++- osu.Game/Screens/Loader.cs | 11 ++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/osu.Game/Configuration/IntroSequence.cs b/osu.Game/Configuration/IntroSequence.cs index 1eb953be36..1ee7da8bac 100644 --- a/osu.Game/Configuration/IntroSequence.cs +++ b/osu.Game/Configuration/IntroSequence.cs @@ -6,6 +6,7 @@ namespace osu.Game.Configuration public enum IntroSequence { Circles, - Triangles + Triangles, + Random } } diff --git a/osu.Game/Screens/Loader.cs b/osu.Game/Screens/Loader.cs index 850349272e..7d2ad0e0ad 100644 --- a/osu.Game/Screens/Loader.cs +++ b/osu.Game/Screens/Loader.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; @@ -12,6 +13,7 @@ using osu.Game.Configuration; using IntroSequence = osu.Game.Configuration.IntroSequence; + namespace osu.Game.Screens { public class Loader : StartupScreen @@ -58,9 +60,16 @@ protected virtual OsuScreen CreateLoadableScreen() } private IntroScreen getIntroSequence() - { + {//вот именно что не показывает ни всплывающих подсказок нихера + Random random = new Random(); switch (introSequence) { + case IntroSequence.Random: + if (random.Next(2) == 0) + return new IntroCircles(); + else + return new IntroTriangles(); + case IntroSequence.Circles: return new IntroCircles(); From 1babd139bc066c1d49e48fa4cf3575784d010eaf Mon Sep 17 00:00:00 2001 From: V1ntagezTV Date: Sun, 29 Sep 2019 00:22:23 +0500 Subject: [PATCH 06/16] remove needless blank --- osu.Game/Screens/Loader.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Screens/Loader.cs b/osu.Game/Screens/Loader.cs index 7d2ad0e0ad..c17463388a 100644 --- a/osu.Game/Screens/Loader.cs +++ b/osu.Game/Screens/Loader.cs @@ -13,7 +13,6 @@ using osu.Game.Configuration; using IntroSequence = osu.Game.Configuration.IntroSequence; - namespace osu.Game.Screens { public class Loader : StartupScreen From 2681e2064ae40da81da7ac1b2962481556025d10 Mon Sep 17 00:00:00 2001 From: V1ntagezTV Date: Sun, 29 Sep 2019 00:34:09 +0500 Subject: [PATCH 07/16] remove comment --- osu.Game/Screens/Loader.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Loader.cs b/osu.Game/Screens/Loader.cs index c17463388a..75ed74978f 100644 --- a/osu.Game/Screens/Loader.cs +++ b/osu.Game/Screens/Loader.cs @@ -59,7 +59,7 @@ protected virtual OsuScreen CreateLoadableScreen() } private IntroScreen getIntroSequence() - {//вот именно что не показывает ни всплывающих подсказок нихера + { Random random = new Random(); switch (introSequence) { From 9f1c3787333dbaa7957992e0248e317f46c2797c Mon Sep 17 00:00:00 2001 From: V1ntagezTV Date: Sun, 29 Sep 2019 00:35:47 +0500 Subject: [PATCH 08/16] moved into the switch case --- osu.Game/Screens/Loader.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Loader.cs b/osu.Game/Screens/Loader.cs index 75ed74978f..fb49c8a574 100644 --- a/osu.Game/Screens/Loader.cs +++ b/osu.Game/Screens/Loader.cs @@ -60,10 +60,10 @@ protected virtual OsuScreen CreateLoadableScreen() private IntroScreen getIntroSequence() { - Random random = new Random(); switch (introSequence) { case IntroSequence.Random: + var random = new Random(); if (random.Next(2) == 0) return new IntroCircles(); else From 740efa57477f75da8078fb0d86e73bc603e7bb64 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 29 Sep 2019 12:13:41 +0800 Subject: [PATCH 09/16] Handle potential null case --- osu.Game/Overlays/MusicController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 172ae4e5cb..49d16a4f3e 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -75,7 +75,7 @@ public void ChangeBeatmapSetPosition(BeatmapSetInfo beatmapSetInfo, int index) /// /// Returns whether the current beatmap track is playing. /// - public bool IsPlaying => beatmap.Value.Track.IsRunning; + public bool IsPlaying => beatmap.Value?.Track.IsRunning ?? false; private void handleBeatmapAdded(BeatmapSetInfo set) => Schedule(() => beatmapSets.Add(set)); From 539f3329cef87bf1024b569a6ae77e033316e15e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 29 Sep 2019 12:23:18 +0800 Subject: [PATCH 10/16] Rename method to match new behaviour --- .../SongSelect/TestSceneBeatmapCarousel.cs | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapCarousel.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapCarousel.cs index 51dc11ebf8..90c6c9065c 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapCarousel.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapCarousel.cs @@ -82,7 +82,7 @@ private void loadBeatmaps(List beatmapSets = null) private void ensureRandomFetchSuccess() => AddAssert("ensure prev random fetch worked", () => selectedSets.Peek() == carousel.SelectedBeatmapSet); - private void checkSelected(int set, int? diff = null) => + private void waitForSelection(int set, int? diff = null) => AddUntilStep($"selected is set{set}{(diff.HasValue ? $" diff{diff.Value}" : "")}", () => { if (diff != null) @@ -168,24 +168,24 @@ public void TestTraversal() loadBeatmaps(); advanceSelection(direction: 1, diff: false); - checkSelected(1, 1); + waitForSelection(1, 1); advanceSelection(direction: 1, diff: true); - checkSelected(1, 2); + waitForSelection(1, 2); advanceSelection(direction: -1, diff: false); - checkSelected(set_count, 1); + waitForSelection(set_count, 1); advanceSelection(direction: -1, diff: true); - checkSelected(set_count - 1, 3); + waitForSelection(set_count - 1, 3); advanceSelection(diff: false); advanceSelection(diff: false); - checkSelected(1, 2); + waitForSelection(1, 2); advanceSelection(direction: -1, diff: true); advanceSelection(direction: -1, diff: true); - checkSelected(set_count, 3); + waitForSelection(set_count, 3); } /// @@ -203,10 +203,10 @@ public void TestFiltering() AddStep("Filter", () => carousel.Filter(new FilterCriteria { SearchText = "set #3!" }, false)); checkVisibleItemCount(diff: false, count: 1); checkVisibleItemCount(diff: true, count: 3); - checkSelected(3, 1); + waitForSelection(3, 1); advanceSelection(diff: true, count: 4); - checkSelected(3, 2); + waitForSelection(3, 2); AddStep("Un-filter (debounce)", () => carousel.Filter(new FilterCriteria())); AddUntilStep("Wait for debounce", () => !carousel.PendingFilterTask); @@ -217,10 +217,10 @@ public void TestFiltering() setSelected(1, 2); AddStep("Filter some difficulties", () => carousel.Filter(new FilterCriteria { SearchText = "Normal" }, false)); - checkSelected(1, 1); + waitForSelection(1, 1); AddStep("Un-filter", () => carousel.Filter(new FilterCriteria(), false)); - checkSelected(1, 1); + waitForSelection(1, 1); AddStep("Filter all", () => carousel.Filter(new FilterCriteria { SearchText = "Dingo" }, false)); @@ -249,7 +249,7 @@ public void TestFiltering() IsLowerInclusive = true } }, false)); - checkSelected(3, 2); + waitForSelection(3, 2); AddStep("Un-filter", () => carousel.Filter(new FilterCriteria(), false)); } @@ -317,7 +317,7 @@ public void TestAddRemove() checkVisibleItemCount(false, set_count); - checkSelected(set_count); + waitForSelection(set_count); } /// @@ -343,11 +343,11 @@ public void TestRemoveAll() AddAssert("Selection is non-null", () => currentSelection != null); AddStep("Remove selected", () => carousel.RemoveBeatmapSet(carousel.SelectedBeatmapSet)); - checkSelected(2); + waitForSelection(2); AddStep("Remove first", () => carousel.RemoveBeatmapSet(carousel.BeatmapSets.First())); AddStep("Remove first", () => carousel.RemoveBeatmapSet(carousel.BeatmapSets.First())); - checkSelected(1); + waitForSelection(1); AddUntilStep("Remove all", () => { @@ -390,17 +390,17 @@ public void TestHiding() checkVisibleItemCount(true, 2); advanceSelection(true); - checkSelected(1, 3); + waitForSelection(1, 3); setHidden(3); - checkSelected(1, 1); + waitForSelection(1, 1); setHidden(2, false); advanceSelection(true); - checkSelected(1, 2); + waitForSelection(1, 2); setHidden(1); - checkSelected(1, 2); + waitForSelection(1, 2); setHidden(2); checkNoSelection(); From ce62f3c75b8e2e896053bbf61291bb31404c2775 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 29 Sep 2019 14:35:35 +0800 Subject: [PATCH 11/16] Simplify and future-proof random retrieval method Will support future added intros without further code changes. Also uses RNG instead of `new Random`. --- osu.Game/Screens/Loader.cs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/osu.Game/Screens/Loader.cs b/osu.Game/Screens/Loader.cs index fb49c8a574..41ee01be20 100644 --- a/osu.Game/Screens/Loader.cs +++ b/osu.Game/Screens/Loader.cs @@ -1,12 +1,12 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Shaders; +using osu.Framework.MathUtils; using osu.Game.Screens.Menu; using osuTK; using osu.Framework.Screens; @@ -60,15 +60,11 @@ protected virtual OsuScreen CreateLoadableScreen() private IntroScreen getIntroSequence() { + if (introSequence == IntroSequence.Random) + introSequence = (IntroSequence)RNG.Next(0, (int)IntroSequence.Random); + switch (introSequence) { - case IntroSequence.Random: - var random = new Random(); - if (random.Next(2) == 0) - return new IntroCircles(); - else - return new IntroTriangles(); - case IntroSequence.Circles: return new IntroCircles(); From 97a0e0097f6e5f4fe7de2b5d4000e5c48df9cd5a Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Sun, 29 Sep 2019 14:56:33 +0300 Subject: [PATCH 12/16] Add testing --- .../Visual/Online/TestSceneUserProfileOverlay.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs index 93e6607ac5..c0457ba0ff 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs @@ -106,6 +106,14 @@ protected override void LoadComplete() Country = new Country { FullName = @"Japan", FlagName = @"JP" }, CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c6.jpg" }, api.IsLoggedIn)); + AddStep("Show bancho", () => profile.ShowUser(new User + { + Username = @"BanchoBot", + Id = 3, + IsBot = true, + Country = new Country { FullName = @"Saint Helena", FlagName = @"SH" }, + CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c4.jpg" + }, api.IsLoggedIn)); AddStep("Hide", profile.Hide); AddStep("Show without reload", profile.Show); From f24ac04bebbcbbc0ca5d0679172d3fbe6efd6854 Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Sun, 29 Sep 2019 15:18:29 +0300 Subject: [PATCH 13/16] Add suggested blank line for consistency --- osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs index c0457ba0ff..98da63508b 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs @@ -106,6 +106,7 @@ protected override void LoadComplete() Country = new Country { FullName = @"Japan", FlagName = @"JP" }, CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c6.jpg" }, api.IsLoggedIn)); + AddStep("Show bancho", () => profile.ShowUser(new User { Username = @"BanchoBot", From 9f498d29908a94f2a70a7e3d390a4202d9a5bdec Mon Sep 17 00:00:00 2001 From: miterosan Date: Sun, 29 Sep 2019 19:25:44 +0200 Subject: [PATCH 14/16] Log the exception that caused to loading of rulesets to fail. --- osu.Game/Rulesets/RulesetStore.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Rulesets/RulesetStore.cs b/osu.Game/Rulesets/RulesetStore.cs index 2d8c9f5b49..a94b0e0c06 100644 --- a/osu.Game/Rulesets/RulesetStore.cs +++ b/osu.Game/Rulesets/RulesetStore.cs @@ -135,9 +135,9 @@ private static void loadFromDisk() foreach (string file in files.Where(f => !Path.GetFileName(f).Contains("Tests"))) loadRulesetFromFile(file); } - catch + catch(Exception e) { - Logger.Log($"Could not load rulesets from directory {Environment.CurrentDirectory}"); + Logger.Error(e, $"Could not load rulesets from directory {Environment.CurrentDirectory}"); } } From 351e89bf182faaaa342c2b0c78f63a10500af18d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 30 Sep 2019 22:03:56 +0900 Subject: [PATCH 15/16] Update framework --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index 46fd5424df..51245351b6 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -62,6 +62,6 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 8fd5f1c3cd..8cbc8b0af3 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -26,7 +26,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index 521552bd4b..a15cae55c4 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -118,8 +118,8 @@ - - + + From ce609302edd25e0a59a36d64d81b2bfc36c2b344 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 1 Oct 2019 15:41:01 +0900 Subject: [PATCH 16/16] Fix CI error --- osu.Game/Rulesets/RulesetStore.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/RulesetStore.cs b/osu.Game/Rulesets/RulesetStore.cs index a94b0e0c06..47aad43966 100644 --- a/osu.Game/Rulesets/RulesetStore.cs +++ b/osu.Game/Rulesets/RulesetStore.cs @@ -135,7 +135,7 @@ private static void loadFromDisk() foreach (string file in files.Where(f => !Path.GetFileName(f).Contains("Tests"))) loadRulesetFromFile(file); } - catch(Exception e) + catch (Exception e) { Logger.Error(e, $"Could not load rulesets from directory {Environment.CurrentDirectory}"); }