From 621bcaed59ac9257d4e85cc1a586a7db6e3ff7f5 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 28 Mar 2017 10:33:23 +0900 Subject: [PATCH 01/11] Add drawable Hits/StrongHits. --- .../Tests/TestCaseTaikoHitObjects.cs | 43 +++------------- .../Tests/TestCaseTaikoPlayfield.cs | 10 ++++ .../Objects/Drawable/CentreHitCirclePiece.cs | 49 +++++++++++++++++++ .../Objects/Drawable/DrawableCentreHit.cs | 17 +++++++ .../Objects/Drawable/DrawableHit.cs | 34 +++++++++++++ .../Drawable/DrawableStrongCentreHit.cs | 17 +++++++ .../osu.Game.Modes.Taiko.csproj | 3 ++ 7 files changed, 136 insertions(+), 37 deletions(-) create mode 100644 osu.Game.Modes.Taiko/Objects/Drawable/CentreHitCirclePiece.cs create mode 100644 osu.Game.Modes.Taiko/Objects/Drawable/DrawableCentreHit.cs create mode 100644 osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongCentreHit.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs index 0204058b8a..48d7017f78 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs @@ -10,6 +10,7 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Screens.Testing; using osu.Game.Graphics; using osu.Game.Modes.Taiko.Objects; +using osu.Game.Modes.Taiko.Objects.Drawable; using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; namespace osu.Desktop.VisualTests.Tests @@ -30,7 +31,7 @@ namespace osu.Desktop.VisualTests.Tests Reset(); }); - Add(new CentreHitCircle(new CirclePiece() + Add(new CentreHitCirclePiece(new CirclePiece() { KiaiMode = kiai }) @@ -38,7 +39,7 @@ namespace osu.Desktop.VisualTests.Tests Position = new Vector2(100, 100) }); - Add(new CentreHitCircle(new StrongCirclePiece() + Add(new CentreHitCirclePiece(new StrongCirclePiece() { KiaiMode = kiai }) @@ -106,7 +107,7 @@ namespace osu.Desktop.VisualTests.Tests { Anchor = Anchor.Centre, Origin = Anchor.Centre, - TextSize = SYMBOL_INNER_SIZE, + TextSize = CirclePiece.SYMBOL_INNER_SIZE, Icon = FontAwesome.fa_asterisk, Shadow = false }); @@ -133,34 +134,6 @@ namespace osu.Desktop.VisualTests.Tests } } - 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) @@ -170,8 +143,8 @@ namespace osu.Desktop.VisualTests.Tests { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Size = new Vector2(SYMBOL_SIZE), - BorderThickness = SYMBOL_BORDER, + Size = new Vector2(CirclePiece.SYMBOL_SIZE), + BorderThickness = CirclePiece.SYMBOL_BORDER, BorderColour = Color4.White, Masking = true, Children = new[] @@ -195,10 +168,6 @@ namespace osu.Desktop.VisualTests.Tests 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 395a0cab13..483c156ea5 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -6,6 +6,7 @@ using osu.Framework.Screens.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.UI; namespace osu.Desktop.VisualTests.Tests @@ -22,6 +23,15 @@ namespace osu.Desktop.VisualTests.Tests AddButton("Hit!", addHitJudgement); AddButton("Miss :(", addMissJudgement); + AddButton("Centre", () => + { + playfield.Add(new DrawableCentreHit(new Hit + { + StartTime = Time.Current + 1000, + PreEmpt = 1000, + IsStrong = false + })); + }); Add(playfield = new TaikoPlayfield { diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/CentreHitCirclePiece.cs b/osu.Game.Modes.Taiko/Objects/Drawable/CentreHitCirclePiece.cs new file mode 100644 index 0000000000..e476430aab --- /dev/null +++ b/osu.Game.Modes.Taiko/Objects/Drawable/CentreHitCirclePiece.cs @@ -0,0 +1,49 @@ +using OpenTK; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Game.Graphics; +using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace osu.Game.Modes.Taiko.Objects.Drawable +{ + /// + /// A circle piece used for centre hits. + /// + public class CentreHitCirclePiece : Container + { + private 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/DrawableCentreHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableCentreHit.cs new file mode 100644 index 0000000000..363ffdd451 --- /dev/null +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableCentreHit.cs @@ -0,0 +1,17 @@ +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[] { 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..f455fc8d5b 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs @@ -2,6 +2,9 @@ // 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.Framework.Graphics.Transforms; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Taiko.Judgements; using System; @@ -16,6 +19,8 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable /// protected abstract List HitKeys { get; } + protected override Container Content => bodyContainer; + private readonly Hit hit; /// @@ -23,10 +28,18 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable /// private bool validKeyPressed; + private 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 +76,26 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable return UpdateJudgement(true); } + + protected override void UpdateState(ArmedState state) + { + switch (State) + { + case ArmedState.Idle: + break; + case ArmedState.Miss: + bodyContainer.FadeOut(100); + break; + case ArmedState.Hit: + bodyContainer.ScaleTo(0.8f, 400, EasingTypes.OutQuad); + bodyContainer.FadeOut(600, EasingTypes.OutQuint); + bodyContainer.MoveToY(-200, 250, EasingTypes.Out); + + bodyContainer.Delay(250); + + bodyContainer.MoveToY(0, 500, EasingTypes.In); + break; + } + } } } 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..19a1eec618 --- /dev/null +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongCentreHit.cs @@ -0,0 +1,17 @@ +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[] { Key.F, Key.J }); + + public DrawableStrongCentreHit(Hit hit) + : base(hit) + { + Add(new CentreHitCirclePiece(new StrongCirclePiece())); + } + } +} diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index fa09ae2c82..1272c7b079 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -52,7 +52,10 @@ + + + From 3f1e8ddcd16324558cd7e553861eae3015a1afca Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 28 Mar 2017 10:51:22 +0900 Subject: [PATCH 02/11] License headers + general fixes. --- .../Tests/TestCaseTaikoHitObjects.cs | 1 - .../Objects/Drawable/CentreHitCirclePiece.cs | 12 +++++------- .../Objects/Drawable/DrawableCentreHit.cs | 7 +++++-- osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs | 2 +- .../Objects/Drawable/DrawableStrongCentreHit.cs | 7 +++++-- osu.Game.Modes.Taiko/packages.config | 1 - 6 files changed, 16 insertions(+), 14 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs index 48d7017f78..96d5ece693 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs @@ -9,7 +9,6 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Screens.Testing; using osu.Game.Graphics; -using osu.Game.Modes.Taiko.Objects; using osu.Game.Modes.Taiko.Objects.Drawable; using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/CentreHitCirclePiece.cs b/osu.Game.Modes.Taiko/Objects/Drawable/CentreHitCirclePiece.cs index e476430aab..580541546f 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/CentreHitCirclePiece.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/CentreHitCirclePiece.cs @@ -1,15 +1,13 @@ -using OpenTK; +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace osu.Game.Modes.Taiko.Objects.Drawable { @@ -18,7 +16,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable /// public class CentreHitCirclePiece : Container { - private CirclePiece circle; + private readonly CirclePiece circle; public CentreHitCirclePiece(CirclePiece piece) { diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableCentreHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableCentreHit.cs index 363ffdd451..b3f9974c15 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableCentreHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableCentreHit.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// 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; @@ -6,7 +9,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { public class DrawableCentreHit : DrawableHit { - protected override List HitKeys { get; } = new List(new Key[] { Key.F, Key.J }); + protected override List HitKeys { get; } = new List(new[] { Key.F, Key.J }); public DrawableCentreHit(Hit hit) : base(hit) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs index f455fc8d5b..f48993fd45 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs @@ -28,7 +28,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable /// private bool validKeyPressed; - private Container bodyContainer; + private readonly Container bodyContainer; protected DrawableHit(Hit hit) : base(hit) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongCentreHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongCentreHit.cs index 19a1eec618..2ad4537bce 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongCentreHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongCentreHit.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// 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; @@ -6,7 +9,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { public class DrawableStrongCentreHit : DrawableStrongHit { - protected override List HitKeys { get; } = new List(new Key[] { Key.F, Key.J }); + protected override List HitKeys { get; } = new List(new[] { Key.F, Key.J }); public DrawableStrongCentreHit(Hit hit) : base(hit) 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 @@  - - + \ No newline at end of file From e518508f2d0e86a28dd466e01fcf08b0e49b811b Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 29 Mar 2017 09:11:07 +0900 Subject: [PATCH 07/11] Better life time ends. --- osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs | 9 +++++---- .../Objects/Drawable/DrawableTaikoHitObject.cs | 1 - 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs index 56e2f329bf..504e3c7c19 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs @@ -83,16 +83,17 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable case ArmedState.Idle: break; case ArmedState.Miss: - bodyContainer.FadeOut(100); + FadeOut(100); + Expire(); break; case ArmedState.Hit: bodyContainer.ScaleTo(0.8f, 400, EasingTypes.OutQuad); - bodyContainer.FadeOut(600, EasingTypes.OutQuint); 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/DrawableTaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs index c14dc6d7b0..5d6d669dc1 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs @@ -30,7 +30,6 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable protected override void LoadComplete() { LifetimeStart = HitObject.StartTime - HitObject.PreEmpt * 2; - LifetimeEnd = HitObject.StartTime + HitObject.PreEmpt; base.LoadComplete(); } From 1a56c48ddb41e1289f0086a8dda9a2a47205b35d Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 29 Mar 2017 13:07:36 +0900 Subject: [PATCH 08/11] Don't need CentreLeft anchors. --- osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs index 504e3c7c19..d2c2df6d21 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs @@ -36,8 +36,8 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable AddInternal(bodyContainer = new Container { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, }); } From 1c503edad1a4dd2d1646edf8d2ea214a9a9edff6 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 29 Mar 2017 13:19:48 +0900 Subject: [PATCH 09/11] Add explicit delay + expire (this will be moved into the base DrawableHitObject later). --- osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs index d2c2df6d21..94c5f63deb 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs @@ -78,13 +78,15 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable protected override void UpdateState(ArmedState state) { + Delay(HitObject.StartTime - Time.Current + Judgement.TimeOffset, true); + switch (State) { case ArmedState.Idle: + Delay(hit.HitWindowMiss); break; case ArmedState.Miss: FadeOut(100); - Expire(); break; case ArmedState.Hit: bodyContainer.ScaleTo(0.8f, 400, EasingTypes.OutQuad); @@ -93,9 +95,10 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable bodyContainer.MoveToY(0, 500, EasingTypes.In); FadeOut(600); - Expire(); break; } + + Expire(); } } } From 74e12bd95e876ed8289fe191ba7bdac870e6ad01 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 29 Mar 2017 14:01:01 +0900 Subject: [PATCH 10/11] Rewrite how drawable-specific circle pieces are instantiated. --- .../Tests/TestCaseTaikoHitObjects.cs | 57 ++++++++++++------- .../Objects/Drawable/DrawableCentreHit.cs | 18 +++++- .../Objects/Drawable/DrawableRimHit.cs | 18 +++++- .../Drawable/DrawableStrongCentreHit.cs | 18 +++++- .../Objects/Drawable/DrawableStrongRimHit.cs | 18 +++++- .../Drawable/Pieces/CentreHitCirclePiece.cs | 46 --------------- .../Drawable/Pieces/CentreHitSymbolPiece.cs | 31 ++++++++++ .../Drawable/Pieces/RimHitCirclePiece.cs | 48 ---------------- .../Drawable/Pieces/RimHitSymbolPiece.cs | 36 ++++++++++++ .../osu.Game.Modes.Taiko.csproj | 4 +- 10 files changed, 174 insertions(+), 120 deletions(-) delete mode 100644 osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CentreHitCirclePiece.cs create mode 100644 osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CentreHitSymbolPiece.cs delete mode 100644 osu.Game.Modes.Taiko/Objects/Drawable/Pieces/RimHitCirclePiece.cs create mode 100644 osu.Game.Modes.Taiko/Objects/Drawable/Pieces/RimHitSymbolPiece.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs index db7f9a2f6a..b5fc96bd20 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs @@ -2,6 +2,7 @@ // 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; @@ -27,36 +28,52 @@ namespace osu.Desktop.VisualTests.Tests Reset(); }); - Add(new CentreHitCirclePiece(new CirclePiece + Add(new CirclePiece { - KiaiMode = kiai - }) - { - Position = new Vector2(100, 100) + Position = new Vector2(100, 100), + Width = 0, + AccentColour = Color4.DarkRed, + KiaiMode = kiai, + Children = new[] + { + new CentreHitSymbolPiece() + } }); - Add(new CentreHitCirclePiece(new StrongCirclePiece + Add(new StrongCirclePiece { - KiaiMode = kiai - }) - { - Position = new Vector2(350, 100) + Position = new Vector2(350, 100), + Width = 0, + AccentColour = Color4.DarkRed, + KiaiMode = kiai, + Children = new[] + { + new CentreHitSymbolPiece() + } }); - Add(new RimHitCirclePiece(new CirclePiece + Add(new CirclePiece { - KiaiMode = kiai - }) - { - Position = new Vector2(100, 300) + Position = new Vector2(100, 300), + Width = 0, + AccentColour = Color4.DarkBlue, + KiaiMode = kiai, + Children = new[] + { + new RimHitSymbolPiece() + } }); - Add(new RimHitCirclePiece(new StrongCirclePiece + Add(new StrongCirclePiece { - KiaiMode = kiai - }) - { - Position = new Vector2(350, 300) + Position = new Vector2(350, 300), + Width = 0, + AccentColour = Color4.DarkBlue, + KiaiMode = kiai, + Children = new[] + { + new RimHitSymbolPiece() + } }); Add(new SwellCircle(new CirclePiece diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableCentreHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableCentreHit.cs index b3f9974c15..a3fcf26f6d 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableCentreHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableCentreHit.cs @@ -4,6 +4,8 @@ using System.Collections.Generic; using OpenTK.Input; using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; +using osu.Game.Graphics; +using osu.Framework.Allocation; namespace osu.Game.Modes.Taiko.Objects.Drawable { @@ -11,10 +13,24 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { protected override List HitKeys { get; } = new List(new[] { Key.F, Key.J }); + private readonly CirclePiece circlePiece; + public DrawableCentreHit(Hit hit) : base(hit) { - Add(new CentreHitCirclePiece(new CirclePiece())); + Add(circlePiece = new CirclePiece + { + Children = new[] + { + new CentreHitSymbolPiece() + } + }); + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + circlePiece.AccentColour = colours.PinkDarker; } } } diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableRimHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableRimHit.cs index 983471d70a..029cdfb7e7 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableRimHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableRimHit.cs @@ -2,6 +2,8 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; +using osu.Framework.Allocation; +using osu.Game.Graphics; using OpenTK.Input; using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; @@ -11,10 +13,24 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { protected override List HitKeys { get; } = new List(new[] { Key.D, Key.K }); + private readonly CirclePiece circlePiece; + public DrawableRimHit(Hit hit) : base(hit) { - Add(new RimHitCirclePiece(new CirclePiece())); + Add(circlePiece = new CirclePiece + { + Children = new[] + { + new RimHitSymbolPiece() + } + }); + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + circlePiece.AccentColour = colours.BlueDarker; } } } diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongCentreHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongCentreHit.cs index 2ad4537bce..7b21924868 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongCentreHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongCentreHit.cs @@ -4,6 +4,8 @@ using System.Collections.Generic; using OpenTK.Input; using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; +using osu.Framework.Allocation; +using osu.Game.Graphics; namespace osu.Game.Modes.Taiko.Objects.Drawable { @@ -11,10 +13,24 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { protected override List HitKeys { get; } = new List(new[] { Key.F, Key.J }); + private readonly CirclePiece circlePiece; + public DrawableStrongCentreHit(Hit hit) : base(hit) { - Add(new CentreHitCirclePiece(new StrongCirclePiece())); + Add(circlePiece = new StrongCirclePiece + { + Children = new [] + { + new CentreHitSymbolPiece() + } + }); + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + circlePiece.AccentColour = colours.PinkDarker; } } } diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongRimHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongRimHit.cs index c25030b634..74d8cdfd49 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongRimHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongRimHit.cs @@ -2,6 +2,8 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; +using osu.Framework.Allocation; +using osu.Game.Graphics; using OpenTK.Input; using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; @@ -11,10 +13,24 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { protected override List HitKeys { get; } = new List(new[] { Key.D, Key.K }); + private readonly CirclePiece circlePiece; + public DrawableStrongRimHit(Hit hit) : base(hit) { - Add(new RimHitCirclePiece(new StrongCirclePiece())); + Add(circlePiece = new StrongCirclePiece + { + Children = new[] + { + new RimHitSymbolPiece() + } + }); + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + circlePiece.AccentColour = colours.BlueDarker; } } } diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CentreHitCirclePiece.cs b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CentreHitCirclePiece.cs deleted file mode 100644 index 78c3aaec01..0000000000 --- a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CentreHitCirclePiece.cs +++ /dev/null @@ -1,46 +0,0 @@ -// 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/CentreHitSymbolPiece.cs b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CentreHitSymbolPiece.cs new file mode 100644 index 0000000000..e62ca6b073 --- /dev/null +++ b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CentreHitSymbolPiece.cs @@ -0,0 +1,31 @@ +// 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.Sprites; +using OpenTK; + +namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces +{ + /// + /// The symbol used for centre hit pieces. + /// + public class CentreHitSymbolPiece : CircularContainer + { + public CentreHitSymbolPiece() + { + Anchor = Anchor.Centre; + Origin = Anchor.Centre; + Size = new Vector2(CirclePiece.SYMBOL_INNER_SIZE); + Masking = true; + Children = new[] + { + new Box + { + RelativeSizeAxes = Axes.Both + } + }; + } + } +} diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/RimHitCirclePiece.cs b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/RimHitCirclePiece.cs deleted file mode 100644 index d2b3833346..0000000000 --- a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/RimHitCirclePiece.cs +++ /dev/null @@ -1,48 +0,0 @@ -// 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/Objects/Drawable/Pieces/RimHitSymbolPiece.cs b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/RimHitSymbolPiece.cs new file mode 100644 index 0000000000..6999634108 --- /dev/null +++ b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/RimHitSymbolPiece.cs @@ -0,0 +1,36 @@ +// 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.Sprites; +using OpenTK; +using OpenTK.Graphics; + +namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces +{ + /// + /// The symbol used for rim hit pieces. + /// + public class RimHitSymbolPiece : CircularContainer + { + public RimHitSymbolPiece() + { + 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 + } + }; + } + } +} diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index cd1550334c..07f9a5d4e6 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -54,16 +54,16 @@ - - + + From 7ba7bc18f8468aeba9c6875f15eded270954f363 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 29 Mar 2017 15:35:22 +0900 Subject: [PATCH 11/11] Don't use a List for HitKeys. --- osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs | 1 - osu.Game.Modes.Taiko/Objects/Drawable/DrawableCentreHit.cs | 3 +-- osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs | 4 ++-- osu.Game.Modes.Taiko/Objects/Drawable/DrawableRimHit.cs | 3 +-- .../Objects/Drawable/DrawableStrongCentreHit.cs | 3 +-- osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongRimHit.cs | 3 +-- 6 files changed, 6 insertions(+), 11 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs index 94f09e12a6..5d6ab9bd1a 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs @@ -6,7 +6,6 @@ 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.Drawable.Pieces; diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableCentreHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableCentreHit.cs index a3fcf26f6d..683d48df10 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableCentreHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableCentreHit.cs @@ -1,7 +1,6 @@ // 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; using osu.Game.Graphics; @@ -11,7 +10,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { public class DrawableCentreHit : DrawableHit { - protected override List HitKeys { get; } = new List(new[] { Key.F, Key.J }); + protected override Key[] HitKeys { get; } = { Key.F, Key.J }; private readonly CirclePiece circlePiece; diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs index 94c5f63deb..ae328fe9ca 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs @@ -7,7 +7,7 @@ using osu.Framework.Graphics.Containers; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Taiko.Judgements; using System; -using System.Collections.Generic; +using System.Linq; namespace osu.Game.Modes.Taiko.Objects.Drawable { @@ -16,7 +16,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable /// /// A list of keys which can result in hits for this HitObject. /// - protected abstract List HitKeys { get; } + protected abstract Key[] HitKeys { get; } protected override Container Content => bodyContainer; diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableRimHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableRimHit.cs index 029cdfb7e7..cab6819300 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableRimHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableRimHit.cs @@ -1,7 +1,6 @@ // 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 osu.Framework.Allocation; using osu.Game.Graphics; using OpenTK.Input; @@ -11,7 +10,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { public class DrawableRimHit : DrawableHit { - protected override List HitKeys { get; } = new List(new[] { Key.D, Key.K }); + protected override Key[] HitKeys { get; } = { Key.D, Key.K }; private readonly CirclePiece circlePiece; diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongCentreHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongCentreHit.cs index 7b21924868..b4ec0b108a 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongCentreHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongCentreHit.cs @@ -1,7 +1,6 @@ // 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; using osu.Framework.Allocation; @@ -11,7 +10,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { public class DrawableStrongCentreHit : DrawableStrongHit { - protected override List HitKeys { get; } = new List(new[] { Key.F, Key.J }); + protected override Key[] HitKeys { get; } = { Key.F, Key.J }; private readonly CirclePiece circlePiece; diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongRimHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongRimHit.cs index 74d8cdfd49..1f77ad0409 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongRimHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongRimHit.cs @@ -1,7 +1,6 @@ // 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 osu.Framework.Allocation; using osu.Game.Graphics; using OpenTK.Input; @@ -11,7 +10,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { public class DrawableStrongRimHit : DrawableStrongHit { - protected override List HitKeys { get; } = new List(new[] { Key.D, Key.K }); + protected override Key[] HitKeys { get; } = { Key.D, Key.K }; private readonly CirclePiece circlePiece;