mirror of
https://github.com/ppy/osu.git
synced 2025-03-05 15:03:16 +08:00
Fade the accent colour instead of stepping.
This commit is contained in:
parent
5a8099a591
commit
0e2f725425
@ -81,7 +81,7 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
var d = new DrumRoll
|
var d = new DrumRoll
|
||||||
{
|
{
|
||||||
StartTime = Time.Current + 1000,
|
StartTime = Time.Current + 1000,
|
||||||
Distance = 2000,
|
Distance = 20000,
|
||||||
PreEmpt = 1000,
|
PreEmpt = 1000,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
@ -15,12 +16,21 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
|||||||
{
|
{
|
||||||
public class DrawableDrumRoll : DrawableTaikoHitObject
|
public class DrawableDrumRoll : DrawableTaikoHitObject
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Number of consecutive hits required to reach the dark/final accent colour.
|
||||||
|
/// </summary>
|
||||||
|
private const int consecutive_hits_for_dark_accent = 5;
|
||||||
|
|
||||||
private readonly DrumRoll drumRoll;
|
private readonly DrumRoll drumRoll;
|
||||||
|
|
||||||
private readonly CirclePiece circle;
|
private readonly CirclePiece circle;
|
||||||
|
|
||||||
private Color4 baseColour;
|
private Color4 accentDarkColour;
|
||||||
private Color4 finalColour;
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of consecutive tick hits.
|
||||||
|
/// </summary>
|
||||||
|
private int consecutiveHits;
|
||||||
|
|
||||||
public DrawableDrumRoll(DrumRoll drumRoll)
|
public DrawableDrumRoll(DrumRoll drumRoll)
|
||||||
: base(drumRoll)
|
: base(drumRoll)
|
||||||
@ -49,8 +59,8 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
circle.Background.Colour = baseColour = colours.YellowDark;
|
circle.AccentColour = AccentColour = colours.YellowDark;
|
||||||
finalColour = colours.YellowDarker;
|
accentDarkColour = colours.YellowDarker;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
@ -66,10 +76,15 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
|||||||
|
|
||||||
private void onTickJudgement(DrawableHitObject<TaikoHitObject, TaikoJudgement> obj)
|
private void onTickJudgement(DrawableHitObject<TaikoHitObject, TaikoJudgement> obj)
|
||||||
{
|
{
|
||||||
int countHit = NestedHitObjects.Count(o => o.Judgement.Result == HitResult.Hit);
|
if (obj.Judgement.Result == HitResult.Hit)
|
||||||
float completion = (float)countHit / NestedHitObjects.Count();
|
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)
|
protected override void CheckJudgement(bool userTriggered)
|
||||||
|
@ -31,7 +31,7 @@ namespace osu.Game.Modes.Taiko.Objects
|
|||||||
/// The distance between ticks of this drumroll.
|
/// The distance between ticks of this drumroll.
|
||||||
/// <para>Half of this value is the hit window of the ticks.</para>
|
/// <para>Half of this value is the hit window of the ticks.</para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public double TickTimeDistance { get; protected set; } = 200;
|
public double TickTimeDistance { get; protected set; } = 100;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Number of drum roll ticks required for a "Good" hit.
|
/// Number of drum roll ticks required for a "Good" hit.
|
||||||
|
Loading…
Reference in New Issue
Block a user