From 2e0d100a226823ee7279fc455325df5eb4f4d352 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 17 Mar 2017 15:19:56 +0900 Subject: [PATCH 1/9] Add base DrawableTaikoHitObject, remove DrawableTaikoHit. --- .../Objects/Drawable/DrawableTaikoHit.cs | 39 ------------------- .../Drawable/DrawableTaikoHitObject.cs | 34 ++++++++++++++++ .../osu.Game.Modes.Taiko.csproj | 2 +- 3 files changed, 35 insertions(+), 40 deletions(-) delete mode 100644 osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHit.cs create mode 100644 osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs 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 760977ef5b..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 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"); - - 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..e29caf3f49 --- /dev/null +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs @@ -0,0 +1,34 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Modes.Objects.Drawables; +using osu.Game.Modes.Taiko.Judgements; + +namespace osu.Game.Modes.Taiko.Objects.Drawable +{ + public class DrawableTaikoHitObject : DrawableHitObject + { + public DrawableTaikoHitObject(TaikoHitObject hitObject) + : base(hitObject) + { + LifetimeStart = HitObject.StartTime - HitObject.PreEmpt; + LifetimeEnd = HitObject.StartTime + HitObject.PreEmpt; + } + + protected override TaikoJudgementInfo CreateJudgementInfo() => new TaikoJudgementInfo(); + + protected override void UpdateState(ArmedState state) + { + } + + protected 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 0e9e6a56b4..aab9a17276 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -50,9 +50,9 @@ + - From cdfe95c15930ac6e0072699d7f7ab2c0725fccaf Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 17 Mar 2017 16:05:16 +0900 Subject: [PATCH 2/9] Add AcentColour and xmldoc. --- .../Objects/Drawable/DrawableTaikoHitObject.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs index e29caf3f49..4adbf2cb33 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs @@ -1,6 +1,7 @@ // 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.Game.Modes.Objects.Drawables; using osu.Game.Modes.Taiko.Judgements; @@ -8,6 +9,11 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { public class DrawableTaikoHitObject : DrawableHitObject { + /// + /// The colour used for various elements of this DrawableHitObject. + /// + public virtual Color4 AccentColour { get; } + public DrawableTaikoHitObject(TaikoHitObject hitObject) : base(hitObject) { @@ -21,6 +27,11 @@ 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)); From 35f63cb2aa774daec62fc13fb7085cb9f05aef9f Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 17 Mar 2017 16:10:40 +0900 Subject: [PATCH 3/9] Set Anchor/Origin and RelativePositionAxes. --- .../Objects/Drawable/DrawableTaikoHitObject.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs index 4adbf2cb33..321a1beea7 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs @@ -2,6 +2,7 @@ // 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; @@ -17,7 +18,12 @@ public class DrawableTaikoHitObject : DrawableHitObject Date: Fri, 17 Mar 2017 18:55:54 +0900 Subject: [PATCH 4/9] Make DrawableTaikoHitObject generic. --- .../Objects/Drawable/DrawableTaikoHitObject.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs index 321a1beea7..5e8aeb4844 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs @@ -8,14 +8,15 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { - public class DrawableTaikoHitObject : DrawableHitObject + public class DrawableTaikoHitObject : DrawableHitObject + where TTaikoObject : TaikoHitObject { /// /// The colour used for various elements of this DrawableHitObject. /// public virtual Color4 AccentColour { get; } - public DrawableTaikoHitObject(TaikoHitObject hitObject) + public DrawableTaikoHitObject(TTaikoObject hitObject) : base(hitObject) { Anchor = Anchor.CentreLeft; From 5136064cb35b706985d50a564ec079e98fd544f5 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 17 Mar 2017 19:23:18 +0900 Subject: [PATCH 5/9] Revert "Make DrawableTaikoHitObject generic." This reverts commit 0e4ed829f2d148558d2f9a671ea4118ea1ab3965. --- .../Objects/Drawable/DrawableTaikoHitObject.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs index 5e8aeb4844..321a1beea7 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs @@ -8,15 +8,14 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { - public class DrawableTaikoHitObject : DrawableHitObject - where TTaikoObject : TaikoHitObject + public class DrawableTaikoHitObject : DrawableHitObject { /// /// The colour used for various elements of this DrawableHitObject. /// public virtual Color4 AccentColour { get; } - public DrawableTaikoHitObject(TTaikoObject hitObject) + public DrawableTaikoHitObject(TaikoHitObject hitObject) : base(hitObject) { Anchor = Anchor.CentreLeft; From 75fb7a3eb34577f302e05547b5feb5be7704a248 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 20 Mar 2017 18:10:09 +0900 Subject: [PATCH 6/9] Suppress Resharper. --- .../Objects/Drawable/DrawableTaikoHitObject.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs index 321a1beea7..bc52be63c6 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs @@ -25,6 +25,9 @@ public DrawableTaikoHitObject(TaikoHitObject hitObject) LifetimeStart = HitObject.StartTime - HitObject.PreEmpt * 2; LifetimeEnd = HitObject.StartTime + HitObject.PreEmpt; + + // Todo: Remove (suppresses Resharper) + AccentColour = Color4.White; } protected override TaikoJudgementInfo CreateJudgementInfo() => new TaikoJudgementInfo(); From 24e78d015e40b633cdbd5b326aab94f82c504465 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 22 Mar 2017 01:46:06 +0900 Subject: [PATCH 7/9] Make UpdateScrollPosition virtual. --- osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs index bc52be63c6..1cd02e8292 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs @@ -41,7 +41,7 @@ protected override void UpdateState(ArmedState state) /// a time value and the HitObject's StartTime. /// /// - protected void UpdateScrollPosition(double time) + protected virtual void UpdateScrollPosition(double time) { MoveToX((float)((HitObject.StartTime - time) / HitObject.PreEmpt)); } From aa8780797ebd3e6df63a6a9d1e2a96204348829a Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 22 Mar 2017 15:22:02 +0900 Subject: [PATCH 8/9] Abstract class + move AccentColour to base. --- .../Objects/Drawable/DrawableTaikoHitObject.cs | 17 ++--------------- .../Objects/Drawables/DrawableHitObject.cs | 6 ++++++ 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs index 1cd02e8292..864a7b80a6 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs @@ -1,21 +1,15 @@ // 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; namespace osu.Game.Modes.Taiko.Objects.Drawable { - public class DrawableTaikoHitObject : DrawableHitObject + public abstract class DrawableTaikoHitObject : DrawableHitObject { - /// - /// The colour used for various elements of this DrawableHitObject. - /// - public virtual Color4 AccentColour { get; } - - public DrawableTaikoHitObject(TaikoHitObject hitObject) + protected DrawableTaikoHitObject(TaikoHitObject hitObject) : base(hitObject) { Anchor = Anchor.CentreLeft; @@ -25,17 +19,10 @@ public DrawableTaikoHitObject(TaikoHitObject hitObject) LifetimeStart = HitObject.StartTime - HitObject.PreEmpt * 2; LifetimeEnd = HitObject.StartTime + HitObject.PreEmpt; - - // Todo: Remove (suppresses Resharper) - AccentColour = Color4.White; } 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. diff --git a/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs index 3ff30bd90e..f3bb07d2d8 100644 --- a/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs @@ -11,6 +11,7 @@ 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 { @@ -73,6 +74,11 @@ public abstract class DrawableHitObject : DrawableHitObject public TObject HitObject; + /// + /// The colour used for various elements of this DrawableHitObject. + /// + public Color4 AccentColour { get; protected set; } + protected DrawableHitObject(TObject hitObject) { HitObject = hitObject; From 5daa5745517eba9a7afc5595ba562b70aa9bd289 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 23 Mar 2017 11:05:58 +0900 Subject: [PATCH 9/9] Don't set lifetime until LoadComplete (fixes possible clock nullref if added without a clock). --- .../Objects/Drawable/DrawableTaikoHitObject.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs index 864a7b80a6..ebad53e787 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs @@ -16,9 +16,14 @@ protected DrawableTaikoHitObject(TaikoHitObject hitObject) 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();