2017-03-20 09:24:28 +00:00
|
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
2017-03-17 10:08:50 +00:00
|
|
|
|
using System;
|
2017-03-28 07:49:39 +00:00
|
|
|
|
using osu.Framework.Graphics;
|
2017-04-18 07:05:58 +00:00
|
|
|
|
using osu.Game.Rulesets.Objects.Drawables;
|
|
|
|
|
using osu.Game.Rulesets.Taiko.Judgements;
|
|
|
|
|
using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces;
|
2017-03-17 10:08:50 +00:00
|
|
|
|
|
2017-04-18 07:05:58 +00:00
|
|
|
|
namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
2017-03-17 10:08:50 +00:00
|
|
|
|
{
|
2017-04-05 01:01:40 +00:00
|
|
|
|
public class DrawableDrumRollTick : DrawableTaikoHitObject<DrumRollTick>
|
2017-03-17 10:08:50 +00:00
|
|
|
|
{
|
|
|
|
|
public DrawableDrumRollTick(DrumRollTick tick)
|
|
|
|
|
: base(tick)
|
|
|
|
|
{
|
2017-08-09 07:19:31 +00:00
|
|
|
|
// Because ticks aren't added by the ScrollingPlayfield, we need to set the following properties ourselves
|
|
|
|
|
RelativePositionAxes = Axes.X;
|
|
|
|
|
X = (float)tick.StartTime;
|
|
|
|
|
|
2017-08-03 04:24:13 +00:00
|
|
|
|
FillMode = FillMode.Fit;
|
2017-03-17 10:08:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-08-09 01:54:00 +00:00
|
|
|
|
protected override void LoadComplete()
|
|
|
|
|
{
|
|
|
|
|
base.LoadComplete();
|
|
|
|
|
|
|
|
|
|
// We need to set this here because RelativeSizeAxes won't/can't set our size by default with a different RelativeChildSize
|
|
|
|
|
Width *= Parent.RelativeChildSize.X;
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-05 01:01:40 +00:00
|
|
|
|
protected override TaikoPiece CreateMainPiece() => new TickPiece
|
|
|
|
|
{
|
|
|
|
|
Filled = HitObject.FirstTick
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
protected override TaikoJudgement CreateJudgement() => new TaikoDrumRollTickJudgement { SecondHit = HitObject.IsStrong };
|
2017-03-17 10:08:50 +00:00
|
|
|
|
|
|
|
|
|
protected override void CheckJudgement(bool userTriggered)
|
|
|
|
|
{
|
|
|
|
|
if (!userTriggered)
|
|
|
|
|
return;
|
|
|
|
|
|
2017-04-05 01:01:40 +00:00
|
|
|
|
if (Math.Abs(Judgement.TimeOffset) < HitObject.HitWindow)
|
2017-03-17 10:08:50 +00:00
|
|
|
|
{
|
|
|
|
|
Judgement.Result = HitResult.Hit;
|
2017-03-21 16:51:44 +00:00
|
|
|
|
Judgement.TaikoResult = TaikoHitResult.Great;
|
2017-03-17 10:08:50 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-23 10:43:00 +00:00
|
|
|
|
protected override void UpdateState(ArmedState state)
|
|
|
|
|
{
|
2017-03-28 07:49:39 +00:00
|
|
|
|
switch (state)
|
|
|
|
|
{
|
|
|
|
|
case ArmedState.Hit:
|
2017-07-22 18:50:25 +00:00
|
|
|
|
Content.ScaleTo(0, 100, Easing.OutQuint);
|
2017-03-28 07:49:39 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2017-03-23 10:43:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-08-20 12:18:21 +00:00
|
|
|
|
public override bool OnPressed(TaikoAction action)
|
2017-03-17 10:08:50 +00:00
|
|
|
|
{
|
2017-03-29 08:57:36 +00:00
|
|
|
|
return Judgement.Result == HitResult.None && UpdateJudgement(true);
|
2017-03-17 10:08:50 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|