diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs index 7aeb75ef8d..1f0bdf40e0 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs @@ -6,7 +6,7 @@ using OpenTK; using OpenTK.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Testing; -using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; +using osu.Game.Modes.Taiko.Objects.Drawables.Pieces; namespace osu.Desktop.VisualTests.Tests { diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index ecd6fe813e..c7ef33c573 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -8,7 +8,7 @@ using osu.Framework.Testing; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Taiko.Judgements; using osu.Game.Modes.Taiko.Objects; -using osu.Game.Modes.Taiko.Objects.Drawable; +using osu.Game.Modes.Taiko.Objects.Drawables; using osu.Game.Modes.Taiko.UI; namespace osu.Desktop.VisualTests.Tests @@ -19,6 +19,8 @@ namespace osu.Desktop.VisualTests.Tests private TaikoPlayfield playfield; + protected override double TimePerAction => 500; + public override void Reset() { base.Reset(); @@ -32,6 +34,8 @@ namespace osu.Desktop.VisualTests.Tests AddStep("Strong Centre", () => addCentreHit(true)); AddStep("Rim", () => addRimHit(false)); AddStep("Strong Rim", () => addRimHit(true)); + AddStep("Add bar line", () => addBarLine(false)); + AddStep("Add major bar line", () => addBarLine(true)); Add(new Container { @@ -73,12 +77,23 @@ namespace osu.Desktop.VisualTests.Tests }); } + private void addBarLine(bool major) + { + BarLine bl = new BarLine + { + StartTime = Time.Current + 1000, + PreEmpt = 1000 + }; + + playfield.AddBarLine(major ? new DrawableMajorBarLine(bl) : new DrawableBarLine(bl)); + } + private void addSwell() { playfield.Add(new DrawableSwell(new Swell { StartTime = Time.Current + 1000, - EndTime = Time.Current + 5000, + EndTime = Time.Current + 1000, PreEmpt = 1000 })); } @@ -88,7 +103,7 @@ namespace osu.Desktop.VisualTests.Tests var d = new DrumRoll { StartTime = Time.Current + 1000, - Distance = 20000, + Distance = 1000, PreEmpt = 1000, }; diff --git a/osu.Game.Modes.Taiko/Objects/BarLine.cs b/osu.Game.Modes.Taiko/Objects/BarLine.cs new file mode 100644 index 0000000000..a6eceb2e48 --- /dev/null +++ b/osu.Game.Modes.Taiko/Objects/BarLine.cs @@ -0,0 +1,26 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Beatmaps.Timing; +using osu.Game.Database; + +namespace osu.Game.Modes.Taiko.Objects +{ + public class BarLine + { + /// + /// The start time of the control point this bar line represents. + /// + public double StartTime; + + /// + /// The time to scroll in the bar line. + /// + public double PreEmpt; + + public void ApplyDefaults(TimingInfo timing, BeatmapDifficulty difficulty) + { + PreEmpt = TaikoHitObject.BASE_SCROLL_TIME / difficulty.SliderMultiplier * timing.BeatLengthAt(StartTime) * timing.SpeedMultiplierAt(StartTime) / 1000; + } + } +} diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableBarLine.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableBarLine.cs new file mode 100644 index 0000000000..6567975796 --- /dev/null +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableBarLine.cs @@ -0,0 +1,81 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using OpenTK; + +namespace osu.Game.Modes.Taiko.Objects.Drawables +{ + /// + /// A line that scrolls alongside hit objects in the playfield and visualises control points. + /// + public class DrawableBarLine : Container + { + /// + /// The width of the line tracker. + /// + private const float tracker_width = 2f; + + /// + /// Fade out time calibrated to a pre-empt of 1000ms. + /// + private const float base_fadeout_time = 100f; + + /// + /// The visual line tracker. + /// + protected Box Tracker; + + /// + /// The bar line. + /// + protected readonly BarLine BarLine; + + public DrawableBarLine(BarLine barLine) + { + BarLine = barLine; + + Anchor = Anchor.CentreLeft; + Origin = Anchor.Centre; + + RelativePositionAxes = Axes.X; + RelativeSizeAxes = Axes.Y; + + Width = tracker_width; + + Children = new[] + { + Tracker = new Box + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + EdgeSmoothness = new Vector2(0.5f, 0), + Alpha = 0.75f + } + }; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + LifetimeStart = BarLine.StartTime - BarLine.PreEmpt * 2; + LifetimeEnd = BarLine.StartTime + BarLine.PreEmpt; + + Delay(BarLine.StartTime - Time.Current); + FadeOut(base_fadeout_time * BarLine.PreEmpt / 1000); + } + + private void updateScrollPosition(double time) => MoveToX((float)((BarLine.StartTime - time) / BarLine.PreEmpt)); + + protected override void Update() + { + base.Update(); + + updateScrollPosition(Time.Current); + } + } +} \ No newline at end of file diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableCentreHit.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableCentreHit.cs similarity index 85% rename from osu.Game.Modes.Taiko/Objects/Drawable/DrawableCentreHit.cs rename to osu.Game.Modes.Taiko/Objects/Drawables/DrawableCentreHit.cs index 76eb6bb77d..c79351f4d9 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableCentreHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableCentreHit.cs @@ -1,12 +1,12 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK.Input; -using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; -using osu.Game.Graphics; using osu.Framework.Allocation; +using osu.Game.Graphics; +using osu.Game.Modes.Taiko.Objects.Drawables.Pieces; +using OpenTK.Input; -namespace osu.Game.Modes.Taiko.Objects.Drawable +namespace osu.Game.Modes.Taiko.Objects.Drawables { public class DrawableCentreHit : DrawableHit { diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRoll.cs similarity index 94% rename from osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs rename to osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRoll.cs index ea6b0043d7..4e8d75315d 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRoll.cs @@ -1,18 +1,18 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK; -using OpenTK.Graphics; +using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.MathUtils; using osu.Game.Graphics; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Taiko.Judgements; -using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; -using System.Linq; +using osu.Game.Modes.Taiko.Objects.Drawables.Pieces; +using OpenTK; +using OpenTK.Graphics; -namespace osu.Game.Modes.Taiko.Objects.Drawable +namespace osu.Game.Modes.Taiko.Objects.Drawables { public class DrawableDrumRoll : DrawableTaikoHitObject { diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRollTick.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRollTick.cs similarity index 95% rename from osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRollTick.cs rename to osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRollTick.cs index b7509bc51d..85f9e32c6c 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRollTick.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRollTick.cs @@ -1,17 +1,17 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK.Input; -using osu.Game.Modes.Taiko.Judgements; using System; -using osu.Game.Modes.Objects.Drawables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Game.Modes.Objects.Drawables; +using osu.Game.Modes.Taiko.Judgements; using OpenTK; using OpenTK.Graphics; -using osu.Framework.Graphics.Sprites; +using OpenTK.Input; -namespace osu.Game.Modes.Taiko.Objects.Drawable +namespace osu.Game.Modes.Taiko.Objects.Drawables { public class DrawableDrumRollTick : DrawableTaikoHitObject { diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableHit.cs similarity index 91% rename from osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs rename to osu.Game.Modes.Taiko/Objects/Drawables/DrawableHit.cs index 87f0e76f60..25ecd5ac84 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableHit.cs @@ -1,16 +1,16 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK.Input; +using System; +using System.Linq; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Taiko.Judgements; -using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; -using System; -using System.Linq; +using osu.Game.Modes.Taiko.Objects.Drawables.Pieces; +using OpenTK.Input; -namespace osu.Game.Modes.Taiko.Objects.Drawable +namespace osu.Game.Modes.Taiko.Objects.Drawables { public abstract class DrawableHit : DrawableTaikoHitObject { @@ -19,7 +19,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable /// protected abstract Key[] HitKeys { get; } - protected override Container Content => bodyContainer; + protected override Container Content => bodyContainer; protected readonly CirclePiece Circle; diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableMajorBarLine.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableMajorBarLine.cs new file mode 100644 index 0000000000..14d3d84f4b --- /dev/null +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableMajorBarLine.cs @@ -0,0 +1,57 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using OpenTK; + +namespace osu.Game.Modes.Taiko.Objects.Drawables +{ + public class DrawableMajorBarLine : DrawableBarLine + { + /// + /// The vertical offset of the triangles from the line tracker. + /// + private const float triangle_offfset = 10f; + + /// + /// The size of the triangles. + /// + private const float triangle_size = 20f; + + public DrawableMajorBarLine(BarLine barLine) + : base(barLine) + { + Add(new Container + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Children = new[] + { + new EquilateralTriangle + { + Name = "Top", + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Position = new Vector2(0, -triangle_offfset), + Size = new Vector2(-triangle_size), + EdgeSmoothness = new Vector2(1), + }, + new EquilateralTriangle + { + Name = "Bottom", + Anchor = Anchor.BottomCentre, + Origin = Anchor.TopCentre, + Position = new Vector2(0, triangle_offfset), + Size = new Vector2(triangle_size), + EdgeSmoothness = new Vector2(1), + } + } + }); + + Tracker.Alpha = 1f; + } + } +} \ No newline at end of file diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableRimHit.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableRimHit.cs similarity index 85% rename from osu.Game.Modes.Taiko/Objects/Drawable/DrawableRimHit.cs rename to osu.Game.Modes.Taiko/Objects/Drawables/DrawableRimHit.cs index 893a6fbb4d..0fa51b1661 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableRimHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableRimHit.cs @@ -3,10 +3,10 @@ using osu.Framework.Allocation; using osu.Game.Graphics; +using osu.Game.Modes.Taiko.Objects.Drawables.Pieces; using OpenTK.Input; -using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; -namespace osu.Game.Modes.Taiko.Objects.Drawable +namespace osu.Game.Modes.Taiko.Objects.Drawables { public class DrawableRimHit : DrawableHit { diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongCentreHit.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongCentreHit.cs similarity index 85% rename from osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongCentreHit.cs rename to osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongCentreHit.cs index bac44f48fb..815c19779a 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongCentreHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongCentreHit.cs @@ -1,12 +1,12 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK.Input; -using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; using osu.Framework.Allocation; using osu.Game.Graphics; +using osu.Game.Modes.Taiko.Objects.Drawables.Pieces; +using OpenTK.Input; -namespace osu.Game.Modes.Taiko.Objects.Drawable +namespace osu.Game.Modes.Taiko.Objects.Drawables { public class DrawableStrongCentreHit : DrawableStrongHit { diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongDrumRoll.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongDrumRoll.cs similarity index 82% rename from osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongDrumRoll.cs rename to osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongDrumRoll.cs index e9723a0162..bb7e197502 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongDrumRoll.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongDrumRoll.cs @@ -2,9 +2,9 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Modes.Taiko.Judgements; -using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; +using osu.Game.Modes.Taiko.Objects.Drawables.Pieces; -namespace osu.Game.Modes.Taiko.Objects.Drawable +namespace osu.Game.Modes.Taiko.Objects.Drawables { public class DrawableStrongDrumRoll : DrawableDrumRoll { diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongHit.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongHit.cs similarity index 95% rename from osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongHit.cs rename to osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongHit.cs index a6cb6ae7fa..116ef94ee4 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongHit.cs @@ -1,14 +1,14 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK.Input; using System; using System.Linq; using osu.Framework.Input; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Taiko.Judgements; +using OpenTK.Input; -namespace osu.Game.Modes.Taiko.Objects.Drawable +namespace osu.Game.Modes.Taiko.Objects.Drawables { public abstract class DrawableStrongHit : DrawableHit { diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongRimHit.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongRimHit.cs similarity index 85% rename from osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongRimHit.cs rename to osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongRimHit.cs index 985ba1c2df..3af0ff399b 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongRimHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongRimHit.cs @@ -3,10 +3,10 @@ using osu.Framework.Allocation; using osu.Game.Graphics; +using osu.Game.Modes.Taiko.Objects.Drawables.Pieces; using OpenTK.Input; -using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; -namespace osu.Game.Modes.Taiko.Objects.Drawable +namespace osu.Game.Modes.Taiko.Objects.Drawables { public class DrawableStrongRimHit : DrawableStrongHit { diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableSwell.cs similarity index 94% rename from osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs rename to osu.Game.Modes.Taiko/Objects/Drawables/DrawableSwell.cs index ec1ab42bfc..717cda9126 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableSwell.cs @@ -1,9 +1,8 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK; -using OpenTK.Graphics; -using OpenTK.Input; +using System; +using System.Linq; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; @@ -12,11 +11,12 @@ using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Taiko.Judgements; -using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; -using System; -using System.Linq; +using osu.Game.Modes.Taiko.Objects.Drawables.Pieces; +using OpenTK; +using OpenTK.Graphics; +using OpenTK.Input; -namespace osu.Game.Modes.Taiko.Objects.Drawable +namespace osu.Game.Modes.Taiko.Objects.Drawables { public class DrawableSwell : DrawableTaikoHitObject { @@ -56,11 +56,11 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { this.swell = swell; - Children = new Framework.Graphics.Drawable[] + Children = new Drawable[] { bodyContainer = new Container { - Children = new Framework.Graphics.Drawable[] + Children = new Drawable[] { expandingRing = new CircularContainer { @@ -89,7 +89,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable Masking = true, BorderThickness = target_ring_thick_border, BlendingMode = BlendingMode.Additive, - Children = new Framework.Graphics.Drawable[] + Children = new Drawable[] { new Box { diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs similarity index 95% rename from osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs rename to osu.Game.Modes.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs index 8da05d8bed..5f85903827 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs @@ -1,14 +1,14 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK.Input; +using System.Collections.Generic; using osu.Framework.Graphics; +using osu.Framework.Input; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Taiko.Judgements; -using System.Collections.Generic; -using osu.Framework.Input; +using OpenTK.Input; -namespace osu.Game.Modes.Taiko.Objects.Drawable +namespace osu.Game.Modes.Taiko.Objects.Drawables { public abstract class DrawableTaikoHitObject : DrawableHitObject { diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CentreHitSymbolPiece.cs b/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/CentreHitSymbolPiece.cs similarity index 90% rename from osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CentreHitSymbolPiece.cs rename to osu.Game.Modes.Taiko/Objects/Drawables/Pieces/CentreHitSymbolPiece.cs index e62ca6b073..0cf4e97b41 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CentreHitSymbolPiece.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/CentreHitSymbolPiece.cs @@ -1,12 +1,12 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Graphics.Containers; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using OpenTK; -namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces +namespace osu.Game.Modes.Taiko.Objects.Drawables.Pieces { /// /// The symbol used for centre hit pieces. diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CirclePiece.cs b/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/CirclePiece.cs similarity index 92% rename from osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CirclePiece.cs rename to osu.Game.Modes.Taiko/Objects/Drawables/Pieces/CirclePiece.cs index d51c06bcad..941ef3b37f 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CirclePiece.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/CirclePiece.cs @@ -1,16 +1,16 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; +using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; using OpenTK.Graphics; -using System; -using osu.Game.Graphics; -namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces +namespace osu.Game.Modes.Taiko.Objects.Drawables.Pieces { /// /// A circle piece which is used uniformly through osu!taiko to visualise hitobjects. @@ -63,7 +63,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces set { throw new InvalidOperationException($"{nameof(CirclePiece)} must always use CentreLeft origin."); } } - protected override Container Content => SymbolContainer; + protected override Container Content => SymbolContainer; protected readonly Container SymbolContainer; private readonly Container background; @@ -81,7 +81,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Y, - Children = new Framework.Graphics.Drawable[] + Children = new Drawable[] { background = new CircularContainer { @@ -90,7 +90,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, Masking = true, - Children = new Framework.Graphics.Drawable[] + Children = new Drawable[] { new Box { diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/RimHitSymbolPiece.cs b/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/RimHitSymbolPiece.cs similarity index 91% rename from osu.Game.Modes.Taiko/Objects/Drawable/Pieces/RimHitSymbolPiece.cs rename to osu.Game.Modes.Taiko/Objects/Drawables/Pieces/RimHitSymbolPiece.cs index 6999634108..6e19497978 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/RimHitSymbolPiece.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/RimHitSymbolPiece.cs @@ -1,13 +1,13 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Graphics.Containers; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using OpenTK; using OpenTK.Graphics; -namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces +namespace osu.Game.Modes.Taiko.Objects.Drawables.Pieces { /// /// The symbol used for rim hit pieces. diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/StrongCirclePiece.cs b/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/StrongCirclePiece.cs similarity index 90% rename from osu.Game.Modes.Taiko/Objects/Drawable/Pieces/StrongCirclePiece.cs rename to osu.Game.Modes.Taiko/Objects/Drawables/Pieces/StrongCirclePiece.cs index 319ca17cb8..9676c4a19f 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/StrongCirclePiece.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/StrongCirclePiece.cs @@ -3,7 +3,7 @@ using OpenTK; -namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces +namespace osu.Game.Modes.Taiko.Objects.Drawables.Pieces { /// /// A type of circle piece which is drawn at a higher scale to represent a "strong" piece. diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/SwellSymbolPiece.cs b/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/SwellSymbolPiece.cs similarity index 88% rename from osu.Game.Modes.Taiko/Objects/Drawable/Pieces/SwellSymbolPiece.cs rename to osu.Game.Modes.Taiko/Objects/Drawables/Pieces/SwellSymbolPiece.cs index 2bd86406a7..e491793902 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/SwellSymbolPiece.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/SwellSymbolPiece.cs @@ -1,10 +1,10 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Graphics; using osu.Framework.Graphics; +using osu.Game.Graphics; -namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces +namespace osu.Game.Modes.Taiko.Objects.Drawables.Pieces { /// /// The symbol used for swell pieces. diff --git a/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs index 5de7e20b67..839471a651 100644 --- a/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs @@ -17,7 +17,7 @@ namespace osu.Game.Modes.Taiko.Objects /// /// Time (in milliseconds) to scroll in the hit object with a speed-adjusted beat length of 1 second. /// - private const double base_scroll_time = 6000; + public const double BASE_SCROLL_TIME = 6000; /// /// The velocity multiplier applied to this hit object. @@ -44,7 +44,7 @@ namespace osu.Game.Modes.Taiko.Objects { base.ApplyDefaults(timing, difficulty); - PreEmpt = base_scroll_time / difficulty.SliderMultiplier * timing.BeatLengthAt(StartTime) * timing.SpeedMultiplierAt(StartTime) / VelocityMultiplier / 1000; + PreEmpt = BASE_SCROLL_TIME / difficulty.SliderMultiplier * timing.BeatLengthAt(StartTime) * timing.SpeedMultiplierAt(StartTime) / VelocityMultiplier / 1000; ControlPoint overridePoint; Kiai = timing.TimingPointAt(StartTime, out overridePoint).KiaiMode; diff --git a/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs b/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs index 5640e1df30..c1ee1f6691 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs @@ -1,17 +1,21 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Beatmaps; +using osu.Framework.Allocation; +using osu.Framework.MathUtils; using osu.Framework.Graphics; +using osu.Game.Beatmaps; +using osu.Game.Beatmaps.Timing; using osu.Game.Modes.Objects.Drawables; +using osu.Game.Modes.Objects.Types; +using osu.Game.Modes.Replays; using osu.Game.Modes.Scoring; using osu.Game.Modes.Taiko.Beatmaps; using osu.Game.Modes.Taiko.Judgements; using osu.Game.Modes.Taiko.Objects; -using osu.Game.Modes.Taiko.Objects.Drawable; +using osu.Game.Modes.Taiko.Objects.Drawables; using osu.Game.Modes.Taiko.Scoring; using osu.Game.Modes.UI; -using osu.Game.Modes.Replays; using osu.Game.Modes.Taiko.Replays; namespace osu.Game.Modes.Taiko.UI @@ -23,6 +27,79 @@ namespace osu.Game.Modes.Taiko.UI { } + [BackgroundDependencyLoader] + private void load() + { + loadBarLines(); + } + + private void loadBarLines() + { + var taikoPlayfield = Playfield as TaikoPlayfield; + + if (taikoPlayfield == null) + return; + + TaikoHitObject lastObject = Beatmap.HitObjects[Beatmap.HitObjects.Count - 1]; + double lastHitTime = 1 + (lastObject as IHasEndTime)?.EndTime ?? lastObject.StartTime; + + var timingPoints = Beatmap.TimingInfo.ControlPoints.FindAll(cp => cp.TimingChange); + + if (timingPoints.Count == 0) + return; + + int currentIndex = 0; + + while (currentIndex < timingPoints.Count && Precision.AlmostEquals(timingPoints[currentIndex].BeatLength, 0)) + currentIndex++; + + double time = timingPoints[currentIndex].Time; + double measureLength = timingPoints[currentIndex].BeatLength * (int)timingPoints[currentIndex].TimeSignature; + + // Find the bar line time closest to 0 + time -= measureLength * (int)(time / measureLength); + + // Always start barlines from a positive time + while (time < 0) + time += measureLength; + + int currentBeat = 0; + while (time <= lastHitTime) + { + ControlPoint current = timingPoints[currentIndex]; + + if (time > current.Time || current.OmitFirstBarLine) + { + bool isMajor = currentBeat % (int)current.TimeSignature == 0; + + var barLine = new BarLine + { + StartTime = time, + }; + + barLine.ApplyDefaults(Beatmap.TimingInfo, Beatmap.BeatmapInfo.Difficulty); + + taikoPlayfield.AddBarLine(isMajor ? new DrawableMajorBarLine(barLine) : new DrawableBarLine(barLine)); + + currentBeat++; + } + + double bl = current.BeatLength; + + if (bl < 800) + bl *= (int)current.TimeSignature; + + time += bl; + + if (currentIndex + 1 >= timingPoints.Count || time < timingPoints[currentIndex + 1].Time) + continue; + + currentBeat = 0; + currentIndex++; + time = timingPoints[currentIndex].Time; + } + } + public override ScoreProcessor CreateScoreProcessor() => new TaikoScoreProcessor(this); protected override IBeatmapConverter CreateBeatmapConverter() => new TaikoBeatmapConverter(); diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index c23d920eda..958055d768 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -14,8 +14,8 @@ using osu.Game.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics.Primitives; -using osu.Game.Modes.Taiko.Objects.Drawable; using System.Linq; +using osu.Game.Modes.Taiko.Objects.Drawables; namespace osu.Game.Modes.Taiko.UI { @@ -40,7 +40,7 @@ namespace osu.Game.Modes.Taiko.UI protected override Container Content => hitObjectContainer; private readonly Container hitExplosionContainer; - //private Container barLineContainer; + private readonly Container barLineContainer; private readonly Container judgementContainer; private readonly Container hitObjectContainer; @@ -96,10 +96,10 @@ namespace osu.Game.Modes.Taiko.UI Size = new Vector2(TaikoHitObject.CIRCLE_RADIUS * 2), BlendingMode = BlendingMode.Additive }, - //barLineContainer = new Container - //{ - // RelativeSizeAxes = Axes.Both, - //}, + barLineContainer = new Container + { + RelativeSizeAxes = Axes.Both, + }, new HitTarget { Anchor = Anchor.CentreLeft, @@ -174,6 +174,11 @@ namespace osu.Game.Modes.Taiko.UI swell.OnStart += () => topLevelHitContainer.Add(swell.CreateProxy()); } + public void AddBarLine(DrawableBarLine barLine) + { + barLineContainer.Add(barLine); + } + public override void OnJudgement(DrawableHitObject judgedObject) { bool wasHit = judgedObject.Judgement.Result == HitResult.Hit; diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index f3f93d720a..1fbf1b27a1 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -53,23 +53,26 @@ + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + +