mirror of
https://github.com/osukey/osukey.git
synced 2025-05-22 22:17:36 +09:00
Migrate drum roll to use nested hitobjects for strong hits
This commit is contained in:
parent
4494853446
commit
e8a140930e
@ -2,28 +2,19 @@
|
|||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Rulesets.Judgements;
|
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osu.Game.Rulesets.Taiko.Judgements;
|
|
||||||
using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces;
|
using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||||
{
|
{
|
||||||
public class DrawableDrumRollTick : DrawableTaikoHitObject<DrumRollTick>
|
public class DrawableDrumRollTick : DrawableTaikoHitObject<DrumRollTick>
|
||||||
{
|
{
|
||||||
private readonly JudgementResult result;
|
|
||||||
private readonly JudgementResult strongResult;
|
|
||||||
|
|
||||||
public DrawableDrumRollTick(DrumRollTick tick)
|
public DrawableDrumRollTick(DrumRollTick tick)
|
||||||
: base(tick)
|
: base(tick)
|
||||||
{
|
{
|
||||||
FillMode = FillMode.Fit;
|
FillMode = FillMode.Fit;
|
||||||
|
|
||||||
result = Results.Single(r => !(r.Judgement is TaikoStrongHitJudgement));
|
|
||||||
strongResult = Results.SingleOrDefault(r => r.Judgement is TaikoStrongHitJudgement);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool DisplayJudgement => false;
|
public override bool DisplayJudgement => false;
|
||||||
@ -38,21 +29,14 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
if (!userTriggered)
|
if (!userTriggered)
|
||||||
{
|
{
|
||||||
if (timeOffset > HitObject.HitWindow)
|
if (timeOffset > HitObject.HitWindow)
|
||||||
{
|
ApplyResult(r => r.Type = HitResult.Miss);
|
||||||
ApplyResult(result, r => r.Type = HitResult.Miss);
|
|
||||||
if (HitObject.IsStrong)
|
|
||||||
ApplyResult(strongResult, r => r.Type = HitResult.Miss);
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Math.Abs(timeOffset) > HitObject.HitWindow)
|
if (Math.Abs(timeOffset) > HitObject.HitWindow)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ApplyResult(result, r => r.Type = HitResult.Great);
|
ApplyResult(r => r.Type = HitResult.Great);
|
||||||
if (HitObject.IsStrong)
|
|
||||||
ApplyResult(strongResult, r => r.Type = HitResult.Great);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdateState(ArmedState state)
|
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);
|
public override bool OnPressed(TaikoAction action) => UpdateJudgement(true);
|
||||||
|
|
||||||
|
protected override DrawableStrongHitObject CreateStrongObject(StrongHitObject hitObject) => new DrawableStrongDrumRollTick(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 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;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user