1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 22:22:54 +08:00

Migrate drum roll to use nested hitobjects for strong hits

This commit is contained in:
smoogipoo 2018-08-03 16:35:12 +09:00
parent 4494853446
commit e8a140930e
2 changed files with 32 additions and 18 deletions

View File

@ -2,28 +2,19 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Linq;
using osu.Framework.Graphics;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.Taiko.Judgements;
using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces;
namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{
public class DrawableDrumRollTick : DrawableTaikoHitObject<DrumRollTick>
{
private readonly JudgementResult result;
private readonly JudgementResult strongResult;
public DrawableDrumRollTick(DrumRollTick tick)
: base(tick)
{
FillMode = FillMode.Fit;
result = Results.Single(r => !(r.Judgement is TaikoStrongHitJudgement));
strongResult = Results.SingleOrDefault(r => r.Judgement is TaikoStrongHitJudgement);
}
public override bool DisplayJudgement => false;
@ -38,21 +29,14 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
if (!userTriggered)
{
if (timeOffset > HitObject.HitWindow)
{
ApplyResult(result, r => r.Type = HitResult.Miss);
if (HitObject.IsStrong)
ApplyResult(strongResult, r => r.Type = HitResult.Miss);
}
ApplyResult(r => r.Type = HitResult.Miss);
return;
}
if (Math.Abs(timeOffset) > HitObject.HitWindow)
return;
ApplyResult(result, r => r.Type = HitResult.Great);
if (HitObject.IsStrong)
ApplyResult(strongResult, r => r.Type = HitResult.Great);
ApplyResult(r => r.Type = HitResult.Great);
}
protected override void UpdateState(ArmedState state)
@ -66,5 +50,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
}
public override bool OnPressed(TaikoAction action) => UpdateJudgement(true);
protected override DrawableStrongHitObject CreateStrongObject(StrongHitObject hitObject) => new DrawableStrongDrumRollTick(hitObject, this);
}
}

View File

@ -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 DrawableStrongDrumRollTick : DrawableStrongHitObject
{
private readonly DrawableDrumRollTick tick;
public DrawableStrongDrumRollTick(StrongHitObject strong, DrawableDrumRollTick tick)
: base(strong)
{
this.tick = tick;
}
protected override void CheckForJudgements(bool userTriggered, double timeOffset)
{
if (!tick.Judged)
return;
ApplyResult(r => r.Type = tick.IsHit ? HitResult.Great : HitResult.Miss);
}
public override bool OnPressed(TaikoAction action) => false;
}
}