From 0e2f72542507f2fcd0214c88f805407614fad16e Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 31 Mar 2017 11:41:06 +0900 Subject: [PATCH] Fade the accent colour instead of stepping. --- .../Tests/TestCaseTaikoPlayfield.cs | 2 +- .../Objects/Drawable/DrawableDrumRoll.cs | 29 ++++++++++++++----- osu.Game.Modes.Taiko/Objects/DrumRoll.cs | 2 +- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index 56d41027f6..e7702bc032 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -81,7 +81,7 @@ namespace osu.Desktop.VisualTests.Tests var d = new DrumRoll { StartTime = Time.Current + 1000, - Distance = 2000, + Distance = 20000, PreEmpt = 1000, }; diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs index f50cab33b0..6b1c4f546b 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs @@ -1,6 +1,7 @@ // 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; @@ -15,12 +16,21 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { public class DrawableDrumRoll : DrawableTaikoHitObject { + /// + /// Number of consecutive hits required to reach the dark/final accent colour. + /// + private const int consecutive_hits_for_dark_accent = 5; + private readonly DrumRoll drumRoll; private readonly CirclePiece circle; - private Color4 baseColour; - private Color4 finalColour; + private Color4 accentDarkColour; + + /// + /// Number of consecutive tick hits. + /// + private int consecutiveHits; public DrawableDrumRoll(DrumRoll drumRoll) : base(drumRoll) @@ -49,8 +59,8 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable [BackgroundDependencyLoader] private void load(OsuColour colours) { - circle.Background.Colour = baseColour = colours.YellowDark; - finalColour = colours.YellowDarker; + circle.AccentColour = AccentColour = colours.YellowDark; + accentDarkColour = colours.YellowDarker; } protected override void LoadComplete() @@ -66,10 +76,15 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable private void onTickJudgement(DrawableHitObject obj) { - int countHit = NestedHitObjects.Count(o => o.Judgement.Result == HitResult.Hit); - float completion = (float)countHit / NestedHitObjects.Count(); + if (obj.Judgement.Result == HitResult.Hit) + consecutiveHits++; + else + consecutiveHits--; - circle.AccentColour = Interpolation.ValueAt(completion, baseColour, finalColour, 0, 1); + consecutiveHits = MathHelper.Clamp(consecutiveHits, 0, consecutive_hits_for_dark_accent); + + Color4 newAccent = Interpolation.ValueAt((float)consecutiveHits / consecutive_hits_for_dark_accent, AccentColour, accentDarkColour, 0, 1); + circle.FadeAccent(newAccent, 100); } protected override void CheckJudgement(bool userTriggered) diff --git a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs index ff73c40d2f..df8870ab97 100644 --- a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs +++ b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs @@ -31,7 +31,7 @@ namespace osu.Game.Modes.Taiko.Objects /// The distance between ticks of this drumroll. /// Half of this value is the hit window of the ticks. /// - public double TickTimeDistance { get; protected set; } = 200; + public double TickTimeDistance { get; protected set; } = 100; /// /// Number of drum roll ticks required for a "Good" hit.