mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 06:03:08 +08:00
Implement drawable drumroll.
This commit is contained in:
parent
2e8607687c
commit
6b1dab5b83
@ -6,6 +6,7 @@ using osu.Framework.Screens.Testing;
|
||||
using osu.Game.Modes.Objects.Drawables;
|
||||
using osu.Game.Modes.Taiko.Judgements;
|
||||
using osu.Game.Modes.Taiko.Objects;
|
||||
using osu.Game.Modes.Taiko.Objects.Drawable;
|
||||
using osu.Game.Modes.Taiko.UI;
|
||||
|
||||
namespace osu.Desktop.VisualTests.Tests
|
||||
@ -22,6 +23,8 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
|
||||
AddButton("Hit!", addHitJudgement);
|
||||
AddButton("Miss :(", addMissJudgement);
|
||||
AddButton("DrumRoll", () => addDrumRoll(false));
|
||||
AddButton("Strong DrumRoll", () => addDrumRoll(true));
|
||||
|
||||
Add(playfield = new TaikoPlayfield
|
||||
{
|
||||
@ -60,6 +63,21 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
});
|
||||
}
|
||||
|
||||
private void addDrumRoll(bool strong)
|
||||
{
|
||||
var d = new DrumRoll
|
||||
{
|
||||
StartTime = Time.Current + 1000,
|
||||
Distance = 2000,
|
||||
PreEmpt = 1000,
|
||||
};
|
||||
|
||||
if (strong)
|
||||
playfield.Add(new DrawableStrongDrumRoll(d));
|
||||
else
|
||||
playfield.Add(new DrawableDrumRoll(d));
|
||||
}
|
||||
|
||||
private class DrawableTestHit : DrawableHitObject<TaikoHitObject, TaikoJudgement>
|
||||
{
|
||||
public DrawableTestHit(TaikoHitObject hitObject)
|
||||
|
@ -1,8 +1,10 @@
|
||||
// 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.Framework.Graphics;
|
||||
using osu.Game.Modes.Objects.Drawables;
|
||||
using osu.Game.Modes.Taiko.Judgements;
|
||||
using osu.Game.Modes.Taiko.Objects.Drawable.Pieces;
|
||||
using System.Linq;
|
||||
|
||||
namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
@ -16,25 +18,23 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
{
|
||||
this.drumRoll = drumRoll;
|
||||
|
||||
int tickIndex = 0;
|
||||
RelativeSizeAxes = Axes.X;
|
||||
Width = (float)(drumRoll.Duration / drumRoll.PreEmpt);
|
||||
|
||||
Add(new DrumRollCirclePiece(CreateCirclePiece()));
|
||||
|
||||
foreach (var tick in drumRoll.Ticks)
|
||||
{
|
||||
var newTick = new DrawableDrumRollTick(tick)
|
||||
{
|
||||
Depth = tickIndex,
|
||||
X = (float)((tick.StartTime - HitObject.StartTime) / drumRoll.Duration)
|
||||
};
|
||||
|
||||
AddNested(newTick);
|
||||
|
||||
tickIndex++;
|
||||
Add(newTick);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void UpdateState(ArmedState state)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void CheckJudgement(bool userTriggered)
|
||||
{
|
||||
if (userTriggered)
|
||||
@ -53,5 +53,11 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
else
|
||||
Judgement.Result = HitResult.Miss;
|
||||
}
|
||||
|
||||
protected override void UpdateState(ArmedState state)
|
||||
{
|
||||
}
|
||||
|
||||
protected virtual CirclePiece CreateCirclePiece() => new CirclePiece();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,20 @@
|
||||
// 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.Taiko.Judgements;
|
||||
using osu.Game.Modes.Taiko.Objects.Drawable.Pieces;
|
||||
|
||||
namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
{
|
||||
public class DrawableStrongDrumRoll : DrawableDrumRoll
|
||||
{
|
||||
public DrawableStrongDrumRoll(DrumRoll drumRoll)
|
||||
: base(drumRoll)
|
||||
{
|
||||
}
|
||||
|
||||
protected override TaikoJudgement CreateJudgement() => new TaikoJudgement { SecondHit = true };
|
||||
|
||||
protected override CirclePiece CreateCirclePiece() => new StrongCirclePiece();
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
// 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.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces
|
||||
{
|
||||
public class DrumRollCirclePiece : Container
|
||||
{
|
||||
private readonly CirclePiece circle;
|
||||
|
||||
public DrumRollCirclePiece(CirclePiece piece)
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
|
||||
Add(circle = piece);
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
circle.AccentColour = colours.YellowDark;
|
||||
}
|
||||
}
|
||||
}
|
@ -53,11 +53,13 @@
|
||||
<Compile Include="Judgements\TaikoJudgement.cs" />
|
||||
<Compile Include="Judgements\TaikoHitResult.cs" />
|
||||
<Compile Include="Objects\Drawable\DrawableHit.cs" />
|
||||
<Compile Include="Objects\Drawable\DrawableStrongDrumRoll.cs" />
|
||||
<Compile Include="Objects\Drawable\DrawableStrongHit.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\DrumRollCirclePiece.cs" />
|
||||
<Compile Include="Objects\Drawable\Pieces\StrongCirclePiece.cs" />
|
||||
<Compile Include="Objects\Drawable\Pieces\CirclePiece.cs" />
|
||||
<Compile Include="Objects\DrumRoll.cs" />
|
||||
@ -102,4 +104,4 @@
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
</Project>
|
Loading…
Reference in New Issue
Block a user