mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 20:59:35 +08:00
Merge pull request #513 from smoogipooo/taiko_drumroll_drawable
Drawable DrumRoll Implementation (Input only)
This commit is contained in:
commit
8ad4c5f312
57
osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs
Normal file
57
osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs
Normal file
@ -0,0 +1,57 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Game.Modes.Objects.Drawables;
|
||||
using osu.Game.Modes.Taiko.Judgements;
|
||||
using System.Linq;
|
||||
|
||||
namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
{
|
||||
public class DrawableDrumRoll : DrawableTaikoHitObject
|
||||
{
|
||||
private readonly DrumRoll drumRoll;
|
||||
|
||||
public DrawableDrumRoll(DrumRoll drumRoll)
|
||||
: base(drumRoll)
|
||||
{
|
||||
this.drumRoll = drumRoll;
|
||||
|
||||
int tickIndex = 0;
|
||||
foreach (var tick in drumRoll.Ticks)
|
||||
{
|
||||
var newTick = new DrawableDrumRollTick(tick)
|
||||
{
|
||||
Depth = tickIndex,
|
||||
X = (float)((tick.StartTime - HitObject.StartTime) / drumRoll.Duration)
|
||||
};
|
||||
|
||||
AddNested(newTick);
|
||||
|
||||
tickIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void UpdateState(ArmedState state)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void CheckJudgement(bool userTriggered)
|
||||
{
|
||||
if (userTriggered)
|
||||
return;
|
||||
|
||||
if (Judgement.TimeOffset < 0)
|
||||
return;
|
||||
|
||||
int countHit = NestedHitObjects.Count(o => o.Judgement.Result == HitResult.Hit);
|
||||
|
||||
if (countHit > drumRoll.RequiredGoodHits)
|
||||
{
|
||||
Judgement.Result = HitResult.Hit;
|
||||
Judgement.TaikoResult = countHit >= drumRoll.RequiredGreatHits ? TaikoHitResult.Great : TaikoHitResult.Good;
|
||||
}
|
||||
else
|
||||
Judgement.Result = HitResult.Miss;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using OpenTK.Input;
|
||||
using osu.Game.Modes.Taiko.Judgements;
|
||||
using System;
|
||||
using osu.Game.Modes.Objects.Drawables;
|
||||
|
||||
namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
{
|
||||
public class DrawableDrumRollTick : DrawableTaikoHitObject
|
||||
{
|
||||
private readonly DrumRollTick tick;
|
||||
|
||||
public DrawableDrumRollTick(DrumRollTick tick)
|
||||
: base(tick)
|
||||
{
|
||||
this.tick = tick;
|
||||
}
|
||||
|
||||
protected override TaikoJudgement CreateJudgement() => new TaikoDrumRollTickJudgement();
|
||||
|
||||
protected override void CheckJudgement(bool userTriggered)
|
||||
{
|
||||
if (!userTriggered)
|
||||
{
|
||||
if (Judgement.TimeOffset > tick.HitWindow)
|
||||
Judgement.Result = HitResult.Miss;
|
||||
return;
|
||||
}
|
||||
|
||||
if (Math.Abs(Judgement.TimeOffset) < tick.HitWindow)
|
||||
{
|
||||
Judgement.Result = HitResult.Hit;
|
||||
Judgement.TaikoResult = TaikoHitResult.Great;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void UpdateState(ArmedState state)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void UpdateScrollPosition(double time)
|
||||
{
|
||||
// Drum roll ticks shouldn't move
|
||||
}
|
||||
|
||||
protected override bool HandleKeyPress(Key key)
|
||||
{
|
||||
return !Judgement.Result.HasValue && UpdateJudgement(true);
|
||||
}
|
||||
}
|
||||
}
|
@ -101,4 +101,4 @@ namespace osu.Game.Modes.Taiko.Objects
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -15,5 +15,10 @@ namespace osu.Game.Modes.Taiko.Objects
|
||||
/// <para>Half of this value is the hit window of the tick.</para>
|
||||
/// </summary>
|
||||
public double TickTimeDistance;
|
||||
|
||||
/// <summary>
|
||||
/// The time allowed to hit this tick.
|
||||
/// </summary>
|
||||
public double HitWindow => TickTimeDistance / 2;
|
||||
}
|
||||
}
|
@ -54,16 +54,18 @@
|
||||
<Compile Include="Judgements\TaikoHitResult.cs" />
|
||||
<Compile Include="Objects\Drawable\DrawableHit.cs" />
|
||||
<Compile Include="Objects\Drawable\DrawableAccentedHit.cs" />
|
||||
<Compile Include="Objects\Drawable\Pieces\AccentedCirclePiece.cs" />
|
||||
<Compile Include="Objects\Drawable\DrawableDrumRoll.cs" />
|
||||
<Compile Include="Objects\Drawable\DrawableDrumRollTick.cs" />
|
||||
<Compile Include="Objects\Drawable\DrawableSwell.cs" />
|
||||
<Compile Include="Objects\Drawable\DrawableTaikoHitObject.cs" />
|
||||
<Compile Include="Objects\Drawable\Pieces\AccentedCirclePiece.cs" />
|
||||
<Compile Include="Objects\Drawable\Pieces\CirclePiece.cs" />
|
||||
<Compile Include="Objects\DrumRoll.cs" />
|
||||
<Compile Include="Objects\DrumRollTick.cs" />
|
||||
<Compile Include="Objects\Hit.cs" />
|
||||
<Compile Include="Objects\Swell.cs" />
|
||||
<Compile Include="Objects\Drawable\Pieces\CirclePiece.cs" />
|
||||
<Compile Include="TaikoDifficultyCalculator.cs" />
|
||||
<Compile Include="Objects\TaikoHitObject.cs" />
|
||||
<Compile Include="TaikoDifficultyCalculator.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Scoring\TaikoScoreProcessor.cs" />
|
||||
<Compile Include="UI\HitTarget.cs" />
|
||||
@ -100,4 +102,4 @@
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
</Project>
|
||||
|
Loading…
Reference in New Issue
Block a user