From 89db7f81cbd9d1d4b7d452cfc584b259f98751c7 Mon Sep 17 00:00:00 2001 From: Santeri Nogelainen Date: Wed, 2 May 2018 17:11:55 +0300 Subject: [PATCH 01/23] Selecting a mod now triggers on mouseup --- osu.Game/Overlays/Mods/ModButton.cs | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs index 2a4f243606..3f1541aee3 100644 --- a/osu.Game/Overlays/Mods/ModButton.cs +++ b/osu.Game/Overlays/Mods/ModButton.cs @@ -147,18 +147,21 @@ namespace osu.Game.Overlays.Mods public virtual Mod SelectedMod => Mods.ElementAtOrDefault(selectedIndex); - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) { - switch (args.Button) + // only trigger the event if we are inside the area of the button + if (Contains(ToScreenSpace(state.Mouse.Position - Position))) { - case MouseButton.Left: - SelectNext(1); - break; - case MouseButton.Right: - SelectNext(-1); - break; + switch (args.Button) + { + case MouseButton.Left: + SelectNext(1); + break; + case MouseButton.Right: + SelectNext(-1); + break; + } } - return true; } From 5489976c20cf5d7e15600c8d2f2a53e93f5c3af7 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 7 May 2018 10:51:17 +0900 Subject: [PATCH 02/23] Implement ruleset-specific beatmap statistics --- osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmap.cs | 45 +++++++++++++++++++ .../Beatmaps/OsuBeatmapConverter.cs | 2 + osu.Game.Rulesets.Osu/OsuRuleset.cs | 33 -------------- osu.Game/Beatmaps/Beatmap.cs | 8 ++++ osu.Game/Rulesets/Ruleset.cs | 2 - osu.Game/Screens/Select/BeatmapInfoWedge.cs | 4 +- 6 files changed, 57 insertions(+), 37 deletions(-) create mode 100644 osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmap.cs diff --git a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmap.cs b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmap.cs new file mode 100644 index 0000000000..68002f73b5 --- /dev/null +++ b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmap.cs @@ -0,0 +1,45 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Collections.Generic; +using System.Linq; +using osu.Game.Beatmaps; +using osu.Game.Graphics; +using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Objects.Types; +using osu.Game.Rulesets.Osu.Objects; + +namespace osu.Game.Rulesets.Osu.Beatmaps +{ + public class OsuBeatmap : Beatmap + { + public override IEnumerable GetStatistics() + { + IEnumerable circles = HitObjects.Where(c => !(c is IHasEndTime)); + IEnumerable sliders = HitObjects.Where(s => s is IHasCurve); + IEnumerable spinners = HitObjects.Where(s => s is IHasEndTime && !(s is IHasCurve)); + + return new[] + { + new BeatmapStatistic + { + Name = @"Circle Count", + Content = circles.Count().ToString(), + Icon = FontAwesome.fa_circle_o + }, + new BeatmapStatistic + { + Name = @"Slider Count", + Content = sliders.Count().ToString(), + Icon = FontAwesome.fa_circle + }, + new BeatmapStatistic + { + Name = @"Spinner Count", + Content = spinners.Count().ToString(), + Icon = FontAwesome.fa_circle + } + }; + } + } +} diff --git a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs index 1cd4ec5668..5f3a909488 100644 --- a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs +++ b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs @@ -65,5 +65,7 @@ namespace osu.Game.Rulesets.Osu.Beatmaps }; } } + + protected override Beatmap CreateBeatmap() => new OsuBeatmap(); } } diff --git a/osu.Game.Rulesets.Osu/OsuRuleset.cs b/osu.Game.Rulesets.Osu/OsuRuleset.cs index 927ffa2146..69a54fb533 100644 --- a/osu.Game.Rulesets.Osu/OsuRuleset.cs +++ b/osu.Game.Rulesets.Osu/OsuRuleset.cs @@ -9,7 +9,6 @@ using osu.Game.Rulesets.Osu.OsuDifficulty; using osu.Game.Rulesets.Osu.UI; using osu.Game.Rulesets.UI; using System.Collections.Generic; -using System.Linq; using osu.Framework.Graphics; using osu.Game.Overlays.Settings; using osu.Framework.Input.Bindings; @@ -17,8 +16,6 @@ using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Osu.Scoring; using osu.Game.Rulesets.Osu.Edit; using osu.Game.Rulesets.Edit; -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; @@ -40,36 +37,6 @@ namespace osu.Game.Rulesets.Osu new KeyBinding(InputKey.MouseRight, OsuAction.RightButton), }; - public override IEnumerable GetBeatmapStatistics(WorkingBeatmap beatmap) - { - IEnumerable hitObjects = beatmap.Beatmap.HitObjects; - IEnumerable circles = hitObjects.Where(c => !(c is IHasEndTime)); - IEnumerable sliders = hitObjects.Where(s => s is IHasCurve); - IEnumerable spinners = hitObjects.Where(s => s is IHasEndTime && !(s is IHasCurve)); - - return new[] - { - new BeatmapStatistic - { - Name = @"Circle Count", - Content = circles.Count().ToString(), - Icon = FontAwesome.fa_circle_o - }, - new BeatmapStatistic - { - Name = @"Slider Count", - Content = sliders.Count().ToString(), - Icon = FontAwesome.fa_circle - }, - new BeatmapStatistic - { - Name = @"Spinner Count", - Content = spinners.Count().ToString(), - Icon = FontAwesome.fa_circle - } - }; - } - public override IEnumerable ConvertLegacyMods(LegacyMods mods) { if (mods.HasFlag(LegacyMods.Nightcore)) diff --git a/osu.Game/Beatmaps/Beatmap.cs b/osu.Game/Beatmaps/Beatmap.cs index 6a7d2690ff..e323dd0241 100644 --- a/osu.Game/Beatmaps/Beatmap.cs +++ b/osu.Game/Beatmaps/Beatmap.cs @@ -44,6 +44,12 @@ namespace osu.Game.Beatmaps /// IEnumerable HitObjects { get; } + /// + /// Returns statistics of the contained in this beatmap. + /// + /// + IEnumerable GetStatistics(); + /// /// Creates a shallow-clone of this beatmap and returns it. /// @@ -90,6 +96,8 @@ namespace osu.Game.Beatmaps IEnumerable IBeatmap.HitObjects => HitObjects; + public virtual IEnumerable GetStatistics() => Enumerable.Empty(); + IBeatmap IBeatmap.Clone() => Clone(); public Beatmap Clone() diff --git a/osu.Game/Rulesets/Ruleset.cs b/osu.Game/Rulesets/Ruleset.cs index d6d1d19628..6883d319f4 100644 --- a/osu.Game/Rulesets/Ruleset.cs +++ b/osu.Game/Rulesets/Ruleset.cs @@ -22,8 +22,6 @@ namespace osu.Game.Rulesets { public readonly RulesetInfo RulesetInfo; - public virtual IEnumerable GetBeatmapStatistics(WorkingBeatmap beatmap) => new BeatmapStatistic[] { }; - public IEnumerable GetAllMods() => Enum.GetValues(typeof(ModType)).Cast() // Confine all mods of each mod type into a single IEnumerable .SelectMany(GetModsFor) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index da82a49f51..c0370763c0 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -234,8 +234,8 @@ namespace osu.Game.Screens.Select Content = getBPMRange(beatmap), })); - //get statistics from the current ruleset. - labels.AddRange(info.Ruleset.CreateInstance().GetBeatmapStatistics(working).Select(s => new InfoLabel(s))); + //get statistics for the current ruleset. + labels.AddRange(working.GetPlayableBeatmap(info.Ruleset).GetStatistics().Select(s => new InfoLabel(s))); } return labels.ToArray(); From accffda5321fb6314d18665eccdf285e703c0972 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 7 May 2018 10:51:30 +0900 Subject: [PATCH 03/23] Add taiko statistics --- .../Beatmaps/TaikoBeatmap.cs | 49 +++++++++++++++++++ .../Beatmaps/TaikoBeatmapConverter.cs | 2 + 2 files changed, 51 insertions(+) create mode 100644 osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmap.cs diff --git a/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmap.cs b/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmap.cs new file mode 100644 index 0000000000..cbf2270c95 --- /dev/null +++ b/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmap.cs @@ -0,0 +1,49 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Collections.Generic; +using System.Linq; +using osu.Game.Beatmaps; +using osu.Game.Graphics; +using osu.Game.Rulesets.Taiko.Objects; + +namespace osu.Game.Rulesets.Taiko.Beatmaps +{ + public class TaikoBeatmap : Beatmap + { + public override IEnumerable GetStatistics() + { + int drumrolls = HitObjects.Count(s => s is DrumRoll); + int swells = HitObjects.Count(s => s is Swell); + int notes = HitObjects.Count - drumrolls - swells; + + return new[] + { + new BeatmapStatistic + { + Name = @"Object Count", + Content = HitObjects.Count.ToString(), + Icon = FontAwesome.fa_circle + }, + new BeatmapStatistic + { + Name = @"Note Count", + Content = notes.ToString(), + Icon = FontAwesome.fa_circle_o + }, + new BeatmapStatistic + { + Name = @"Drumroll Count", + Content = drumrolls.ToString(), + Icon = FontAwesome.fa_circle + }, + new BeatmapStatistic + { + Name = @"Swell Count", + Content = swells.ToString(), + Icon = FontAwesome.fa_circle + } + }; + } + } +} diff --git a/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs index eeb0fa1871..d40e8dc643 100644 --- a/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -197,5 +197,7 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps } } } + + protected override Beatmap CreateBeatmap() => new TaikoBeatmap(); } } From 8a4717d2e9e84875f14f02f318020f8f6949d1cf Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 7 May 2018 10:57:01 +0900 Subject: [PATCH 04/23] Add catch statistics --- .../Beatmaps/CatchBeatmap.cs | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmap.cs diff --git a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmap.cs b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmap.cs new file mode 100644 index 0000000000..1b65a70207 --- /dev/null +++ b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmap.cs @@ -0,0 +1,49 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Collections.Generic; +using System.Linq; +using osu.Game.Beatmaps; +using osu.Game.Graphics; +using osu.Game.Rulesets.Catch.Objects; + +namespace osu.Game.Rulesets.Catch.Beatmaps +{ + public class CatchBeatmap : Beatmap + { + public override IEnumerable GetStatistics() + { + int juiceStreams = HitObjects.Count(s => s is JuiceStream); + int bananaShowers = HitObjects.Count(s => s is BananaShower); + int fruits = HitObjects.Count - juiceStreams - bananaShowers; + + return new[] + { + new BeatmapStatistic + { + Name = @"Object Count", + Content = HitObjects.Count.ToString(), + Icon = FontAwesome.fa_circle + }, + new BeatmapStatistic + { + Name = @"Fruit Count", + Content = fruits.ToString(), + Icon = FontAwesome.fa_circle_o + }, + new BeatmapStatistic + { + Name = @"Juice Stream Count", + Content = juiceStreams.ToString(), + Icon = FontAwesome.fa_circle + }, + new BeatmapStatistic + { + Name = @"Banana Shower Count", + Content = bananaShowers.ToString(), + Icon = FontAwesome.fa_circle + } + }; + } + } +} From b737644208e0008eae06bdbe3a03b5ff9a527d1a Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 7 May 2018 10:58:56 +0900 Subject: [PATCH 05/23] Add mania statistics --- .../Beatmaps/ManiaBeatmap.cs | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmap.cs b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmap.cs index 6af3719f83..22cc57d924 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmap.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmap.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Linq; using osu.Game.Beatmaps; +using osu.Game.Graphics; using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.UI; @@ -29,5 +30,33 @@ namespace osu.Game.Rulesets.Mania.Beatmaps { Stages.Add(defaultStage); } + + public override IEnumerable GetStatistics() + { + int holdnotes = HitObjects.Count(s => s is HoldNote); + int notes = HitObjects.Count - holdnotes; + + return new[] + { + new BeatmapStatistic + { + Name = @"Object Count", + Content = HitObjects.Count.ToString(), + Icon = FontAwesome.fa_circle + }, + new BeatmapStatistic + { + Name = @"Note Count", + Content = notes.ToString(), + Icon = FontAwesome.fa_circle_o + }, + new BeatmapStatistic + { + Name = @"Hold Note Count", + Content = holdnotes.ToString(), + Icon = FontAwesome.fa_circle + }, + }; + } } } From 5f74dc2c1746dec30ead8270bf58c1635146653d Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 7 May 2018 10:59:30 +0900 Subject: [PATCH 06/23] Simplify osu-ruleset statistics --- osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmap.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmap.cs b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmap.cs index 68002f73b5..7b534deccf 100644 --- a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmap.cs +++ b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmap.cs @@ -6,7 +6,6 @@ using System.Linq; using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Rulesets.Objects; -using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Osu.Objects; namespace osu.Game.Rulesets.Osu.Beatmaps @@ -15,9 +14,9 @@ namespace osu.Game.Rulesets.Osu.Beatmaps { public override IEnumerable GetStatistics() { - IEnumerable circles = HitObjects.Where(c => !(c is IHasEndTime)); - IEnumerable sliders = HitObjects.Where(s => s is IHasCurve); - IEnumerable spinners = HitObjects.Where(s => s is IHasEndTime && !(s is IHasCurve)); + IEnumerable circles = HitObjects.Where(c => c is HitCircle); + IEnumerable sliders = HitObjects.Where(s => s is Slider); + IEnumerable spinners = HitObjects.Where(s => s is Spinner); return new[] { From b9e4b59e46ff589a864de4da71b1fc504a1f95c0 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 7 May 2018 11:01:09 +0900 Subject: [PATCH 07/23] Actually construct catch beatmaps --- osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs index 4a0b120e47..f40ef67dfb 100644 --- a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs +++ b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs @@ -69,5 +69,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps X = positionData.X / CatchPlayfield.BASE_WIDTH }; } + + protected override Beatmap CreateBeatmap() => new CatchBeatmap(); } } From 7eb64ab590ccd828a04328b5b61818e544cb48be Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 7 May 2018 11:33:05 +0900 Subject: [PATCH 08/23] Remove object counts from mania/taiko/catch --- osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmap.cs | 8 +------- osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmap.cs | 8 +------- osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmap.cs | 12 +++--------- 3 files changed, 5 insertions(+), 23 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmap.cs b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmap.cs index 1b65a70207..5b4af6ea8a 100644 --- a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmap.cs +++ b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmap.cs @@ -13,18 +13,12 @@ namespace osu.Game.Rulesets.Catch.Beatmaps { public override IEnumerable GetStatistics() { + int fruits = HitObjects.Count(s => s is Fruit); int juiceStreams = HitObjects.Count(s => s is JuiceStream); int bananaShowers = HitObjects.Count(s => s is BananaShower); - int fruits = HitObjects.Count - juiceStreams - bananaShowers; return new[] { - new BeatmapStatistic - { - Name = @"Object Count", - Content = HitObjects.Count.ToString(), - Icon = FontAwesome.fa_circle - }, new BeatmapStatistic { Name = @"Fruit Count", diff --git a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmap.cs b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmap.cs index 22cc57d924..ad5f8e447d 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmap.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmap.cs @@ -33,17 +33,11 @@ namespace osu.Game.Rulesets.Mania.Beatmaps public override IEnumerable GetStatistics() { + int notes = HitObjects.Count(s => s is Note); int holdnotes = HitObjects.Count(s => s is HoldNote); - int notes = HitObjects.Count - holdnotes; return new[] { - new BeatmapStatistic - { - Name = @"Object Count", - Content = HitObjects.Count.ToString(), - Icon = FontAwesome.fa_circle - }, new BeatmapStatistic { Name = @"Note Count", diff --git a/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmap.cs b/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmap.cs index cbf2270c95..36f6df7869 100644 --- a/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmap.cs +++ b/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmap.cs @@ -13,22 +13,16 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps { public override IEnumerable GetStatistics() { + int hits = HitObjects.Count(s => s is Hit); int drumrolls = HitObjects.Count(s => s is DrumRoll); int swells = HitObjects.Count(s => s is Swell); - int notes = HitObjects.Count - drumrolls - swells; return new[] { new BeatmapStatistic { - Name = @"Object Count", - Content = HitObjects.Count.ToString(), - Icon = FontAwesome.fa_circle - }, - new BeatmapStatistic - { - Name = @"Note Count", - Content = notes.ToString(), + Name = @"Hit Count", + Content = hits.ToString(), Icon = FontAwesome.fa_circle_o }, new BeatmapStatistic From 251bdfdee8c0232235b8de4f25620ca270946fd6 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 7 May 2018 11:33:15 +0900 Subject: [PATCH 09/23] Simplify statistics in osu ruleset --- osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmap.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmap.cs b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmap.cs index 7b534deccf..6d90c2a875 100644 --- a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmap.cs +++ b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmap.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.Linq; using osu.Game.Beatmaps; using osu.Game.Graphics; -using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Osu.Objects; namespace osu.Game.Rulesets.Osu.Beatmaps @@ -14,28 +13,28 @@ namespace osu.Game.Rulesets.Osu.Beatmaps { public override IEnumerable GetStatistics() { - IEnumerable circles = HitObjects.Where(c => c is HitCircle); - IEnumerable sliders = HitObjects.Where(s => s is Slider); - IEnumerable spinners = HitObjects.Where(s => s is Spinner); + int circles = HitObjects.Count(c => c is HitCircle); + int sliders = HitObjects.Count(s => s is Slider); + int spinners = HitObjects.Count(s => s is Spinner); return new[] { new BeatmapStatistic { Name = @"Circle Count", - Content = circles.Count().ToString(), + Content = circles.ToString(), Icon = FontAwesome.fa_circle_o }, new BeatmapStatistic { Name = @"Slider Count", - Content = sliders.Count().ToString(), + Content = sliders.ToString(), Icon = FontAwesome.fa_circle }, new BeatmapStatistic { Name = @"Spinner Count", - Content = spinners.Count().ToString(), + Content = spinners.ToString(), Icon = FontAwesome.fa_circle } }; From 6a9f139d9b1fb1fb89a3ef93687e5ef8ae85507b Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 7 May 2018 11:33:40 +0900 Subject: [PATCH 10/23] Instantiate convertible hitobjects for beatmap info wedge --- osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs b/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs index efd6c36ce2..a618e44301 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs +++ b/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs @@ -13,6 +13,7 @@ using osu.Game.Beatmaps; using osu.Game.Graphics.Sprites; using osu.Game.Rulesets; using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Osu; using osu.Game.Screens.Select; using osu.Game.Tests.Beatmaps; @@ -138,7 +139,7 @@ namespace osu.Game.Tests.Visual { List objects = new List(); for (double i = 0; i < 50000; i += 1000) - objects.Add(new HitObject { StartTime = i }); + objects.Add(new TestHitObject { StartTime = i }); return new Beatmap { @@ -153,7 +154,8 @@ namespace osu.Game.Tests.Visual }, Ruleset = ruleset, StarDifficulty = 6, - Version = $"{ruleset.ShortName}Version" + Version = $"{ruleset.ShortName}Version", + BaseDifficulty = new BeatmapDifficulty() }, HitObjects = objects }; @@ -163,5 +165,12 @@ namespace osu.Game.Tests.Visual { public new BufferedWedgeInfo Info => base.Info; } + + private class TestHitObject : HitObject, IHasPosition + { + public float X { get; } = 0; + public float Y { get; } = 0; + public Vector2 Position { get; } = Vector2.Zero; + } } } From 09c70a93625d4bf3b2f6318b95014a55d0d27f49 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 7 May 2018 11:36:51 +0900 Subject: [PATCH 11/23] Add info label tests to TestCaseBeatmapInfoWedge --- .../Visual/TestCaseBeatmapInfoWedge.cs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs b/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs index a618e44301..0d3e08154f 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs +++ b/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs @@ -12,9 +12,12 @@ using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; using osu.Game.Graphics.Sprites; using osu.Game.Rulesets; +using osu.Game.Rulesets.Catch; +using osu.Game.Rulesets.Mania; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Osu; +using osu.Game.Rulesets.Taiko; using osu.Game.Screens.Select; using osu.Game.Tests.Beatmaps; @@ -73,13 +76,23 @@ namespace osu.Game.Tests.Visual selectBeatmap(testBeatmap); + testBeatmapLabels(ruleset); + // TODO: adjust cases once more info is shown for other gamemodes switch (ruleset) { - case OsuRuleset osu: - testOsuBeatmap(osu); + case OsuRuleset _: testInfoLabels(5); break; + case TaikoRuleset _: + testInfoLabels(5); + break; + case CatchRuleset _: + testInfoLabels(5); + break; + case ManiaRuleset _: + testInfoLabels(4); + break; default: testInfoLabels(2); break; @@ -89,7 +102,7 @@ namespace osu.Game.Tests.Visual testNullBeatmap(); } - private void testOsuBeatmap(OsuRuleset ruleset) + private void testBeatmapLabels(Ruleset ruleset) { AddAssert("check version", () => infoWedge.Info.VersionLabel.Text == $"{ruleset.ShortName}Version"); AddAssert("check title", () => infoWedge.Info.TitleLabel.Text == $"{ruleset.ShortName}Source — {ruleset.ShortName}Title"); From fbd7ccc03fa732e3d6e4276f75c999538b14097f Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 7 May 2018 11:59:17 +0900 Subject: [PATCH 12/23] Make BeatmapInfoWedge display properly for converts --- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 49 ++++++++++++++++++--- 1 file changed, 44 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index c0370763c0..7a8a04bd43 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -4,9 +4,11 @@ using System; using System.Collections.Generic; using System.Linq; +using JetBrains.Annotations; using OpenTK; using OpenTK.Graphics; using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; @@ -21,6 +23,8 @@ using osu.Game.Rulesets.Objects.Types; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Cursor; using osu.Framework.Localisation; +using osu.Game.Rulesets; +using osu.Game.Rulesets.UI; namespace osu.Game.Screens.Select { @@ -28,6 +32,8 @@ namespace osu.Game.Screens.Select { private static readonly Vector2 wedged_container_shear = new Vector2(0.15f, 0); + private readonly IBindable ruleset = new Bindable(); + protected BufferedWedgeInfo Info; public BeatmapInfoWedge() @@ -46,6 +52,14 @@ namespace osu.Game.Screens.Select }; } + [BackgroundDependencyLoader(true)] + private void load([CanBeNull] OsuGame osuGame) + { + if (osuGame != null) + ruleset.BindTo(osuGame.Ruleset); + ruleset.ValueChanged += updateRuleset; + } + protected override bool BlockPassThroughMouse => false; protected override void PopIn() @@ -62,7 +76,17 @@ namespace osu.Game.Screens.Select this.FadeOut(500, Easing.In); } + private WorkingBeatmap beatmap; + public void UpdateBeatmap(WorkingBeatmap beatmap) + { + this.beatmap = beatmap; + loadBeatmap(); + } + + private void updateRuleset(RulesetInfo ruleset) => loadBeatmap(); + + private void loadBeatmap() { LoadComponentAsync(new BufferedWedgeInfo(beatmap) { @@ -90,14 +114,18 @@ namespace osu.Game.Screens.Select private UnicodeBindableString titleBinding; private UnicodeBindableString artistBinding; + private RulesetInfo ruleset; + public BufferedWedgeInfo(WorkingBeatmap working) { this.working = working; } - [BackgroundDependencyLoader] - private void load(LocalisationEngine localisation) + [BackgroundDependencyLoader(true)] + private void load([NotNull] LocalisationEngine localisation, [CanBeNull] OsuGame osuGame) { + ruleset = osuGame?.Ruleset.Value ?? working.BeatmapInfo.Ruleset; + var beatmapInfo = working.BeatmapInfo; var metadata = beatmapInfo.Metadata ?? working.BeatmapSetInfo?.Metadata ?? new BeatmapMetadata(); @@ -211,7 +239,6 @@ namespace osu.Game.Screens.Select private InfoLabel[] getInfoLabels() { var beatmap = working.Beatmap; - var info = working.BeatmapInfo; List labels = new List(); @@ -234,8 +261,20 @@ namespace osu.Game.Screens.Select Content = getBPMRange(beatmap), })); - //get statistics for the current ruleset. - labels.AddRange(working.GetPlayableBeatmap(info.Ruleset).GetStatistics().Select(s => new InfoLabel(s))); + IBeatmap playableBeatmap; + + try + { + // Try to get the beatmap with the user's ruleset + playableBeatmap = working.GetPlayableBeatmap(ruleset); + } + catch (BeatmapInvalidForRulesetException) + { + // Can't be converted to the user's ruleset, so use the beatmap's own ruleset + playableBeatmap = working.GetPlayableBeatmap(working.BeatmapInfo.Ruleset); + } + + labels.AddRange(playableBeatmap.GetStatistics().Select(s => new InfoLabel(s))); } return labels.ToArray(); From ecb8de29a20138c057fa937ab048dc1cc32f7c2e Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 10 May 2018 20:30:03 -0300 Subject: [PATCH 13/23] Adjust BreadcrumbControl to better match the designs. --- .../UserInterface/BreadcrumbControl.cs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs index 3f59eeca97..f5017de639 100644 --- a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs +++ b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs @@ -14,14 +14,18 @@ namespace osu.Game.Graphics.UserInterface public class BreadcrumbControl : OsuTabControl { private const float padding = 10; + private const float item_chevron_size = 10; - protected override TabItem CreateTabItem(T value) => new BreadcrumbTabItem(value); + protected override TabItem CreateTabItem(T value) => new BreadcrumbTabItem(value) + { + AccentColour = AccentColour, + }; - protected override float StripWidth() => base.StripWidth() - (padding + 8); + protected override float StripWidth() => base.StripWidth() - (padding + item_chevron_size); public BreadcrumbControl() { - Height = 26; + Height = 32; TabContainer.Spacing = new Vector2(padding, 0f); Current.ValueChanged += tab => { @@ -47,6 +51,7 @@ namespace osu.Game.Graphics.UserInterface public override bool HandleKeyboardInput => State == Visibility.Visible; public override bool HandleMouseInput => State == Visibility.Visible; + public override bool IsRemovable => true; private Visibility state; @@ -77,13 +82,14 @@ namespace osu.Game.Graphics.UserInterface public BreadcrumbTabItem(T value) : base(value) { - Text.TextSize = 16; - Padding = new MarginPadding { Right = padding + 8 }; //padding + chevron width + Text.TextSize = 18; + Text.Margin = new MarginPadding { Vertical = 8 }; + Padding = new MarginPadding { Right = padding + item_chevron_size }; Add(Chevron = new SpriteIcon { Anchor = Anchor.CentreRight, Origin = Anchor.CentreLeft, - Size = new Vector2(12), + Size = new Vector2(item_chevron_size), Icon = FontAwesome.fa_chevron_right, Margin = new MarginPadding { Left = padding }, Alpha = 0f, From c35760fdef40981d1830e32e5d2c5d292300f9d8 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 10 May 2018 20:39:05 -0300 Subject: [PATCH 14/23] Rename osu.Game/Screens/Multiplayer to Multi. --- osu.Game.Tests/Visual/TestCaseDrawableRoom.cs | 2 +- osu.Game.Tests/Visual/TestCaseRoomInspector.cs | 2 +- osu.Game/Screens/Menu/MainMenu.cs | 2 +- osu.Game/Screens/Multi/.DS_Store | Bin 0 -> 6148 bytes .../{Multiplayer => Multi}/DrawableGameType.cs | 2 +- .../{Multiplayer => Multi}/DrawableRoom.cs | 2 +- osu.Game/Screens/{Multiplayer => Multi}/Lobby.cs | 2 +- osu.Game/Screens/{Multiplayer => Multi}/Match.cs | 2 +- .../{Multiplayer => Multi}/MatchCreate.cs | 2 +- .../{Multiplayer => Multi}/ModeTypeInfo.cs | 2 +- .../{Multiplayer => Multi}/ParticipantInfo.cs | 2 +- .../{Multiplayer => Multi}/RoomInspector.cs | 2 +- 12 files changed, 11 insertions(+), 11 deletions(-) create mode 100644 osu.Game/Screens/Multi/.DS_Store rename osu.Game/Screens/{Multiplayer => Multi}/DrawableGameType.cs (96%) rename osu.Game/Screens/{Multiplayer => Multi}/DrawableRoom.cs (99%) rename osu.Game/Screens/{Multiplayer => Multi}/Lobby.cs (91%) rename osu.Game/Screens/{Multiplayer => Multi}/Match.cs (96%) rename osu.Game/Screens/{Multiplayer => Multi}/MatchCreate.cs (92%) rename osu.Game/Screens/{Multiplayer => Multi}/ModeTypeInfo.cs (98%) rename osu.Game/Screens/{Multiplayer => Multi}/ParticipantInfo.cs (99%) rename osu.Game/Screens/{Multiplayer => Multi}/RoomInspector.cs (99%) diff --git a/osu.Game.Tests/Visual/TestCaseDrawableRoom.cs b/osu.Game.Tests/Visual/TestCaseDrawableRoom.cs index 25f8ba06c4..958dbd3c74 100644 --- a/osu.Game.Tests/Visual/TestCaseDrawableRoom.cs +++ b/osu.Game.Tests/Visual/TestCaseDrawableRoom.cs @@ -8,7 +8,7 @@ using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; using osu.Game.Online.Multiplayer; using osu.Game.Rulesets; -using osu.Game.Screens.Multiplayer; +using osu.Game.Screens.Multi; using osu.Game.Users; namespace osu.Game.Tests.Visual diff --git a/osu.Game.Tests/Visual/TestCaseRoomInspector.cs b/osu.Game.Tests/Visual/TestCaseRoomInspector.cs index 88059d2dcf..d0752cfc76 100644 --- a/osu.Game.Tests/Visual/TestCaseRoomInspector.cs +++ b/osu.Game.Tests/Visual/TestCaseRoomInspector.cs @@ -7,7 +7,7 @@ using osu.Framework.Graphics; using osu.Game.Beatmaps; using osu.Game.Online.Multiplayer; using osu.Game.Rulesets; -using osu.Game.Screens.Multiplayer; +using osu.Game.Screens.Multi; using osu.Game.Users; namespace osu.Game.Tests.Visual diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index f2ea6d85a8..b09b53063a 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -14,7 +14,7 @@ using osu.Game.Screens.Backgrounds; using osu.Game.Screens.Charts; using osu.Game.Screens.Direct; using osu.Game.Screens.Edit; -using osu.Game.Screens.Multiplayer; +using osu.Game.Screens.Multi; using osu.Game.Screens.Select; using osu.Game.Screens.Tournament; diff --git a/osu.Game/Screens/Multi/.DS_Store b/osu.Game/Screens/Multi/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0 Date: Thu, 10 May 2018 20:44:24 -0300 Subject: [PATCH 15/23] Move multiplayer screen components to osu.Game/Screens/Multi/Components --- osu.Game.Tests/Visual/TestCaseDrawableRoom.cs | 1 + osu.Game.Tests/Visual/TestCaseRoomInspector.cs | 1 + osu.Game/Screens/Multi/.DS_Store | Bin 6148 -> 0 bytes .../Multi/{ => Components}/DrawableGameType.cs | 2 +- .../Multi/{ => Components}/DrawableRoom.cs | 6 +++--- .../Multi/{ => Components}/ModeTypeInfo.cs | 4 ++-- .../Multi/{ => Components}/ParticipantInfo.cs | 4 ++-- .../Multi/{ => Components}/RoomInspector.cs | 6 +++--- 8 files changed, 13 insertions(+), 11 deletions(-) delete mode 100644 osu.Game/Screens/Multi/.DS_Store rename osu.Game/Screens/Multi/{ => Components}/DrawableGameType.cs (96%) rename osu.Game/Screens/Multi/{ => Components}/DrawableRoom.cs (99%) rename osu.Game/Screens/Multi/{ => Components}/ModeTypeInfo.cs (98%) rename osu.Game/Screens/Multi/{ => Components}/ParticipantInfo.cs (99%) rename osu.Game/Screens/Multi/{ => Components}/RoomInspector.cs (99%) diff --git a/osu.Game.Tests/Visual/TestCaseDrawableRoom.cs b/osu.Game.Tests/Visual/TestCaseDrawableRoom.cs index 958dbd3c74..3c61efd689 100644 --- a/osu.Game.Tests/Visual/TestCaseDrawableRoom.cs +++ b/osu.Game.Tests/Visual/TestCaseDrawableRoom.cs @@ -9,6 +9,7 @@ using osu.Game.Beatmaps; using osu.Game.Online.Multiplayer; using osu.Game.Rulesets; using osu.Game.Screens.Multi; +using osu.Game.Screens.Multi.Components; using osu.Game.Users; namespace osu.Game.Tests.Visual diff --git a/osu.Game.Tests/Visual/TestCaseRoomInspector.cs b/osu.Game.Tests/Visual/TestCaseRoomInspector.cs index d0752cfc76..4cf19924e9 100644 --- a/osu.Game.Tests/Visual/TestCaseRoomInspector.cs +++ b/osu.Game.Tests/Visual/TestCaseRoomInspector.cs @@ -8,6 +8,7 @@ using osu.Game.Beatmaps; using osu.Game.Online.Multiplayer; using osu.Game.Rulesets; using osu.Game.Screens.Multi; +using osu.Game.Screens.Multi.Components; using osu.Game.Users; namespace osu.Game.Tests.Visual diff --git a/osu.Game/Screens/Multi/.DS_Store b/osu.Game/Screens/Multi/.DS_Store deleted file mode 100644 index 5008ddfcf53c02e82d7eee2e57c38e5672ef89f6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK; -using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Extensions.Color4Extensions; @@ -17,8 +15,10 @@ using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Online.Multiplayer; using osu.Game.Users; +using OpenTK; +using OpenTK.Graphics; -namespace osu.Game.Screens.Multi +namespace osu.Game.Screens.Multi.Components { public class DrawableRoom : OsuClickableContainer { diff --git a/osu.Game/Screens/Multi/ModeTypeInfo.cs b/osu.Game/Screens/Multi/Components/ModeTypeInfo.cs similarity index 98% rename from osu.Game/Screens/Multi/ModeTypeInfo.cs rename to osu.Game/Screens/Multi/Components/ModeTypeInfo.cs index 1c175bad44..e3aba685a7 100644 --- a/osu.Game/Screens/Multi/ModeTypeInfo.cs +++ b/osu.Game/Screens/Multi/Components/ModeTypeInfo.cs @@ -1,14 +1,14 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; using osu.Game.Online.Multiplayer; +using OpenTK; -namespace osu.Game.Screens.Multi +namespace osu.Game.Screens.Multi.Components { public class ModeTypeInfo : Container { diff --git a/osu.Game/Screens/Multi/ParticipantInfo.cs b/osu.Game/Screens/Multi/Components/ParticipantInfo.cs similarity index 99% rename from osu.Game/Screens/Multi/ParticipantInfo.cs rename to osu.Game/Screens/Multi/Components/ParticipantInfo.cs index a5d2bcd78a..ab404488f1 100644 --- a/osu.Game/Screens/Multi/ParticipantInfo.cs +++ b/osu.Game/Screens/Multi/Components/ParticipantInfo.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Linq; -using OpenTK; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -11,8 +10,9 @@ using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Users; +using OpenTK; -namespace osu.Game.Screens.Multi +namespace osu.Game.Screens.Multi.Components { public class ParticipantInfo : Container { diff --git a/osu.Game/Screens/Multi/RoomInspector.cs b/osu.Game/Screens/Multi/Components/RoomInspector.cs similarity index 99% rename from osu.Game/Screens/Multi/RoomInspector.cs rename to osu.Game/Screens/Multi/Components/RoomInspector.cs index d8c5d5ea9a..92910e8301 100644 --- a/osu.Game/Screens/Multi/RoomInspector.cs +++ b/osu.Game/Screens/Multi/Components/RoomInspector.cs @@ -2,8 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Linq; -using OpenTK; -using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Extensions.Color4Extensions; @@ -20,8 +18,10 @@ using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Online.Multiplayer; using osu.Game.Users; +using OpenTK; +using OpenTK.Graphics; -namespace osu.Game.Screens.Multi +namespace osu.Game.Screens.Multi.Components { public class RoomInspector : Container { From bc9ac8f72a2a281cf43510cd8b81c825a423c27f Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 10 May 2018 20:47:25 -0300 Subject: [PATCH 16/23] Move multiplayer screens to osu.Game/Screens/Multi/Screens --- osu.Game/Screens/Menu/MainMenu.cs | 1 + osu.Game/Screens/Multi/{ => Screens}/Lobby.cs | 2 +- osu.Game/Screens/Multi/{ => Screens}/Match.cs | 6 +++--- osu.Game/Screens/Multi/{ => Screens}/MatchCreate.cs | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) rename osu.Game/Screens/Multi/{ => Screens}/Lobby.cs (90%) rename osu.Game/Screens/Multi/{ => Screens}/Match.cs (96%) rename osu.Game/Screens/Multi/{ => Screens}/MatchCreate.cs (91%) diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index b09b53063a..2baa26c676 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -15,6 +15,7 @@ using osu.Game.Screens.Charts; using osu.Game.Screens.Direct; using osu.Game.Screens.Edit; using osu.Game.Screens.Multi; +using osu.Game.Screens.Multi.Screens; using osu.Game.Screens.Select; using osu.Game.Screens.Tournament; diff --git a/osu.Game/Screens/Multi/Lobby.cs b/osu.Game/Screens/Multi/Screens/Lobby.cs similarity index 90% rename from osu.Game/Screens/Multi/Lobby.cs rename to osu.Game/Screens/Multi/Screens/Lobby.cs index 80e682e9f9..dcda40e0d7 100644 --- a/osu.Game/Screens/Multi/Lobby.cs +++ b/osu.Game/Screens/Multi/Screens/Lobby.cs @@ -4,7 +4,7 @@ using System; using System.Collections.Generic; -namespace osu.Game.Screens.Multi +namespace osu.Game.Screens.Multi.Screens { public class Lobby : ScreenWhiteBox { diff --git a/osu.Game/Screens/Multi/Match.cs b/osu.Game/Screens/Multi/Screens/Match.cs similarity index 96% rename from osu.Game/Screens/Multi/Match.cs rename to osu.Game/Screens/Multi/Screens/Match.cs index eee302a115..4ba7fe9f6a 100644 --- a/osu.Game/Screens/Multi/Match.cs +++ b/osu.Game/Screens/Multi/Screens/Match.cs @@ -3,14 +3,14 @@ using System; using System.Collections.Generic; +using osu.Framework.Graphics; using osu.Framework.Screens; using osu.Game.Screens.Backgrounds; using osu.Game.Screens.Play; -using OpenTK.Graphics; using osu.Game.Screens.Select; -using osu.Framework.Graphics; +using OpenTK.Graphics; -namespace osu.Game.Screens.Multi +namespace osu.Game.Screens.Multi.Screens { public class Match : ScreenWhiteBox { diff --git a/osu.Game/Screens/Multi/MatchCreate.cs b/osu.Game/Screens/Multi/Screens/MatchCreate.cs similarity index 91% rename from osu.Game/Screens/Multi/MatchCreate.cs rename to osu.Game/Screens/Multi/Screens/MatchCreate.cs index db528ae2a3..6b4e26d5e5 100644 --- a/osu.Game/Screens/Multi/MatchCreate.cs +++ b/osu.Game/Screens/Multi/Screens/MatchCreate.cs @@ -4,7 +4,7 @@ using System; using System.Collections.Generic; -namespace osu.Game.Screens.Multi +namespace osu.Game.Screens.Multi.Screens { public class MatchCreate : ScreenWhiteBox { From a86843ccc93c1a88d65f527daf011c7b12db1674 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 10 May 2018 20:49:42 -0300 Subject: [PATCH 17/23] Remove unused usings caused by multiplayer folder restructuring. --- osu.Game.Tests/Visual/TestCaseDrawableRoom.cs | 1 - osu.Game.Tests/Visual/TestCaseRoomInspector.cs | 1 - osu.Game/Screens/Menu/MainMenu.cs | 1 - 3 files changed, 3 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseDrawableRoom.cs b/osu.Game.Tests/Visual/TestCaseDrawableRoom.cs index 3c61efd689..bb5bf93a69 100644 --- a/osu.Game.Tests/Visual/TestCaseDrawableRoom.cs +++ b/osu.Game.Tests/Visual/TestCaseDrawableRoom.cs @@ -8,7 +8,6 @@ using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; using osu.Game.Online.Multiplayer; using osu.Game.Rulesets; -using osu.Game.Screens.Multi; using osu.Game.Screens.Multi.Components; using osu.Game.Users; diff --git a/osu.Game.Tests/Visual/TestCaseRoomInspector.cs b/osu.Game.Tests/Visual/TestCaseRoomInspector.cs index 4cf19924e9..cb1425ca69 100644 --- a/osu.Game.Tests/Visual/TestCaseRoomInspector.cs +++ b/osu.Game.Tests/Visual/TestCaseRoomInspector.cs @@ -7,7 +7,6 @@ using osu.Framework.Graphics; using osu.Game.Beatmaps; using osu.Game.Online.Multiplayer; using osu.Game.Rulesets; -using osu.Game.Screens.Multi; using osu.Game.Screens.Multi.Components; using osu.Game.Users; diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index 2baa26c676..907ad81111 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -14,7 +14,6 @@ using osu.Game.Screens.Backgrounds; using osu.Game.Screens.Charts; using osu.Game.Screens.Direct; using osu.Game.Screens.Edit; -using osu.Game.Screens.Multi; using osu.Game.Screens.Multi.Screens; using osu.Game.Screens.Select; using osu.Game.Screens.Tournament; From 2bab08c4373a96360d48a8ed183ff79c1385b3d7 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 11 May 2018 14:07:17 +0900 Subject: [PATCH 18/23] Fix post-merge errors --- osu-framework | 2 +- osu.Game/Beatmaps/Beatmap.cs | 44 ----------------------------------- osu.Game/Beatmaps/IBeatmap.cs | 6 +++++ 3 files changed, 7 insertions(+), 45 deletions(-) diff --git a/osu-framework b/osu-framework index 0773d895d9..8c4f232694 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 0773d895d9aa0729995cd4a23efc28238e35ceed +Subproject commit 8c4f23269447d9ce21a5dbd3a0fd4f6caae9ab38 diff --git a/osu.Game/Beatmaps/Beatmap.cs b/osu.Game/Beatmaps/Beatmap.cs index 9517d44fcd..84897853d8 100644 --- a/osu.Game/Beatmaps/Beatmap.cs +++ b/osu.Game/Beatmaps/Beatmap.cs @@ -12,50 +12,6 @@ using osu.Game.IO.Serialization.Converters; namespace osu.Game.Beatmaps { - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /// /// A Beatmap containing converted HitObjects. /// diff --git a/osu.Game/Beatmaps/IBeatmap.cs b/osu.Game/Beatmaps/IBeatmap.cs index 4676f056fa..fe20bce98a 100644 --- a/osu.Game/Beatmaps/IBeatmap.cs +++ b/osu.Game/Beatmaps/IBeatmap.cs @@ -41,6 +41,12 @@ namespace osu.Game.Beatmaps /// IEnumerable HitObjects { get; } + /// + /// Returns statistics for the contained in this beatmap. + /// + /// + IEnumerable GetStatistics(); + /// /// Creates a shallow-clone of this beatmap and returns it. /// From 816ad5c4269c080611156ed6cc798207188fb86a Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 11 May 2018 14:10:53 +0900 Subject: [PATCH 19/23] Pass down ruleset to the buffered wedge --- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 7a8a04bd43..c88e01562f 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -88,7 +88,7 @@ namespace osu.Game.Screens.Select private void loadBeatmap() { - LoadComponentAsync(new BufferedWedgeInfo(beatmap) + LoadComponentAsync(new BufferedWedgeInfo(beatmap, ruleset.Value) { Shear = -Shear, Depth = Info?.Depth + 1 ?? 0, @@ -114,18 +114,18 @@ namespace osu.Game.Screens.Select private UnicodeBindableString titleBinding; private UnicodeBindableString artistBinding; - private RulesetInfo ruleset; + private readonly RulesetInfo ruleset; - public BufferedWedgeInfo(WorkingBeatmap working) + public BufferedWedgeInfo(WorkingBeatmap working, RulesetInfo userRuleset) { this.working = working; + + ruleset = userRuleset ?? working.BeatmapInfo.Ruleset; } [BackgroundDependencyLoader(true)] - private void load([NotNull] LocalisationEngine localisation, [CanBeNull] OsuGame osuGame) + private void load([NotNull] LocalisationEngine localisation) { - ruleset = osuGame?.Ruleset.Value ?? working.BeatmapInfo.Ruleset; - var beatmapInfo = working.BeatmapInfo; var metadata = beatmapInfo.Metadata ?? working.BeatmapSetInfo?.Metadata ?? new BeatmapMetadata(); From fd9796d08c1c3aa74d7691f8825f353fefeb5b7a Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 11 May 2018 14:13:52 +0900 Subject: [PATCH 20/23] Remove some unnecessary changes --- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index c88e01562f..236b1310e1 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -123,8 +123,8 @@ namespace osu.Game.Screens.Select ruleset = userRuleset ?? working.BeatmapInfo.Ruleset; } - [BackgroundDependencyLoader(true)] - private void load([NotNull] LocalisationEngine localisation) + [BackgroundDependencyLoader] + private void load(LocalisationEngine localisation) { var beatmapInfo = working.BeatmapInfo; var metadata = beatmapInfo.Metadata ?? working.BeatmapSetInfo?.Metadata ?? new BeatmapMetadata(); From 4fc887b25f1addd4cc08d7cdcb6e93df23c3ad16 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 11 May 2018 21:40:36 +0900 Subject: [PATCH 21/23] Add a pressing effect to make mouse up response feel good --- osu.Game/Overlays/Mods/ModButton.cs | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs index 3f1541aee3..1d012b1288 100644 --- a/osu.Game/Overlays/Mods/ModButton.cs +++ b/osu.Game/Overlays/Mods/ModButton.cs @@ -116,6 +116,7 @@ namespace osu.Game.Overlays.Mods } private Mod mod; + private Container scaleContainer; public Mod Mod { @@ -147,8 +148,16 @@ namespace osu.Game.Overlays.Mods public virtual Mod SelectedMod => Mods.ElementAtOrDefault(selectedIndex); + protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + { + scaleContainer.ScaleTo(0.9f, 800, Easing.Out); + return base.OnMouseDown(state, args); + } + protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) { + scaleContainer.ScaleTo(1, 500, Easing.OutElastic); + // only trigger the event if we are inside the area of the button if (Contains(ToScreenSpace(state.Mouse.Position - Position))) { @@ -162,6 +171,7 @@ namespace osu.Game.Overlays.Mods break; } } + return true; } @@ -179,7 +189,8 @@ namespace osu.Game.Overlays.Mods start = Mods.Length - 1; for (int i = start; i < Mods.Length && i >= 0; i += direction) - if (SelectAt(i)) return; + if (SelectAt(i)) + return; Deselect(); } @@ -245,8 +256,14 @@ namespace osu.Game.Overlays.Mods Anchor = Anchor.TopCentre, Children = new Drawable[] { - iconsContainer = new Container + scaleContainer = new Container { + Child = iconsContainer = new Container + { + RelativeSizeAxes = Axes.Both, + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + }, RelativeSizeAxes = Axes.Both, Origin = Anchor.Centre, Anchor = Anchor.Centre, From 7cb0d328e60fbccc495b419fc69eed730b348881 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 11 May 2018 21:40:48 +0900 Subject: [PATCH 22/23] Make mods screen dynamically testable --- osu.Game.Tests/Visual/TestCaseMods.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/TestCaseMods.cs b/osu.Game.Tests/Visual/TestCaseMods.cs index dad8fb8fed..d3d21509fd 100644 --- a/osu.Game.Tests/Visual/TestCaseMods.cs +++ b/osu.Game.Tests/Visual/TestCaseMods.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using System.ComponentModel; using osu.Framework.Allocation; using osu.Framework.Graphics; @@ -17,6 +18,7 @@ using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.Sprites; using osu.Game.Rulesets.Mania; using osu.Game.Rulesets.Mania.Mods; +using osu.Game.Rulesets.UI; using OpenTK.Graphics; namespace osu.Game.Tests.Visual @@ -24,6 +26,19 @@ namespace osu.Game.Tests.Visual [Description("mod select and icon display")] public class TestCaseMods : OsuTestCase { + public override IReadOnlyList RequiredTypes => new[] + { + typeof(ModSelectOverlay), + typeof(ModDisplay), + typeof(ModSection), + typeof(ModIcon), + typeof(ModButton), + typeof(ModButtonEmpty), + typeof(DifficultyReductionSection), + typeof(DifficultyIncreaseSection), + typeof(SpecialSection), + }; + private const string unranked_suffix = " (Unranked)"; private RulesetStore rulesets; @@ -66,7 +81,8 @@ namespace osu.Game.Tests.Visual Ruleset ruleset = rulesetInfo.CreateInstance(); AddStep($"switch to {ruleset.Description}", () => modSelect.Ruleset.Value = rulesetInfo); - switch (ruleset) { + switch (ruleset) + { case OsuRuleset or: testOsuMods(or); break; From aa5d5ab2a844c5834134b159c1960b2c3f397dca Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 11 May 2018 21:48:35 +0900 Subject: [PATCH 23/23] Fix readonly field --- osu.Game/Overlays/Mods/ModButton.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs index 1d012b1288..f4e0e3db04 100644 --- a/osu.Game/Overlays/Mods/ModButton.cs +++ b/osu.Game/Overlays/Mods/ModButton.cs @@ -116,7 +116,7 @@ namespace osu.Game.Overlays.Mods } private Mod mod; - private Container scaleContainer; + private readonly Container scaleContainer; public Mod Mod {