mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Major rsefinements to taiko drawable classes.
This commit is contained in:
@ -3,15 +3,18 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Input;
|
||||
using osu.Game.Modes.Objects.Drawables;
|
||||
using osu.Game.Modes.Taiko.Judgements;
|
||||
using osu.Game.Modes.Taiko.Objects.Drawables.Pieces;
|
||||
using OpenTK;
|
||||
using OpenTK.Input;
|
||||
|
||||
namespace osu.Game.Modes.Taiko.Objects.Drawables
|
||||
{
|
||||
public abstract class DrawableTaikoHitObject : DrawableHitObject<TaikoHitObject, TaikoJudgement>
|
||||
public abstract class DrawableTaikoHitObject<TaikoHitType> : DrawableHitObject<TaikoHitObject, TaikoJudgement>
|
||||
where TaikoHitType : TaikoHitObject
|
||||
{
|
||||
/// <summary>
|
||||
/// A list of keys which this hit object will accept. These are the standard Taiko keys for now.
|
||||
@ -19,35 +22,56 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables
|
||||
/// </summary>
|
||||
private readonly List<Key> validKeys = new List<Key>(new[] { Key.D, Key.F, Key.J, Key.K });
|
||||
|
||||
protected DrawableTaikoHitObject(TaikoHitObject hitObject)
|
||||
public override Vector2 OriginPosition => new Vector2(DrawHeight / 2);
|
||||
|
||||
protected override Container<Drawable> Content => bodyContainer;
|
||||
|
||||
protected readonly TaikoPiece MainPiece;
|
||||
|
||||
private readonly Container bodyContainer;
|
||||
|
||||
public new TaikoHitType HitObject;
|
||||
|
||||
protected DrawableTaikoHitObject(TaikoHitType hitObject)
|
||||
: base(hitObject)
|
||||
{
|
||||
HitObject = hitObject;
|
||||
|
||||
Anchor = Anchor.CentreLeft;
|
||||
Origin = Anchor.CentreLeft;
|
||||
Origin = Anchor.Custom;
|
||||
|
||||
AutoSizeAxes = Axes.Both;
|
||||
|
||||
RelativePositionAxes = Axes.X;
|
||||
|
||||
AddInternal(bodyContainer = new Container
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Children = new[]
|
||||
{
|
||||
MainPiece = CreateMainPiece()
|
||||
}
|
||||
});
|
||||
|
||||
MainPiece.KiaiMode = HitObject.Kiai;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
LifetimeStart = HitObject.StartTime - HitObject.PreEmpt * 2;
|
||||
|
||||
base.LoadComplete();
|
||||
}
|
||||
|
||||
protected override TaikoJudgement CreateJudgement() => new TaikoJudgement();
|
||||
|
||||
protected virtual CirclePiece CreateCirclePiece() => new CirclePiece();
|
||||
protected virtual TaikoPiece CreateMainPiece() => new CirclePiece(HitObject.IsStrong);
|
||||
|
||||
/// <summary>
|
||||
/// Sets the scroll position of the DrawableHitObject relative to the offset between
|
||||
/// a time value and the HitObject's StartTime.
|
||||
/// </summary>
|
||||
/// <param name="time"></param>
|
||||
protected virtual void UpdateScrollPosition(double time)
|
||||
{
|
||||
MoveToX((float)((HitObject.StartTime - time) / HitObject.PreEmpt));
|
||||
}
|
||||
protected virtual void UpdateScrollPosition(double time) => MoveToX((float)((HitObject.StartTime - time) / HitObject.PreEmpt));
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
|
Reference in New Issue
Block a user