2017-03-20 17:24:28 +08:00
|
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
|
|
|
|
using osu.Game.Modes.Objects.Drawables;
|
2017-03-17 18:30:22 +08:00
|
|
|
|
using osu.Game.Modes.Taiko.Judgements;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Modes.Taiko.Objects.Drawable
|
|
|
|
|
{
|
|
|
|
|
public class DrawableDrumRoll : DrawableTaikoHitObject
|
|
|
|
|
{
|
2017-03-23 18:43:49 +08:00
|
|
|
|
private readonly DrumRoll drumRoll;
|
2017-03-17 18:30:22 +08:00
|
|
|
|
|
|
|
|
|
public DrawableDrumRoll(DrumRoll drumRoll)
|
|
|
|
|
: base(drumRoll)
|
|
|
|
|
{
|
|
|
|
|
this.drumRoll = drumRoll;
|
|
|
|
|
|
|
|
|
|
int tickIndex = 0;
|
|
|
|
|
foreach (var tick in drumRoll.Ticks)
|
|
|
|
|
{
|
|
|
|
|
var newTick = new DrawableDrumRollTick(tick)
|
|
|
|
|
{
|
|
|
|
|
Depth = tickIndex,
|
|
|
|
|
X = (float)((tick.StartTime - HitObject.StartTime) / drumRoll.Duration)
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
AddNested(newTick);
|
|
|
|
|
|
|
|
|
|
tickIndex++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-23 18:43:00 +08:00
|
|
|
|
protected override void UpdateState(ArmedState state)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-17 18:30:22 +08:00
|
|
|
|
protected override void CheckJudgement(bool userTriggered)
|
|
|
|
|
{
|
|
|
|
|
if (userTriggered)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (Judgement.TimeOffset < 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
int countHit = NestedHitObjects.Count(o => o.Judgement.Result == HitResult.Hit);
|
|
|
|
|
|
|
|
|
|
if (countHit > drumRoll.RequiredGoodHits)
|
|
|
|
|
{
|
|
|
|
|
Judgement.Result = HitResult.Hit;
|
2017-03-22 00:51:44 +08:00
|
|
|
|
Judgement.TaikoResult = countHit >= drumRoll.RequiredGreatHits ? TaikoHitResult.Great : TaikoHitResult.Good;
|
2017-03-17 18:30:22 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
Judgement.Result = HitResult.Miss;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|