diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs index dddc487bd6..c9d2429882 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs @@ -2,14 +2,11 @@ // 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.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using osu.Framework.Testing; using osu.Game.Graphics; -using osu.Game.Modes.Taiko.Objects; using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; namespace osu.Desktop.VisualTests.Tests @@ -30,7 +27,7 @@ public override void Reset() Reset(); }); - Add(new CentreHitCircle(new CirclePiece() + Add(new CentreHitCirclePiece(new CirclePiece { KiaiMode = kiai }) @@ -38,7 +35,7 @@ public override void Reset() Position = new Vector2(100, 100) }); - Add(new CentreHitCircle(new StrongCirclePiece() + Add(new CentreHitCirclePiece(new StrongCirclePiece { KiaiMode = kiai }) @@ -46,7 +43,7 @@ public override void Reset() Position = new Vector2(350, 100) }); - Add(new RimHitCircle(new CirclePiece() + Add(new RimHitCirclePiece(new CirclePiece { KiaiMode = kiai }) @@ -54,7 +51,7 @@ public override void Reset() Position = new Vector2(100, 300) }); - Add(new RimHitCircle(new StrongCirclePiece() + Add(new RimHitCirclePiece(new StrongCirclePiece { KiaiMode = kiai }) @@ -78,7 +75,7 @@ public override void Reset() Position = new Vector2(350, 500) }); - Add(new DrumRollCircle(new CirclePiece() + Add(new DrumRollCircle(new CirclePiece { KiaiMode = kiai }) @@ -87,7 +84,7 @@ public override void Reset() Position = new Vector2(575, 100) }); - Add(new DrumRollCircle(new StrongCirclePiece() + Add(new DrumRollCircle(new StrongCirclePiece { KiaiMode = kiai }) @@ -111,72 +108,8 @@ private void load(OsuColour colours) } } - private class CentreHitCircle : BaseCircle - { - public CentreHitCircle(CirclePiece piece) - : base(piece) - { - Piece.Add(new CircularContainer - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Size = new Vector2(SYMBOL_INNER_SIZE), - Masking = true, - Children = new[] - { - new Box - { - RelativeSizeAxes = Axes.Both - } - } - }); - } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - Piece.AccentColour = colours.PinkDarker; - } - } - - private class RimHitCircle : BaseCircle - { - public RimHitCircle(CirclePiece piece) - : base(piece) - { - Piece.Add(new CircularContainer - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Size = new Vector2(SYMBOL_SIZE), - BorderThickness = SYMBOL_BORDER, - BorderColour = Color4.White, - Masking = true, - Children = new[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Alpha = 0, - AlwaysPresent = true - } - } - }); - } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - Piece.AccentColour = colours.BlueDarker; - } - } - private abstract class BaseCircle : Container { - protected const float SYMBOL_SIZE = TaikoHitObject.CIRCLE_RADIUS * 2f * 0.45f; - protected const float SYMBOL_BORDER = 8; - protected const float SYMBOL_INNER_SIZE = SYMBOL_SIZE - 2 * SYMBOL_BORDER; - protected readonly CirclePiece Piece; protected BaseCircle(CirclePiece piece) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index 2d30f6802b..60e155d6aa 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -1,6 +1,9 @@ // 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.Primitives; using osu.Framework.MathUtils; using osu.Framework.Testing; using osu.Game.Modes.Objects.Drawables; @@ -24,10 +27,20 @@ public override void Reset() AddButton("Hit!", addHitJudgement); AddButton("Miss :(", addMissJudgement); AddButton("Swell", addSwell); + AddButton("Centre", () => addCentreHit(false)); + AddButton("Strong Centre", () => addCentreHit(true)); + AddButton("Rim", () => addRimHit(false)); + AddButton("Strong Rim", () => addRimHit(true)); - Add(playfield = new TaikoPlayfield + Add(new Container { - Y = 200 + RelativeSizeAxes = Axes.X, + Y = 200, + Padding = new MarginPadding { Left = 200 }, + Children = new[] + { + playfield = new TaikoPlayfield() + } }); } @@ -71,6 +84,34 @@ private void addSwell() PreEmpt = 1000 })); } + + private void addCentreHit(bool strong) + { + Hit h = new Hit + { + StartTime = Time.Current + 1000, + PreEmpt = 1000 + }; + + if (strong) + playfield.Add(new DrawableStrongCentreHit(h)); + else + playfield.Add(new DrawableCentreHit(h)); + } + + private void addRimHit(bool strong) + { + Hit h = new Hit + { + StartTime = Time.Current + 1000, + PreEmpt = 1000 + }; + + if (strong) + playfield.Add(new DrawableStrongRimHit(h)); + else + playfield.Add(new DrawableRimHit(h)); + } private class DrawableTestHit : DrawableHitObject { diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableCentreHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableCentreHit.cs new file mode 100644 index 0000000000..b3f9974c15 --- /dev/null +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableCentreHit.cs @@ -0,0 +1,20 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Collections.Generic; +using OpenTK.Input; +using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; + +namespace osu.Game.Modes.Taiko.Objects.Drawable +{ + public class DrawableCentreHit : DrawableHit + { + protected override List HitKeys { get; } = new List(new[] { Key.F, Key.J }); + + public DrawableCentreHit(Hit hit) + : base(hit) + { + Add(new CentreHitCirclePiece(new CirclePiece())); + } + } +} diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs index a3ea9e36b9..504e3c7c19 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs @@ -2,6 +2,8 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK.Input; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Taiko.Judgements; using System; @@ -16,6 +18,8 @@ public abstract class DrawableHit : DrawableTaikoHitObject /// protected abstract List HitKeys { get; } + protected override Container Content => bodyContainer; + private readonly Hit hit; /// @@ -23,10 +27,18 @@ public abstract class DrawableHit : DrawableTaikoHitObject /// private bool validKeyPressed; + private readonly Container bodyContainer; + protected DrawableHit(Hit hit) : base(hit) { this.hit = hit; + + AddInternal(bodyContainer = new Container + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + }); } protected override void CheckJudgement(bool userTriggered) @@ -63,5 +75,27 @@ protected override bool HandleKeyPress(Key key) return UpdateJudgement(true); } + + protected override void UpdateState(ArmedState state) + { + switch (State) + { + case ArmedState.Idle: + break; + case ArmedState.Miss: + FadeOut(100); + Expire(); + break; + case ArmedState.Hit: + bodyContainer.ScaleTo(0.8f, 400, EasingTypes.OutQuad); + bodyContainer.MoveToY(-200, 250, EasingTypes.Out); + bodyContainer.Delay(250); + bodyContainer.MoveToY(0, 500, EasingTypes.In); + + FadeOut(600); + Expire(); + break; + } + } } } diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableRimHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableRimHit.cs new file mode 100644 index 0000000000..983471d70a --- /dev/null +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableRimHit.cs @@ -0,0 +1,20 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Collections.Generic; +using OpenTK.Input; +using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; + +namespace osu.Game.Modes.Taiko.Objects.Drawable +{ + public class DrawableRimHit : DrawableHit + { + protected override List HitKeys { get; } = new List(new[] { Key.D, Key.K }); + + public DrawableRimHit(Hit hit) + : base(hit) + { + Add(new RimHitCirclePiece(new CirclePiece())); + } + } +} diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongCentreHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongCentreHit.cs new file mode 100644 index 0000000000..2ad4537bce --- /dev/null +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongCentreHit.cs @@ -0,0 +1,20 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Collections.Generic; +using OpenTK.Input; +using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; + +namespace osu.Game.Modes.Taiko.Objects.Drawable +{ + public class DrawableStrongCentreHit : DrawableStrongHit + { + protected override List HitKeys { get; } = new List(new[] { Key.F, Key.J }); + + public DrawableStrongCentreHit(Hit hit) + : base(hit) + { + Add(new CentreHitCirclePiece(new StrongCirclePiece())); + } + } +} diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongRimHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongRimHit.cs new file mode 100644 index 0000000000..c25030b634 --- /dev/null +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongRimHit.cs @@ -0,0 +1,20 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Collections.Generic; +using OpenTK.Input; +using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; + +namespace osu.Game.Modes.Taiko.Objects.Drawable +{ + public class DrawableStrongRimHit : DrawableStrongHit + { + protected override List HitKeys { get; } = new List(new[] { Key.D, Key.K }); + + public DrawableStrongRimHit(Hit hit) + : base(hit) + { + Add(new RimHitCirclePiece(new StrongCirclePiece())); + } + } +} diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CentreHitCirclePiece.cs b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CentreHitCirclePiece.cs new file mode 100644 index 0000000000..78c3aaec01 --- /dev/null +++ b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CentreHitCirclePiece.cs @@ -0,0 +1,46 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Game.Graphics; +using OpenTK; + +namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces +{ + /// + /// A circle piece used for centre hits. + /// + public class CentreHitCirclePiece : Container + { + private readonly CirclePiece circle; + + public CentreHitCirclePiece(CirclePiece piece) + { + Add(circle = piece); + + circle.Add(new CircularContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(CirclePiece.SYMBOL_INNER_SIZE), + Masking = true, + Children = new[] + { + new Box + { + RelativeSizeAxes = Axes.Both + } + } + }); + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + circle.AccentColour = colours.PinkDarker; + } + } +} diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/RimHitCirclePiece.cs b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/RimHitCirclePiece.cs new file mode 100644 index 0000000000..d2b3833346 --- /dev/null +++ b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/RimHitCirclePiece.cs @@ -0,0 +1,48 @@ +// 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 osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Game.Graphics; + +namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces +{ + public class RimHitCirclePiece : Container + { + private readonly CirclePiece circle; + + public RimHitCirclePiece(CirclePiece piece) + { + Add(circle = piece); + + circle.Add(new CircularContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(CirclePiece.SYMBOL_SIZE), + BorderThickness = CirclePiece.SYMBOL_BORDER, + BorderColour = Color4.White, + Masking = true, + Children = new[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Alpha = 0, + AlwaysPresent = true + } + } + }); + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + circle.AccentColour = colours.BlueDarker; + } + } +} diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index 2e9034839f..d9e3e2401f 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -52,8 +52,14 @@ + + + + + + @@ -103,4 +109,4 @@ --> - + diff --git a/osu.Game.Modes.Taiko/packages.config b/osu.Game.Modes.Taiko/packages.config index 08fca09c35..4031dd62a8 100644 --- a/osu.Game.Modes.Taiko/packages.config +++ b/osu.Game.Modes.Taiko/packages.config @@ -1,5 +1,4 @@  -