From 767ecb4422e9cdef40551d4c9b9aa56805080f63 Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Tue, 10 Apr 2018 00:11:53 -0700 Subject: [PATCH 01/19] Fix rank status --- osu.Game/Beatmaps/RankStatus.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Beatmaps/RankStatus.cs b/osu.Game/Beatmaps/RankStatus.cs index 5ca358ddef..8792c088af 100644 --- a/osu.Game/Beatmaps/RankStatus.cs +++ b/osu.Game/Beatmaps/RankStatus.cs @@ -13,8 +13,7 @@ namespace osu.Game.Beatmaps Approved = 1, Loved = 8, Favourites = 2, - [Description("Mod Requests")] - ModRequests = 3, + Qualified = 3, Pending = 4, Graveyard = 5, [Description("My Maps")] From 9793137bfa7e4e54b346cd1cfd3d7f3b4c61b5fd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 11 Apr 2018 22:31:50 +0900 Subject: [PATCH 02/19] Add back app.manifest Resolves #2380 --- app.manifest | 46 ++++++++++++++++++++++++++++++++++++++++++++++ osu.Game.props | 3 +++ 2 files changed, 49 insertions(+) create mode 100644 app.manifest diff --git a/app.manifest b/app.manifest new file mode 100644 index 0000000000..d1c97498f4 --- /dev/null +++ b/app.manifest @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + + + diff --git a/osu.Game.props b/osu.Game.props index 87edafb97f..ec859e64a5 100644 --- a/osu.Game.props +++ b/osu.Game.props @@ -3,6 +3,9 @@ 7 + + ..\app.manifest + osu.licenseheader From 461e063f1946e8459697fe7c1a4a468cf9de0f31 Mon Sep 17 00:00:00 2001 From: Joehu Date: Wed, 11 Apr 2018 22:50:39 -0700 Subject: [PATCH 03/19] Rename RankStatus to BeatmapSearchCategory --- osu.Game/Beatmaps/{RankStatus.cs => BeatmapSearchCategory.cs} | 2 +- osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs | 4 ++-- osu.Game/Overlays/Direct/FilterControl.cs | 2 +- osu.Game/Overlays/DirectOverlay.cs | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) rename osu.Game/Beatmaps/{RankStatus.cs => BeatmapSearchCategory.cs} (89%) diff --git a/osu.Game/Beatmaps/RankStatus.cs b/osu.Game/Beatmaps/BeatmapSearchCategory.cs similarity index 89% rename from osu.Game/Beatmaps/RankStatus.cs rename to osu.Game/Beatmaps/BeatmapSearchCategory.cs index 8792c088af..fdd284376f 100644 --- a/osu.Game/Beatmaps/RankStatus.cs +++ b/osu.Game/Beatmaps/BeatmapSearchCategory.cs @@ -5,7 +5,7 @@ using System.ComponentModel; namespace osu.Game.Beatmaps { - public enum RankStatus + public enum BeatmapSearchCategory { Any = 7, [Description("Ranked & Approved")] diff --git a/osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs b/osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs index c54d0ea556..2482aae170 100644 --- a/osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs +++ b/osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs @@ -13,12 +13,12 @@ namespace osu.Game.Online.API.Requests { private readonly string query; private readonly RulesetInfo ruleset; - private readonly RankStatus rankStatus; + private readonly BeatmapSearchCategory rankStatus; private readonly DirectSortCriteria sortCriteria; private readonly SortDirection direction; private string directionString => direction == SortDirection.Descending ? @"desc" : @"asc"; - public SearchBeatmapSetsRequest(string query, RulesetInfo ruleset, RankStatus rankStatus = RankStatus.Any, DirectSortCriteria sortCriteria = DirectSortCriteria.Ranked, SortDirection direction = SortDirection.Descending) + public SearchBeatmapSetsRequest(string query, RulesetInfo ruleset, BeatmapSearchCategory rankStatus = BeatmapSearchCategory.Any, DirectSortCriteria sortCriteria = DirectSortCriteria.Ranked, SortDirection direction = SortDirection.Descending) { this.query = System.Uri.EscapeDataString(query); this.ruleset = ruleset; diff --git a/osu.Game/Overlays/Direct/FilterControl.cs b/osu.Game/Overlays/Direct/FilterControl.cs index 84a09547aa..e861326b27 100644 --- a/osu.Game/Overlays/Direct/FilterControl.cs +++ b/osu.Game/Overlays/Direct/FilterControl.cs @@ -15,7 +15,7 @@ using osu.Game.Rulesets; namespace osu.Game.Overlays.Direct { - public class FilterControl : SearchableListFilterControl + public class FilterControl : SearchableListFilterControl { public readonly Bindable Ruleset = new Bindable(); private FillFlowContainer modeButtons; diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index 8d8a4aebaa..208b237576 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -22,7 +22,7 @@ using OpenTK.Graphics; namespace osu.Game.Overlays { - public class DirectOverlay : SearchableListOverlay + public class DirectOverlay : SearchableListOverlay { private const float panel_padding = 10f; @@ -40,7 +40,7 @@ namespace osu.Game.Overlays protected override Color4 TrianglesColourDark => OsuColour.FromHex(@"3f5265"); protected override SearchableListHeader CreateHeader() => new Header(); - protected override SearchableListFilterControl CreateFilterControl() => new FilterControl(); + protected override SearchableListFilterControl CreateFilterControl() => new FilterControl(); private IEnumerable beatmapSets; From f18594887bce516cb975a0da572a336d7f403d3a Mon Sep 17 00:00:00 2001 From: Joehu Date: Thu, 12 Apr 2018 07:49:23 -0700 Subject: [PATCH 04/19] Move enum to SearchBeatmapSetsRequest --- osu.Game/Beatmaps/BeatmapSearchCategory.cs | 22 ------------------- .../API/Requests/SearchBeatmapSetsRequest.cs | 16 ++++++++++++++ osu.Game/Overlays/Direct/FilterControl.cs | 1 + 3 files changed, 17 insertions(+), 22 deletions(-) delete mode 100644 osu.Game/Beatmaps/BeatmapSearchCategory.cs diff --git a/osu.Game/Beatmaps/BeatmapSearchCategory.cs b/osu.Game/Beatmaps/BeatmapSearchCategory.cs deleted file mode 100644 index fdd284376f..0000000000 --- a/osu.Game/Beatmaps/BeatmapSearchCategory.cs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using System.ComponentModel; - -namespace osu.Game.Beatmaps -{ - public enum BeatmapSearchCategory - { - Any = 7, - [Description("Ranked & Approved")] - RankedApproved = 0, - Approved = 1, - Loved = 8, - Favourites = 2, - Qualified = 3, - Pending = 4, - Graveyard = 5, - [Description("My Maps")] - MyMaps = 6, - } -} diff --git a/osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs b/osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs index 2482aae170..52ed7218ad 100644 --- a/osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs +++ b/osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; +using System.ComponentModel; using osu.Game.Beatmaps; using osu.Game.Overlays; using osu.Game.Overlays.Direct; @@ -30,4 +31,19 @@ namespace osu.Game.Online.API.Requests // ReSharper disable once ImpureMethodCallOnReadonlyValueField protected override string Target => $@"beatmapsets/search?q={query}&m={ruleset.ID ?? 0}&s={(int)rankStatus}&sort={sortCriteria.ToString().ToLower()}_{directionString}"; } + + public enum BeatmapSearchCategory + { + Any = 7, + [Description("Ranked & Approved")] + RankedApproved = 0, + Approved = 1, + Loved = 8, + Favourites = 2, + Qualified = 3, + Pending = 4, + Graveyard = 5, + [Description("My Maps")] + MyMaps = 6, + } } diff --git a/osu.Game/Overlays/Direct/FilterControl.cs b/osu.Game/Overlays/Direct/FilterControl.cs index e861326b27..ddbac10ac8 100644 --- a/osu.Game/Overlays/Direct/FilterControl.cs +++ b/osu.Game/Overlays/Direct/FilterControl.cs @@ -10,6 +10,7 @@ using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Graphics.Containers; +using osu.Game.Online.API.Requests; using osu.Game.Overlays.SearchableList; using osu.Game.Rulesets; From df4b64effcc5418ce11940d7f9754afeaaafa883 Mon Sep 17 00:00:00 2001 From: Joehu Date: Thu, 12 Apr 2018 08:03:19 -0700 Subject: [PATCH 05/19] Rename rankStatus to searchCategory --- osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs b/osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs index 52ed7218ad..1abb844c8d 100644 --- a/osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs +++ b/osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs @@ -14,22 +14,22 @@ namespace osu.Game.Online.API.Requests { private readonly string query; private readonly RulesetInfo ruleset; - private readonly BeatmapSearchCategory rankStatus; + private readonly BeatmapSearchCategory searchCategory; private readonly DirectSortCriteria sortCriteria; private readonly SortDirection direction; private string directionString => direction == SortDirection.Descending ? @"desc" : @"asc"; - public SearchBeatmapSetsRequest(string query, RulesetInfo ruleset, BeatmapSearchCategory rankStatus = BeatmapSearchCategory.Any, DirectSortCriteria sortCriteria = DirectSortCriteria.Ranked, SortDirection direction = SortDirection.Descending) + public SearchBeatmapSetsRequest(string query, RulesetInfo ruleset, BeatmapSearchCategory searchCategory = BeatmapSearchCategory.Any, DirectSortCriteria sortCriteria = DirectSortCriteria.Ranked, SortDirection direction = SortDirection.Descending) { this.query = System.Uri.EscapeDataString(query); this.ruleset = ruleset; - this.rankStatus = rankStatus; + this.searchCategory = searchCategory; this.sortCriteria = sortCriteria; this.direction = direction; } // ReSharper disable once ImpureMethodCallOnReadonlyValueField - protected override string Target => $@"beatmapsets/search?q={query}&m={ruleset.ID ?? 0}&s={(int)rankStatus}&sort={sortCriteria.ToString().ToLower()}_{directionString}"; + protected override string Target => $@"beatmapsets/search?q={query}&m={ruleset.ID ?? 0}&s={(int)searchCategory}&sort={sortCriteria.ToString().ToLower()}_{directionString}"; } public enum BeatmapSearchCategory From 463b189d2fcc1730b7bc276e50aa69c408c3a691 Mon Sep 17 00:00:00 2001 From: Joehu Date: Thu, 12 Apr 2018 08:13:24 -0700 Subject: [PATCH 06/19] Remove unused using directives --- osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs | 1 - osu.Game/Overlays/Direct/FilterControl.cs | 1 - 2 files changed, 2 deletions(-) diff --git a/osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs b/osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs index 1abb844c8d..ed59ed53c2 100644 --- a/osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs +++ b/osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.ComponentModel; -using osu.Game.Beatmaps; using osu.Game.Overlays; using osu.Game.Overlays.Direct; using osu.Game.Rulesets; diff --git a/osu.Game/Overlays/Direct/FilterControl.cs b/osu.Game/Overlays/Direct/FilterControl.cs index ddbac10ac8..286eb8ecef 100644 --- a/osu.Game/Overlays/Direct/FilterControl.cs +++ b/osu.Game/Overlays/Direct/FilterControl.cs @@ -7,7 +7,6 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Online.API.Requests; From b23b0a445be8628db6d019a61912df1519429d36 Mon Sep 17 00:00:00 2001 From: tgi74000 Date: Fri, 13 Apr 2018 15:41:35 +0200 Subject: [PATCH 07/19] Add support for replay mods --- osu.Game.Rulesets.Catch/CatchRuleset.cs | 40 +++++++++++ osu.Game.Rulesets.Mania/ManiaRuleset.cs | 69 +++++++++++++++++++ osu.Game.Rulesets.Osu/OsuRuleset.cs | 49 +++++++++++++ osu.Game.Rulesets.Taiko/TaikoRuleset.cs | 40 +++++++++++ osu.Game/Beatmaps/DummyWorkingBeatmap.cs | 3 + osu.Game/Beatmaps/Legacy/LegacyMods.cs | 43 ++++++++++++ osu.Game/OsuGame.cs | 1 + osu.Game/Rulesets/Ruleset.cs | 3 + .../Scoring/Legacy/LegacyScoreParser.cs | 5 +- 9 files changed, 252 insertions(+), 1 deletion(-) create mode 100644 osu.Game/Beatmaps/Legacy/LegacyMods.cs diff --git a/osu.Game.Rulesets.Catch/CatchRuleset.cs b/osu.Game.Rulesets.Catch/CatchRuleset.cs index 8930b09089..87de1aed97 100644 --- a/osu.Game.Rulesets.Catch/CatchRuleset.cs +++ b/osu.Game.Rulesets.Catch/CatchRuleset.cs @@ -12,6 +12,7 @@ using osu.Framework.Graphics; using osu.Framework.Input.Bindings; using osu.Game.Rulesets.Catch.Replays; using osu.Game.Rulesets.Replays.Types; +using osu.Game.Beatmaps.Legacy; namespace osu.Game.Rulesets.Catch { @@ -29,6 +30,45 @@ namespace osu.Game.Rulesets.Catch new KeyBinding(InputKey.Shift, CatchAction.Dash), }; + public override IEnumerable GetLegacyModsFor(LegacyMods mods) + { + if (mods.HasFlag(LegacyMods.NightCore)) + yield return new CatchModNightcore(); + else if (mods.HasFlag(LegacyMods.DoubleTime)) + yield return new CatchModDoubleTime(); + + + if (mods.HasFlag(LegacyMods.AutoPlay)) + yield return new CatchModAutoplay(); + + if (mods.HasFlag(LegacyMods.Easy)) + yield return new CatchModEasy(); + + if (mods.HasFlag(LegacyMods.FlashLight)) + yield return new CatchModFlashlight(); + + if (mods.HasFlag(LegacyMods.HalfTime)) + yield return new CatchModHalfTime(); + + if (mods.HasFlag(LegacyMods.HardRock)) + yield return new CatchModHardRock(); + + if (mods.HasFlag(LegacyMods.Hidden)) + yield return new CatchModHidden(); + + if (mods.HasFlag(LegacyMods.NoFail)) + yield return new CatchModNoFail(); + + if (mods.HasFlag(LegacyMods.Perfect)) + yield return new CatchModPerfect(); + + if (mods.HasFlag(LegacyMods.Relax)) + yield return new CatchModRelax(); + + if (mods.HasFlag(LegacyMods.SuddenDeath)) + yield return new CatchModSuddenDeath(); + } + public override IEnumerable GetModsFor(ModType type) { switch (type) diff --git a/osu.Game.Rulesets.Mania/ManiaRuleset.cs b/osu.Game.Rulesets.Mania/ManiaRuleset.cs index 7f37f55d14..4bd243664b 100644 --- a/osu.Game.Rulesets.Mania/ManiaRuleset.cs +++ b/osu.Game.Rulesets.Mania/ManiaRuleset.cs @@ -14,6 +14,7 @@ using osu.Framework.Input.Bindings; using osu.Game.Graphics; using osu.Game.Rulesets.Mania.Replays; using osu.Game.Rulesets.Replays.Types; +using osu.Game.Beatmaps.Legacy; namespace osu.Game.Rulesets.Mania { @@ -21,6 +22,74 @@ namespace osu.Game.Rulesets.Mania { public override RulesetContainer CreateRulesetContainerWith(WorkingBeatmap beatmap, bool isForCurrentRuleset) => new ManiaRulesetContainer(this, beatmap, isForCurrentRuleset); + public override IEnumerable GetLegacyModsFor(LegacyMods mods) + { + if (mods.HasFlag(LegacyMods.NightCore)) + yield return new ManiaModNightcore(); + else if (mods.HasFlag(LegacyMods.DoubleTime)) + yield return new ManiaModDoubleTime(); + + if (mods.HasFlag(LegacyMods.AutoPlay)) + yield return new ManiaModAutoplay(); + + if (mods.HasFlag(LegacyMods.Easy)) + yield return new ManiaModEasy(); + + if (mods.HasFlag(LegacyMods.FadeIn)) + yield return new ManiaModFadeIn(); + + if (mods.HasFlag(LegacyMods.FlashLight)) + yield return new ManiaModFlashlight(); + + if (mods.HasFlag(LegacyMods.HalfTime)) + yield return new ManiaModHalfTime(); + + if (mods.HasFlag(LegacyMods.HardRock)) + yield return new ManiaModHardRock(); + + if (mods.HasFlag(LegacyMods.Hidden)) + yield return new ManiaModHidden(); + + if (mods.HasFlag(LegacyMods.Key1)) + yield return new ManiaModKey1(); + + if (mods.HasFlag(LegacyMods.Key2)) + yield return new ManiaModKey2(); + + if (mods.HasFlag(LegacyMods.Key3)) + yield return new ManiaModKey3(); + + if (mods.HasFlag(LegacyMods.Key4)) + yield return new ManiaModKey4(); + + if (mods.HasFlag(LegacyMods.Key5)) + yield return new ManiaModKey5(); + + if (mods.HasFlag(LegacyMods.Key6)) + yield return new ManiaModKey6(); + + if (mods.HasFlag(LegacyMods.Key7)) + yield return new ManiaModKey7(); + + if (mods.HasFlag(LegacyMods.Key8)) + yield return new ManiaModKey8(); + + if (mods.HasFlag(LegacyMods.Key9)) + yield return new ManiaModKey9(); + + if (mods.HasFlag(LegacyMods.NoFail)) + yield return new ManiaModNoFail(); + + if (mods.HasFlag(LegacyMods.Perfect)) + yield return new ManiaModPerfect(); + + if (mods.HasFlag(LegacyMods.Random)) + yield return new ManiaModRandom(); + + if (mods.HasFlag(LegacyMods.SuddenDeath)) + yield return new ManiaModSuddenDeath(); + } + public override IEnumerable GetModsFor(ModType type) { switch (type) diff --git a/osu.Game.Rulesets.Osu/OsuRuleset.cs b/osu.Game.Rulesets.Osu/OsuRuleset.cs index 37e6ec3817..7611f160ae 100644 --- a/osu.Game.Rulesets.Osu/OsuRuleset.cs +++ b/osu.Game.Rulesets.Osu/OsuRuleset.cs @@ -21,6 +21,7 @@ using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Osu.Replays; using osu.Game.Rulesets.Replays.Types; +using osu.Game.Beatmaps.Legacy; namespace osu.Game.Rulesets.Osu { @@ -66,6 +67,54 @@ namespace osu.Game.Rulesets.Osu }; } + public override IEnumerable GetLegacyModsFor(LegacyMods mods) + { + if (mods.HasFlag(LegacyMods.NightCore)) + yield return new OsuModNightcore(); + else if (mods.HasFlag(LegacyMods.DoubleTime)) + yield return new OsuModDoubleTime(); + + + if (mods.HasFlag(LegacyMods.AutoPilot)) + yield return new OsuModAutopilot(); + + if (mods.HasFlag(LegacyMods.AutoPlay)) + yield return new OsuModAutoplay(); + + if (mods.HasFlag(LegacyMods.Easy)) + yield return new OsuModEasy(); + + if (mods.HasFlag(LegacyMods.FlashLight)) + yield return new OsuModFlashlight(); + + if (mods.HasFlag(LegacyMods.HalfTime)) + yield return new OsuModHalfTime(); + + if (mods.HasFlag(LegacyMods.HardRock)) + yield return new OsuModHardRock(); + + if (mods.HasFlag(LegacyMods.Hidden)) + yield return new OsuModHidden(); + + if (mods.HasFlag(LegacyMods.NoFail)) + yield return new OsuModNoFail(); + + if (mods.HasFlag(LegacyMods.Perfect)) + yield return new OsuModPerfect(); + + if (mods.HasFlag(LegacyMods.Relax)) + yield return new OsuModRelax(); + + if (mods.HasFlag(LegacyMods.SpunOut)) + yield return new OsuModSpunOut(); + + if (mods.HasFlag(LegacyMods.SuddenDeath)) + yield return new OsuModSuddenDeath(); + + if (mods.HasFlag(LegacyMods.TargetPractice)) + yield return new OsuModTarget(); + } + public override IEnumerable GetModsFor(ModType type) { switch (type) diff --git a/osu.Game.Rulesets.Taiko/TaikoRuleset.cs b/osu.Game.Rulesets.Taiko/TaikoRuleset.cs index cb5e020601..1881e84fb0 100644 --- a/osu.Game.Rulesets.Taiko/TaikoRuleset.cs +++ b/osu.Game.Rulesets.Taiko/TaikoRuleset.cs @@ -12,6 +12,7 @@ using osu.Framework.Graphics; using osu.Framework.Input.Bindings; using osu.Game.Rulesets.Replays.Types; using osu.Game.Rulesets.Taiko.Replays; +using osu.Game.Beatmaps.Legacy; namespace osu.Game.Rulesets.Taiko { @@ -31,6 +32,45 @@ namespace osu.Game.Rulesets.Taiko new KeyBinding(InputKey.MouseRight, TaikoAction.RightRim), }; + public override IEnumerable GetLegacyModsFor(LegacyMods mods) + { + if (mods.HasFlag(LegacyMods.NightCore)) + yield return new TaikoModNightcore(); + else if (mods.HasFlag(LegacyMods.DoubleTime)) + yield return new TaikoModDoubleTime(); + + + if (mods.HasFlag(LegacyMods.AutoPlay)) + yield return new TaikoModAutoplay(); + + if (mods.HasFlag(LegacyMods.Easy)) + yield return new TaikoModEasy(); + + if (mods.HasFlag(LegacyMods.FlashLight)) + yield return new TaikoModFlashlight(); + + if (mods.HasFlag(LegacyMods.HalfTime)) + yield return new TaikoModHalfTime(); + + if (mods.HasFlag(LegacyMods.HardRock)) + yield return new TaikoModHardRock(); + + if (mods.HasFlag(LegacyMods.Hidden)) + yield return new TaikoModHidden(); + + if (mods.HasFlag(LegacyMods.NoFail)) + yield return new TaikoModNoFail(); + + if (mods.HasFlag(LegacyMods.Perfect)) + yield return new TaikoModPerfect(); + + if (mods.HasFlag(LegacyMods.Relax)) + yield return new TaikoModRelax(); + + if (mods.HasFlag(LegacyMods.SuddenDeath)) + yield return new TaikoModSuddenDeath(); + } + public override IEnumerable GetModsFor(ModType type) { switch (type) diff --git a/osu.Game/Beatmaps/DummyWorkingBeatmap.cs b/osu.Game/Beatmaps/DummyWorkingBeatmap.cs index 0424ff84f1..4a33e5eb7e 100644 --- a/osu.Game/Beatmaps/DummyWorkingBeatmap.cs +++ b/osu.Game/Beatmaps/DummyWorkingBeatmap.cs @@ -8,6 +8,7 @@ using osu.Framework.Graphics.Textures; using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.UI; +using osu.Game.Beatmaps.Legacy; namespace osu.Game.Beatmaps { @@ -53,6 +54,8 @@ namespace osu.Game.Beatmaps { public override IEnumerable GetModsFor(ModType type) => new Mod[] { }; + public override IEnumerable GetLegacyModsFor(LegacyMods mods) => new Mod[] { }; + public override RulesetContainer CreateRulesetContainerWith(WorkingBeatmap beatmap, bool isForCurrentRuleset) { throw new NotImplementedException(); diff --git a/osu.Game/Beatmaps/Legacy/LegacyMods.cs b/osu.Game/Beatmaps/Legacy/LegacyMods.cs new file mode 100644 index 0000000000..2ac7324778 --- /dev/null +++ b/osu.Game/Beatmaps/Legacy/LegacyMods.cs @@ -0,0 +1,43 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; + +namespace osu.Game.Beatmaps.Legacy +{ + [Flags] + public enum LegacyMods + { + None = 0, + NoFail = 1, + Easy = 2, + TouchDevice = 4, + Hidden = 8, + HardRock = 16, + SuddenDeath = 32, + DoubleTime = 64, + Relax = 128, + HalfTime = 256, + NightCore = 512, + FlashLight = 1024, + AutoPlay = 2048, + SpunOut = 4096, + AutoPilot = 8192, + Perfect = 16384, + Key4 = 32768, + Key5 = 65536, + Key6 = 131072, + Key7 = 262144, + Key8 = 524288, + keyMod = 1015808,// k4+k5+k6+k7+k8 + FadeIn = 1048576, + Random = 2097152, + Cinema = 4194304, + TargetPractice = 8388608, + Key9 = 16777216, + Coop = 33554432, + Key1 = 67108864, + Key3 = 134217728, + Key2 = 268435456, + } +} diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index d1cf372067..6c35a2ecea 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -194,6 +194,7 @@ namespace osu.Game } Beatmap.Value = BeatmapManager.GetWorkingBeatmap(s.Beatmap); + Beatmap.Value.Mods.BindTo(new Bindable>(s.Mods)); menu.Push(new PlayerLoader(new ReplayPlayer(s.Replay))); } diff --git a/osu.Game/Rulesets/Ruleset.cs b/osu.Game/Rulesets/Ruleset.cs index c2af4d566c..f2cf813d38 100644 --- a/osu.Game/Rulesets/Ruleset.cs +++ b/osu.Game/Rulesets/Ruleset.cs @@ -14,6 +14,7 @@ using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Replays.Types; using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.UI; +using osu.Game.Beatmaps.Legacy; namespace osu.Game.Rulesets { @@ -33,6 +34,8 @@ namespace osu.Game.Rulesets public abstract IEnumerable GetModsFor(ModType type); + public abstract IEnumerable GetLegacyModsFor(LegacyMods mods); + public Mod GetAutoplayMod() => GetAllMods().First(mod => mod is ModAutoplay); protected Ruleset(RulesetInfo rulesetInfo = null) diff --git a/osu.Game/Rulesets/Scoring/Legacy/LegacyScoreParser.cs b/osu.Game/Rulesets/Scoring/Legacy/LegacyScoreParser.cs index 5ee009ba98..806e8d2fdb 100644 --- a/osu.Game/Rulesets/Scoring/Legacy/LegacyScoreParser.cs +++ b/osu.Game/Rulesets/Scoring/Legacy/LegacyScoreParser.cs @@ -9,6 +9,9 @@ using osu.Game.Rulesets.Replays; using osu.Game.Rulesets.Replays.Legacy; using osu.Game.Users; using SharpCompress.Compressors.LZMA; +using osu.Game.Beatmaps.Legacy; +using osu.Game.Rulesets.Mods; +using System.Linq; namespace osu.Game.Rulesets.Scoring.Legacy { @@ -64,7 +67,7 @@ namespace osu.Game.Rulesets.Scoring.Legacy /* score.Perfect = */ sr.ReadBoolean(); /* score.EnabledMods = (Mods)*/ - sr.ReadInt32(); + score.Mods = currentRuleset.GetLegacyModsFor((LegacyMods)sr.ReadInt32()).ToArray(); /* score.HpGraphString = */ sr.ReadString(); /* score.Date = */ From 73ba8e1c876d2e57bdda27e8c87ea0f39a63c4df Mon Sep 17 00:00:00 2001 From: tgi74000 Date: Fri, 13 Apr 2018 16:10:01 +0200 Subject: [PATCH 08/19] CI: remove unused directive --- osu.Game/Rulesets/Scoring/Legacy/LegacyScoreParser.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Rulesets/Scoring/Legacy/LegacyScoreParser.cs b/osu.Game/Rulesets/Scoring/Legacy/LegacyScoreParser.cs index 806e8d2fdb..62d1cb3a32 100644 --- a/osu.Game/Rulesets/Scoring/Legacy/LegacyScoreParser.cs +++ b/osu.Game/Rulesets/Scoring/Legacy/LegacyScoreParser.cs @@ -10,7 +10,6 @@ using osu.Game.Rulesets.Replays.Legacy; using osu.Game.Users; using SharpCompress.Compressors.LZMA; using osu.Game.Beatmaps.Legacy; -using osu.Game.Rulesets.Mods; using System.Linq; namespace osu.Game.Rulesets.Scoring.Legacy From 3454ec1ca385d1725432d7322c98fc9dd1f6226f Mon Sep 17 00:00:00 2001 From: tgi74000 Date: Sun, 15 Apr 2018 20:23:57 +0200 Subject: [PATCH 09/19] Set Value instead of BindTo --- osu.Game/OsuGame.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 18dc9f4ea1..f69135e5c9 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -196,7 +196,7 @@ namespace osu.Game } Beatmap.Value = BeatmapManager.GetWorkingBeatmap(s.Beatmap); - Beatmap.Value.Mods.BindTo(new Bindable>(s.Mods)); + Beatmap.Value.Mods.Value = s.Mods; menu.Push(new PlayerLoader(new ReplayPlayer(s.Replay))); } From 1b9d54a6ad4bd555a965b769d7b7863c625d1509 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 16 Apr 2018 17:39:03 +0900 Subject: [PATCH 10/19] Fix various data races causing crashes or incorrect leaderboard states --- .../Select/Leaderboards/Leaderboard.cs | 79 +++++++++++-------- 1 file changed, 46 insertions(+), 33 deletions(-) diff --git a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs index 3a6ab8f84b..a6bbbce9b9 100644 --- a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs +++ b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs @@ -39,8 +39,9 @@ namespace osu.Game.Screens.Select.Leaderboards private readonly LoadingAnimation loading; - private IEnumerable scores; + private ScheduledDelegate showScoresDelegate; + private IEnumerable scores; public IEnumerable Scores { get { return scores; } @@ -59,29 +60,34 @@ namespace osu.Game.Screens.Select.Leaderboards // ensure placeholder is hidden when displaying scores PlaceholderState = PlaceholderState.Successful; - // schedule because we may not be loaded yet (LoadComponentAsync complains). - Schedule(() => + var flow = scrollFlow = new FillFlowContainer { - LoadComponentAsync(new FillFlowContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Spacing = new Vector2(0f, 5f), - Padding = new MarginPadding { Top = 10, Bottom = 5 }, - ChildrenEnumerable = scores.Select((s, index) => new LeaderboardScore(s, index + 1) { Action = () => ScoreSelected?.Invoke(s) }) - }, f => - { - scrollContainer.Add(scrollFlow = f); + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Spacing = new Vector2(0f, 5f), + Padding = new MarginPadding { Top = 10, Bottom = 5 }, + ChildrenEnumerable = scores.Select((s, index) => new LeaderboardScore(s, index + 1) { Action = () => ScoreSelected?.Invoke(s) }) + }; - int i = 0; - foreach (var s in f.Children) - { - using (s.BeginDelayedSequence(i++ * 50, true)) - s.Show(); - } + // schedule because we may not be loaded yet (LoadComponentAsync complains). + showScoresDelegate?.Cancel(); + if (!IsLoaded) + showScoresDelegate = Schedule(showScores); + else + showScores(); - scrollContainer.ScrollTo(0f, false); - }); + void showScores() => LoadComponentAsync(flow, _ => + { + scrollContainer.Add(flow); + + int i = 0; + foreach (var s in flow.Children) + { + using (s.BeginDelayedSequence(i++ * 50, true)) + s.Show(); + } + + scrollContainer.ScrollTo(0f, false); }); } } @@ -249,26 +255,33 @@ namespace osu.Game.Screens.Select.Leaderboards PlaceholderState = PlaceholderState.Retrieving; loading.Show(); + var localBeatmap = Beatmap; + getScoresRequest = new GetScoresRequest(Beatmap, osuGame?.Ruleset.Value ?? Beatmap.Ruleset, Scope); - getScoresRequest.Success += r => + getScoresRequest.Success += r => Schedule(() => { + if (localBeatmap != Beatmap) + return; + Scores = r.Scores; PlaceholderState = Scores.Any() ? PlaceholderState.Successful : PlaceholderState.NoScores; - }; - getScoresRequest.Failure += onUpdateFailed; + }); + + getScoresRequest.Failure += e => Schedule(() => + { + if (localBeatmap != Beatmap) + return; + + if (e is OperationCanceledException) + return; + + PlaceholderState = PlaceholderState.NetworkFailure; + Logger.Error(e, @"Couldn't fetch beatmap scores!"); + }); api.Queue(getScoresRequest); } - private void onUpdateFailed(Exception e) - { - if (e is OperationCanceledException) - return; - - PlaceholderState = PlaceholderState.NetworkFailure; - Logger.Error(e, @"Couldn't fetch beatmap scores!"); - } - private void replacePlaceholder(Placeholder placeholder) { var existingPlaceholder = placeholderContainer.Children.LastOrDefault() as Placeholder; From b9220a1e293c9eef775d6606e398d012c50180dc Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 16 Apr 2018 17:39:55 +0900 Subject: [PATCH 11/19] Fix leaderboard placeholder sometimes disappearing indefinitely --- .../Screens/Select/Leaderboards/Leaderboard.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs index a6bbbce9b9..4d8d43f60a 100644 --- a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs +++ b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs @@ -282,24 +282,29 @@ namespace osu.Game.Screens.Select.Leaderboards api.Queue(getScoresRequest); } + private Placeholder currentPlaceholder; + private void replacePlaceholder(Placeholder placeholder) { - var existingPlaceholder = placeholderContainer.Children.LastOrDefault() as Placeholder; - - if (placeholder != null && placeholder.Equals(existingPlaceholder)) + if (placeholder != null && placeholder.Equals(currentPlaceholder)) return; - existingPlaceholder?.FadeOut(150, Easing.OutQuint).Expire(); + currentPlaceholder?.FadeOut(150, Easing.OutQuint).Expire(); if (placeholder == null) + { + currentPlaceholder = null; return; + } Scores = null; - placeholderContainer.Add(placeholder); + placeholderContainer.Child = placeholder; placeholder.ScaleTo(0.8f).Then().ScaleTo(1, fade_duration * 3, Easing.OutQuint); placeholder.FadeInFromZero(fade_duration, Easing.OutQuint); + + currentPlaceholder = placeholder; } protected override void Update() From 9af6ef18646d8700ab4be15a6748c8a6f9762c47 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 16 Apr 2018 17:48:49 +0900 Subject: [PATCH 12/19] Remove extra unneded safety --- osu.Game/Screens/Select/Leaderboards/Leaderboard.cs | 8 -------- 1 file changed, 8 deletions(-) diff --git a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs index 4d8d43f60a..429e6a405d 100644 --- a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs +++ b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs @@ -255,23 +255,15 @@ namespace osu.Game.Screens.Select.Leaderboards PlaceholderState = PlaceholderState.Retrieving; loading.Show(); - var localBeatmap = Beatmap; - getScoresRequest = new GetScoresRequest(Beatmap, osuGame?.Ruleset.Value ?? Beatmap.Ruleset, Scope); getScoresRequest.Success += r => Schedule(() => { - if (localBeatmap != Beatmap) - return; - Scores = r.Scores; PlaceholderState = Scores.Any() ? PlaceholderState.Successful : PlaceholderState.NoScores; }); getScoresRequest.Failure += e => Schedule(() => { - if (localBeatmap != Beatmap) - return; - if (e is OperationCanceledException) return; From 9b36cf2066d499f9ca0c57cb7741cee6db6cfc7f Mon Sep 17 00:00:00 2001 From: tgi74000 Date: Mon, 16 Apr 2018 14:14:40 +0200 Subject: [PATCH 13/19] Review changes --- osu.Game.Rulesets.Catch/CatchRuleset.cs | 9 ++- osu.Game.Rulesets.Mania/ManiaRuleset.cs | 8 +-- osu.Game.Rulesets.Osu/OsuRuleset.cs | 13 ++-- osu.Game.Rulesets.Taiko/TaikoRuleset.cs | 9 ++- osu.Game/Beatmaps/DummyWorkingBeatmap.cs | 2 - osu.Game/Beatmaps/Legacy/LegacyMods.cs | 59 +++++++++---------- osu.Game/Rulesets/Ruleset.cs | 7 ++- .../Scoring/Legacy/LegacyScoreParser.cs | 2 +- 8 files changed, 54 insertions(+), 55 deletions(-) diff --git a/osu.Game.Rulesets.Catch/CatchRuleset.cs b/osu.Game.Rulesets.Catch/CatchRuleset.cs index 87de1aed97..cfe0fc5cec 100644 --- a/osu.Game.Rulesets.Catch/CatchRuleset.cs +++ b/osu.Game.Rulesets.Catch/CatchRuleset.cs @@ -30,21 +30,20 @@ namespace osu.Game.Rulesets.Catch new KeyBinding(InputKey.Shift, CatchAction.Dash), }; - public override IEnumerable GetLegacyModsFor(LegacyMods mods) + public override IEnumerable ConvertLegacyMods(LegacyMods mods) { - if (mods.HasFlag(LegacyMods.NightCore)) + if (mods.HasFlag(LegacyMods.Nightcore)) yield return new CatchModNightcore(); else if (mods.HasFlag(LegacyMods.DoubleTime)) yield return new CatchModDoubleTime(); - - if (mods.HasFlag(LegacyMods.AutoPlay)) + if (mods.HasFlag(LegacyMods.Autoplay)) yield return new CatchModAutoplay(); if (mods.HasFlag(LegacyMods.Easy)) yield return new CatchModEasy(); - if (mods.HasFlag(LegacyMods.FlashLight)) + if (mods.HasFlag(LegacyMods.Flashlight)) yield return new CatchModFlashlight(); if (mods.HasFlag(LegacyMods.HalfTime)) diff --git a/osu.Game.Rulesets.Mania/ManiaRuleset.cs b/osu.Game.Rulesets.Mania/ManiaRuleset.cs index 4bd243664b..0546cbc174 100644 --- a/osu.Game.Rulesets.Mania/ManiaRuleset.cs +++ b/osu.Game.Rulesets.Mania/ManiaRuleset.cs @@ -22,14 +22,14 @@ namespace osu.Game.Rulesets.Mania { public override RulesetContainer CreateRulesetContainerWith(WorkingBeatmap beatmap, bool isForCurrentRuleset) => new ManiaRulesetContainer(this, beatmap, isForCurrentRuleset); - public override IEnumerable GetLegacyModsFor(LegacyMods mods) + public override IEnumerable ConvertLegacyMods(LegacyMods mods) { - if (mods.HasFlag(LegacyMods.NightCore)) + if (mods.HasFlag(LegacyMods.Nightcore)) yield return new ManiaModNightcore(); else if (mods.HasFlag(LegacyMods.DoubleTime)) yield return new ManiaModDoubleTime(); - if (mods.HasFlag(LegacyMods.AutoPlay)) + if (mods.HasFlag(LegacyMods.Autoplay)) yield return new ManiaModAutoplay(); if (mods.HasFlag(LegacyMods.Easy)) @@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Mania if (mods.HasFlag(LegacyMods.FadeIn)) yield return new ManiaModFadeIn(); - if (mods.HasFlag(LegacyMods.FlashLight)) + if (mods.HasFlag(LegacyMods.Flashlight)) yield return new ManiaModFlashlight(); if (mods.HasFlag(LegacyMods.HalfTime)) diff --git a/osu.Game.Rulesets.Osu/OsuRuleset.cs b/osu.Game.Rulesets.Osu/OsuRuleset.cs index 7611f160ae..e0ecee97a3 100644 --- a/osu.Game.Rulesets.Osu/OsuRuleset.cs +++ b/osu.Game.Rulesets.Osu/OsuRuleset.cs @@ -67,24 +67,23 @@ namespace osu.Game.Rulesets.Osu }; } - public override IEnumerable GetLegacyModsFor(LegacyMods mods) + public override IEnumerable ConvertLegacyMods(LegacyMods mods) { - if (mods.HasFlag(LegacyMods.NightCore)) + if (mods.HasFlag(LegacyMods.Nightcore)) yield return new OsuModNightcore(); else if (mods.HasFlag(LegacyMods.DoubleTime)) yield return new OsuModDoubleTime(); - - if (mods.HasFlag(LegacyMods.AutoPilot)) + if (mods.HasFlag(LegacyMods.Autopilot)) yield return new OsuModAutopilot(); - if (mods.HasFlag(LegacyMods.AutoPlay)) + if (mods.HasFlag(LegacyMods.Autoplay)) yield return new OsuModAutoplay(); if (mods.HasFlag(LegacyMods.Easy)) yield return new OsuModEasy(); - if (mods.HasFlag(LegacyMods.FlashLight)) + if (mods.HasFlag(LegacyMods.Flashlight)) yield return new OsuModFlashlight(); if (mods.HasFlag(LegacyMods.HalfTime)) @@ -111,7 +110,7 @@ namespace osu.Game.Rulesets.Osu if (mods.HasFlag(LegacyMods.SuddenDeath)) yield return new OsuModSuddenDeath(); - if (mods.HasFlag(LegacyMods.TargetPractice)) + if (mods.HasFlag(LegacyMods.Target)) yield return new OsuModTarget(); } diff --git a/osu.Game.Rulesets.Taiko/TaikoRuleset.cs b/osu.Game.Rulesets.Taiko/TaikoRuleset.cs index 1881e84fb0..06a8e44a14 100644 --- a/osu.Game.Rulesets.Taiko/TaikoRuleset.cs +++ b/osu.Game.Rulesets.Taiko/TaikoRuleset.cs @@ -32,21 +32,20 @@ namespace osu.Game.Rulesets.Taiko new KeyBinding(InputKey.MouseRight, TaikoAction.RightRim), }; - public override IEnumerable GetLegacyModsFor(LegacyMods mods) + public override IEnumerable ConvertLegacyMods(LegacyMods mods) { - if (mods.HasFlag(LegacyMods.NightCore)) + if (mods.HasFlag(LegacyMods.Nightcore)) yield return new TaikoModNightcore(); else if (mods.HasFlag(LegacyMods.DoubleTime)) yield return new TaikoModDoubleTime(); - - if (mods.HasFlag(LegacyMods.AutoPlay)) + if (mods.HasFlag(LegacyMods.Autoplay)) yield return new TaikoModAutoplay(); if (mods.HasFlag(LegacyMods.Easy)) yield return new TaikoModEasy(); - if (mods.HasFlag(LegacyMods.FlashLight)) + if (mods.HasFlag(LegacyMods.Flashlight)) yield return new TaikoModFlashlight(); if (mods.HasFlag(LegacyMods.HalfTime)) diff --git a/osu.Game/Beatmaps/DummyWorkingBeatmap.cs b/osu.Game/Beatmaps/DummyWorkingBeatmap.cs index 4a33e5eb7e..48cee0d512 100644 --- a/osu.Game/Beatmaps/DummyWorkingBeatmap.cs +++ b/osu.Game/Beatmaps/DummyWorkingBeatmap.cs @@ -54,8 +54,6 @@ namespace osu.Game.Beatmaps { public override IEnumerable GetModsFor(ModType type) => new Mod[] { }; - public override IEnumerable GetLegacyModsFor(LegacyMods mods) => new Mod[] { }; - public override RulesetContainer CreateRulesetContainerWith(WorkingBeatmap beatmap, bool isForCurrentRuleset) { throw new NotImplementedException(); diff --git a/osu.Game/Beatmaps/Legacy/LegacyMods.cs b/osu.Game/Beatmaps/Legacy/LegacyMods.cs index 2ac7324778..0983610ba0 100644 --- a/osu.Game/Beatmaps/Legacy/LegacyMods.cs +++ b/osu.Game/Beatmaps/Legacy/LegacyMods.cs @@ -9,35 +9,34 @@ namespace osu.Game.Beatmaps.Legacy public enum LegacyMods { None = 0, - NoFail = 1, - Easy = 2, - TouchDevice = 4, - Hidden = 8, - HardRock = 16, - SuddenDeath = 32, - DoubleTime = 64, - Relax = 128, - HalfTime = 256, - NightCore = 512, - FlashLight = 1024, - AutoPlay = 2048, - SpunOut = 4096, - AutoPilot = 8192, - Perfect = 16384, - Key4 = 32768, - Key5 = 65536, - Key6 = 131072, - Key7 = 262144, - Key8 = 524288, - keyMod = 1015808,// k4+k5+k6+k7+k8 - FadeIn = 1048576, - Random = 2097152, - Cinema = 4194304, - TargetPractice = 8388608, - Key9 = 16777216, - Coop = 33554432, - Key1 = 67108864, - Key3 = 134217728, - Key2 = 268435456, + NoFail = 1 << 0, + Easy = 1 << 1, + TouchDevice = 1 << 2, + Hidden = 1 << 3, + HardRock = 1 << 4, + SuddenDeath = 1 << 5, + DoubleTime = 1 << 6, + Relax = 1 << 7, + HalfTime = 1 << 8, + Nightcore = 1 << 9, + Flashlight = 1 << 10, + Autoplay = 1 << 11, + SpunOut = 1 << 12, + Autopilot = 1 << 13, + Perfect = 1 << 14, + Key4 = 1 << 15, + Key5 = 1 << 16, + Key6 = 1 << 17, + Key7 = 1 << 18, + Key8 = 1 << 19, + FadeIn = 1 << 20, + Random = 1 << 21, + Cinema = 1 << 22, + Target = 1 << 23, + Key9 = 1 << 24, + KeyCoop = 1 << 25, + Key1 = 1 << 26, + Key3 = 1 << 27, + Key2 = 1 << 28, } } diff --git a/osu.Game/Rulesets/Ruleset.cs b/osu.Game/Rulesets/Ruleset.cs index f2cf813d38..cd1d030afe 100644 --- a/osu.Game/Rulesets/Ruleset.cs +++ b/osu.Game/Rulesets/Ruleset.cs @@ -34,7 +34,12 @@ namespace osu.Game.Rulesets public abstract IEnumerable GetModsFor(ModType type); - public abstract IEnumerable GetLegacyModsFor(LegacyMods mods); + /// + /// Converts mods from legacy enum values. Do not override if you're not a legacy ruleset. + /// + /// The legacy enum which will be converted + /// An enumerable of constructed s + public virtual IEnumerable ConvertLegacyMods(LegacyMods mods) => new Mod[] { }; public Mod GetAutoplayMod() => GetAllMods().First(mod => mod is ModAutoplay); diff --git a/osu.Game/Rulesets/Scoring/Legacy/LegacyScoreParser.cs b/osu.Game/Rulesets/Scoring/Legacy/LegacyScoreParser.cs index 62d1cb3a32..239f200e29 100644 --- a/osu.Game/Rulesets/Scoring/Legacy/LegacyScoreParser.cs +++ b/osu.Game/Rulesets/Scoring/Legacy/LegacyScoreParser.cs @@ -66,7 +66,7 @@ namespace osu.Game.Rulesets.Scoring.Legacy /* score.Perfect = */ sr.ReadBoolean(); /* score.EnabledMods = (Mods)*/ - score.Mods = currentRuleset.GetLegacyModsFor((LegacyMods)sr.ReadInt32()).ToArray(); + score.Mods = currentRuleset.ConvertLegacyMods((LegacyMods)sr.ReadInt32()).ToArray(); /* score.HpGraphString = */ sr.ReadString(); /* score.Date = */ From 1feba556ebee972cd812795bd2e0a6135de154e6 Mon Sep 17 00:00:00 2001 From: tgi74000 Date: Mon, 16 Apr 2018 14:25:43 +0200 Subject: [PATCH 14/19] CI: unused directive --- osu.Game/Beatmaps/DummyWorkingBeatmap.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Beatmaps/DummyWorkingBeatmap.cs b/osu.Game/Beatmaps/DummyWorkingBeatmap.cs index 48cee0d512..0424ff84f1 100644 --- a/osu.Game/Beatmaps/DummyWorkingBeatmap.cs +++ b/osu.Game/Beatmaps/DummyWorkingBeatmap.cs @@ -8,7 +8,6 @@ using osu.Framework.Graphics.Textures; using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.UI; -using osu.Game.Beatmaps.Legacy; namespace osu.Game.Beatmaps { From a27f39a55575411584f7bd02c444cfcaece7d6fa Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 18 Apr 2018 11:57:06 +0900 Subject: [PATCH 15/19] Add documentation explaining intertwining logic --- osu.Game/Screens/Select/Leaderboards/Leaderboard.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs index 429e6a405d..43f6f13db3 100644 --- a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs +++ b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs @@ -109,6 +109,10 @@ namespace osu.Game.Screens.Select.Leaderboards private PlaceholderState placeholderState; + /// + /// Update the placeholder visibility. + /// Setting this to anything other than PlaceholderState.Successful will cancel all existing retrieval requests and hide scores. + /// protected PlaceholderState PlaceholderState { get { return placeholderState; } From 188c8ce1e7582f3789827a7004831b35e932bc34 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 18 Apr 2018 11:58:55 +0900 Subject: [PATCH 16/19] Remove unnecessary score nulling (already happens in PlaceholderState_Set) --- osu.Game/Screens/Select/Leaderboards/Leaderboard.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs index 43f6f13db3..9dae8fb273 100644 --- a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs +++ b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs @@ -293,8 +293,6 @@ namespace osu.Game.Screens.Select.Leaderboards return; } - Scores = null; - placeholderContainer.Child = placeholder; placeholder.ScaleTo(0.8f).Then().ScaleTo(1, fade_duration * 3, Easing.OutQuint); From 68a13a5fb50093930d815ae9585c278ff1fccfbd Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 18 Apr 2018 14:18:56 +0900 Subject: [PATCH 17/19] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 02d7a0fa47..f858902d16 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 02d7a0fa4798d197cd08570ee48951edbb7c7860 +Subproject commit f858902d167c42d000662cb3a1cd202d723ea182 From d5ce618d9bf32e4098d6a0a2c947981be7d59982 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 18 Apr 2018 15:12:48 +0900 Subject: [PATCH 18/19] Update with framework changes --- osu.Game/Tests/Visual/OsuTestCase.cs | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/osu.Game/Tests/Visual/OsuTestCase.cs b/osu.Game/Tests/Visual/OsuTestCase.cs index decf0c9bdb..02f425c296 100644 --- a/osu.Game/Tests/Visual/OsuTestCase.cs +++ b/osu.Game/Tests/Visual/OsuTestCase.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using System.IO; using System.Reflection; using osu.Framework.Testing; @@ -10,28 +9,27 @@ namespace osu.Game.Tests.Visual { public abstract class OsuTestCase : TestCase { - public override void RunTest() - { - using (var host = new CleanRunHeadlessGameHost($"test-{Guid.NewGuid()}", realtime: false)) - host.Run(new OsuTestCaseTestRunner(this)); - } + protected override ITestCaseTestRunner CreateRunner() => new OsuTestCaseTestRunner(); - public class OsuTestCaseTestRunner : OsuGameBase + public class OsuTestCaseTestRunner : OsuGameBase, ITestCaseTestRunner { - private readonly OsuTestCase testCase; - protected override string MainResourceFile => File.Exists(base.MainResourceFile) ? base.MainResourceFile : Assembly.GetExecutingAssembly().Location; - public OsuTestCaseTestRunner(OsuTestCase testCase) + private readonly TestCaseTestRunner.TestRunner runner; + + public OsuTestCaseTestRunner() { - this.testCase = testCase; + runner = new TestCaseTestRunner.TestRunner(); } protected override void LoadComplete() { base.LoadComplete(); - Add(new TestCaseTestRunner.TestRunner(testCase)); + + Add(runner); } + + public void RunTestBlocking(TestCase test) => runner.RunTestBlocking(test); } } } From 560fcfc661e3a5917631bb472f1adda4276c636e Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 18 Apr 2018 15:15:29 +0900 Subject: [PATCH 19/19] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index f858902d16..16e6a453db 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit f858902d167c42d000662cb3a1cd202d723ea182 +Subproject commit 16e6a453db9a8f4454238a2911eb5f1444b7ec2a