2018-01-05 19:21:19 +08:00
|
|
|
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
2017-03-20 18:17:31 +08:00
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
|
|
|
|
using osu.Framework.Graphics;
|
2017-08-20 20:18:21 +08:00
|
|
|
|
using osu.Framework.Input.Bindings;
|
2017-04-18 15:05:58 +08:00
|
|
|
|
using osu.Game.Rulesets.Objects.Drawables;
|
|
|
|
|
using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces;
|
2017-04-05 09:01:40 +08:00
|
|
|
|
using OpenTK;
|
2017-12-26 13:18:23 +08:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using osu.Game.Audio;
|
|
|
|
|
using System.Collections.Generic;
|
2017-03-20 18:17:31 +08:00
|
|
|
|
|
2017-04-18 15:05:58 +08:00
|
|
|
|
namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
2017-03-20 18:17:31 +08:00
|
|
|
|
{
|
2018-01-04 17:50:17 +08:00
|
|
|
|
public abstract class DrawableTaikoHitObject<TaikoHitType> : DrawableHitObject<TaikoHitObject>, IKeyBindingHandler<TaikoAction>
|
2017-09-06 17:05:51 +08:00
|
|
|
|
where TaikoHitType : TaikoHitObject
|
2017-03-20 18:17:31 +08:00
|
|
|
|
{
|
2017-04-05 09:01:40 +08:00
|
|
|
|
public override Vector2 OriginPosition => new Vector2(DrawHeight / 2);
|
|
|
|
|
|
2017-08-22 19:51:53 +08:00
|
|
|
|
protected readonly Vector2 BaseSize;
|
|
|
|
|
|
2017-04-05 09:01:40 +08:00
|
|
|
|
protected readonly TaikoPiece MainPiece;
|
|
|
|
|
|
|
|
|
|
public new TaikoHitType HitObject;
|
|
|
|
|
|
|
|
|
|
protected DrawableTaikoHitObject(TaikoHitType hitObject)
|
2017-03-20 18:17:31 +08:00
|
|
|
|
: base(hitObject)
|
|
|
|
|
{
|
2017-04-05 09:01:40 +08:00
|
|
|
|
HitObject = hitObject;
|
|
|
|
|
|
2017-03-20 18:17:31 +08:00
|
|
|
|
Anchor = Anchor.CentreLeft;
|
2017-04-05 09:01:40 +08:00
|
|
|
|
Origin = Anchor.Custom;
|
|
|
|
|
|
2017-08-03 12:24:13 +08:00
|
|
|
|
RelativeSizeAxes = Axes.Both;
|
2017-08-22 19:51:53 +08:00
|
|
|
|
Size = BaseSize = new Vector2(HitObject.IsStrong ? TaikoHitObject.DEFAULT_STRONG_SIZE : TaikoHitObject.DEFAULT_SIZE);
|
2017-03-20 18:17:31 +08:00
|
|
|
|
|
2017-08-03 12:24:13 +08:00
|
|
|
|
Add(MainPiece = CreateMainPiece());
|
2017-04-05 09:01:40 +08:00
|
|
|
|
MainPiece.KiaiMode = HitObject.Kiai;
|
2017-03-20 18:17:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
2017-12-26 13:18:23 +08:00
|
|
|
|
// Normal and clap samples are handled by the drum
|
|
|
|
|
protected override IEnumerable<SampleInfo> GetSamples() => HitObject.Samples.Where(s => s.Name != SampleInfo.HIT_NORMAL && s.Name != SampleInfo.HIT_CLAP);
|
|
|
|
|
|
2017-12-26 18:55:56 +08:00
|
|
|
|
protected override string SampleNamespace => "Taiko";
|
|
|
|
|
|
2017-08-03 18:49:50 +08:00
|
|
|
|
protected virtual TaikoPiece CreateMainPiece() => new CirclePiece();
|
2017-04-04 11:53:06 +08:00
|
|
|
|
|
2017-08-20 20:18:21 +08:00
|
|
|
|
public abstract bool OnPressed(TaikoAction action);
|
2017-03-25 22:43:41 +08:00
|
|
|
|
|
2017-08-20 20:18:21 +08:00
|
|
|
|
public virtual bool OnReleased(TaikoAction action) => false;
|
|
|
|
|
}
|
2017-03-20 18:17:31 +08:00
|
|
|
|
}
|