From a7eb219d39008497c92b1ae900e231c632345958 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 20 Mar 2017 19:17:31 +0900 Subject: [PATCH] Add basic support for drawing circles. Conflicts: osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs --- .../Drawable/DrawableTaikoHitObject.cs | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs new file mode 100644 index 0000000000..8dcb73da51 --- /dev/null +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs @@ -0,0 +1,62 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// 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 + { + /// + /// The colour used for various elements of this DrawableHitObject. + /// + 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) + { + } + + /// + /// Sets the scroll position of the DrawableHitObject relative to the offset between + /// a time value and the HitObject's StartTime. + /// + /// + protected void UpdateScrollPosition(double time) + { + MoveToX((float)((HitObject.StartTime - time) / HitObject.PreEmpt)); + } + + protected override void Update() + { + UpdateScrollPosition(Time.Current); + } + + protected abstract ScrollingCirclePiece CreateCircle(); + } +}