2019-01-24 16:43:03 +08:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Game.Rulesets.Objects.Drawables;
|
|
|
|
|
using osu.Game.Rulesets.Scoring;
|
|
|
|
|
using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces;
|
2020-04-15 15:54:50 +08:00
|
|
|
|
using osu.Game.Skinning;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|
|
|
|
{
|
|
|
|
|
public class DrawableDrumRollTick : DrawableTaikoHitObject<DrumRollTick>
|
|
|
|
|
{
|
2020-04-07 16:40:18 +08:00
|
|
|
|
/// <summary>
|
2020-04-27 11:23:53 +08:00
|
|
|
|
/// The hit type corresponding to the <see cref="TaikoAction"/> that the user pressed to hit this <see cref="DrawableDrumRollTick"/>.
|
2020-04-07 16:40:18 +08:00
|
|
|
|
/// </summary>
|
2020-04-27 11:23:53 +08:00
|
|
|
|
public HitType JudgementType;
|
2020-04-07 16:40:18 +08:00
|
|
|
|
|
2018-04-13 17:19:50 +08:00
|
|
|
|
public DrawableDrumRollTick(DrumRollTick tick)
|
|
|
|
|
: base(tick)
|
|
|
|
|
{
|
|
|
|
|
FillMode = FillMode.Fit;
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-15 15:54:50 +08:00
|
|
|
|
protected override SkinnableDrawable CreateMainPiece() => new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.DrumRollTick),
|
2020-04-16 09:04:09 +08:00
|
|
|
|
_ => new TickPiece
|
|
|
|
|
{
|
|
|
|
|
Filled = HitObject.FirstTick
|
|
|
|
|
});
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2018-08-06 10:31:46 +08:00
|
|
|
|
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
if (!userTriggered)
|
2018-08-02 15:09:04 +08:00
|
|
|
|
{
|
|
|
|
|
if (timeOffset > HitObject.HitWindow)
|
2018-08-03 15:35:12 +08:00
|
|
|
|
ApplyResult(r => r.Type = HitResult.Miss);
|
2018-04-13 17:19:50 +08:00
|
|
|
|
return;
|
2018-08-02 15:09:04 +08:00
|
|
|
|
}
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2018-08-02 15:09:04 +08:00
|
|
|
|
if (Math.Abs(timeOffset) > HitObject.HitWindow)
|
2018-04-13 17:19:50 +08:00
|
|
|
|
return;
|
|
|
|
|
|
2018-08-03 15:35:12 +08:00
|
|
|
|
ApplyResult(r => r.Type = HitResult.Great);
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
2019-08-27 10:03:56 +08:00
|
|
|
|
protected override void UpdateStateTransforms(ArmedState state)
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
switch (state)
|
|
|
|
|
{
|
|
|
|
|
case ArmedState.Hit:
|
2019-09-12 18:29:08 +08:00
|
|
|
|
this.ScaleTo(0, 100, Easing.OutQuint);
|
2018-04-13 17:19:50 +08:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-07 16:40:18 +08:00
|
|
|
|
public override bool OnPressed(TaikoAction action)
|
|
|
|
|
{
|
2020-04-27 11:23:53 +08:00
|
|
|
|
JudgementType = action == TaikoAction.LeftRim || action == TaikoAction.RightRim ? HitType.Rim : HitType.Centre;
|
2020-04-07 16:40:18 +08:00
|
|
|
|
return UpdateResult(true);
|
|
|
|
|
}
|
2018-08-03 15:35:12 +08:00
|
|
|
|
|
2018-08-14 13:28:05 +08:00
|
|
|
|
protected override DrawableStrongNestedHit CreateStrongHit(StrongHitObject hitObject) => new StrongNestedHit(hitObject, this);
|
2018-08-03 15:56:46 +08:00
|
|
|
|
|
2018-08-14 13:28:05 +08:00
|
|
|
|
private class StrongNestedHit : DrawableStrongNestedHit
|
2018-08-03 15:56:46 +08:00
|
|
|
|
{
|
2018-08-14 13:28:05 +08:00
|
|
|
|
public StrongNestedHit(StrongHitObject strong, DrawableDrumRollTick tick)
|
2018-08-03 15:56:46 +08:00
|
|
|
|
: base(strong, tick)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2018-08-06 10:31:46 +08:00
|
|
|
|
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
2018-08-03 15:56:46 +08:00
|
|
|
|
{
|
|
|
|
|
if (!MainObject.Judged)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
ApplyResult(r => r.Type = MainObject.IsHit ? HitResult.Great : HitResult.Miss);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override bool OnPressed(TaikoAction action) => false;
|
|
|
|
|
}
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
}
|