1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-23 20:07:26 +08:00
osu-lazer/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs

76 lines
2.3 KiB
C#
Raw Normal View History

// 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.Framework.Graphics.Containers;
2018-04-13 17:19:50 +08:00
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces;
namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{
public class DrawableDrumRollTick : DrawableTaikoHitObject<DrumRollTick>
{
public DrawableDrumRollTick(DrumRollTick tick)
: base(tick)
{
FillMode = FillMode.Fit;
}
public override bool DisplayResult => false;
2018-04-13 17:19:50 +08:00
protected override CompositeDrawable CreateMainPiece() => new TickPiece
2018-04-13 17:19:50 +08:00
{
Filled = HitObject.FirstTick
};
protected override void CheckForResult(bool userTriggered, double timeOffset)
2018-04-13 17:19:50 +08:00
{
if (!userTriggered)
{
if (timeOffset > HitObject.HitWindow)
ApplyResult(r => r.Type = HitResult.Miss);
2018-04-13 17:19:50 +08:00
return;
}
2018-04-13 17:19:50 +08:00
if (Math.Abs(timeOffset) > HitObject.HitWindow)
2018-04-13 17:19:50 +08:00
return;
ApplyResult(r => r.Type = HitResult.Great);
2018-04-13 17:19:50 +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;
}
}
public override bool OnPressed(TaikoAction action) => UpdateResult(true);
protected override DrawableStrongNestedHit CreateStrongHit(StrongHitObject hitObject) => new StrongNestedHit(hitObject, this);
2018-08-03 15:56:46 +08:00
private class StrongNestedHit : DrawableStrongNestedHit
2018-08-03 15:56:46 +08:00
{
public StrongNestedHit(StrongHitObject strong, DrawableDrumRollTick tick)
2018-08-03 15:56:46 +08:00
: base(strong, tick)
{
}
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
}
}