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
|
|
|
|
|
2022-06-17 15:37:17 +08:00
|
|
|
|
#nullable disable
|
|
|
|
|
|
2017-03-17 18:08:50 +08:00
|
|
|
|
using System;
|
2020-12-15 06:10:19 +08:00
|
|
|
|
using JetBrains.Annotations;
|
2022-11-07 14:21:58 +08:00
|
|
|
|
using osu.Framework.Bindables;
|
2017-03-28 15:49:39 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
2021-09-16 17:26:12 +08:00
|
|
|
|
using osu.Framework.Input.Events;
|
2022-01-17 00:15:01 +08:00
|
|
|
|
using osu.Game.Rulesets.Objects;
|
2017-04-18 15:05:58 +08:00
|
|
|
|
using osu.Game.Rulesets.Objects.Drawables;
|
2020-12-07 11:30:25 +08:00
|
|
|
|
using osu.Game.Rulesets.Taiko.Skinning.Default;
|
2020-04-15 15:54:50 +08:00
|
|
|
|
using osu.Game.Skinning;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2017-04-18 15:05:58 +08:00
|
|
|
|
namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
2017-03-17 18:08:50 +08:00
|
|
|
|
{
|
2020-12-15 04:47:31 +08:00
|
|
|
|
public class DrawableDrumRollTick : DrawableTaikoStrongableHitObject<DrumRollTick, DrumRollTick.StrongNestedHit>
|
2017-03-17 18:08:50 +08:00
|
|
|
|
{
|
2022-11-07 14:21:58 +08:00
|
|
|
|
public BindableBool IsFirstTick = new BindableBool();
|
|
|
|
|
|
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
|
|
|
|
|
2020-12-15 06:10:19 +08:00
|
|
|
|
public DrawableDrumRollTick()
|
|
|
|
|
: this(null)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public DrawableDrumRollTick([CanBeNull] DrumRollTick tick)
|
2017-03-17 18:08:50 +08:00
|
|
|
|
: base(tick)
|
|
|
|
|
{
|
2017-08-03 12:24:13 +08:00
|
|
|
|
FillMode = FillMode.Fit;
|
2017-03-17 18:08:50 +08:00
|
|
|
|
}
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2022-11-07 14:21:58 +08:00
|
|
|
|
protected override SkinnableDrawable CreateMainPiece() => new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.DrumRollTick), _ => new TickPiece());
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2022-09-27 22:54:24 +08:00
|
|
|
|
public override double MaximumJudgementOffset => HitObject.HitWindow;
|
2020-11-25 22:38:47 +08:00
|
|
|
|
|
2022-11-07 14:21:58 +08:00
|
|
|
|
protected override void OnApply()
|
|
|
|
|
{
|
|
|
|
|
base.OnApply();
|
|
|
|
|
|
|
|
|
|
IsFirstTick.Value = HitObject.FirstTick;
|
|
|
|
|
}
|
|
|
|
|
|
2018-08-06 10:31:46 +08:00
|
|
|
|
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
2017-03-17 18:08:50 +08:00
|
|
|
|
{
|
|
|
|
|
if (!userTriggered)
|
2018-08-02 15:09:04 +08:00
|
|
|
|
{
|
|
|
|
|
if (timeOffset > HitObject.HitWindow)
|
2020-09-29 14:13:11 +08:00
|
|
|
|
ApplyResult(r => r.Type = r.Judgement.MinResult);
|
2017-03-17 18:08: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)
|
2017-09-06 16:02:13 +08:00
|
|
|
|
return;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2020-09-29 14:13:11 +08:00
|
|
|
|
ApplyResult(r => r.Type = r.Judgement.MaxResult);
|
2017-03-17 18:08:50 +08:00
|
|
|
|
}
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2022-01-17 00:15:01 +08:00
|
|
|
|
public override void OnKilled()
|
|
|
|
|
{
|
|
|
|
|
base.OnKilled();
|
|
|
|
|
|
|
|
|
|
if (Time.Current > HitObject.GetEndTime() && !Judged)
|
|
|
|
|
ApplyResult(r => r.Type = r.Judgement.MinResult);
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-04 15:19:07 +08:00
|
|
|
|
protected override void UpdateHitStateTransforms(ArmedState state)
|
2017-03-23 18:43:00 +08:00
|
|
|
|
{
|
2017-03-28 15:49:39 +08:00
|
|
|
|
switch (state)
|
|
|
|
|
{
|
|
|
|
|
case ArmedState.Hit:
|
2019-09-12 18:29:08 +08:00
|
|
|
|
this.ScaleTo(0, 100, Easing.OutQuint);
|
2017-03-28 15:49:39 +08:00
|
|
|
|
break;
|
|
|
|
|
}
|
2017-03-23 18:43:00 +08:00
|
|
|
|
}
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2021-09-16 17:26:12 +08:00
|
|
|
|
public override bool OnPressed(KeyBindingPressEvent<TaikoAction> e)
|
2020-04-07 16:40:18 +08:00
|
|
|
|
{
|
2021-09-16 17:26:12 +08:00
|
|
|
|
JudgementType = e.Action == TaikoAction.LeftRim || e.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
|
|
|
|
|
2020-12-15 06:21:19 +08:00
|
|
|
|
protected override DrawableStrongNestedHit CreateStrongNestedHit(DrumRollTick.StrongNestedHit hitObject) => new StrongNestedHit(hitObject);
|
2018-08-03 15:56:46 +08:00
|
|
|
|
|
2020-12-21 01:02:31 +08:00
|
|
|
|
public class StrongNestedHit : DrawableStrongNestedHit
|
2018-08-03 15:56:46 +08:00
|
|
|
|
{
|
2020-12-15 06:21:19 +08:00
|
|
|
|
public new DrawableDrumRollTick ParentHitObject => (DrawableDrumRollTick)base.ParentHitObject;
|
|
|
|
|
|
|
|
|
|
public StrongNestedHit()
|
|
|
|
|
: this(null)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public StrongNestedHit([CanBeNull] DrumRollTick.StrongNestedHit nestedHit)
|
|
|
|
|
: base(nestedHit)
|
2018-08-03 15:56:46 +08:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2018-08-06 10:31:46 +08:00
|
|
|
|
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
2018-08-03 15:56:46 +08:00
|
|
|
|
{
|
2020-12-15 06:21:19 +08:00
|
|
|
|
if (!ParentHitObject.Judged)
|
2018-08-03 15:56:46 +08:00
|
|
|
|
return;
|
|
|
|
|
|
2020-12-15 06:21:19 +08:00
|
|
|
|
ApplyResult(r => r.Type = ParentHitObject.IsHit ? r.Judgement.MaxResult : r.Judgement.MinResult);
|
2018-08-03 15:56:46 +08:00
|
|
|
|
}
|
|
|
|
|
|
2022-01-17 00:15:01 +08:00
|
|
|
|
public override void OnKilled()
|
|
|
|
|
{
|
|
|
|
|
base.OnKilled();
|
|
|
|
|
|
|
|
|
|
if (Time.Current > ParentHitObject.HitObject.GetEndTime() && !Judged)
|
|
|
|
|
ApplyResult(r => r.Type = r.Judgement.MinResult);
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-16 17:26:12 +08:00
|
|
|
|
public override bool OnPressed(KeyBindingPressEvent<TaikoAction> e) => false;
|
2018-08-03 15:56:46 +08:00
|
|
|
|
}
|
2017-03-17 18:08:50 +08:00
|
|
|
|
}
|
|
|
|
|
}
|