1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 21:03:08 +08:00

Merge pull request #516 from smoogipooo/taiko_bash_drawable

Drawable Bash Implementation (Input only)
This commit is contained in:
Dean Herbert 2017-03-27 12:20:05 +09:00 committed by GitHub
commit d6d19d726b
6 changed files with 82 additions and 14 deletions

View File

@ -61,7 +61,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps
if (endTimeData != null)
{
// We compute the end time manually to add in the Bash convert factor
return new Bash
return new Swell
{
StartTime = original.StartTime,
Sample = original.Sample,

View File

@ -0,0 +1,75 @@
// 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.Objects.Drawables;
using osu.Game.Modes.Taiko.Judgements;
using System;
namespace osu.Game.Modes.Taiko.Objects.Drawable
{
public class DrawableSwell : DrawableTaikoHitObject
{
/// <summary>
/// The amount of times the user has hit this swell.
/// </summary>
private int userHits;
private readonly Swell swell;
public DrawableSwell(Swell swell)
: base(swell)
{
this.swell = swell;
}
protected override void CheckJudgement(bool userTriggered)
{
if (userTriggered)
{
if (Time.Current < HitObject.StartTime)
return;
userHits++;
if (userHits == swell.RequiredHits)
{
Judgement.Result = HitResult.Hit;
Judgement.TaikoResult = TaikoHitResult.Great;
}
}
else
{
if (Judgement.TimeOffset < 0)
return;
if (userHits > swell.RequiredHits / 2)
{
Judgement.Result = HitResult.Hit;
Judgement.TaikoResult = TaikoHitResult.Good;
}
else
Judgement.Result = HitResult.Miss;
}
}
protected override void UpdateState(ArmedState state)
{
}
protected override void UpdateScrollPosition(double time)
{
base.UpdateScrollPosition(Math.Min(time, HitObject.StartTime));
}
protected override bool HandleKeyPress(Key key)
{
if (Judgement.Result.HasValue)
return false;
UpdateJudgement(true);
return true;
}
}
}

View File

@ -5,7 +5,6 @@ using OpenTK.Input;
using osu.Framework.Graphics;
using osu.Game.Modes.Objects.Drawables;
using osu.Game.Modes.Taiko.Judgements;
using osu.Game.Modes.Taiko.Objects.Drawable.Pieces;
using System.Collections.Generic;
using osu.Framework.Input;
@ -26,11 +25,6 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
Origin = Anchor.Centre;
RelativePositionAxes = Axes.X;
Children = new[]
{
CreateCircle()
};
}
protected override void LoadComplete()
@ -73,7 +67,5 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
// Handle it!
return HandleKeyPress(args.Key);
}
protected abstract CirclePiece CreateCircle();
}
}

View File

@ -8,14 +8,14 @@ using osu.Game.Modes.Objects.Types;
namespace osu.Game.Modes.Taiko.Objects
{
public class Bash : TaikoHitObject, IHasEndTime
public class Swell : TaikoHitObject, IHasEndTime
{
public double EndTime { get; set; }
public double Duration => EndTime - StartTime;
/// <summary>
/// The number of hits required to complete the bash successfully.
/// The number of hits required to complete the swell successfully.
/// </summary>
public int RequiredHits { get; protected set; }

View File

@ -165,7 +165,7 @@ namespace osu.Game.Modes.Taiko.Scoring
SecondHit = obj.Accented
});
}
else if (obj is Bash)
else if (obj is Swell)
{
AddJudgement(new TaikoJudgement
{

View File

@ -54,12 +54,13 @@
<Compile Include="Judgements\TaikoHitResult.cs" />
<Compile Include="Objects\Drawable\DrawableHit.cs" />
<Compile Include="Objects\Drawable\DrawableAccentedHit.cs" />
<Compile Include="Objects\Drawable\DrawableTaikoHitObject.cs" />
<Compile Include="Objects\Bash.cs" />
<Compile Include="Objects\Drawable\Pieces\AccentedCirclePiece.cs" />
<Compile Include="Objects\Drawable\DrawableSwell.cs" />
<Compile Include="Objects\Drawable\DrawableTaikoHitObject.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" />