diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHit.cs deleted file mode 100644 index 13b543b908..0000000000 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHit.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Textures; -using osu.Framework.Graphics.Transforms; -using OpenTK; - -namespace osu.Game.Modes.Taiko.Objects.Drawable -{ - internal class DrawableTaikoHit : Sprite - { - private readonly TaikoHitObject h; - - public DrawableTaikoHit(TaikoHitObject h) - { - this.h = h; - - Origin = Anchor.Centre; - Scale = new Vector2(0.2f); - RelativePositionAxes = Axes.Both; - Position = new Vector2(1.1f, 0.5f); - } - - [BackgroundDependencyLoader] - private void load(TextureStore textures) - { - Texture = textures.Get(@"Menu/logo"); - - const double duration = 0; - - Transforms.Add(new TransformPositionX { StartTime = h.StartTime - 200, EndTime = h.StartTime, StartValue = 1.1f, EndValue = 0.1f }); - Transforms.Add(new TransformAlpha { StartTime = h.StartTime + duration + 200, EndTime = h.StartTime + duration + 400, StartValue = 1, EndValue = 0 }); - Expire(true); - } - } -} 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..ebad53e787 --- /dev/null +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs @@ -0,0 +1,46 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; +using osu.Game.Modes.Objects.Drawables; +using osu.Game.Modes.Taiko.Judgements; + +namespace osu.Game.Modes.Taiko.Objects.Drawable +{ + public abstract class DrawableTaikoHitObject : DrawableHitObject + { + protected DrawableTaikoHitObject(TaikoHitObject hitObject) + : base(hitObject) + { + Anchor = Anchor.CentreLeft; + Origin = Anchor.Centre; + + RelativePositionAxes = Axes.X; + } + + protected override void LoadComplete() + { + LifetimeStart = HitObject.StartTime - HitObject.PreEmpt * 2; + LifetimeEnd = HitObject.StartTime + HitObject.PreEmpt; + + base.LoadComplete(); + } + + protected override TaikoJudgementInfo CreateJudgementInfo() => new TaikoJudgementInfo(); + + /// + /// Sets the scroll position of the DrawableHitObject relative to the offset between + /// a time value and the HitObject's StartTime. + /// + /// + protected virtual void UpdateScrollPosition(double time) + { + MoveToX((float)((HitObject.StartTime - time) / HitObject.PreEmpt)); + } + + protected override void Update() + { + UpdateScrollPosition(Time.Current); + } + } +} diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index f7bc6883e1..312bde5f04 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -51,12 +51,12 @@ + - diff --git a/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs index 6322614496..277e65c1b1 100644 --- a/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs @@ -11,6 +11,7 @@ using osu.Game.Beatmaps.Samples; using osu.Game.Modes.Judgements; using Container = osu.Framework.Graphics.Containers.Container; using osu.Game.Modes.Objects.Types; +using OpenTK.Graphics; namespace osu.Game.Modes.Objects.Drawables { @@ -76,6 +77,11 @@ namespace osu.Game.Modes.Objects.Drawables public TObject HitObject; + /// + /// The colour used for various elements of this DrawableHitObject. + /// + public Color4 AccentColour { get; protected set; } + protected DrawableHitObject(TObject hitObject) { HitObject = hitObject;