From 891bd011c6fe86e9d7380544470b64c32de2ffa7 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 17 Mar 2017 18:54:44 +0900 Subject: [PATCH 01/10] Add basic DrawableBash (no graphics yet, just input). --- .../Objects/Drawable/DrawableBash.cs | 79 +++++++++++++++++++ .../osu.Game.Modes.Taiko.csproj | 1 + 2 files changed, 80 insertions(+) create mode 100644 osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs new file mode 100644 index 0000000000..b69546e1aa --- /dev/null +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs @@ -0,0 +1,79 @@ +// 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.Input; +using osu.Game.Modes.Objects.Drawables; +using osu.Game.Modes.Taiko.Judgements; +using System; + +namespace osu.Game.Modes.Taiko.Objects.Drawable +{ + public class DrawableBash : DrawableTaikoHitObject + { + /// + /// A list of keys which this HitObject will accept. These are the standard Taiko keys for now. + /// These should be moved to bindings later. + /// + private List validKeys { get; } = new List(new[] { Key.D, Key.F, Key.J, Key.K }); + + /// + /// The amount of times the user has hit this bash. + /// + private int userHits; + + public DrawableBash(TaikoHitObject hitObject) + : base(hitObject) + { + } + + protected override void CheckJudgement(bool userTriggered) + { + if (userTriggered) + { + if (Time.Current < HitObject.StartTime) + return; + + userHits++; + + if (userHits == HitObject.RequiredHits) + { + Judgement.Result = HitResult.Hit; + Judgement.Score = TaikoScoreResult.Great; + } + } + else + { + if (Judgement.TimeOffset < 0) + return; + + if (userHits > HitObject.RequiredHits / 2) + { + Judgement.Result = HitResult.Hit; + Judgement.Score = TaikoScoreResult.Good; + } + else + Judgement.Result = HitResult.Miss; + } + } + + protected override void Update() + { + UpdateScrollPosition(Math.Min(Time.Current, HitObject.StartTime)); + } + + protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + { + if (Judgement.Result.HasValue) + return false; + + if (!validKeys.Contains(args.Key)) + return false; + + UpdateJudgement(true); + + return true; + } + } +} diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index bdc8edb62e..73963a828c 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -51,6 +51,7 @@ + From a2d07acb4b6089d67852b00d2cb28c6c27439c16 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 17 Mar 2017 18:59:21 +0900 Subject: [PATCH 02/10] Fix post-merge errors. --- osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs index b69546e1aa..4e848c76c3 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs @@ -10,7 +10,7 @@ using System; namespace osu.Game.Modes.Taiko.Objects.Drawable { - public class DrawableBash : DrawableTaikoHitObject + public class DrawableBash : DrawableTaikoHitObject { /// /// A list of keys which this HitObject will accept. These are the standard Taiko keys for now. @@ -23,8 +23,8 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable /// private int userHits; - public DrawableBash(TaikoHitObject hitObject) - : base(hitObject) + public DrawableBash(Bash bash) + : base(bash) { } From e3afa9bf715603a6ecd5f8e5decf82ea2507eab0 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 17 Mar 2017 19:25:55 +0900 Subject: [PATCH 03/10] Fix post-merge errors. --- osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs index 4e848c76c3..00abd3017d 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs @@ -10,7 +10,7 @@ using System; namespace osu.Game.Modes.Taiko.Objects.Drawable { - public class DrawableBash : DrawableTaikoHitObject + public class DrawableBash : DrawableTaikoHitObject { /// /// A list of keys which this HitObject will accept. These are the standard Taiko keys for now. @@ -23,9 +23,12 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable /// private int userHits; + private Bash bash; + public DrawableBash(Bash bash) : base(bash) { + this.bash = bash; } protected override void CheckJudgement(bool userTriggered) @@ -37,7 +40,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable userHits++; - if (userHits == HitObject.RequiredHits) + if (userHits == bash.RequiredHits) { Judgement.Result = HitResult.Hit; Judgement.Score = TaikoScoreResult.Great; @@ -48,7 +51,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable if (Judgement.TimeOffset < 0) return; - if (userHits > HitObject.RequiredHits / 2) + if (userHits > bash.RequiredHits / 2) { Judgement.Result = HitResult.Hit; Judgement.Score = TaikoScoreResult.Good; From 1532ae78a4801cc1563c458a1f2f31b6beed0d5b Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 22 Mar 2017 01:55:31 +0900 Subject: [PATCH 04/10] Fix post-merge errors. --- osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs index 00abd3017d..5b3b31f74e 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs @@ -43,7 +43,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable if (userHits == bash.RequiredHits) { Judgement.Result = HitResult.Hit; - Judgement.Score = TaikoScoreResult.Great; + Judgement.TaikoResult = TaikoHitResult.Great; } } else @@ -54,7 +54,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable if (userHits > bash.RequiredHits / 2) { Judgement.Result = HitResult.Hit; - Judgement.Score = TaikoScoreResult.Good; + Judgement.TaikoResult = TaikoHitResult.Good; } else Judgement.Result = HitResult.Miss; From a72ae319a1f3a07c8aa91f240bba8f26fcd11e50 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 22 Mar 2017 01:55:41 +0900 Subject: [PATCH 05/10] Override UpdateScrollPosition instead of Update. --- osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs index 5b3b31f74e..41433fc61c 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs @@ -61,9 +61,9 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable } } - protected override void Update() + protected override void UpdateScrollPosition(double time) { - UpdateScrollPosition(Math.Min(Time.Current, HitObject.StartTime)); + base.UpdateScrollPosition(Math.Min(time, HitObject.StartTime)); } protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) From 79fa9daec82c0561c8769569d91416a5eb16160e Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 24 Mar 2017 15:05:54 +0900 Subject: [PATCH 06/10] Fix post-merge errors. --- osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs index 41433fc61c..1aa962be12 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs @@ -23,7 +23,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable /// private int userHits; - private Bash bash; + private readonly Bash bash; public DrawableBash(Bash bash) : base(bash) @@ -61,6 +61,10 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable } } + protected override void UpdateState(ArmedState state) + { + } + protected override void UpdateScrollPosition(double time) { base.UpdateScrollPosition(Math.Min(time, HitObject.StartTime)); From e7941859e4ef1b5b102d047ffafc7968c9057545 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Sat, 25 Mar 2017 20:57:49 +0900 Subject: [PATCH 07/10] Rename bash -> swell. --- .../Beatmaps/TaikoBeatmapConverter.cs | 2 +- .../{DrawableBash.cs => DrawableSwell.cs} | 16 ++++++++-------- .../Objects/{Bash.cs => Swell.cs} | 4 ++-- .../Scoring/TaikoScoreProcessor.cs | 2 +- osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) rename osu.Game.Modes.Taiko/Objects/Drawable/{DrawableBash.cs => DrawableSwell.cs} (82%) rename osu.Game.Modes.Taiko/Objects/{Bash.cs => Swell.cs} (84%) diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs index b2676bf28a..9b143e9fde 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -61,7 +61,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps if (endTimeData != null) { // We compute the end time manually to add in the Bash convert factor - return new Bash + return new Swell { StartTime = original.StartTime, Sample = original.Sample, diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs similarity index 82% rename from osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs rename to osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs index 1aa962be12..9d0e23553d 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs @@ -10,7 +10,7 @@ using System; namespace osu.Game.Modes.Taiko.Objects.Drawable { - public class DrawableBash : DrawableTaikoHitObject + public class DrawableSwell : DrawableTaikoHitObject { /// /// A list of keys which this HitObject will accept. These are the standard Taiko keys for now. @@ -19,16 +19,16 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable private List validKeys { get; } = new List(new[] { Key.D, Key.F, Key.J, Key.K }); /// - /// The amount of times the user has hit this bash. + /// The amount of times the user has hit this swell. /// private int userHits; - private readonly Bash bash; + private readonly Swell swell; - public DrawableBash(Bash bash) - : base(bash) + public DrawableSwell(Swell swell) + : base(swell) { - this.bash = bash; + this.swell = swell; } protected override void CheckJudgement(bool userTriggered) @@ -40,7 +40,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable userHits++; - if (userHits == bash.RequiredHits) + if (userHits == swell.RequiredHits) { Judgement.Result = HitResult.Hit; Judgement.TaikoResult = TaikoHitResult.Great; @@ -51,7 +51,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable if (Judgement.TimeOffset < 0) return; - if (userHits > bash.RequiredHits / 2) + if (userHits > swell.RequiredHits / 2) { Judgement.Result = HitResult.Hit; Judgement.TaikoResult = TaikoHitResult.Good; diff --git a/osu.Game.Modes.Taiko/Objects/Bash.cs b/osu.Game.Modes.Taiko/Objects/Swell.cs similarity index 84% rename from osu.Game.Modes.Taiko/Objects/Bash.cs rename to osu.Game.Modes.Taiko/Objects/Swell.cs index b8b4eea6a9..20b9a6effb 100644 --- a/osu.Game.Modes.Taiko/Objects/Bash.cs +++ b/osu.Game.Modes.Taiko/Objects/Swell.cs @@ -8,14 +8,14 @@ using osu.Game.Modes.Objects.Types; namespace osu.Game.Modes.Taiko.Objects { - public class Bash : TaikoHitObject, IHasEndTime + public class Swell : TaikoHitObject, IHasEndTime { public double EndTime { get; set; } public double Duration => EndTime - StartTime; /// - /// The number of hits required to complete the bash successfully. + /// The number of hits required to complete the swell successfully. /// public int RequiredHits { get; protected set; } diff --git a/osu.Game.Modes.Taiko/Scoring/TaikoScoreProcessor.cs b/osu.Game.Modes.Taiko/Scoring/TaikoScoreProcessor.cs index 3007411230..a3759d9c81 100644 --- a/osu.Game.Modes.Taiko/Scoring/TaikoScoreProcessor.cs +++ b/osu.Game.Modes.Taiko/Scoring/TaikoScoreProcessor.cs @@ -165,7 +165,7 @@ namespace osu.Game.Modes.Taiko.Scoring SecondHit = obj.Accented }); } - else if (obj is Bash) + else if (obj is Swell) { AddJudgement(new TaikoJudgement { diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index b1f47832c0..7780230ede 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -52,9 +52,9 @@ - + - + From cbb6930f76991bc23dbf551043d98fa0e40b8c46 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Sat, 25 Mar 2017 20:53:28 +0900 Subject: [PATCH 08/10] Remove CreateCircle() - hitobjects should handle the addition of this to their hierarchy themselves. CreateCircle() lends itself to a few issues: - It can't be used for drum roll ticks unless it returned a Container instead, at which point the method loses its meaning, and I would rather that constructed in the ctor. - Writing `return Accented ? new AccentedCirclePiece() : new CirclePiece()` in two places as the body of this method feels wrong - it's something I would expect to be taken care of in the base DrawableTaikoHitObject, but that leads back to #1. - Swells don't have an AccentedCirclePiece, so #2 becomes more problematic. --- .../Objects/Drawable/DrawableTaikoHitObject.cs | 8 -------- 1 file changed, 8 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs index e165f40442..c77c7762e3 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs @@ -4,7 +4,6 @@ using osu.Framework.Graphics; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Taiko.Judgements; -using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; namespace osu.Game.Modes.Taiko.Objects.Drawable { @@ -17,11 +16,6 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable Origin = Anchor.Centre; RelativePositionAxes = Axes.X; - - Children = new[] - { - CreateCircle() - }; } protected override void LoadComplete() @@ -48,7 +42,5 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { UpdateScrollPosition(Time.Current); } - - protected abstract CirclePiece CreateCircle(); } } From 9b0a15cd6ccf83b977c32def44c14e69e254969f Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Sat, 25 Mar 2017 23:48:00 +0900 Subject: [PATCH 09/10] Fix post-merge errors. --- osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index f11b9c24d1..b32288c2d9 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -54,11 +54,9 @@ - - From d9ecb430ede96463a314fc2637e7f27f179867c1 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Sat, 25 Mar 2017 23:48:13 +0900 Subject: [PATCH 10/10] Remove validKeys (now in DrawableTaikoHitObject). --- .../Objects/Drawable/DrawableSwell.cs | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs index 9d0e23553d..15584ac73f 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs @@ -2,8 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK.Input; -using System.Collections.Generic; -using osu.Framework.Input; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Taiko.Judgements; using System; @@ -12,12 +10,6 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { public class DrawableSwell : DrawableTaikoHitObject { - /// - /// A list of keys which this HitObject will accept. These are the standard Taiko keys for now. - /// These should be moved to bindings later. - /// - private List validKeys { get; } = new List(new[] { Key.D, Key.F, Key.J, Key.K }); - /// /// The amount of times the user has hit this swell. /// @@ -70,14 +62,11 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable base.UpdateScrollPosition(Math.Min(time, HitObject.StartTime)); } - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + protected override bool HandleKeyPress(Key key) { if (Judgement.Result.HasValue) return false; - if (!validKeys.Contains(args.Key)) - return false; - UpdateJudgement(true); return true;