mirror of
https://github.com/ppy/osu.git
synced 2024-12-16 04:22:54 +08:00
Add basic support for drawing circles.
Conflicts: osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs
This commit is contained in:
parent
8f90bcf7fd
commit
a7eb219d39
@ -0,0 +1,62 @@
|
|||||||
|
// 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.Graphics;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Game.Modes.Objects.Drawables;
|
||||||
|
using osu.Game.Modes.Taiko.Judgements;
|
||||||
|
using osu.Game.Modes.Taiko.Objects.Drawable.Pieces;
|
||||||
|
|
||||||
|
namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||||
|
{
|
||||||
|
public abstract class DrawableTaikoHitObject : DrawableHitObject<TaikoHitObject, TaikoJudgementInfo>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The colour used for various elements of this DrawableHitObject.
|
||||||
|
/// </summary>
|
||||||
|
public virtual Color4 AccentColour { get; }
|
||||||
|
|
||||||
|
protected DrawableTaikoHitObject(TaikoHitObject hitObject)
|
||||||
|
: base(hitObject)
|
||||||
|
{
|
||||||
|
Anchor = Anchor.CentreLeft;
|
||||||
|
Origin = Anchor.Centre;
|
||||||
|
|
||||||
|
RelativePositionAxes = Axes.X;
|
||||||
|
|
||||||
|
LifetimeStart = HitObject.StartTime - HitObject.PreEmpt * 2;
|
||||||
|
LifetimeEnd = HitObject.StartTime + HitObject.PreEmpt;
|
||||||
|
|
||||||
|
// Todo: Remove (suppresses Resharper)
|
||||||
|
AccentColour = Color4.White;
|
||||||
|
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
CreateCircle()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override TaikoJudgementInfo CreateJudgementInfo() => new TaikoJudgementInfo();
|
||||||
|
|
||||||
|
protected override void UpdateState(ArmedState state)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <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 void UpdateScrollPosition(double time)
|
||||||
|
{
|
||||||
|
MoveToX((float)((HitObject.StartTime - time) / HitObject.PreEmpt));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Update()
|
||||||
|
{
|
||||||
|
UpdateScrollPosition(Time.Current);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract ScrollingCirclePiece CreateCircle();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user