2019-01-24 08:43:03 +00: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 09:19:50 +00:00
|
|
|
|
|
2022-06-17 07:37:17 +00:00
|
|
|
|
#nullable disable
|
|
|
|
|
|
2017-03-17 10:08:50 +00:00
|
|
|
|
using System;
|
2020-12-14 22:10:19 +00:00
|
|
|
|
using JetBrains.Annotations;
|
2022-11-07 06:21:58 +00:00
|
|
|
|
using osu.Framework.Bindables;
|
2017-03-28 07:49:39 +00:00
|
|
|
|
using osu.Framework.Graphics;
|
2021-09-16 09:26:12 +00:00
|
|
|
|
using osu.Framework.Input.Events;
|
2022-01-16 16:15:01 +00:00
|
|
|
|
using osu.Game.Rulesets.Objects;
|
2017-04-18 07:05:58 +00:00
|
|
|
|
using osu.Game.Rulesets.Objects.Drawables;
|
2020-12-07 03:30:25 +00:00
|
|
|
|
using osu.Game.Rulesets.Taiko.Skinning.Default;
|
2020-04-15 07:54:50 +00:00
|
|
|
|
using osu.Game.Skinning;
|
2018-04-13 09:19: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
|
|
|
|
{
|
2020-12-14 20:47:31 +00:00
|
|
|
|
public partial class DrawableDrumRollTick : DrawableTaikoStrongableHitObject<DrumRollTick, DrumRollTick.StrongNestedHit>
|
2017-03-17 10:08:50 +00:00
|
|
|
|
{
|
2022-11-07 06:21:58 +00:00
|
|
|
|
public BindableBool IsFirstTick = new BindableBool();
|
|
|
|
|
|
2020-04-07 08:40:18 +00:00
|
|
|
|
/// <summary>
|
2020-04-27 03:23:53 +00:00
|
|
|
|
/// The hit type corresponding to the <see cref="TaikoAction"/> that the user pressed to hit this <see cref="DrawableDrumRollTick"/>.
|
2020-04-07 08:40:18 +00:00
|
|
|
|
/// </summary>
|
2020-04-27 03:23:53 +00:00
|
|
|
|
public HitType JudgementType;
|
2020-04-07 08:40:18 +00:00
|
|
|
|
|
2020-12-14 22:10:19 +00:00
|
|
|
|
public DrawableDrumRollTick()
|
|
|
|
|
: this(null)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public DrawableDrumRollTick([CanBeNull] DrumRollTick tick)
|
2017-03-17 10:08:50 +00:00
|
|
|
|
: base(tick)
|
|
|
|
|
{
|
2017-08-03 04:24:13 +00:00
|
|
|
|
FillMode = FillMode.Fit;
|
2017-03-17 10:08:50 +00:00
|
|
|
|
}
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2022-11-11 06:41:06 +00:00
|
|
|
|
protected override SkinnableDrawable CreateMainPiece() => new SkinnableDrawable(new TaikoSkinComponentLookup(TaikoSkinComponents.DrumRollTick), _ => new TickPiece());
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2022-11-07 06:21:58 +00:00
|
|
|
|
protected override void OnApply()
|
|
|
|
|
{
|
|
|
|
|
base.OnApply();
|
|
|
|
|
|
|
|
|
|
IsFirstTick.Value = HitObject.FirstTick;
|
|
|
|
|
}
|
|
|
|
|
|
2018-08-06 02:31:46 +00:00
|
|
|
|
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
2017-03-17 10:08:50 +00:00
|
|
|
|
{
|
|
|
|
|
if (!userTriggered)
|
2018-08-02 07:09:04 +00:00
|
|
|
|
{
|
|
|
|
|
if (timeOffset > HitObject.HitWindow)
|
2024-02-05 12:21:01 +00:00
|
|
|
|
ApplyMinResult();
|
2017-03-17 10:08:50 +00:00
|
|
|
|
return;
|
2018-08-02 07:09:04 +00:00
|
|
|
|
}
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2018-08-02 07:09:04 +00:00
|
|
|
|
if (Math.Abs(timeOffset) > HitObject.HitWindow)
|
2017-09-06 08:02:13 +00:00
|
|
|
|
return;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2024-02-05 12:21:01 +00:00
|
|
|
|
ApplyMaxResult();
|
2017-03-17 10:08:50 +00:00
|
|
|
|
}
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2022-01-16 16:15:01 +00:00
|
|
|
|
public override void OnKilled()
|
|
|
|
|
{
|
|
|
|
|
base.OnKilled();
|
|
|
|
|
|
|
|
|
|
if (Time.Current > HitObject.GetEndTime() && !Judged)
|
2024-02-05 12:21:01 +00:00
|
|
|
|
ApplyMinResult();
|
2022-01-16 16:15:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-11-04 07:19:07 +00:00
|
|
|
|
protected override void UpdateHitStateTransforms(ArmedState state)
|
2017-03-23 10:43:00 +00:00
|
|
|
|
{
|
2017-03-28 07:49:39 +00:00
|
|
|
|
switch (state)
|
|
|
|
|
{
|
|
|
|
|
case ArmedState.Hit:
|
2022-11-07 06:11:40 +00:00
|
|
|
|
this.ScaleTo(1.4f, 200, Easing.OutQuint);
|
|
|
|
|
this.FadeOut(200, Easing.OutQuint);
|
2017-03-28 07:49:39 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2017-03-23 10:43:00 +00:00
|
|
|
|
}
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2021-09-16 09:26:12 +00:00
|
|
|
|
public override bool OnPressed(KeyBindingPressEvent<TaikoAction> e)
|
2020-04-07 08:40:18 +00:00
|
|
|
|
{
|
2021-09-16 09:26:12 +00:00
|
|
|
|
JudgementType = e.Action == TaikoAction.LeftRim || e.Action == TaikoAction.RightRim ? HitType.Rim : HitType.Centre;
|
2020-04-07 08:40:18 +00:00
|
|
|
|
return UpdateResult(true);
|
|
|
|
|
}
|
2018-08-03 07:35:12 +00:00
|
|
|
|
|
2020-12-14 22:21:19 +00:00
|
|
|
|
protected override DrawableStrongNestedHit CreateStrongNestedHit(DrumRollTick.StrongNestedHit hitObject) => new StrongNestedHit(hitObject);
|
2018-08-03 07:56:46 +00:00
|
|
|
|
|
2020-12-20 17:02:31 +00:00
|
|
|
|
public partial class StrongNestedHit : DrawableStrongNestedHit
|
2018-08-03 07:56:46 +00:00
|
|
|
|
{
|
2020-12-14 22:21:19 +00:00
|
|
|
|
public new DrawableDrumRollTick ParentHitObject => (DrawableDrumRollTick)base.ParentHitObject;
|
|
|
|
|
|
|
|
|
|
public StrongNestedHit()
|
|
|
|
|
: this(null)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public StrongNestedHit([CanBeNull] DrumRollTick.StrongNestedHit nestedHit)
|
|
|
|
|
: base(nestedHit)
|
2018-08-03 07:56:46 +00:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2018-08-06 02:31:46 +00:00
|
|
|
|
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
2018-08-03 07:56:46 +00:00
|
|
|
|
{
|
2020-12-14 22:21:19 +00:00
|
|
|
|
if (!ParentHitObject.Judged)
|
2018-08-03 07:56:46 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2024-01-25 16:25:41 +00:00
|
|
|
|
ApplyResult(static (r, hitObject) =>
|
2024-01-24 18:13:45 +00:00
|
|
|
|
{
|
2024-01-25 16:25:41 +00:00
|
|
|
|
var nestedHit = (StrongNestedHit)hitObject;
|
|
|
|
|
r.Type = nestedHit.ParentHitObject!.IsHit ? r.Judgement.MaxResult : r.Judgement.MinResult;
|
|
|
|
|
});
|
2018-08-03 07:56:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-09-16 09:26:12 +00:00
|
|
|
|
public override bool OnPressed(KeyBindingPressEvent<TaikoAction> e) => false;
|
2018-08-03 07:56:46 +00:00
|
|
|
|
}
|
2017-03-17 10:08:50 +00:00
|
|
|
|
}
|
|
|
|
|
}
|