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 OpenTK.Input;
|
2017-03-17 18:08:50 +08:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using osu.Game.Modes.Taiko.Judgements;
|
|
|
|
|
using System;
|
|
|
|
|
using osu.Game.Modes.Objects.Drawables;
|
|
|
|
|
using osu.Framework.Input;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Modes.Taiko.Objects.Drawable
|
|
|
|
|
{
|
2017-03-17 18:27:06 +08:00
|
|
|
|
public class DrawableDrumRollTick : DrawableTaikoHitObject
|
2017-03-17 18:08:50 +08:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// A list of keys which this HitObject will accept. These are the standard Taiko keys for now.
|
|
|
|
|
/// These should be moved to bindings later.
|
|
|
|
|
/// </summary>
|
|
|
|
|
private List<Key> validKeys = new List<Key>(new[] { Key.D, Key.F, Key.J, Key.K });
|
|
|
|
|
|
2017-03-17 18:27:06 +08:00
|
|
|
|
private DrumRollTick tick;
|
|
|
|
|
|
2017-03-17 18:08:50 +08:00
|
|
|
|
public DrawableDrumRollTick(DrumRollTick tick)
|
|
|
|
|
: base(tick)
|
|
|
|
|
{
|
2017-03-17 18:27:06 +08:00
|
|
|
|
this.tick = tick;
|
2017-03-17 18:08:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
2017-03-23 18:43:00 +08:00
|
|
|
|
protected override TaikoJudgement CreateJudgement() => new TaikoDrumRollTickJudgement();
|
2017-03-17 18:08:50 +08:00
|
|
|
|
|
|
|
|
|
protected override void CheckJudgement(bool userTriggered)
|
|
|
|
|
{
|
|
|
|
|
if (!userTriggered)
|
|
|
|
|
{
|
2017-03-17 18:27:06 +08:00
|
|
|
|
if (Judgement.TimeOffset > tick.TickTimeDistance / 2)
|
2017-03-20 17:07:44 +08:00
|
|
|
|
Judgement.Result = HitResult.Miss;
|
2017-03-17 18:08:50 +08:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-17 18:27:06 +08:00
|
|
|
|
if (Math.Abs(Judgement.TimeOffset) < tick.TickTimeDistance / 2)
|
2017-03-17 18:08:50 +08:00
|
|
|
|
{
|
|
|
|
|
Judgement.Result = HitResult.Hit;
|
2017-03-22 00:51:44 +08:00
|
|
|
|
Judgement.TaikoResult = TaikoHitResult.Great;
|
2017-03-17 18:08:50 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-23 18:43:00 +08:00
|
|
|
|
protected override void UpdateState(ArmedState state)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-22 00:51:53 +08:00
|
|
|
|
protected override void UpdateScrollPosition(double time)
|
2017-03-17 18:08:50 +08:00
|
|
|
|
{
|
|
|
|
|
// Drum roll ticks shouldn't move
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
|
|
|
|
{
|
|
|
|
|
if (args.Repeat)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if (Judgement.Result.HasValue)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if (!validKeys.Contains(args.Key))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
return UpdateJudgement(true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|