mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 07:42:57 +08:00
Migrate DrawableDrumRoll to use a nested hitobject for strong hits
This commit is contained in:
parent
fdf889359f
commit
4494853446
@ -13,7 +13,6 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Rulesets.Taiko.Judgements;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
{
|
||||
@ -24,9 +23,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
/// </summary>
|
||||
private const int rolling_hits_for_engaged_colour = 5;
|
||||
|
||||
private readonly JudgementResult result;
|
||||
private readonly JudgementResult strongResult;
|
||||
|
||||
/// <summary>
|
||||
/// Rolling number of tick hits. This increases for hits and decreases for misses.
|
||||
/// </summary>
|
||||
@ -48,9 +44,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
AddNested(newTick);
|
||||
tickContainer.Add(newTick);
|
||||
}
|
||||
|
||||
result = Results.Single(r => !(r.Judgement is TaikoStrongHitJudgement));
|
||||
strongResult = Results.SingleOrDefault(r => r.Judgement is TaikoStrongHitJudgement);
|
||||
}
|
||||
|
||||
protected override TaikoPiece CreateMainPiece() => new ElongatedCirclePiece();
|
||||
@ -90,17 +83,9 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
|
||||
int countHit = NestedHitObjects.Count(o => o.IsHit);
|
||||
if (countHit >= HitObject.RequiredGoodHits)
|
||||
{
|
||||
ApplyResult(result, r => r.Type = countHit >= HitObject.RequiredGreatHits ? HitResult.Great : HitResult.Good);
|
||||
if (HitObject.IsStrong)
|
||||
ApplyResult(strongResult, r => r.Type = HitResult.Great);
|
||||
}
|
||||
ApplyResult(r => r.Type = countHit >= HitObject.RequiredGreatHits ? HitResult.Great : HitResult.Good);
|
||||
else
|
||||
{
|
||||
ApplyResult(result, r => r.Type = HitResult.Miss);
|
||||
if (HitObject.IsStrong)
|
||||
ApplyResult(strongResult, r => r.Type = HitResult.Miss);
|
||||
}
|
||||
ApplyResult(r => r.Type = HitResult.Miss);
|
||||
}
|
||||
|
||||
protected override void UpdateState(ArmedState state)
|
||||
@ -113,5 +98,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected override DrawableStrongHitObject CreateStrongObject(StrongHitObject hitObject) => new DrawableStrongDrumRoll(hitObject, this);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,28 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
{
|
||||
public class DrawableStrongDrumRoll : DrawableStrongHitObject
|
||||
{
|
||||
private readonly DrawableDrumRoll drumRoll;
|
||||
|
||||
public DrawableStrongDrumRoll(StrongHitObject strong, DrawableDrumRoll drumRoll)
|
||||
: base(strong)
|
||||
{
|
||||
this.drumRoll = drumRoll;
|
||||
}
|
||||
|
||||
protected override void CheckForJudgements(bool userTriggered, double timeOffset)
|
||||
{
|
||||
if (!drumRoll.Judged)
|
||||
return;
|
||||
|
||||
ApplyResult(r => r.Type = drumRoll.IsHit ? HitResult.Great : HitResult.Miss);
|
||||
}
|
||||
|
||||
public override bool OnPressed(TaikoAction action) => false;
|
||||
}
|
||||
}
|
@ -10,6 +10,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
protected DrawableStrongHitObject(StrongHitObject strong)
|
||||
: base(strong)
|
||||
{
|
||||
AlwaysPresent = true;
|
||||
}
|
||||
|
||||
protected override void UpdateState(ArmedState state)
|
||||
|
Loading…
Reference in New Issue
Block a user