diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs index b599fea57d..f1e2ecef7e 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs @@ -13,6 +13,8 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { private readonly DrumRoll drumRoll; + private readonly DrumRollCirclePiece circle; + public DrawableDrumRoll(DrumRoll drumRoll) : base(drumRoll) { @@ -21,7 +23,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable RelativeSizeAxes = Axes.X; Width = (float)(drumRoll.Duration / drumRoll.PreEmpt); - Add(new DrumRollCirclePiece(CreateCirclePiece())); + Add(circle = new DrumRollCirclePiece(CreateCirclePiece())); foreach (var tick in drumRoll.Ticks) { @@ -30,11 +32,19 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable X = (float)((tick.StartTime - HitObject.StartTime) / drumRoll.Duration) }; + newTick.OnJudgement += onTickJudgement; + AddNested(newTick); Add(newTick); } } + private void onTickJudgement(DrawableHitObject obj) + { + int countHit = NestedHitObjects.Count(o => o.Judgement.Result == HitResult.Hit); + circle.Completion = (float)countHit / NestedHitObjects.Count(); + } + protected override void LoadComplete() { base.LoadComplete(); diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CirclePiece.cs b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CirclePiece.cs index ec98feddae..2af469d05f 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CirclePiece.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CirclePiece.cs @@ -36,9 +36,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces accentColour = value; innerBackground.Colour = AccentColour; - - triangles.ColourLight = AccentColour; - triangles.ColourDark = AccentColour.Darken(0.1f); + triangles.Colour = AccentColour; resetEdgeEffects(); } @@ -107,6 +105,8 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, + ColourLight = Color4.White, + ColourDark = Color4.White.Darken(0.1f) } } }, diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/DrumRollCirclePiece.cs b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/DrumRollCirclePiece.cs index 076ac5d03a..3be99ab161 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/DrumRollCirclePiece.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/DrumRollCirclePiece.cs @@ -1,9 +1,12 @@ // 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.MathUtils; using osu.Game.Graphics; namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces @@ -13,8 +16,30 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces /// public class DrumRollCirclePiece : Container { + private float completion; + /// + /// The amount of the drumroll that has been completed, as a percentage of the number + /// of ticks in the drumroll. This determines the internal colour of the drumroll. + /// + public float Completion + { + get { return completion; } + set + { + completion = MathHelper.Clamp(value, 0, 1); + + if (!IsLoaded) + return; + + circle.AccentColour = Interpolation.ValueAt(completion, baseColour, finalColour, 0, 1); + } + } + private readonly CirclePiece circle; + private Color4 baseColour; + private Color4 finalColour; + public DrumRollCirclePiece(CirclePiece piece) { RelativeSizeAxes = Axes.X; @@ -25,7 +50,8 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces [BackgroundDependencyLoader] private void load(OsuColour colours) { - circle.AccentColour = colours.YellowDark; + circle.AccentColour = baseColour = colours.YellowDark; + finalColour = colours.YellowDarker; } } }