From 554d0d6fb8fa7b7dbd8c3f8454575ed1bfeda2b2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 2 Aug 2017 19:37:20 +0900 Subject: [PATCH 01/12] Update basic structure of Catch project --- .../Beatmaps/CatchBeatmapConverter.cs | 9 +- .../Objects/Drawable/DrawableFruit.cs | 83 +++++++++++++++---- .../UI/CatchHitRenderer.cs | 9 +- 3 files changed, 85 insertions(+), 16 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs index f9859cd244..40180ac3a0 100644 --- a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs +++ b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs @@ -8,6 +8,7 @@ using System; using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Beatmaps; using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Osu.UI; namespace osu.Game.Rulesets.Catch.Beatmaps { @@ -17,7 +18,13 @@ namespace osu.Game.Rulesets.Catch.Beatmaps protected override IEnumerable ConvertHitObject(HitObject original, Beatmap beatmap) { - yield return null; + var catchHit = original as CatchBaseHit; + + yield return catchHit ?? new Fruit + { + StartTime = original.StartTime, + Position = ((IHasXPosition)original).X / OsuPlayfield.BASE_SIZE.X + }; } } } diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs index 3e7d9bd6d7..01f9a78c8e 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs @@ -3,33 +3,88 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Textures; +using osu.Framework.Graphics.Shapes; +using osu.Framework.MathUtils; +using osu.Game.Rulesets.Catch.Judgements; +using osu.Game.Rulesets.Objects.Drawables; using OpenTK; namespace osu.Game.Rulesets.Catch.Objects.Drawable { - internal class DrawableFruit : Sprite + internal class DrawableFruit : DrawableHitObject { - //private readonly CatchBaseHit h; - - public DrawableFruit(CatchBaseHit h) + public DrawableFruit(CatchBaseHit h) : base(h) { - //this.h = h; - Origin = Anchor.Centre; - Scale = new Vector2(0.1f); - RelativePositionAxes = Axes.Y; + Size = new Vector2(50); + RelativePositionAxes = Axes.Both; Position = new Vector2(h.Position, -0.1f); + Rotation = (float)(RNG.NextDouble() - 0.5f) * 40; + + Alpha = 0; } [BackgroundDependencyLoader] - private void load(TextureStore textures) + private void load() { - Texture = textures.Get(@"Menu/logo"); + Children = new Framework.Graphics.Drawable[] + { + new Circle + { + RelativePositionAxes = Axes.Both, + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.TopCentre, + Origin = Anchor.Centre, + Scale = new Vector2(0.12f), + Y = 0.08f, + }, + new Circle + { + RelativePositionAxes = Axes.Both, + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.TopCentre, + Origin = Anchor.Centre, + Scale = new Vector2(0.32f), + Position = new Vector2(-0.16f, 0.3f), + }, + new Circle + { + RelativePositionAxes = Axes.Both, + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.TopCentre, + Origin = Anchor.Centre, + Scale = new Vector2(0.32f), + Position = new Vector2(0.16f, 0.3f), + }, + new Circle + { + RelativePositionAxes = Axes.Both, + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.TopCentre, + Origin = Anchor.Centre, + Scale = new Vector2(0.32f), + Position = new Vector2(0, 0.6f), + }, + }; + + Alpha = 0; + } + + protected override CatchJudgement CreateJudgement() => new CatchJudgement(); + + private const float preempt = 1000; + + protected override void UpdateState(ArmedState state) + { + using (BeginAbsoluteSequence(HitObject.StartTime - preempt)) + { + // default state + this.MoveToY(-0.1f).FadeOut(); + + // animation + this.FadeIn(200).MoveToY(0.9f, preempt); + } - //Transforms.Add(new TransformPosition { StartTime = h.StartTime - 200, EndTime = h.StartTime, StartValue = new Vector2(h.Position, -0.1f), EndValue = new Vector2(h.Position, 0.9f) }); - //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.Rulesets.Catch/UI/CatchHitRenderer.cs b/osu.Game.Rulesets.Catch/UI/CatchHitRenderer.cs index 179440adb3..cd6adfeea9 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchHitRenderer.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchHitRenderer.cs @@ -6,6 +6,7 @@ using osu.Game.Rulesets.Beatmaps; using osu.Game.Rulesets.Catch.Beatmaps; using osu.Game.Rulesets.Catch.Judgements; using osu.Game.Rulesets.Catch.Objects; +using osu.Game.Rulesets.Catch.Objects.Drawable; using osu.Game.Rulesets.Catch.Scoring; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Scoring; @@ -26,6 +27,12 @@ namespace osu.Game.Rulesets.Catch.UI protected override Playfield CreatePlayfield() => new CatchPlayfield(); - protected override DrawableHitObject GetVisualRepresentation(CatchBaseHit h) => null; + protected override DrawableHitObject GetVisualRepresentation(CatchBaseHit h) + { + if (h is Fruit) + return new DrawableFruit(h); + + return null; + } } } From 81b738f68c8d1245c0b34f557538e1fcc01c9c72 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 2 Aug 2017 20:28:24 +0900 Subject: [PATCH 02/12] Add basic Catcher --- osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs | 18 ++++- osu.Game.Rulesets.Catch/UI/Catcher.cs | 73 +++++++++++++++++++ .../osu.Game.Rulesets.Catch.csproj | 1 + 3 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 osu.Game.Rulesets.Catch/UI/Catcher.cs diff --git a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs index 8be52150fc..3aa5b3f1e3 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs @@ -18,7 +18,23 @@ namespace osu.Game.Rulesets.Catch.UI Anchor = Anchor.BottomCentre; Origin = Anchor.BottomCentre; - Add(new Box { RelativeSizeAxes = Axes.Both, Alpha = 0.5f }); + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Alpha = 0.5f + }, + new Catcher + { + RelativePositionAxes = Axes.Both, + RelativeSizeAxes = Axes.Both, + Scale = new Vector2(0.2f), + FillMode = FillMode.Fit, + Origin = Anchor.TopCentre, + Position = new Vector2(0.5f, 0.9f), + } + }; } } } \ No newline at end of file diff --git a/osu.Game.Rulesets.Catch/UI/Catcher.cs b/osu.Game.Rulesets.Catch/UI/Catcher.cs new file mode 100644 index 0000000000..42e4f03da1 --- /dev/null +++ b/osu.Game.Rulesets.Catch/UI/Catcher.cs @@ -0,0 +1,73 @@ +using System; +using osu.Framework.Allocation; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Textures; +using osu.Framework.Input; +using OpenTK; +using OpenTK.Input; + +namespace osu.Game.Rulesets.Catch.UI +{ + public class Catcher : Sprite + { + public override bool HandleInput => true; + + [BackgroundDependencyLoader] + private void load(TextureStore textures) + { + Texture = textures.Get(@"Play/Catch/fruit-catcher-idle"); + } + + private bool leftPressed; + private bool rightPressed; + + private int currentDirection; + + protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + { + if (args.Repeat) return true; + + switch (args.Key) + { + case Key.Left: + currentDirection = -1; + leftPressed = true; + return true; + case Key.Right: + currentDirection = 1; + rightPressed = true; + return true; + } + + return base.OnKeyDown(state, args); + } + + protected override bool OnKeyUp(InputState state, KeyUpEventArgs args) + { + switch (args.Key) + { + case Key.Left: + currentDirection = rightPressed ? 1 : 0; + leftPressed = false; + + return true; + case Key.Right: + currentDirection = leftPressed ? -1 : 0; + rightPressed = false; + return true; + } + + return base.OnKeyUp(state, args); + } + + protected override void Update() + { + base.Update(); + + if (currentDirection == 0) return; + + Scale = new Vector2(Scale.X * (Math.Sign(currentDirection) != Math.Sign(Scale.X) ? -1 : 1), Scale.Y); + X = (float)MathHelper.Clamp(X + currentDirection * Clock.ElapsedFrameTime / 1000, 0, 1); + } + } +} diff --git a/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj b/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj index 83996df41a..f84f9302bb 100644 --- a/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj +++ b/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj @@ -57,6 +57,7 @@ + From 51d2b9c35ce255e161cdd5c00a874a2b1587a7f9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 2 Aug 2017 20:41:38 +0900 Subject: [PATCH 03/12] Tidy up visually --- .../Objects/Drawable/DrawableFruit.cs | 2 +- osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs | 15 +++++---------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs index 01f9a78c8e..9b4a9bd957 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs @@ -82,7 +82,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable this.MoveToY(-0.1f).FadeOut(); // animation - this.FadeIn(200).MoveToY(0.9f, preempt); + this.FadeIn(200).MoveToY(1, preempt); } Expire(true); diff --git a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs index 3aa5b3f1e3..ba766fa61b 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Graphics; -using osu.Framework.Graphics.Shapes; using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.UI; using OpenTK; @@ -14,17 +13,13 @@ namespace osu.Game.Rulesets.Catch.UI { public CatchPlayfield() { - Size = new Vector2(1, 0.9f); - Anchor = Anchor.BottomCentre; - Origin = Anchor.BottomCentre; + Size = new Vector2(1); + + Anchor = Anchor.TopCentre; + Origin = Anchor.TopCentre; Children = new Drawable[] { - new Box - { - RelativeSizeAxes = Axes.Both, - Alpha = 0.5f - }, new Catcher { RelativePositionAxes = Axes.Both, @@ -32,7 +27,7 @@ namespace osu.Game.Rulesets.Catch.UI Scale = new Vector2(0.2f), FillMode = FillMode.Fit, Origin = Anchor.TopCentre, - Position = new Vector2(0.5f, 0.9f), + Position = new Vector2(0.5f, 1), } }; } From c9300852139dbe6c5d0ddd843c785721f2acd33c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 3 Aug 2017 08:32:38 +0900 Subject: [PATCH 04/12] Add glow --- .../Objects/Drawable/DrawableFruit.cs | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs index 9b4a9bd957..be51f60c46 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs @@ -2,17 +2,37 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.MathUtils; +using osu.Game.Graphics; using osu.Game.Rulesets.Catch.Judgements; using osu.Game.Rulesets.Objects.Drawables; using OpenTK; +using OpenTK.Graphics; namespace osu.Game.Rulesets.Catch.Objects.Drawable { internal class DrawableFruit : DrawableHitObject { + private class Pulp : Circle, IHasAccentColour + { + public Pulp() + { + EdgeEffect = new EdgeEffectParameters + { + Type = EdgeEffectType.Glow, + Radius = 5, + Colour = AccentColour.Opacity(0.5f), + }; + } + + public Color4 AccentColour { get; set; } = Color4.White; + } + + public DrawableFruit(CatchBaseHit h) : base(h) { Origin = Anchor.Centre; @@ -29,7 +49,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable { Children = new Framework.Graphics.Drawable[] { - new Circle + new Pulp { RelativePositionAxes = Axes.Both, RelativeSizeAxes = Axes.Both, @@ -38,7 +58,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable Scale = new Vector2(0.12f), Y = 0.08f, }, - new Circle + new Pulp { RelativePositionAxes = Axes.Both, RelativeSizeAxes = Axes.Both, @@ -47,7 +67,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable Scale = new Vector2(0.32f), Position = new Vector2(-0.16f, 0.3f), }, - new Circle + new Pulp { RelativePositionAxes = Axes.Both, RelativeSizeAxes = Axes.Both, @@ -56,7 +76,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable Scale = new Vector2(0.32f), Position = new Vector2(0.16f, 0.3f), }, - new Circle + new Pulp { RelativePositionAxes = Axes.Both, RelativeSizeAxes = Axes.Both, From b71caca131c42c6b34cc0717483f754e111b2ec0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 7 Aug 2017 15:09:31 +0900 Subject: [PATCH 05/12] Expand abilities of catcher --- osu.Desktop.Tests/Visual/TestCaseCatcher.cs | 26 ++++ osu.Desktop.Tests/osu.Desktop.Tests.csproj | 1 + osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs | 10 +- osu.Game.Rulesets.Catch/UI/Catcher.cs | 73 --------- osu.Game.Rulesets.Catch/UI/CatcherArea.cs | 143 ++++++++++++++++++ .../osu.Game.Rulesets.Catch.csproj | 2 +- 6 files changed, 175 insertions(+), 80 deletions(-) create mode 100644 osu.Desktop.Tests/Visual/TestCaseCatcher.cs delete mode 100644 osu.Game.Rulesets.Catch/UI/Catcher.cs create mode 100644 osu.Game.Rulesets.Catch/UI/CatcherArea.cs diff --git a/osu.Desktop.Tests/Visual/TestCaseCatcher.cs b/osu.Desktop.Tests/Visual/TestCaseCatcher.cs new file mode 100644 index 0000000000..eb714c9994 --- /dev/null +++ b/osu.Desktop.Tests/Visual/TestCaseCatcher.cs @@ -0,0 +1,26 @@ +using osu.Framework.Graphics; +using osu.Game.Rulesets.Catch.UI; +using OpenTK; + +namespace osu.Desktop.Tests.Visual +{ + internal class TestCaseCatcher : OsuTestCase + { + protected override void LoadComplete() + { + base.LoadComplete(); + + Children = new Drawable[] + { + new CatcherArea + { + RelativePositionAxes = Axes.Both, + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Size = new Vector2(1, 0.2f), + } + }; + } + } +} diff --git a/osu.Desktop.Tests/osu.Desktop.Tests.csproj b/osu.Desktop.Tests/osu.Desktop.Tests.csproj index aa862498d1..ba8ae06863 100644 --- a/osu.Desktop.Tests/osu.Desktop.Tests.csproj +++ b/osu.Desktop.Tests/osu.Desktop.Tests.csproj @@ -71,6 +71,7 @@ + diff --git a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs index ba766fa61b..03aabc5632 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs @@ -20,14 +20,12 @@ namespace osu.Game.Rulesets.Catch.UI Children = new Drawable[] { - new Catcher + new CatcherArea { - RelativePositionAxes = Axes.Both, RelativeSizeAxes = Axes.Both, - Scale = new Vector2(0.2f), - FillMode = FillMode.Fit, - Origin = Anchor.TopCentre, - Position = new Vector2(0.5f, 1), + Anchor = Anchor.BottomLeft, + Origin = Anchor.TopLeft, + Height = 0.3f } }; } diff --git a/osu.Game.Rulesets.Catch/UI/Catcher.cs b/osu.Game.Rulesets.Catch/UI/Catcher.cs deleted file mode 100644 index 42e4f03da1..0000000000 --- a/osu.Game.Rulesets.Catch/UI/Catcher.cs +++ /dev/null @@ -1,73 +0,0 @@ -using System; -using osu.Framework.Allocation; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Textures; -using osu.Framework.Input; -using OpenTK; -using OpenTK.Input; - -namespace osu.Game.Rulesets.Catch.UI -{ - public class Catcher : Sprite - { - public override bool HandleInput => true; - - [BackgroundDependencyLoader] - private void load(TextureStore textures) - { - Texture = textures.Get(@"Play/Catch/fruit-catcher-idle"); - } - - private bool leftPressed; - private bool rightPressed; - - private int currentDirection; - - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) - { - if (args.Repeat) return true; - - switch (args.Key) - { - case Key.Left: - currentDirection = -1; - leftPressed = true; - return true; - case Key.Right: - currentDirection = 1; - rightPressed = true; - return true; - } - - return base.OnKeyDown(state, args); - } - - protected override bool OnKeyUp(InputState state, KeyUpEventArgs args) - { - switch (args.Key) - { - case Key.Left: - currentDirection = rightPressed ? 1 : 0; - leftPressed = false; - - return true; - case Key.Right: - currentDirection = leftPressed ? -1 : 0; - rightPressed = false; - return true; - } - - return base.OnKeyUp(state, args); - } - - protected override void Update() - { - base.Update(); - - if (currentDirection == 0) return; - - Scale = new Vector2(Scale.X * (Math.Sign(currentDirection) != Math.Sign(Scale.X) ? -1 : 1), Scale.Y); - X = (float)MathHelper.Clamp(X + currentDirection * Clock.ElapsedFrameTime / 1000, 0, 1); - } - } -} diff --git a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs new file mode 100644 index 0000000000..cb979ffc55 --- /dev/null +++ b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs @@ -0,0 +1,143 @@ +using System; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Textures; +using osu.Framework.Input; +using OpenTK; +using OpenTK.Input; + +namespace osu.Game.Rulesets.Catch.UI +{ + public class CatcherArea : Container + { + public override bool HandleInput => true; + + private Sprite catcher; + + private Drawable createAdditiveFrame() => new Sprite + { + RelativePositionAxes = Axes.Both, + Anchor = Anchor.TopLeft, + Origin = Anchor.TopCentre, + RelativeSizeAxes = Axes.Both, + FillMode = FillMode.Fit, + + Texture = catcher.Texture, + BlendingMode = BlendingMode.Additive, + Position = catcher.Position, + Scale = catcher.Scale, + }; + + [BackgroundDependencyLoader] + private void load(TextureStore textures) + { + Children = new Drawable[] + { + catcher = new Sprite + { + RelativePositionAxes = Axes.Both, + Anchor = Anchor.TopLeft, + Origin = Anchor.TopCentre, + RelativeSizeAxes = Axes.Both, + FillMode = FillMode.Fit, + + X = 0.5f, + Texture = textures.Get(@"Play/Catch/fruit-catcher-idle"), + }, + }; + } + + private bool leftPressed; + private bool rightPressed; + + private int currentDirection; + + private bool dashing; + + protected bool Dashing + { + get + { + return dashing; + } + set + { + if (value == dashing) return; + + dashing = value; + + if (dashing) + Schedule(addAdditiveSprite); + } + } + + private void addAdditiveSprite() + { + if (!dashing) return; + + var additive = createAdditiveFrame(); + + Add(additive); + + additive.FadeTo(0.4f).FadeOut(800, Easing.OutQuint).Expire(); + + Scheduler.AddDelayed(addAdditiveSprite, 50); + } + + protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + { + if (args.Repeat) return true; + + switch (args.Key) + { + case Key.Left: + currentDirection = -1; + leftPressed = true; + return true; + case Key.Right: + currentDirection = 1; + rightPressed = true; + return true; + case Key.ShiftLeft: + Dashing = true; + return true; + } + + return base.OnKeyDown(state, args); + } + + protected override bool OnKeyUp(InputState state, KeyUpEventArgs args) + { + switch (args.Key) + { + case Key.Left: + currentDirection = rightPressed ? 1 : 0; + leftPressed = false; + return true; + case Key.Right: + currentDirection = leftPressed ? -1 : 0; + rightPressed = false; + return true; + case Key.ShiftLeft: + Dashing = false; + return true; + } + + return base.OnKeyUp(state, args); + } + + protected override void Update() + { + base.Update(); + + if (currentDirection == 0) return; + + float speed = Dashing ? 1.5f : 1; + + catcher.Scale = new Vector2(Math.Sign(currentDirection), 1); + catcher.X = (float)MathHelper.Clamp(catcher.X + currentDirection * Clock.ElapsedFrameTime / 1800 * speed, 0, 1); + } + } +} diff --git a/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj b/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj index f84f9302bb..003fe2763e 100644 --- a/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj +++ b/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj @@ -57,7 +57,7 @@ - + From 725a69d9736a214e46855954ca6a82f86508ff17 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 7 Aug 2017 16:02:14 +0900 Subject: [PATCH 06/12] Begin conversion --- .../Beatmaps/CatchBeatmapConverter.cs | 13 ++++++++----- .../Objects/Drawable/DrawableFruit.cs | 5 +++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs index 40180ac3a0..6a20fa525e 100644 --- a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs +++ b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs @@ -16,14 +16,17 @@ namespace osu.Game.Rulesets.Catch.Beatmaps { protected override IEnumerable ValidConversionTypes { get; } = new[] { typeof(IHasXPosition) }; - protected override IEnumerable ConvertHitObject(HitObject original, Beatmap beatmap) + protected override IEnumerable ConvertHitObject(HitObject obj, Beatmap beatmap) { - var catchHit = original as CatchBaseHit; + var distanceData = obj as IHasDistance; + var repeatsData = obj as IHasRepeats; + var endTimeData = obj as IHasEndTime; + var curveData = obj as IHasCurve; - yield return catchHit ?? new Fruit + yield return new Fruit { - StartTime = original.StartTime, - Position = ((IHasXPosition)original).X / OsuPlayfield.BASE_SIZE.X + StartTime = obj.StartTime, + Position = ((IHasXPosition)obj).X / OsuPlayfield.BASE_SIZE.X }; } } diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs index be51f60c46..aa92f36d23 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs @@ -49,6 +49,11 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable { Children = new Framework.Graphics.Drawable[] { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.Red, + }, new Pulp { RelativePositionAxes = Axes.Both, From fc30c471ed3156a15c429d720e4f0beb0b825dd3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 8 Aug 2017 07:18:31 +0900 Subject: [PATCH 07/12] Update resources --- osu-resources | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-resources b/osu-resources index 76656c51f2..f6042e1cb3 160000 --- a/osu-resources +++ b/osu-resources @@ -1 +1 @@ -Subproject commit 76656c51f281e7934159e9ed4414378fef24d130 +Subproject commit f6042e1cb37cfad6c879d0e1245f7880c7fcd5f5 From fe625f711ab7660c9bb0e853769763cff30d8ba2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 8 Aug 2017 07:22:03 +0900 Subject: [PATCH 08/12] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 107c551767..8413a36fd2 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 107c5517670ca88dbe8c83a97e37e99ac5742ee6 +Subproject commit 8413a36fd26f3bae2a789208a9317b4511c35e99 From 4d1dd70cfbe23f9faf8f59c0cecfe13ead267db2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 8 Aug 2017 07:32:23 +0900 Subject: [PATCH 09/12] Licence headers --- osu.Desktop.Tests/Visual/TestCaseCatcher.cs | 5 ++++- osu.Game.Rulesets.Catch/UI/CatcherArea.cs | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/osu.Desktop.Tests/Visual/TestCaseCatcher.cs b/osu.Desktop.Tests/Visual/TestCaseCatcher.cs index eb714c9994..0e92b5114b 100644 --- a/osu.Desktop.Tests/Visual/TestCaseCatcher.cs +++ b/osu.Desktop.Tests/Visual/TestCaseCatcher.cs @@ -1,4 +1,7 @@ -using osu.Framework.Graphics; +// 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.Rulesets.Catch.UI; using OpenTK; diff --git a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs index cb979ffc55..153302c1d1 100644 --- a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs +++ b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; From 70585a279dc3be236f617ebb70b20407a76cdeaa Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 8 Aug 2017 07:48:03 +0900 Subject: [PATCH 10/12] Comment out unused variables for now --- osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs index 6a20fa525e..4e741b3a55 100644 --- a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs +++ b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs @@ -18,10 +18,10 @@ namespace osu.Game.Rulesets.Catch.Beatmaps protected override IEnumerable ConvertHitObject(HitObject obj, Beatmap beatmap) { - var distanceData = obj as IHasDistance; + /*var distanceData = obj as IHasDistance; var repeatsData = obj as IHasRepeats; var endTimeData = obj as IHasEndTime; - var curveData = obj as IHasCurve; + var curveData = obj as IHasCurve;*/ yield return new Fruit { From 482626adc27d94acbdc909d21a93633f33b242cd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 8 Aug 2017 12:57:38 +0900 Subject: [PATCH 11/12] Don't crash on spinners --- osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs index 4e741b3a55..d6efe45adf 100644 --- a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs +++ b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs @@ -18,10 +18,8 @@ namespace osu.Game.Rulesets.Catch.Beatmaps protected override IEnumerable ConvertHitObject(HitObject obj, Beatmap beatmap) { - /*var distanceData = obj as IHasDistance; - var repeatsData = obj as IHasRepeats; - var endTimeData = obj as IHasEndTime; - var curveData = obj as IHasCurve;*/ + if (!(obj is IHasXPosition)) + yield break; yield return new Fruit { From 1c7fe02d1b73838d2ca286a86b98225e3a519b84 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 9 Aug 2017 08:56:45 +0900 Subject: [PATCH 12/12] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 8413a36fd2..d29abdf0d0 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 8413a36fd26f3bae2a789208a9317b4511c35e99 +Subproject commit d29abdf0d042d832f0849c013d14762db04730e7