mirror of
https://github.com/ppy/osu.git
synced 2024-12-20 14:32:55 +08:00
9690591593
This is a temporary solution for now that uses DrawableHitObject.SampleNamespace for the override. We will not want to do this going forward, and instead have the rulesets add their custom resource stores to the games', but that requires deciding where/when to apply/remove such resource stores, and is probably left to skinning.
53 lines
1.9 KiB
C#
53 lines
1.9 KiB
C#
// 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.Framework.Input.Bindings;
|
|
using osu.Game.Rulesets.Objects.Drawables;
|
|
using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces;
|
|
using OpenTK;
|
|
using System.Linq;
|
|
using osu.Game.Audio;
|
|
using System.Collections.Generic;
|
|
|
|
namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|
{
|
|
public abstract class DrawableTaikoHitObject<TaikoHitType> : DrawableScrollingHitObject<TaikoHitObject>, IKeyBindingHandler<TaikoAction>
|
|
where TaikoHitType : TaikoHitObject
|
|
{
|
|
public override Vector2 OriginPosition => new Vector2(DrawHeight / 2);
|
|
|
|
protected readonly Vector2 BaseSize;
|
|
|
|
protected readonly TaikoPiece MainPiece;
|
|
|
|
public new TaikoHitType HitObject;
|
|
|
|
protected DrawableTaikoHitObject(TaikoHitType hitObject)
|
|
: base(hitObject)
|
|
{
|
|
HitObject = hitObject;
|
|
|
|
Anchor = Anchor.CentreLeft;
|
|
Origin = Anchor.Custom;
|
|
|
|
RelativeSizeAxes = Axes.Both;
|
|
Size = BaseSize = new Vector2(HitObject.IsStrong ? TaikoHitObject.DEFAULT_STRONG_SIZE : TaikoHitObject.DEFAULT_SIZE);
|
|
|
|
Add(MainPiece = CreateMainPiece());
|
|
MainPiece.KiaiMode = HitObject.Kiai;
|
|
}
|
|
|
|
// 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);
|
|
|
|
protected override string SampleNamespace => "Taiko";
|
|
|
|
protected virtual TaikoPiece CreateMainPiece() => new CirclePiece();
|
|
|
|
public abstract bool OnPressed(TaikoAction action);
|
|
|
|
public virtual bool OnReleased(TaikoAction action) => false;
|
|
}
|
|
}
|