From 187a025d36a70aa649b84b6573770d5412f12dfd Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 29 Mar 2018 16:07:20 +0900 Subject: [PATCH 1/6] Make hitobjects sorted by their start times --- osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs | 1 - osu.Game.Rulesets.Mania/UI/Column.cs | 1 - osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs | 2 -- osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs | 2 -- osu.Game/Rulesets/UI/HitObjectContainer.cs | 11 +++++++++++ 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs index 39b7ffb387..8bb206543b 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs @@ -57,7 +57,6 @@ namespace osu.Game.Rulesets.Catch.UI public override void Add(DrawableHitObject h) { - h.Depth = (float)h.HitObject.StartTime; h.OnJudgement += onJudgement; base.Add(h); diff --git a/osu.Game.Rulesets.Mania/UI/Column.cs b/osu.Game.Rulesets.Mania/UI/Column.cs index 21f00c003b..109ffd0d25 100644 --- a/osu.Game.Rulesets.Mania/UI/Column.cs +++ b/osu.Game.Rulesets.Mania/UI/Column.cs @@ -205,7 +205,6 @@ namespace osu.Game.Rulesets.Mania.UI /// The DrawableHitObject to add. public override void Add(DrawableHitObject hitObject) { - hitObject.Depth = (float)hitObject.HitObject.StartTime; hitObject.AccentColour = AccentColour; hitObject.OnJudgement += OnJudgement; diff --git a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs index 98a8096678..0c5d757474 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs @@ -55,8 +55,6 @@ namespace osu.Game.Rulesets.Osu.UI public override void Add(DrawableHitObject h) { - h.Depth = (float)h.HitObject.StartTime; - h.OnJudgement += onJudgement; var c = h as IDrawableHitObjectWithProxiedApproach; diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs index 75aaceaecb..effb9eb54f 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs @@ -208,8 +208,6 @@ namespace osu.Game.Rulesets.Taiko.UI public override void Add(DrawableHitObject h) { - h.Depth = (float)h.HitObject.StartTime; - h.OnJudgement += OnJudgement; base.Add(h); diff --git a/osu.Game/Rulesets/UI/HitObjectContainer.cs b/osu.Game/Rulesets/UI/HitObjectContainer.cs index c26a6cdff0..ecb10dfba2 100644 --- a/osu.Game/Rulesets/UI/HitObjectContainer.cs +++ b/osu.Game/Rulesets/UI/HitObjectContainer.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; +using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.Objects.Drawables; @@ -15,5 +16,15 @@ namespace osu.Game.Rulesets.UI public virtual void Add(DrawableHitObject hitObject) => AddInternal(hitObject); public virtual bool Remove(DrawableHitObject hitObject) => RemoveInternal(hitObject); + + protected override int Compare(Drawable x, Drawable y) + { + if (!(x is DrawableHitObject xObj) || !(y is DrawableHitObject yObj)) + return base.Compare(x, y); + + // Put earlier hitobjects towards the end of the list, so they handle input first + int i = yObj.HitObject.StartTime.CompareTo(xObj.HitObject.StartTime); + return i == 0 ? CompareReverseChildID(x, y) : i; + } } } From bb7618eb0c0b4dc38c87786a7e88381718147620 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 29 Mar 2018 16:13:05 +0900 Subject: [PATCH 2/6] FIx mania playfield playing the wrong/duplicated sounds Fixes #2266. --- osu.Game.Rulesets.Mania/UI/Column.cs | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/osu.Game.Rulesets.Mania/UI/Column.cs b/osu.Game.Rulesets.Mania/UI/Column.cs index 109ffd0d25..15c9a83b78 100644 --- a/osu.Game.Rulesets.Mania/UI/Column.cs +++ b/osu.Game.Rulesets.Mania/UI/Column.cs @@ -262,21 +262,13 @@ namespace osu.Game.Rulesets.Mania.UI public bool OnPressed(ManiaAction action) { - // Play the sounds of the next hitobject - if (HitObjects.AliveObjects.Any()) - { - // If there are alive hitobjects, we can abuse the fact that AliveObjects are sorted by time (see: Add()) - HitObjects.AliveObjects.First().PlaySamples(); - } - else - { - // If not, we do a slow search - we might want to do a BinarySearch here if this becomes problematic - // We fallback to LastOrDefault() if we're beyond the last note in the map - var hitObject = HitObjects.Objects.FirstOrDefault(h => h.HitObject.StartTime > Time.Current) ?? HitObjects.Objects.LastOrDefault(); - hitObject?.PlaySamples(); - } + if (action != Action) + return false; - return false; + var hitObject = HitObjects.Objects.LastOrDefault(h => h.HitObject.StartTime > Time.Current) ?? HitObjects.Objects.FirstOrDefault(); + hitObject?.PlaySamples(); + + return true; } public bool OnReleased(ManiaAction action) => false; From 5c4b0c2b8d22c2a567d0afbfe6558ec038496c37 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 29 Mar 2018 16:55:07 +0900 Subject: [PATCH 3/6] Add rider run/debug configurations --- .../VisualTests__net461_.xml | 24 +++++++++++++++++++ .../VisualTests__netcoreapp2_0_.xml | 24 +++++++++++++++++++ .../.idea/runConfigurations/osu___net461_.xml | 24 +++++++++++++++++++ .../osu___netcoreapp2_0_.xml | 24 +++++++++++++++++++ 4 files changed, 96 insertions(+) create mode 100644 .idea/.idea.osu/.idea/runConfigurations/VisualTests__net461_.xml create mode 100644 .idea/.idea.osu/.idea/runConfigurations/VisualTests__netcoreapp2_0_.xml create mode 100644 .idea/.idea.osu/.idea/runConfigurations/osu___net461_.xml create mode 100644 .idea/.idea.osu/.idea/runConfigurations/osu___netcoreapp2_0_.xml diff --git a/.idea/.idea.osu/.idea/runConfigurations/VisualTests__net461_.xml b/.idea/.idea.osu/.idea/runConfigurations/VisualTests__net461_.xml new file mode 100644 index 0000000000..5122f08aaa --- /dev/null +++ b/.idea/.idea.osu/.idea/runConfigurations/VisualTests__net461_.xml @@ -0,0 +1,24 @@ + + + + \ No newline at end of file diff --git a/.idea/.idea.osu/.idea/runConfigurations/VisualTests__netcoreapp2_0_.xml b/.idea/.idea.osu/.idea/runConfigurations/VisualTests__netcoreapp2_0_.xml new file mode 100644 index 0000000000..a5c78f0a7a --- /dev/null +++ b/.idea/.idea.osu/.idea/runConfigurations/VisualTests__netcoreapp2_0_.xml @@ -0,0 +1,24 @@ + + + + \ No newline at end of file diff --git a/.idea/.idea.osu/.idea/runConfigurations/osu___net461_.xml b/.idea/.idea.osu/.idea/runConfigurations/osu___net461_.xml new file mode 100644 index 0000000000..bacfd6c576 --- /dev/null +++ b/.idea/.idea.osu/.idea/runConfigurations/osu___net461_.xml @@ -0,0 +1,24 @@ + + + + \ No newline at end of file diff --git a/.idea/.idea.osu/.idea/runConfigurations/osu___netcoreapp2_0_.xml b/.idea/.idea.osu/.idea/runConfigurations/osu___netcoreapp2_0_.xml new file mode 100644 index 0000000000..b02c7977b6 --- /dev/null +++ b/.idea/.idea.osu/.idea/runConfigurations/osu___netcoreapp2_0_.xml @@ -0,0 +1,24 @@ + + + + \ No newline at end of file From 49c8bc44ad2934fa6e522a09f581994336d963af Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 29 Mar 2018 17:08:06 +0900 Subject: [PATCH 4/6] Remove silly stuff --- .../.idea/runConfigurations/VisualTests__net461_.xml | 5 ----- .../.idea/runConfigurations/VisualTests__netcoreapp2_0_.xml | 5 ----- .idea/.idea.osu/.idea/runConfigurations/osu___net461_.xml | 5 ----- .../.idea/runConfigurations/osu___netcoreapp2_0_.xml | 5 ----- 4 files changed, 20 deletions(-) diff --git a/.idea/.idea.osu/.idea/runConfigurations/VisualTests__net461_.xml b/.idea/.idea.osu/.idea/runConfigurations/VisualTests__net461_.xml index 5122f08aaa..0615aa755f 100644 --- a/.idea/.idea.osu/.idea/runConfigurations/VisualTests__net461_.xml +++ b/.idea/.idea.osu/.idea/runConfigurations/VisualTests__net461_.xml @@ -4,10 +4,6 @@