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..cf4bccfe60 --- /dev/null +++ b/.idea/.idea.osu/.idea/runConfigurations/VisualTests__net461_.xml @@ -0,0 +1,18 @@ + + + + \ 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..08b4e38667 --- /dev/null +++ b/.idea/.idea.osu/.idea/runConfigurations/VisualTests__netcoreapp2_0_.xml @@ -0,0 +1,18 @@ + + + + \ 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..971868a81b --- /dev/null +++ b/.idea/.idea.osu/.idea/runConfigurations/osu___net461_.xml @@ -0,0 +1,18 @@ + + + + \ 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..2f5c137631 --- /dev/null +++ b/.idea/.idea.osu/.idea/runConfigurations/osu___netcoreapp2_0_.xml @@ -0,0 +1,18 @@ + + + + \ No newline at end of file diff --git a/osu-framework b/osu-framework index f60cd46471..85b3494117 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit f60cd4647165d1dadb91aa045f41cef42c11bad9 +Subproject commit 85b3494117ccef1b396b70957e1cffaba06e2b54 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..15c9a83b78 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; @@ -263,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; 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; + } } }