mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 10:33:30 +08:00
Implement nested strong hit application
This commit is contained in:
parent
d823c77a63
commit
ae6dedacaf
@ -166,7 +166,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
Content.X = DrawHeight / 2;
|
||||
}
|
||||
|
||||
protected override DrawableStrongNestedHit CreateStrongNestedHit(DrumRoll.StrongNestedHit hitObject) => new StrongNestedHit(hitObject, this);
|
||||
protected override DrawableStrongNestedHit CreateStrongNestedHit(DrumRoll.StrongNestedHit hitObject) => new StrongNestedHit(hitObject);
|
||||
|
||||
private void updateColour(double fadeDuration = 0)
|
||||
{
|
||||
@ -176,17 +176,24 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
|
||||
private class StrongNestedHit : DrawableStrongNestedHit
|
||||
{
|
||||
public StrongNestedHit(DrumRoll.StrongNestedHit nestedHit, DrawableDrumRoll drumRoll)
|
||||
: base(nestedHit, drumRoll)
|
||||
public new DrawableDrumRoll ParentHitObject => (DrawableDrumRoll)base.ParentHitObject;
|
||||
|
||||
public StrongNestedHit()
|
||||
: this(null)
|
||||
{
|
||||
}
|
||||
|
||||
public StrongNestedHit([CanBeNull] DrumRoll.StrongNestedHit nestedHit)
|
||||
: base(nestedHit)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
||||
{
|
||||
if (!MainObject.Judged)
|
||||
if (!ParentHitObject.Judged)
|
||||
return;
|
||||
|
||||
ApplyResult(r => r.Type = MainObject.IsHit ? r.Judgement.MaxResult : r.Judgement.MinResult);
|
||||
ApplyResult(r => r.Type = ParentHitObject.IsHit ? r.Judgement.MaxResult : r.Judgement.MinResult);
|
||||
}
|
||||
|
||||
public override bool OnPressed(TaikoAction action) => false;
|
||||
|
@ -67,21 +67,28 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
return UpdateResult(true);
|
||||
}
|
||||
|
||||
protected override DrawableStrongNestedHit CreateStrongNestedHit(DrumRollTick.StrongNestedHit hitObject) => new StrongNestedHit(hitObject, this);
|
||||
protected override DrawableStrongNestedHit CreateStrongNestedHit(DrumRollTick.StrongNestedHit hitObject) => new StrongNestedHit(hitObject);
|
||||
|
||||
private class StrongNestedHit : DrawableStrongNestedHit
|
||||
{
|
||||
public StrongNestedHit(DrumRollTick.StrongNestedHit nestedHit, DrawableDrumRollTick tick)
|
||||
: base(nestedHit, tick)
|
||||
public new DrawableDrumRollTick ParentHitObject => (DrawableDrumRollTick)base.ParentHitObject;
|
||||
|
||||
public StrongNestedHit()
|
||||
: this(null)
|
||||
{
|
||||
}
|
||||
|
||||
public StrongNestedHit([CanBeNull] DrumRollTick.StrongNestedHit nestedHit)
|
||||
: base(nestedHit)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
||||
{
|
||||
if (!MainObject.Judged)
|
||||
if (!ParentHitObject.Judged)
|
||||
return;
|
||||
|
||||
ApplyResult(r => r.Type = MainObject.IsHit ? r.Judgement.MaxResult : r.Judgement.MinResult);
|
||||
ApplyResult(r => r.Type = ParentHitObject.IsHit ? r.Judgement.MaxResult : r.Judgement.MinResult);
|
||||
}
|
||||
|
||||
public override bool OnPressed(TaikoAction action) => false;
|
||||
|
@ -250,32 +250,37 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
}
|
||||
}
|
||||
|
||||
protected override DrawableStrongNestedHit CreateStrongNestedHit(Hit.StrongNestedHit hitObject) => new StrongNestedHit(hitObject, this);
|
||||
protected override DrawableStrongNestedHit CreateStrongNestedHit(Hit.StrongNestedHit hitObject) => new StrongNestedHit(hitObject);
|
||||
|
||||
private class StrongNestedHit : DrawableStrongNestedHit
|
||||
{
|
||||
public new DrawableHit ParentHitObject => (DrawableHit)base.ParentHitObject;
|
||||
|
||||
/// <summary>
|
||||
/// The lenience for the second key press.
|
||||
/// This does not adjust by map difficulty in ScoreV2 yet.
|
||||
/// </summary>
|
||||
private const double second_hit_window = 30;
|
||||
|
||||
public new DrawableHit MainObject => (DrawableHit)base.MainObject;
|
||||
public StrongNestedHit()
|
||||
: this(null)
|
||||
{
|
||||
}
|
||||
|
||||
public StrongNestedHit(Hit.StrongNestedHit nestedHit, DrawableHit hit)
|
||||
: base(nestedHit, hit)
|
||||
public StrongNestedHit([CanBeNull] Hit.StrongNestedHit nestedHit)
|
||||
: base(nestedHit)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
||||
{
|
||||
if (!MainObject.Result.HasResult)
|
||||
if (!ParentHitObject.Result.HasResult)
|
||||
{
|
||||
base.CheckForResult(userTriggered, timeOffset);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!MainObject.Result.IsHit)
|
||||
if (!ParentHitObject.Result.IsHit)
|
||||
{
|
||||
ApplyResult(r => r.Type = r.Judgement.MinResult);
|
||||
return;
|
||||
@ -283,27 +288,27 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
|
||||
if (!userTriggered)
|
||||
{
|
||||
if (timeOffset - MainObject.Result.TimeOffset > second_hit_window)
|
||||
if (timeOffset - ParentHitObject.Result.TimeOffset > second_hit_window)
|
||||
ApplyResult(r => r.Type = r.Judgement.MinResult);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Math.Abs(timeOffset - MainObject.Result.TimeOffset) <= second_hit_window)
|
||||
if (Math.Abs(timeOffset - ParentHitObject.Result.TimeOffset) <= second_hit_window)
|
||||
ApplyResult(r => r.Type = r.Judgement.MaxResult);
|
||||
}
|
||||
|
||||
public override bool OnPressed(TaikoAction action)
|
||||
{
|
||||
// Don't process actions until the main hitobject is hit
|
||||
if (!MainObject.IsHit)
|
||||
if (!ParentHitObject.IsHit)
|
||||
return false;
|
||||
|
||||
// Don't process actions if the pressed button was released
|
||||
if (MainObject.HitAction == null)
|
||||
if (ParentHitObject.HitAction == null)
|
||||
return false;
|
||||
|
||||
// Don't handle invalid hit action presses
|
||||
if (!MainObject.HitActions.Contains(action))
|
||||
if (!ParentHitObject.HitActions.Contains(action))
|
||||
return false;
|
||||
|
||||
return UpdateResult(true);
|
||||
|
@ -1,7 +1,7 @@
|
||||
// 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.
|
||||
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Game.Rulesets.Taiko.Judgements;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
@ -11,12 +11,11 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
/// </summary>
|
||||
public abstract class DrawableStrongNestedHit : DrawableTaikoHitObject
|
||||
{
|
||||
public readonly DrawableHitObject MainObject;
|
||||
public new DrawableTaikoHitObject ParentHitObject => (DrawableTaikoHitObject)base.ParentHitObject;
|
||||
|
||||
protected DrawableStrongNestedHit(StrongNestedHitObject nestedHit, DrawableHitObject mainObject)
|
||||
protected DrawableStrongNestedHit([CanBeNull] StrongNestedHitObject nestedHit)
|
||||
: base(nestedHit)
|
||||
{
|
||||
MainObject = mainObject;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -248,7 +248,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
{
|
||||
case TaikoStrongJudgement _:
|
||||
if (result.IsHit)
|
||||
hitExplosionContainer.Children.FirstOrDefault(e => e.JudgedObject == ((DrawableStrongNestedHit)judgedObject).MainObject)?.VisualiseSecondHit();
|
||||
hitExplosionContainer.Children.FirstOrDefault(e => e.JudgedObject == ((DrawableStrongNestedHit)judgedObject).ParentHitObject)?.VisualiseSecondHit();
|
||||
break;
|
||||
|
||||
case TaikoDrumRollTickJudgement _:
|
||||
|
Loading…
Reference in New Issue
Block a user