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

68 lines
2.2 KiB
C#
Raw Normal View History

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 System;
2017-03-28 15:49:39 +08:00
using osu.Framework.Graphics;
2017-04-18 15:05:58 +08:00
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Taiko.Judgements;
2017-04-04 11:38:55 +08:00
using OpenTK.Input;
2017-04-18 15:05:58 +08:00
using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces;
2017-04-18 15:05:58 +08:00
namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{
public class DrawableDrumRollTick : DrawableTaikoHitObject<DrumRollTick>
{
public DrawableDrumRollTick(DrumRollTick tick)
: base(tick)
{
2017-08-09 15:19:31 +08:00
// Because ticks aren't added by the ScrollingPlayfield, we need to set the following properties ourselves
RelativePositionAxes = Axes.X;
X = (float)tick.StartTime;
FillMode = FillMode.Fit;
}
2017-08-09 09:54:00 +08: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;
}
protected override TaikoPiece CreateMainPiece() => new TickPiece
{
Filled = HitObject.FirstTick
};
protected override TaikoJudgement CreateJudgement() => new TaikoDrumRollTickJudgement { SecondHit = HitObject.IsStrong };
protected override void CheckJudgement(bool userTriggered)
{
if (!userTriggered)
return;
if (Math.Abs(Judgement.TimeOffset) < HitObject.HitWindow)
{
Judgement.Result = HitResult.Hit;
2017-03-22 00:51:44 +08:00
Judgement.TaikoResult = TaikoHitResult.Great;
}
}
2017-03-23 18:43:00 +08:00
protected override void UpdateState(ArmedState state)
{
2017-03-28 15:49:39 +08:00
switch (state)
{
case ArmedState.Hit:
2017-07-23 02:50:25 +08:00
Content.ScaleTo(0, 100, Easing.OutQuint);
2017-03-28 15:49:39 +08:00
break;
}
2017-03-23 18:43:00 +08:00
}
protected override bool HandleKeyPress(Key key)
{
return Judgement.Result == HitResult.None && UpdateJudgement(true);
}
}
}