From debe13629f07da44eb14489aa959eb772127c11e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 8 Aug 2017 09:20:54 +0900 Subject: [PATCH 01/18] Don't set RelativePositionAxes when setting ScrollingAxes --- .../Rulesets/Objects/Drawables/DrawableScrollingHitObject.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableScrollingHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableScrollingHitObject.cs index 243fd79b6f..f67dd4dfea 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableScrollingHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableScrollingHitObject.cs @@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Objects.Drawables { set { - RelativePositionAxes = value; + RelativePositionAxes |= value; if ((value & Axes.X) > 0) X = (float)HitObject.StartTime; From e67379b6de2619d16caf236b0ab4929264e5b001 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 8 Aug 2017 10:35:56 +0900 Subject: [PATCH 02/18] Use ScrollingHitRenderer --- .../Objects/Drawable/DrawableFruit.cs | 19 ++++++------------- .../UI/CatchHitRenderer.cs | 2 +- osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs | 17 ++++++++++++++--- 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs index aa92f36d23..a2cf0ec279 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs @@ -15,7 +15,7 @@ using OpenTK.Graphics; namespace osu.Game.Rulesets.Catch.Objects.Drawable { - internal class DrawableFruit : DrawableHitObject + internal class DrawableFruit : DrawableScrollingHitObject { private class Pulp : Circle, IHasAccentColour { @@ -37,11 +37,11 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable { Origin = Anchor.Centre; Size = new Vector2(50); - RelativePositionAxes = Axes.Both; - Position = new Vector2(h.Position, -0.1f); - Rotation = (float)(RNG.NextDouble() - 0.5f) * 40; - Alpha = 0; + RelativePositionAxes = Axes.Both; + X = h.Position; + + Rotation = (float)(RNG.NextDouble() - 0.5f) * 40; } [BackgroundDependencyLoader] @@ -91,8 +91,6 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable Position = new Vector2(0, 0.6f), }, }; - - Alpha = 0; } protected override CatchJudgement CreateJudgement() => new CatchJudgement(); @@ -103,14 +101,9 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable { using (BeginAbsoluteSequence(HitObject.StartTime - preempt)) { - // default state - this.MoveToY(-0.1f).FadeOut(); - // animation - this.FadeIn(200).MoveToY(1, preempt); + this.FadeIn(200); } - - Expire(true); } } } diff --git a/osu.Game.Rulesets.Catch/UI/CatchHitRenderer.cs b/osu.Game.Rulesets.Catch/UI/CatchHitRenderer.cs index cd6adfeea9..8f614cc4c3 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchHitRenderer.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchHitRenderer.cs @@ -14,7 +14,7 @@ using osu.Game.Rulesets.UI; namespace osu.Game.Rulesets.Catch.UI { - public class CatchHitRenderer : HitRenderer + public class CatchHitRenderer : ScrollingHitRenderer { public CatchHitRenderer(WorkingBeatmap beatmap, bool isForCurrentRuleset) : base(beatmap, isForCurrentRuleset) diff --git a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs index 03aabc5632..3aed94daad 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs @@ -6,20 +6,31 @@ using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.UI; using OpenTK; using osu.Game.Rulesets.Catch.Judgements; +using osu.Framework.Graphics.Containers; namespace osu.Game.Rulesets.Catch.UI { - public class CatchPlayfield : Playfield + public class CatchPlayfield : ScrollingPlayfield { + protected override Container Content => content; + private readonly Container content; + public CatchPlayfield() + : base(Axes.Y) { Size = new Vector2(1); Anchor = Anchor.TopCentre; Origin = Anchor.TopCentre; - Children = new Drawable[] + InternalChildren = new Drawable[] { + content = new Container + { + Scale = new Vector2(1, -1), + RelativeSizeAxes = Axes.Both, + Origin = Anchor.BottomLeft + }, new CatcherArea { RelativeSizeAxes = Axes.Both, @@ -30,4 +41,4 @@ namespace osu.Game.Rulesets.Catch.UI }; } } -} \ No newline at end of file +} From 4bdaa8ae680213f6b4e2c18e514f7bd51c0a9068 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 8 Aug 2017 10:36:05 +0900 Subject: [PATCH 03/18] Add basic miss support --- .../Objects/Drawable/DrawableFruit.cs | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs index a2cf0ec279..8531428acf 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs @@ -17,6 +17,8 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable { internal class DrawableFruit : DrawableScrollingHitObject { + private Box box; + private class Pulp : Circle, IHasAccentColour { public Pulp() @@ -49,10 +51,10 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable { Children = new Framework.Graphics.Drawable[] { - new Box + box = new Box { RelativeSizeAxes = Axes.Both, - Colour = Color4.Red, + Colour = Color4.Blue, }, new Pulp { @@ -97,6 +99,12 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable private const float preempt = 1000; + protected override void CheckJudgement(bool userTriggered) + { + if (Judgement.TimeOffset > 0) + Judgement.Result = HitResult.Miss; + } + protected override void UpdateState(ArmedState state) { using (BeginAbsoluteSequence(HitObject.StartTime - preempt)) @@ -104,6 +112,17 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable // animation this.FadeIn(200); } + + switch (state) + { + case ArmedState.Miss: + using (BeginAbsoluteSequence(HitObject.StartTime, true)) + { + this.FadeOut(250).RotateTo(Rotation * 2, 250, Easing.Out); + box.FadeColour(Color4.OrangeRed); + } + break; + } } } } From 3926238be992dfb4cb1e2b34f0e4f742b06157e1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 8 Aug 2017 10:53:59 +0900 Subject: [PATCH 04/18] Allow DrawableHitObjects to be removed from a Playfield --- osu.Game/Rulesets/UI/Playfield.cs | 6 ++++++ osu.Game/Rulesets/UI/ScrollingPlayfield.cs | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/osu.Game/Rulesets/UI/Playfield.cs b/osu.Game/Rulesets/UI/Playfield.cs index 5f07df5088..ade2c2d070 100644 --- a/osu.Game/Rulesets/UI/Playfield.cs +++ b/osu.Game/Rulesets/UI/Playfield.cs @@ -82,6 +82,12 @@ namespace osu.Game.Rulesets.UI /// The DrawableHitObject to add. public virtual void Add(DrawableHitObject h) => HitObjects.Add(h); + /// + /// Remove a DrawableHitObject from this Playfield. + /// + /// The DrawableHitObject to remove. + public virtual void Remove(DrawableHitObject h) => HitObjects.Remove(h); + /// /// Triggered when an object's Judgement is updated. /// diff --git a/osu.Game/Rulesets/UI/ScrollingPlayfield.cs b/osu.Game/Rulesets/UI/ScrollingPlayfield.cs index 1a88c74ebc..f1eef6ea31 100644 --- a/osu.Game/Rulesets/UI/ScrollingPlayfield.cs +++ b/osu.Game/Rulesets/UI/ScrollingPlayfield.cs @@ -204,6 +204,13 @@ namespace osu.Game.Rulesets.UI queuedHitObjects.Enqueue(hitObject); } + public override bool Remove(DrawableHitObject hitObject) + { + foreach (var c in InternalChildren.OfType()) + c.Remove(hitObject); + return true; + } + protected override void Update() { base.Update(); From 99a00ed3190b68063357adee55e07899d192c061 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 8 Aug 2017 12:46:01 +0900 Subject: [PATCH 05/18] Make fruit look a bit better (and buffer them to a texture) --- .../Objects/Drawable/DrawableFruit.cs | 84 +++++++++---------- 1 file changed, 40 insertions(+), 44 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs index 8531428acf..f8b0830089 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs @@ -17,12 +17,14 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable { internal class DrawableFruit : DrawableScrollingHitObject { - private Box box; + const float pulp_size = 30; private class Pulp : Circle, IHasAccentColour { public Pulp() { + Size = new Vector2(pulp_size); + EdgeEffect = new EdgeEffectParameters { Type = EdgeEffectType.Glow, @@ -38,11 +40,13 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable public DrawableFruit(CatchBaseHit h) : base(h) { Origin = Anchor.Centre; - Size = new Vector2(50); + Size = new Vector2(pulp_size * 2, pulp_size * 2.6f); RelativePositionAxes = Axes.Both; X = h.Position; + Colour = new Color4(RNG.NextSingle(), RNG.NextSingle(), RNG.NextSingle(), 1); + Rotation = (float)(RNG.NextDouble() - 0.5f) * 40; } @@ -51,47 +55,42 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable { Children = new Framework.Graphics.Drawable[] { - box = new Box + //todo: share this more + new BufferedContainer { RelativeSizeAxes = Axes.Both, - Colour = Color4.Blue, - }, - new Pulp - { - RelativePositionAxes = Axes.Both, - RelativeSizeAxes = Axes.Both, - Anchor = Anchor.TopCentre, - Origin = Anchor.Centre, - Scale = new Vector2(0.12f), - Y = 0.08f, - }, - new Pulp - { - 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 Pulp - { - 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 Pulp - { - RelativePositionAxes = Axes.Both, - RelativeSizeAxes = Axes.Both, - Anchor = Anchor.TopCentre, - Origin = Anchor.Centre, - Scale = new Vector2(0.32f), - Position = new Vector2(0, 0.6f), - }, + CacheDrawnFrameBuffer = true, + Children = new Framework.Graphics.Drawable[] + { + new Pulp + { + RelativePositionAxes = Axes.Both, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Scale = new Vector2(0.6f), + }, + new Pulp + { + RelativePositionAxes = Axes.Both, + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Y = -0.08f + }, + new Pulp + { + RelativePositionAxes = Axes.Both, + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + Y = -0.08f + }, + new Pulp + { + RelativePositionAxes = Axes.Both, + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + }, + } + } }; } @@ -117,10 +116,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable { case ArmedState.Miss: using (BeginAbsoluteSequence(HitObject.StartTime, true)) - { this.FadeOut(250).RotateTo(Rotation * 2, 250, Easing.Out); - box.FadeColour(Color4.OrangeRed); - } break; } } From ff490cf44ce155542fe9faee5041eae13223e653 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 8 Aug 2017 12:46:37 +0900 Subject: [PATCH 06/18] Add catching support --- .../Objects/Drawable/DrawableFruit.cs | 10 +- osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs | 24 +- osu.Game.Rulesets.Catch/UI/CatcherArea.cs | 254 ++++++++++-------- 3 files changed, 179 insertions(+), 109 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs index f8b0830089..0aba83696c 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.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 System; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; @@ -15,7 +16,7 @@ using OpenTK.Graphics; namespace osu.Game.Rulesets.Catch.Objects.Drawable { - internal class DrawableFruit : DrawableScrollingHitObject + public class DrawableFruit : DrawableScrollingHitObject { const float pulp_size = 30; @@ -37,7 +38,8 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable } - public DrawableFruit(CatchBaseHit h) : base(h) + public DrawableFruit(CatchBaseHit h) + : base(h) { Origin = Anchor.Centre; Size = new Vector2(pulp_size * 2, pulp_size * 2.6f); @@ -50,6 +52,8 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable Rotation = (float)(RNG.NextDouble() - 0.5f) * 40; } + public Func CheckPosition; + [BackgroundDependencyLoader] private void load() { @@ -101,7 +105,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable protected override void CheckJudgement(bool userTriggered) { if (Judgement.TimeOffset > 0) - Judgement.Result = HitResult.Miss; + Judgement.Result = CheckPosition?.Invoke(HitObject) ?? false ? HitResult.Hit : HitResult.Miss; } protected override void UpdateState(ArmedState state) diff --git a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs index 3aed94daad..388444d49d 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs @@ -7,6 +7,8 @@ using osu.Game.Rulesets.UI; using OpenTK; using osu.Game.Rulesets.Catch.Judgements; using osu.Framework.Graphics.Containers; +using osu.Game.Rulesets.Catch.Objects.Drawable; +using osu.Game.Rulesets.Objects.Drawables; namespace osu.Game.Rulesets.Catch.UI { @@ -14,6 +16,7 @@ namespace osu.Game.Rulesets.Catch.UI { protected override Container Content => content; private readonly Container content; + private readonly CatcherArea catcherArea; public CatchPlayfield() : base(Axes.Y) @@ -31,7 +34,7 @@ namespace osu.Game.Rulesets.Catch.UI RelativeSizeAxes = Axes.Both, Origin = Anchor.BottomLeft }, - new CatcherArea + catcherArea = new CatcherArea { RelativeSizeAxes = Axes.Both, Anchor = Anchor.BottomLeft, @@ -40,5 +43,24 @@ namespace osu.Game.Rulesets.Catch.UI } }; } + + public override void Add(DrawableHitObject h) + { + base.Add(h); + + var fruit = (DrawableFruit)h; + fruit.CheckPosition = catcherArea.CheckIfWeCanCatch; + fruit.OnJudgement += Fruit_OnJudgement; + } + + private void Fruit_OnJudgement(DrawableHitObject obj) + { + if (obj.Judgement.Result == HitResult.Hit) + { + Vector2 screenPosition = obj.ScreenSpaceDrawQuad.Centre; + Remove(obj); + catcherArea.Add(obj, screenPosition); + } + } } } diff --git a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs index 153302c1d1..6ed8030941 100644 --- a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs +++ b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs @@ -2,12 +2,18 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Linq; 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 osu.Framework.MathUtils; +using osu.Game.Rulesets.Catch.Judgements; +using osu.Game.Rulesets.Catch.Objects; +using osu.Game.Rulesets.Catch.Objects.Drawable; +using osu.Game.Rulesets.Objects.Drawables; using OpenTK; using OpenTK.Input; @@ -15,132 +21,170 @@ namespace osu.Game.Rulesets.Catch.UI { public class CatcherArea : Container { - public override bool HandleInput => true; + private Catcher catcher; - private Sprite catcher; + public void Add(DrawableHitObject fruit, Vector2 screenPosition) => catcher.AddToStack(fruit, screenPosition); - 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, - }; + public bool CheckIfWeCanCatch(CatchBaseHit obj) => Math.Abs(catcher.Position.X - obj.Position) < catcher.DrawSize.X / DrawSize.X / 2; [BackgroundDependencyLoader] - private void load(TextureStore textures) + private void load() { Children = new Drawable[] { - catcher = new Sprite + catcher = new Catcher { 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; + catcher.Size = new Vector2(DrawSize.Y); + } - float speed = Dashing ? 1.5f : 1; + private class Catcher : Container + { + public override bool HandleInput => true; - catcher.Scale = new Vector2(Math.Sign(currentDirection), 1); - catcher.X = (float)MathHelper.Clamp(catcher.X + currentDirection * Clock.ElapsedFrameTime / 1800 * speed, 0, 1); + private Texture texture; + + [BackgroundDependencyLoader] + private void load(TextureStore textures) + { + texture = textures.Get(@"Play/Catch/fruit-catcher-idle"); + + Child = createCatcherSprite(); + } + + 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 = createCatcherSprite(); + + additive.RelativePositionAxes = Axes.Both; + additive.BlendingMode = BlendingMode.Additive; + additive.Position = Position; + additive.Scale = Scale; + + ((CatcherArea)Parent).Add(additive); + + additive.FadeTo(0.4f).FadeOut(800, Easing.OutQuint).Expire(); + + Scheduler.AddDelayed(addAdditiveSprite, 50); + } + + private Sprite createCatcherSprite() => new Sprite + { + RelativeSizeAxes = Axes.Both, + FillMode = FillMode.Fit, + Texture = texture, + OriginPosition = new Vector2(DrawWidth / 2, 10) //temporary until the sprite is aligned correctly. + }; + + 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; + + Scale = new Vector2(Math.Sign(currentDirection), 1); + X = (float)MathHelper.Clamp(X + currentDirection * Clock.ElapsedFrameTime / 1800 * speed, 0, 1); + } + + public void AddToStack(DrawableHitObject fruit, Vector2 absolutePosition) + { + fruit.RelativePositionAxes = Axes.None; + fruit.Position = new Vector2(ToLocalSpace(absolutePosition).X - DrawSize.X / 2, 0); + + fruit.Anchor = Anchor.TopCentre; + fruit.Origin = Anchor.BottomCentre; + fruit.Scale *= 0.7f; + fruit.LifetimeEnd = double.MaxValue; + fruit.Depth = (float)Time.Current; + + float distance = fruit.DrawSize.X / 2 * fruit.Scale.X; + + while (Children.OfType().Any(f => Vector2.DistanceSquared(f.Position, fruit.Position) < distance * distance)) + { + fruit.X += RNG.Next(-5, 5); + fruit.Y -= RNG.Next(0, 5); + } + + Add(fruit); + } } } } From 5704e9ee6553de4324dffa802cdf7bbada5108ec Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 8 Aug 2017 12:56:22 +0900 Subject: [PATCH 07/18] Fix failing at beginning of map --- osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs b/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs index 3f29547e46..1c866320c9 100644 --- a/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs +++ b/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs @@ -19,6 +19,14 @@ namespace osu.Game.Rulesets.Catch.Scoring { } + protected override void Reset() + { + base.Reset(); + + Health.Value = 1; + Accuracy.Value = 1; + } + protected override void OnNewJudgement(CatchJudgement judgement) { } From ca2da5ac9bae231d16e6827064a2a2c200a6393d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 8 Aug 2017 12:57:38 +0900 Subject: [PATCH 08/18] 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 2203d55d647fd60072f96eed7ac35e564a704210 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 8 Aug 2017 13:31:55 +0900 Subject: [PATCH 09/18] fixes --- osu-framework | 2 +- osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs | 4 ++-- osu.Game/Rulesets/UI/ScrollingPlayfield.cs | 7 ------- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/osu-framework b/osu-framework index 8413a36fd2..dd0daafcfc 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 8413a36fd26f3bae2a789208a9317b4511c35e99 +Subproject commit dd0daafcfc0d625bb588c8e12d7db58bc00c255e diff --git a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs index 388444d49d..4ea6d180f3 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs @@ -21,6 +21,8 @@ namespace osu.Game.Rulesets.Catch.UI public CatchPlayfield() : base(Axes.Y) { + Reversed.Value = true; + Size = new Vector2(1); Anchor = Anchor.TopCentre; @@ -30,9 +32,7 @@ namespace osu.Game.Rulesets.Catch.UI { content = new Container { - Scale = new Vector2(1, -1), RelativeSizeAxes = Axes.Both, - Origin = Anchor.BottomLeft }, catcherArea = new CatcherArea { diff --git a/osu.Game/Rulesets/UI/ScrollingPlayfield.cs b/osu.Game/Rulesets/UI/ScrollingPlayfield.cs index 6929967a96..adfcb6c971 100644 --- a/osu.Game/Rulesets/UI/ScrollingPlayfield.cs +++ b/osu.Game/Rulesets/UI/ScrollingPlayfield.cs @@ -219,13 +219,6 @@ namespace osu.Game.Rulesets.UI return removed; } - public override bool Remove(DrawableHitObject hitObject) - { - foreach (var c in InternalChildren.OfType()) - c.Remove(hitObject); - return true; - } - protected override void Update() { base.Update(); From 06e5f7de096ad87088003705cd863585016d4d53 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 9 Aug 2017 10:16:31 +0900 Subject: [PATCH 10/18] Make pulp size private --- osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs index 0aba83696c..62e5c094be 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs @@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable { public class DrawableFruit : DrawableScrollingHitObject { - const float pulp_size = 30; + private const float pulp_size = 30; private class Pulp : Circle, IHasAccentColour { From b88f37de455f78511b13e50e06cd4f66483c79cc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 9 Aug 2017 11:50:34 +0900 Subject: [PATCH 11/18] Add custom actions for Catch Reworks input management for rulesets --- osu.Desktop.Tests/Visual/TestCaseCatcher.cs | 17 ++++-- .../RulesetInputManager.cs | 32 +++++++++++ .../UI/CatchHitRenderer.cs | 3 + osu.Game.Rulesets.Catch/UI/CatcherArea.cs | 56 +++++++++---------- .../osu.Game.Rulesets.Catch.csproj | 2 + .../OsuKeyConversionInputManager.cs | 3 +- osu.Game.Rulesets.Osu/UI/OsuHitRenderer.cs | 4 +- osu.Game/Input/ActionMappingInputManager.cs | 34 +++++++++++ osu.Game/Rulesets/UI/HitRenderer.cs | 5 +- .../Screens/Play/KeyConversionInputManager.cs | 16 ------ osu.Game/osu.Game.csproj | 2 +- 11 files changed, 116 insertions(+), 58 deletions(-) create mode 100644 osu.Game.Rulesets.Catch/RulesetInputManager.cs create mode 100644 osu.Game/Input/ActionMappingInputManager.cs delete mode 100644 osu.Game/Screens/Play/KeyConversionInputManager.cs diff --git a/osu.Desktop.Tests/Visual/TestCaseCatcher.cs b/osu.Desktop.Tests/Visual/TestCaseCatcher.cs index 0e92b5114b..de32608a6c 100644 --- a/osu.Desktop.Tests/Visual/TestCaseCatcher.cs +++ b/osu.Desktop.Tests/Visual/TestCaseCatcher.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Graphics; +using osu.Game.Rulesets.Catch; using osu.Game.Rulesets.Catch.UI; using OpenTK; @@ -15,14 +16,18 @@ namespace osu.Desktop.Tests.Visual Children = new Drawable[] { - new CatcherArea + new CatchInputManager { - RelativePositionAxes = Axes.Both, RelativeSizeAxes = Axes.Both, - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - Size = new Vector2(1, 0.2f), - } + Child = new CatcherArea + { + RelativePositionAxes = Axes.Both, + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Size = new Vector2(1, 0.2f), + } + }, }; } } diff --git a/osu.Game.Rulesets.Catch/RulesetInputManager.cs b/osu.Game.Rulesets.Catch/RulesetInputManager.cs new file mode 100644 index 0000000000..78bd18baa3 --- /dev/null +++ b/osu.Game.Rulesets.Catch/RulesetInputManager.cs @@ -0,0 +1,32 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Collections.Generic; +using osu.Game.Input; +using OpenTK.Input; + +namespace osu.Game.Rulesets.Catch +{ + public class CatchInputManager : ActionMappingInputManager + { + public CatchInputManager() + { + Mappings = new Dictionary + { + { Key.Z, CatchAction.MoveLeft }, + { Key.Left, CatchAction.MoveLeft }, + { Key.X, CatchAction.MoveRight }, + { Key.Right, CatchAction.MoveRight }, + { Key.LShift, CatchAction.Dash }, + { Key.RShift, CatchAction.Dash }, + }; + } + } + + public enum CatchAction + { + MoveLeft, + MoveRight, + Dash + } +} diff --git a/osu.Game.Rulesets.Catch/UI/CatchHitRenderer.cs b/osu.Game.Rulesets.Catch/UI/CatchHitRenderer.cs index 8f614cc4c3..04e3036db6 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchHitRenderer.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchHitRenderer.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 osu.Framework.Input; using osu.Game.Beatmaps; using osu.Game.Rulesets.Beatmaps; using osu.Game.Rulesets.Catch.Beatmaps; @@ -27,6 +28,8 @@ namespace osu.Game.Rulesets.Catch.UI protected override Playfield CreatePlayfield() => new CatchPlayfield(); + protected override PassThroughInputManager CreateKeyConversionInputManager() => new CatchInputManager(); + protected override DrawableHitObject GetVisualRepresentation(CatchBaseHit h) { if (h is Fruit) diff --git a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs index 6ed8030941..f0a6b89d7e 100644 --- a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs +++ b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs @@ -15,7 +15,6 @@ using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Catch.Objects.Drawable; using osu.Game.Rulesets.Objects.Drawables; using OpenTK; -using OpenTK.Input; namespace osu.Game.Rulesets.Catch.UI { @@ -63,9 +62,6 @@ namespace osu.Game.Rulesets.Catch.UI Child = createCatcherSprite(); } - private bool leftPressed; - private bool rightPressed; - private int currentDirection; private bool dashing; @@ -114,19 +110,20 @@ namespace osu.Game.Rulesets.Catch.UI { if (args.Repeat) return true; - switch (args.Key) + if (state.Data is CatchAction) { - 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; + switch ((CatchAction)state.Data) + { + case CatchAction.MoveLeft: + currentDirection--; + return true; + case CatchAction.MoveRight: + currentDirection++; + return true; + case CatchAction.Dash: + Dashing = true; + return true; + } } return base.OnKeyDown(state, args); @@ -134,19 +131,20 @@ namespace osu.Game.Rulesets.Catch.UI protected override bool OnKeyUp(InputState state, KeyUpEventArgs args) { - switch (args.Key) + if (state.Data is CatchAction) { - 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; + switch ((CatchAction)state.Data) + { + case CatchAction.MoveLeft: + currentDirection++; + return true; + case CatchAction.MoveRight: + currentDirection--; + return true; + case CatchAction.Dash: + Dashing = false; + return true; + } } return base.OnKeyUp(state, args); @@ -161,7 +159,7 @@ namespace osu.Game.Rulesets.Catch.UI float speed = Dashing ? 1.5f : 1; Scale = new Vector2(Math.Sign(currentDirection), 1); - X = (float)MathHelper.Clamp(X + currentDirection * Clock.ElapsedFrameTime / 1800 * speed, 0, 1); + X = (float)MathHelper.Clamp(X + Math.Sign(currentDirection) * Clock.ElapsedFrameTime / 1800 * speed, 0, 1); } public void AddToStack(DrawableHitObject fruit, Vector2 absolutePosition) diff --git a/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj b/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj index 003fe2763e..fcffcb8060 100644 --- a/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj +++ b/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj @@ -38,6 +38,7 @@ True + @@ -50,6 +51,7 @@ + diff --git a/osu.Game.Rulesets.Osu/OsuKeyConversionInputManager.cs b/osu.Game.Rulesets.Osu/OsuKeyConversionInputManager.cs index d60aab90fb..10adca4e43 100644 --- a/osu.Game.Rulesets.Osu/OsuKeyConversionInputManager.cs +++ b/osu.Game.Rulesets.Osu/OsuKeyConversionInputManager.cs @@ -3,14 +3,13 @@ using System.Linq; using osu.Framework.Input; -using osu.Game.Screens.Play; using OpenTK.Input; using KeyboardState = osu.Framework.Input.KeyboardState; using MouseState = osu.Framework.Input.MouseState; namespace osu.Game.Rulesets.Osu { - public class OsuKeyConversionInputManager : KeyConversionInputManager + public class OsuKeyConversionInputManager : PassThroughInputManager { private bool leftViaKeyboard; private bool rightViaKeyboard; diff --git a/osu.Game.Rulesets.Osu/UI/OsuHitRenderer.cs b/osu.Game.Rulesets.Osu/UI/OsuHitRenderer.cs index e582d2fcd3..e59af40db4 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuHitRenderer.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuHitRenderer.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 osu.Framework.Input; using OpenTK; using osu.Game.Beatmaps; using osu.Game.Rulesets.Beatmaps; @@ -12,7 +13,6 @@ using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Rulesets.Osu.Scoring; using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.UI; -using osu.Game.Screens.Play; namespace osu.Game.Rulesets.Osu.UI { @@ -31,7 +31,7 @@ namespace osu.Game.Rulesets.Osu.UI protected override Playfield CreatePlayfield() => new OsuPlayfield(); - protected override KeyConversionInputManager CreateKeyConversionInputManager() => new OsuKeyConversionInputManager(); + protected override PassThroughInputManager CreateKeyConversionInputManager() => new OsuKeyConversionInputManager(); protected override DrawableHitObject GetVisualRepresentation(OsuHitObject h) { diff --git a/osu.Game/Input/ActionMappingInputManager.cs b/osu.Game/Input/ActionMappingInputManager.cs new file mode 100644 index 0000000000..5e2facdc93 --- /dev/null +++ b/osu.Game/Input/ActionMappingInputManager.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 System.Collections.Generic; +using osu.Framework.Input; +using OpenTK.Input; + +namespace osu.Game.Input +{ + public class ActionMappingInputManager : PassThroughInputManager + where T : struct + { + protected IDictionary Mappings { get; set; } + + protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + { + mapKey(state, args.Key); + return base.OnKeyDown(state, args); + } + + protected override bool OnKeyUp(InputState state, KeyUpEventArgs args) + { + mapKey(state, args.Key); + return base.OnKeyUp(state, args); + } + + private void mapKey(InputState state, Key key) + { + T mappedData; + if (Mappings.TryGetValue(key, out mappedData)) + state.Data = mappedData; + } + } +} diff --git a/osu.Game/Rulesets/UI/HitRenderer.cs b/osu.Game/Rulesets/UI/HitRenderer.cs index 47339fb6e6..244c3312c4 100644 --- a/osu.Game/Rulesets/UI/HitRenderer.cs +++ b/osu.Game/Rulesets/UI/HitRenderer.cs @@ -14,6 +14,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; +using osu.Framework.Input; using osu.Game.Rulesets.Replays; using osu.Game.Rulesets.Scoring; using OpenTK; @@ -47,7 +48,7 @@ namespace osu.Game.Rulesets.UI /// /// The key conversion input manager for this HitRenderer. /// - protected readonly KeyConversionInputManager KeyConversionInputManager; + protected readonly PassThroughInputManager KeyConversionInputManager; /// /// Whether we are currently providing the local user a gameplay cursor. @@ -87,7 +88,7 @@ namespace osu.Game.Rulesets.UI /// Creates a key conversion input manager. /// /// The input manager. - protected virtual KeyConversionInputManager CreateKeyConversionInputManager() => new KeyConversionInputManager(); + protected virtual PassThroughInputManager CreateKeyConversionInputManager() => new PassThroughInputManager(); protected virtual FramedReplayInputHandler CreateReplayInputHandler(Replay replay) => new FramedReplayInputHandler(replay); diff --git a/osu.Game/Screens/Play/KeyConversionInputManager.cs b/osu.Game/Screens/Play/KeyConversionInputManager.cs deleted file mode 100644 index f3ca764bd7..0000000000 --- a/osu.Game/Screens/Play/KeyConversionInputManager.cs +++ /dev/null @@ -1,16 +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.Input; - -namespace osu.Game.Screens.Play -{ - /// - /// An InputManager primarily used to map keys to new functions. - /// By default this does nothing; override TransformState to make alterations. - /// - public class KeyConversionInputManager : PassThroughInputManager - { - - } -} \ No newline at end of file diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 17596f0f49..0a73754e14 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -118,6 +118,7 @@ + @@ -309,7 +310,6 @@ - From eee64049866a6aa60a57ae9985d6d29722361c98 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 9 Aug 2017 12:37:47 +0900 Subject: [PATCH 12/18] Store bindings to database --- osu.Game/Input/ActionMappingInputManager.cs | 53 +++++++++++++++++++++ osu.Game/OsuGameBase.cs | 4 ++ 2 files changed, 57 insertions(+) diff --git a/osu.Game/Input/ActionMappingInputManager.cs b/osu.Game/Input/ActionMappingInputManager.cs index 5e2facdc93..89e8686a2c 100644 --- a/osu.Game/Input/ActionMappingInputManager.cs +++ b/osu.Game/Input/ActionMappingInputManager.cs @@ -1,9 +1,16 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using System.Collections.Generic; +using osu.Framework.Allocation; using osu.Framework.Input; +using osu.Framework.Platform; +using osu.Game.Database; +using osu.Game.Rulesets; using OpenTK.Input; +using SQLite.Net; +using SQLiteNetExtensions.Attributes; namespace osu.Game.Input { @@ -12,6 +19,13 @@ namespace osu.Game.Input { protected IDictionary Mappings { get; set; } + [BackgroundDependencyLoader] + private void load(BindingStore bindings) + { + foreach (var b in bindings.Query()) + Mappings[b.Key] = (T)(object)b.Action; + } + protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) { mapKey(state, args.Key); @@ -30,5 +44,44 @@ namespace osu.Game.Input if (Mappings.TryGetValue(key, out mappedData)) state.Data = mappedData; } + + private T parseStringRepresentation(string str) + { + T res; + + if (Enum.TryParse(str, out res)) + return res; + + return default(T); + } + } + + public class Binding + { + [ForeignKey(typeof(RulesetInfo))] + public int? RulesetID { get; set; } + + public Key Key { get; set; } + + public int Action { get; set; } + } + + public class BindingStore : DatabaseBackedStore + { + public BindingStore(SQLiteConnection connection, Storage storage = null) + : base(connection, storage) + { + } + + protected override void Prepare(bool reset = false) + { + Connection.CreateTable(); + } + + protected override Type[] ValidTypes => new[] + { + typeof(Binding) + }; + } } diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 0dec4228de..b76235f3f4 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -19,6 +19,7 @@ using osu.Game.Online.API; using SQLite.Net; using osu.Framework.Graphics.Performance; using osu.Game.Database; +using osu.Game.Input; using osu.Game.IO; using osu.Game.Rulesets; using osu.Game.Rulesets.Scoring; @@ -37,6 +38,8 @@ namespace osu.Game protected ScoreStore ScoreStore; + protected BindingStore BindingStore; + protected override string MainResourceFile => @"osu.Game.Resources.dll"; public APIAccess API; @@ -104,6 +107,7 @@ namespace osu.Game dependencies.Cache(FileStore = new FileStore(connection, Host.Storage)); dependencies.Cache(BeatmapManager = new BeatmapManager(Host.Storage, FileStore, connection, RulesetStore, Host)); dependencies.Cache(ScoreStore = new ScoreStore(Host.Storage, connection, Host, BeatmapManager)); + dependencies.Cache(BindingStore = new BindingStore(connection)); dependencies.Cache(new OsuColour()); //this completely overrides the framework default. will need to change once we make a proper FontStore. From 7c0e7ebcd0e734ba69cf4da5140b9a583aba3204 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 9 Aug 2017 13:04:11 +0900 Subject: [PATCH 13/18] Give HitRenderer a reference to Ruleset Used to get correct bindings for a mode (ActionMappingInputManager). --- osu.Desktop.Tests/Visual/TestCaseCatcher.cs | 9 ++++--- osu.Desktop.Tests/Visual/TestCaseGamefield.cs | 12 ++++++--- .../Visual/TestCaseScrollingPlayfield.cs | 2 +- osu.Game.Rulesets.Catch/CatchRuleset.cs | 7 ++++- .../RulesetInputManager.cs | 2 +- .../UI/CatchHitRenderer.cs | 6 ++--- osu.Game.Rulesets.Mania/ManiaRuleset.cs | 7 ++++- .../UI/ManiaHitRenderer.cs | 4 +-- osu.Game.Rulesets.Osu/OsuRuleset.cs | 7 ++++- osu.Game.Rulesets.Osu/UI/OsuHitRenderer.cs | 6 ++--- osu.Game.Rulesets.Taiko/TaikoRuleset.cs | 7 ++++- .../UI/TaikoHitRenderer.cs | 5 ++-- osu.Game/Beatmaps/DummyWorkingBeatmap.cs | 7 ++++- osu.Game/Input/ActionMappingInputManager.cs | 10 ++++++- osu.Game/Rulesets/Ruleset.cs | 7 +++++ osu.Game/Rulesets/RulesetInfo.cs | 2 +- osu.Game/Rulesets/RulesetStore.cs | 2 +- osu.Game/Rulesets/UI/HitRenderer.cs | 26 +++++++++++++------ osu.Game/Rulesets/UI/ScrollingHitRenderer.cs | 4 +-- 19 files changed, 93 insertions(+), 39 deletions(-) diff --git a/osu.Desktop.Tests/Visual/TestCaseCatcher.cs b/osu.Desktop.Tests/Visual/TestCaseCatcher.cs index de32608a6c..3f57b5eeb9 100644 --- a/osu.Desktop.Tests/Visual/TestCaseCatcher.cs +++ b/osu.Desktop.Tests/Visual/TestCaseCatcher.cs @@ -1,7 +1,9 @@ // 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.Game.Rulesets; using osu.Game.Rulesets.Catch; using osu.Game.Rulesets.Catch.UI; using OpenTK; @@ -10,13 +12,12 @@ namespace osu.Desktop.Tests.Visual { internal class TestCaseCatcher : OsuTestCase { - protected override void LoadComplete() + [BackgroundDependencyLoader] + private void load(RulesetStore rulesets) { - base.LoadComplete(); - Children = new Drawable[] { - new CatchInputManager + new CatchInputManager(rulesets.GetRuleset(2)) { RelativeSizeAxes = Axes.Both, Child = new CatcherArea diff --git a/osu.Desktop.Tests/Visual/TestCaseGamefield.cs b/osu.Desktop.Tests/Visual/TestCaseGamefield.cs index 9d61c9ab0c..98dda56d41 100644 --- a/osu.Desktop.Tests/Visual/TestCaseGamefield.cs +++ b/osu.Desktop.Tests/Visual/TestCaseGamefield.cs @@ -11,11 +11,15 @@ using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets; +using osu.Game.Rulesets.Catch; using osu.Game.Rulesets.Catch.UI; +using osu.Game.Rulesets.Mania; using osu.Game.Rulesets.Mania.UI; using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.UI; +using osu.Game.Rulesets.Taiko; using osu.Game.Rulesets.Taiko.UI; using OpenTK; @@ -84,25 +88,25 @@ namespace osu.Desktop.Tests.Visual Clock = new FramedClock(), Children = new Drawable[] { - new OsuHitRenderer(beatmap, false) + new OsuHitRenderer(new OsuRuleset(new RulesetInfo()), beatmap, false) { Scale = new Vector2(0.5f), Anchor = Anchor.TopLeft, Origin = Anchor.TopLeft }, - new TaikoHitRenderer(beatmap, false) + new TaikoHitRenderer(new TaikoRuleset(new RulesetInfo()),beatmap, false) { Scale = new Vector2(0.5f), Anchor = Anchor.TopRight, Origin = Anchor.TopRight }, - new CatchHitRenderer(beatmap, false) + new CatchHitRenderer(new CatchRuleset(new RulesetInfo()),beatmap, false) { Scale = new Vector2(0.5f), Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft }, - new ManiaHitRenderer(beatmap, false) + new ManiaHitRenderer(new ManiaRuleset(new RulesetInfo()),beatmap, false) { Scale = new Vector2(0.5f), Anchor = Anchor.BottomRight, diff --git a/osu.Desktop.Tests/Visual/TestCaseScrollingPlayfield.cs b/osu.Desktop.Tests/Visual/TestCaseScrollingPlayfield.cs index 7f067efa78..aaa2f7d49d 100644 --- a/osu.Desktop.Tests/Visual/TestCaseScrollingPlayfield.cs +++ b/osu.Desktop.Tests/Visual/TestCaseScrollingPlayfield.cs @@ -59,7 +59,7 @@ namespace osu.Desktop.Tests.Visual private class TestHitRenderer : ScrollingHitRenderer { public TestHitRenderer(WorkingBeatmap beatmap, bool isForCurrentRuleset) - : base(beatmap, isForCurrentRuleset) + : base(null, beatmap, isForCurrentRuleset) { } diff --git a/osu.Game.Rulesets.Catch/CatchRuleset.cs b/osu.Game.Rulesets.Catch/CatchRuleset.cs index dc13329bde..66e2fd30bb 100644 --- a/osu.Game.Rulesets.Catch/CatchRuleset.cs +++ b/osu.Game.Rulesets.Catch/CatchRuleset.cs @@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Catch { public class CatchRuleset : Ruleset { - public override HitRenderer CreateHitRendererWith(WorkingBeatmap beatmap, bool isForCurrentRuleset) => new CatchHitRenderer(beatmap, isForCurrentRuleset); + public override HitRenderer CreateHitRendererWith(WorkingBeatmap beatmap, bool isForCurrentRuleset) => new CatchHitRenderer(this, beatmap, isForCurrentRuleset); public override IEnumerable GetModsFor(ModType type) { @@ -102,5 +102,10 @@ namespace osu.Game.Rulesets.Catch public override ScoreProcessor CreateScoreProcessor() => new CatchScoreProcessor(); public override int LegacyID => 2; + + public CatchRuleset(RulesetInfo rulesetInfo) + : base(rulesetInfo) + { + } } } diff --git a/osu.Game.Rulesets.Catch/RulesetInputManager.cs b/osu.Game.Rulesets.Catch/RulesetInputManager.cs index 78bd18baa3..eada5cf532 100644 --- a/osu.Game.Rulesets.Catch/RulesetInputManager.cs +++ b/osu.Game.Rulesets.Catch/RulesetInputManager.cs @@ -9,7 +9,7 @@ namespace osu.Game.Rulesets.Catch { public class CatchInputManager : ActionMappingInputManager { - public CatchInputManager() + public CatchInputManager(RulesetInfo ruleset) : base(ruleset) { Mappings = new Dictionary { diff --git a/osu.Game.Rulesets.Catch/UI/CatchHitRenderer.cs b/osu.Game.Rulesets.Catch/UI/CatchHitRenderer.cs index 04e3036db6..d08b349459 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchHitRenderer.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchHitRenderer.cs @@ -17,8 +17,8 @@ namespace osu.Game.Rulesets.Catch.UI { public class CatchHitRenderer : ScrollingHitRenderer { - public CatchHitRenderer(WorkingBeatmap beatmap, bool isForCurrentRuleset) - : base(beatmap, isForCurrentRuleset) + public CatchHitRenderer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset) + : base(ruleset, beatmap, isForCurrentRuleset) { } @@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Catch.UI protected override Playfield CreatePlayfield() => new CatchPlayfield(); - protected override PassThroughInputManager CreateKeyConversionInputManager() => new CatchInputManager(); + protected override PassThroughInputManager CreateActionMappingInputManager() => new CatchInputManager(Ruleset.RulesetInfo); protected override DrawableHitObject GetVisualRepresentation(CatchBaseHit h) { diff --git a/osu.Game.Rulesets.Mania/ManiaRuleset.cs b/osu.Game.Rulesets.Mania/ManiaRuleset.cs index a8a89a57e0..b61230d347 100644 --- a/osu.Game.Rulesets.Mania/ManiaRuleset.cs +++ b/osu.Game.Rulesets.Mania/ManiaRuleset.cs @@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Mania { public class ManiaRuleset : Ruleset { - public override HitRenderer CreateHitRendererWith(WorkingBeatmap beatmap, bool isForCurrentRuleset) => new ManiaHitRenderer(beatmap, isForCurrentRuleset); + public override HitRenderer CreateHitRendererWith(WorkingBeatmap beatmap, bool isForCurrentRuleset) => new ManiaHitRenderer(this, beatmap, isForCurrentRuleset); public override IEnumerable GetModsFor(ModType type) { @@ -118,5 +118,10 @@ namespace osu.Game.Rulesets.Mania public override ScoreProcessor CreateScoreProcessor() => new ManiaScoreProcessor(); public override int LegacyID => 3; + + public ManiaRuleset(RulesetInfo rulesetInfo) + : base(rulesetInfo) + { + } } } diff --git a/osu.Game.Rulesets.Mania/UI/ManiaHitRenderer.cs b/osu.Game.Rulesets.Mania/UI/ManiaHitRenderer.cs index 0b8ad10b16..ffb3ad4a45 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaHitRenderer.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaHitRenderer.cs @@ -38,8 +38,8 @@ namespace osu.Game.Rulesets.Mania.UI public IEnumerable BarLines; - public ManiaHitRenderer(WorkingBeatmap beatmap, bool isForCurrentRuleset) - : base(beatmap, isForCurrentRuleset) + public ManiaHitRenderer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset) + : base(ruleset, beatmap, isForCurrentRuleset) { // Generate the bar lines double lastObjectTime = (Objects.LastOrDefault() as IHasEndTime)?.EndTime ?? Objects.LastOrDefault()?.StartTime ?? double.MaxValue; diff --git a/osu.Game.Rulesets.Osu/OsuRuleset.cs b/osu.Game.Rulesets.Osu/OsuRuleset.cs index 9a1971d791..d80beaf0a3 100644 --- a/osu.Game.Rulesets.Osu/OsuRuleset.cs +++ b/osu.Game.Rulesets.Osu/OsuRuleset.cs @@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Osu { public class OsuRuleset : Ruleset { - public override HitRenderer CreateHitRendererWith(WorkingBeatmap beatmap, bool isForCurrentRuleset) => new OsuHitRenderer(beatmap, isForCurrentRuleset); + public override HitRenderer CreateHitRendererWith(WorkingBeatmap beatmap, bool isForCurrentRuleset) => new OsuHitRenderer(this, beatmap, isForCurrentRuleset); public override IEnumerable GetBeatmapStatistics(WorkingBeatmap beatmap) => new[] { @@ -126,5 +126,10 @@ namespace osu.Game.Rulesets.Osu public override SettingsSubsection CreateSettings() => new OsuSettings(); public override int LegacyID => 0; + + public OsuRuleset(RulesetInfo rulesetInfo) + : base(rulesetInfo) + { + } } } diff --git a/osu.Game.Rulesets.Osu/UI/OsuHitRenderer.cs b/osu.Game.Rulesets.Osu/UI/OsuHitRenderer.cs index e59af40db4..1356e97907 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuHitRenderer.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuHitRenderer.cs @@ -18,8 +18,8 @@ namespace osu.Game.Rulesets.Osu.UI { public class OsuHitRenderer : HitRenderer { - public OsuHitRenderer(WorkingBeatmap beatmap, bool isForCurrentRuleset) - : base(beatmap, isForCurrentRuleset) + public OsuHitRenderer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset) + : base(ruleset, beatmap, isForCurrentRuleset) { } @@ -31,7 +31,7 @@ namespace osu.Game.Rulesets.Osu.UI protected override Playfield CreatePlayfield() => new OsuPlayfield(); - protected override PassThroughInputManager CreateKeyConversionInputManager() => new OsuKeyConversionInputManager(); + protected override PassThroughInputManager CreateActionMappingInputManager() => new OsuKeyConversionInputManager(); protected override DrawableHitObject GetVisualRepresentation(OsuHitObject h) { diff --git a/osu.Game.Rulesets.Taiko/TaikoRuleset.cs b/osu.Game.Rulesets.Taiko/TaikoRuleset.cs index 83db9b35af..9b2536a7ec 100644 --- a/osu.Game.Rulesets.Taiko/TaikoRuleset.cs +++ b/osu.Game.Rulesets.Taiko/TaikoRuleset.cs @@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Taiko { public class TaikoRuleset : Ruleset { - public override HitRenderer CreateHitRendererWith(WorkingBeatmap beatmap, bool isForCurrentRuleset) => new TaikoHitRenderer(beatmap, isForCurrentRuleset); + public override HitRenderer CreateHitRendererWith(WorkingBeatmap beatmap, bool isForCurrentRuleset) => new TaikoHitRenderer(this, beatmap, isForCurrentRuleset); public override IEnumerable GetModsFor(ModType type) { @@ -103,5 +103,10 @@ namespace osu.Game.Rulesets.Taiko public override ScoreProcessor CreateScoreProcessor() => new TaikoScoreProcessor(); public override int LegacyID => 1; + + public TaikoRuleset(RulesetInfo rulesetInfo) + : base(rulesetInfo) + { + } } } diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoHitRenderer.cs b/osu.Game.Rulesets.Taiko/UI/TaikoHitRenderer.cs index 570b4be488..cb89cfed72 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoHitRenderer.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoHitRenderer.cs @@ -23,8 +23,8 @@ namespace osu.Game.Rulesets.Taiko.UI { public class TaikoHitRenderer : HitRenderer { - public TaikoHitRenderer(WorkingBeatmap beatmap, bool isForCurrentRuleset) - : base(beatmap, isForCurrentRuleset) + public TaikoHitRenderer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset) + : base(ruleset, beatmap, isForCurrentRuleset) { } @@ -93,7 +93,6 @@ namespace osu.Game.Rulesets.Taiko.UI return new Vector2(1, default_relative_height * aspectAdjust); } - public override ScoreProcessor CreateScoreProcessor() => new TaikoScoreProcessor(this); protected override BeatmapConverter CreateBeatmapConverter() => new TaikoBeatmapConverter(); diff --git a/osu.Game/Beatmaps/DummyWorkingBeatmap.cs b/osu.Game/Beatmaps/DummyWorkingBeatmap.cs index bd53a80555..7538893cb7 100644 --- a/osu.Game/Beatmaps/DummyWorkingBeatmap.cs +++ b/osu.Game/Beatmaps/DummyWorkingBeatmap.cs @@ -54,7 +54,7 @@ namespace osu.Game.Beatmaps private class DummyRulesetInfo : RulesetInfo { - public override Ruleset CreateInstance() => new DummyRuleset(); + public override Ruleset CreateInstance() => new DummyRuleset(this); private class DummyRuleset : Ruleset { @@ -77,6 +77,11 @@ namespace osu.Game.Beatmaps public override string Description => "dummy"; public override IEnumerable CreateGameplayKeys() => new List(); + + public DummyRuleset(RulesetInfo rulesetInfo) + : base(rulesetInfo) + { + } } } } diff --git a/osu.Game/Input/ActionMappingInputManager.cs b/osu.Game/Input/ActionMappingInputManager.cs index 89e8686a2c..2e78b49b75 100644 --- a/osu.Game/Input/ActionMappingInputManager.cs +++ b/osu.Game/Input/ActionMappingInputManager.cs @@ -17,12 +17,20 @@ namespace osu.Game.Input public class ActionMappingInputManager : PassThroughInputManager where T : struct { + private readonly RulesetInfo ruleset; + + protected ActionMappingInputManager(RulesetInfo ruleset = null) + { + this.ruleset = ruleset; + } + protected IDictionary Mappings { get; set; } [BackgroundDependencyLoader] private void load(BindingStore bindings) { - foreach (var b in bindings.Query()) + var rulesetId = ruleset?.ID; + foreach (var b in bindings.Query(b => b.RulesetID == rulesetId)) Mappings[b.Key] = (T)(object)b.Action; } diff --git a/osu.Game/Rulesets/Ruleset.cs b/osu.Game/Rulesets/Ruleset.cs index b3be36a983..4a492b84fb 100644 --- a/osu.Game/Rulesets/Ruleset.cs +++ b/osu.Game/Rulesets/Ruleset.cs @@ -15,12 +15,19 @@ namespace osu.Game.Rulesets { public abstract class Ruleset { + public readonly RulesetInfo RulesetInfo; + public virtual IEnumerable GetBeatmapStatistics(WorkingBeatmap beatmap) => new BeatmapStatistic[] { }; public abstract IEnumerable GetModsFor(ModType type); public abstract Mod GetAutoplayMod(); + protected Ruleset(RulesetInfo rulesetInfo) + { + RulesetInfo = rulesetInfo; + } + /// /// Attempt to create a hit renderer for a beatmap /// diff --git a/osu.Game/Rulesets/RulesetInfo.cs b/osu.Game/Rulesets/RulesetInfo.cs index 84ecb7718e..bc23649ede 100644 --- a/osu.Game/Rulesets/RulesetInfo.cs +++ b/osu.Game/Rulesets/RulesetInfo.cs @@ -20,6 +20,6 @@ namespace osu.Game.Rulesets [Indexed] public bool Available { get; set; } - public virtual Ruleset CreateInstance() => (Ruleset)Activator.CreateInstance(Type.GetType(InstantiationInfo)); + public virtual Ruleset CreateInstance() => (Ruleset)Activator.CreateInstance(Type.GetType(InstantiationInfo), this); } } \ No newline at end of file diff --git a/osu.Game/Rulesets/RulesetStore.cs b/osu.Game/Rulesets/RulesetStore.cs index 1564df1366..2956c11d7f 100644 --- a/osu.Game/Rulesets/RulesetStore.cs +++ b/osu.Game/Rulesets/RulesetStore.cs @@ -44,7 +44,7 @@ namespace osu.Game.Rulesets continue; foreach (Type rulesetType in rulesets) - instances.Add((Ruleset)Activator.CreateInstance(rulesetType)); + instances.Add((Ruleset)Activator.CreateInstance(rulesetType, new RulesetInfo())); } catch (Exception) { } } diff --git a/osu.Game/Rulesets/UI/HitRenderer.cs b/osu.Game/Rulesets/UI/HitRenderer.cs index 244c3312c4..00f8e8a469 100644 --- a/osu.Game/Rulesets/UI/HitRenderer.cs +++ b/osu.Game/Rulesets/UI/HitRenderer.cs @@ -67,9 +67,16 @@ namespace osu.Game.Rulesets.UI /// protected abstract bool AllObjectsJudged { get; } - internal HitRenderer() + protected readonly Ruleset Ruleset; + + /// + /// A visual representation of a . + /// + /// The ruleset being repesented. + internal HitRenderer(Ruleset ruleset) { - KeyConversionInputManager = CreateKeyConversionInputManager(); + Ruleset = ruleset; + KeyConversionInputManager = CreateActionMappingInputManager(); KeyConversionInputManager.RelativeSizeAxes = Axes.Both; } @@ -88,7 +95,7 @@ namespace osu.Game.Rulesets.UI /// Creates a key conversion input manager. /// /// The input manager. - protected virtual PassThroughInputManager CreateKeyConversionInputManager() => new PassThroughInputManager(); + protected virtual PassThroughInputManager CreateActionMappingInputManager() => new PassThroughInputManager(); protected virtual FramedReplayInputHandler CreateReplayInputHandler(Replay replay) => new FramedReplayInputHandler(replay); @@ -134,9 +141,10 @@ namespace osu.Game.Rulesets.UI /// /// Creates a hit renderer for a beatmap. /// + /// The ruleset being repesented. /// The beatmap to create the hit renderer for. /// Whether to assume the beatmap is for the current ruleset. - internal HitRenderer(WorkingBeatmap beatmap, bool isForCurrentRuleset) + internal HitRenderer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset) : base(ruleset) { Debug.Assert(beatmap != null, "HitRenderer initialized with a null beatmap."); @@ -236,10 +244,11 @@ namespace osu.Game.Rulesets.UI /// /// Creates a hit renderer for a beatmap. /// + /// The ruleset being repesented. /// The beatmap to create the hit renderer for. /// Whether to assume the beatmap is for the current ruleset. - protected HitRenderer(WorkingBeatmap beatmap, bool isForCurrentRuleset) - : base(beatmap, isForCurrentRuleset) + protected HitRenderer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset) + : base(ruleset, beatmap, isForCurrentRuleset) { InputManager.Add(content = new Container { @@ -343,10 +352,11 @@ namespace osu.Game.Rulesets.UI /// /// Creates a hit renderer for a beatmap. /// + /// The ruleset being repesented. /// The beatmap to create the hit renderer for. /// Whether to assume the beatmap is for the current ruleset. - protected HitRenderer(WorkingBeatmap beatmap, bool isForCurrentRuleset) - : base(beatmap, isForCurrentRuleset) + protected HitRenderer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset) + : base(ruleset, beatmap, isForCurrentRuleset) { } } diff --git a/osu.Game/Rulesets/UI/ScrollingHitRenderer.cs b/osu.Game/Rulesets/UI/ScrollingHitRenderer.cs index da4340ac7a..37df08ba21 100644 --- a/osu.Game/Rulesets/UI/ScrollingHitRenderer.cs +++ b/osu.Game/Rulesets/UI/ScrollingHitRenderer.cs @@ -32,8 +32,8 @@ namespace osu.Game.Rulesets.UI /// protected readonly SortedList DefaultControlPoints = new SortedList(Comparer.Default); - protected ScrollingHitRenderer(WorkingBeatmap beatmap, bool isForCurrentRuleset) - : base(beatmap, isForCurrentRuleset) + protected ScrollingHitRenderer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset) + : base(ruleset, beatmap, isForCurrentRuleset) { } From f21b370f4e2098a61ef9e1de431ab5b11d48bda9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 9 Aug 2017 13:23:23 +0900 Subject: [PATCH 14/18] Add variant for rulesets with more than one possible key layout --- osu.Game/Input/ActionMappingInputManager.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/osu.Game/Input/ActionMappingInputManager.cs b/osu.Game/Input/ActionMappingInputManager.cs index 2e78b49b75..d926b888c5 100644 --- a/osu.Game/Input/ActionMappingInputManager.cs +++ b/osu.Game/Input/ActionMappingInputManager.cs @@ -10,6 +10,7 @@ using osu.Game.Database; using osu.Game.Rulesets; using OpenTK.Input; using SQLite.Net; +using SQLite.Net.Attributes; using SQLiteNetExtensions.Attributes; namespace osu.Game.Input @@ -19,9 +20,12 @@ namespace osu.Game.Input { private readonly RulesetInfo ruleset; - protected ActionMappingInputManager(RulesetInfo ruleset = null) + private readonly int? variant; + + protected ActionMappingInputManager(RulesetInfo ruleset = null, int? variant = null) { this.ruleset = ruleset; + this.variant = variant; } protected IDictionary Mappings { get; set; } @@ -30,7 +34,7 @@ namespace osu.Game.Input private void load(BindingStore bindings) { var rulesetId = ruleset?.ID; - foreach (var b in bindings.Query(b => b.RulesetID == rulesetId)) + foreach (var b in bindings.Query(b => b.RulesetID == rulesetId && b.Variant == variant)) Mappings[b.Key] = (T)(object)b.Action; } @@ -69,6 +73,9 @@ namespace osu.Game.Input [ForeignKey(typeof(RulesetInfo))] public int? RulesetID { get; set; } + [Indexed] + public int? Variant { get; set; } + public Key Key { get; set; } public int Action { get; set; } From 723e27353c0a25792f7361729ccb33aef8c48b9d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 9 Aug 2017 13:28:29 +0900 Subject: [PATCH 15/18] HitRenderer -> RulesetContainer --- osu.Desktop.Tests/Visual/TestCaseGamefield.cs | 8 +-- .../Visual/TestCaseScrollingPlayfield.cs | 10 ++-- osu.Game.Rulesets.Catch/CatchRuleset.cs | 2 +- .../Scoring/CatchScoreProcessor.cs | 4 +- ...itRenderer.cs => CatchRulesetContainer.cs} | 4 +- .../osu.Game.Rulesets.Catch.csproj | 2 +- osu.Game.Rulesets.Mania/ManiaRuleset.cs | 2 +- .../Mods/IGenerateSpeedAdjustments.cs | 4 +- .../Mods/ManiaModGravity.cs | 10 ++-- .../Scoring/ManiaScoreProcessor.cs | 4 +- ...itRenderer.cs => ManiaRulesetContainer.cs} | 4 +- .../osu.Game.Rulesets.Mania.csproj | 2 +- osu.Game.Rulesets.Osu/OsuRuleset.cs | 2 +- .../Scoring/OsuScoreProcessor.cs | 4 +- ...uHitRenderer.cs => OsuRulesetContainer.cs} | 4 +- .../osu.Game.Rulesets.Osu.csproj | 2 +- .../Scoring/TaikoScoreProcessor.cs | 4 +- osu.Game.Rulesets.Taiko/TaikoRuleset.cs | 2 +- osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs | 2 +- ...itRenderer.cs => TaikoRulesetContainer.cs} | 4 +- .../osu.Game.Rulesets.Taiko.csproj | 2 +- osu.Game/Beatmaps/DummyWorkingBeatmap.cs | 2 +- osu.Game/Rulesets/Mods/IApplicableMod.cs | 10 ++-- osu.Game/Rulesets/Mods/ModAutoplay.cs | 4 +- osu.Game/Rulesets/Ruleset.cs | 2 +- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 8 +-- .../{HitRenderer.cs => RulesetContainer.cs} | 50 +++++++++---------- ...nderer.cs => ScrollingRulesetContainer.cs} | 10 ++-- osu.Game/Screens/Play/HUDOverlay.cs | 6 +-- osu.Game/Screens/Play/Player.cs | 40 +++++++-------- osu.Game/Screens/Play/ReplayPlayer.cs | 2 +- osu.Game/osu.Game.csproj | 4 +- 32 files changed, 110 insertions(+), 110 deletions(-) rename osu.Game.Rulesets.Catch/UI/{CatchHitRenderer.cs => CatchRulesetContainer.cs} (84%) rename osu.Game.Rulesets.Mania/UI/{ManiaHitRenderer.cs => ManiaRulesetContainer.cs} (92%) rename osu.Game.Rulesets.Osu/UI/{OsuHitRenderer.cs => OsuRulesetContainer.cs} (88%) rename osu.Game.Rulesets.Taiko/UI/{TaikoHitRenderer.cs => TaikoRulesetContainer.cs} (93%) rename osu.Game/Rulesets/UI/{HitRenderer.cs => RulesetContainer.cs} (84%) rename osu.Game/Rulesets/UI/{ScrollingHitRenderer.cs => ScrollingRulesetContainer.cs} (87%) diff --git a/osu.Desktop.Tests/Visual/TestCaseGamefield.cs b/osu.Desktop.Tests/Visual/TestCaseGamefield.cs index 98dda56d41..73c61f5669 100644 --- a/osu.Desktop.Tests/Visual/TestCaseGamefield.cs +++ b/osu.Desktop.Tests/Visual/TestCaseGamefield.cs @@ -88,25 +88,25 @@ namespace osu.Desktop.Tests.Visual Clock = new FramedClock(), Children = new Drawable[] { - new OsuHitRenderer(new OsuRuleset(new RulesetInfo()), beatmap, false) + new OsuRulesetContainer(new OsuRuleset(new RulesetInfo()), beatmap, false) { Scale = new Vector2(0.5f), Anchor = Anchor.TopLeft, Origin = Anchor.TopLeft }, - new TaikoHitRenderer(new TaikoRuleset(new RulesetInfo()),beatmap, false) + new TaikoRulesetContainer(new TaikoRuleset(new RulesetInfo()),beatmap, false) { Scale = new Vector2(0.5f), Anchor = Anchor.TopRight, Origin = Anchor.TopRight }, - new CatchHitRenderer(new CatchRuleset(new RulesetInfo()),beatmap, false) + new CatchRulesetContainer(new CatchRuleset(new RulesetInfo()),beatmap, false) { Scale = new Vector2(0.5f), Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft }, - new ManiaHitRenderer(new ManiaRuleset(new RulesetInfo()),beatmap, false) + new ManiaRulesetContainer(new ManiaRuleset(new RulesetInfo()),beatmap, false) { Scale = new Vector2(0.5f), Anchor = Anchor.BottomRight, diff --git a/osu.Desktop.Tests/Visual/TestCaseScrollingPlayfield.cs b/osu.Desktop.Tests/Visual/TestCaseScrollingPlayfield.cs index aaa2f7d49d..861e79b0b1 100644 --- a/osu.Desktop.Tests/Visual/TestCaseScrollingPlayfield.cs +++ b/osu.Desktop.Tests/Visual/TestCaseScrollingPlayfield.cs @@ -50,15 +50,15 @@ namespace osu.Desktop.Tests.Visual WorkingBeatmap beatmap = new TestWorkingBeatmap(b); - TestHitRenderer hitRenderer; - Add(hitRenderer = new TestHitRenderer(beatmap, true)); + TestRulesetContainer rulesetContainer; + Add(rulesetContainer = new TestRulesetContainer(beatmap, true)); - AddStep("Reverse direction", () => hitRenderer.Playfield.Reversed.Value = !hitRenderer.Playfield.Reversed); + AddStep("Reverse direction", () => rulesetContainer.Playfield.Reversed.Value = !rulesetContainer.Playfield.Reversed); } - private class TestHitRenderer : ScrollingHitRenderer + private class TestRulesetContainer : ScrollingRulesetContainer { - public TestHitRenderer(WorkingBeatmap beatmap, bool isForCurrentRuleset) + public TestRulesetContainer(WorkingBeatmap beatmap, bool isForCurrentRuleset) : base(null, beatmap, isForCurrentRuleset) { } diff --git a/osu.Game.Rulesets.Catch/CatchRuleset.cs b/osu.Game.Rulesets.Catch/CatchRuleset.cs index 66e2fd30bb..8d45ea8fa2 100644 --- a/osu.Game.Rulesets.Catch/CatchRuleset.cs +++ b/osu.Game.Rulesets.Catch/CatchRuleset.cs @@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Catch { public class CatchRuleset : Ruleset { - public override HitRenderer CreateHitRendererWith(WorkingBeatmap beatmap, bool isForCurrentRuleset) => new CatchHitRenderer(this, beatmap, isForCurrentRuleset); + public override RulesetContainer CreateRulesetContainerWith(WorkingBeatmap beatmap, bool isForCurrentRuleset) => new CatchRulesetContainer(this, beatmap, isForCurrentRuleset); public override IEnumerable GetModsFor(ModType type) { diff --git a/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs b/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs index 1c866320c9..33c1355823 100644 --- a/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs +++ b/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs @@ -14,8 +14,8 @@ namespace osu.Game.Rulesets.Catch.Scoring { } - public CatchScoreProcessor(HitRenderer hitRenderer) - : base(hitRenderer) + public CatchScoreProcessor(RulesetContainer rulesetContainer) + : base(rulesetContainer) { } diff --git a/osu.Game.Rulesets.Catch/UI/CatchHitRenderer.cs b/osu.Game.Rulesets.Catch/UI/CatchRulesetContainer.cs similarity index 84% rename from osu.Game.Rulesets.Catch/UI/CatchHitRenderer.cs rename to osu.Game.Rulesets.Catch/UI/CatchRulesetContainer.cs index d08b349459..27cc05c47a 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchHitRenderer.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchRulesetContainer.cs @@ -15,9 +15,9 @@ using osu.Game.Rulesets.UI; namespace osu.Game.Rulesets.Catch.UI { - public class CatchHitRenderer : ScrollingHitRenderer + public class CatchRulesetContainer : ScrollingRulesetContainer { - public CatchHitRenderer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset) + public CatchRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset) : base(ruleset, beatmap, isForCurrentRuleset) { } diff --git a/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj b/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj index fcffcb8060..8fefdc7b3c 100644 --- a/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj +++ b/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj @@ -60,7 +60,7 @@ - + diff --git a/osu.Game.Rulesets.Mania/ManiaRuleset.cs b/osu.Game.Rulesets.Mania/ManiaRuleset.cs index b61230d347..50ad6960ae 100644 --- a/osu.Game.Rulesets.Mania/ManiaRuleset.cs +++ b/osu.Game.Rulesets.Mania/ManiaRuleset.cs @@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Mania { public class ManiaRuleset : Ruleset { - public override HitRenderer CreateHitRendererWith(WorkingBeatmap beatmap, bool isForCurrentRuleset) => new ManiaHitRenderer(this, beatmap, isForCurrentRuleset); + public override RulesetContainer CreateRulesetContainerWith(WorkingBeatmap beatmap, bool isForCurrentRuleset) => new ManiaRulesetContainer(this, beatmap, isForCurrentRuleset); public override IEnumerable GetModsFor(ModType type) { diff --git a/osu.Game.Rulesets.Mania/Mods/IGenerateSpeedAdjustments.cs b/osu.Game.Rulesets.Mania/Mods/IGenerateSpeedAdjustments.cs index f179aa2ff8..954ee3f481 100644 --- a/osu.Game.Rulesets.Mania/Mods/IGenerateSpeedAdjustments.cs +++ b/osu.Game.Rulesets.Mania/Mods/IGenerateSpeedAdjustments.cs @@ -15,9 +15,9 @@ namespace osu.Game.Rulesets.Mania.Mods /// /// Applies this mod to a hit renderer. /// - /// The hit renderer to apply to. + /// The hit renderer to apply to. /// The per-column list of speed adjustments for hit objects. /// The list of speed adjustments for bar lines. - void ApplyToHitRenderer(ManiaHitRenderer hitRenderer, ref List[] hitObjectTimingChanges, ref List barlineTimingChanges); + void ApplyToRulesetContainer(ManiaRulesetContainer rulesetContainer, ref List[] hitObjectTimingChanges, ref List barlineTimingChanges); } } diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModGravity.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModGravity.cs index 1ba8ac4710..a054e0db56 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModGravity.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModGravity.cs @@ -20,12 +20,12 @@ namespace osu.Game.Rulesets.Mania.Mods public override FontAwesome Icon => FontAwesome.fa_sort_desc; - public void ApplyToHitRenderer(ManiaHitRenderer hitRenderer, ref List[] hitObjectTimingChanges, ref List barlineTimingChanges) + public void ApplyToRulesetContainer(ManiaRulesetContainer rulesetContainer, ref List[] hitObjectTimingChanges, ref List barlineTimingChanges) { // We have to generate one speed adjustment per hit object for gravity - foreach (ManiaHitObject obj in hitRenderer.Objects) + foreach (ManiaHitObject obj in rulesetContainer.Objects) { - MultiplierControlPoint controlPoint = hitRenderer.CreateControlPointAt(obj.StartTime); + MultiplierControlPoint controlPoint = rulesetContainer.CreateControlPointAt(obj.StartTime); // Beat length has too large of an effect for gravity, so we'll force it to a constant value for now controlPoint.TimingPoint.BeatLength = 1000; @@ -33,9 +33,9 @@ namespace osu.Game.Rulesets.Mania.Mods } // Like with hit objects, we need to generate one speed adjustment per bar line - foreach (DrawableBarLine barLine in hitRenderer.BarLines) + foreach (DrawableBarLine barLine in rulesetContainer.BarLines) { - var controlPoint = hitRenderer.CreateControlPointAt(barLine.HitObject.StartTime); + var controlPoint = rulesetContainer.CreateControlPointAt(barLine.HitObject.StartTime); // Beat length has too large of an effect for gravity, so we'll force it to a constant value for now controlPoint.TimingPoint.BeatLength = 1000; diff --git a/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs b/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs index f575342486..63b443319f 100644 --- a/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs +++ b/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs @@ -155,8 +155,8 @@ namespace osu.Game.Rulesets.Mania.Scoring { } - public ManiaScoreProcessor(HitRenderer hitRenderer) - : base(hitRenderer) + public ManiaScoreProcessor(RulesetContainer rulesetContainer) + : base(rulesetContainer) { } diff --git a/osu.Game.Rulesets.Mania/UI/ManiaHitRenderer.cs b/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs similarity index 92% rename from osu.Game.Rulesets.Mania/UI/ManiaHitRenderer.cs rename to osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs index ffb3ad4a45..7f6b19f3bd 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaHitRenderer.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs @@ -29,7 +29,7 @@ using osu.Game.Rulesets.UI; namespace osu.Game.Rulesets.Mania.UI { - public class ManiaHitRenderer : ScrollingHitRenderer + public class ManiaRulesetContainer : ScrollingRulesetContainer { /// /// Preferred column count. This will only have an effect during the initialization of the play field. @@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Mania.UI public IEnumerable BarLines; - public ManiaHitRenderer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset) + public ManiaRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset) : base(ruleset, beatmap, isForCurrentRuleset) { // Generate the bar lines diff --git a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj index 3832f9ace5..fb0b2d907f 100644 --- a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj +++ b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj @@ -82,7 +82,7 @@ - + diff --git a/osu.Game.Rulesets.Osu/OsuRuleset.cs b/osu.Game.Rulesets.Osu/OsuRuleset.cs index d80beaf0a3..212c634aaf 100644 --- a/osu.Game.Rulesets.Osu/OsuRuleset.cs +++ b/osu.Game.Rulesets.Osu/OsuRuleset.cs @@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Osu { public class OsuRuleset : Ruleset { - public override HitRenderer CreateHitRendererWith(WorkingBeatmap beatmap, bool isForCurrentRuleset) => new OsuHitRenderer(this, beatmap, isForCurrentRuleset); + public override RulesetContainer CreateRulesetContainerWith(WorkingBeatmap beatmap, bool isForCurrentRuleset) => new OsuRulesetContainer(this, beatmap, isForCurrentRuleset); public override IEnumerable GetBeatmapStatistics(WorkingBeatmap beatmap) => new[] { diff --git a/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs b/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs index 079ee928af..856ca0c98d 100644 --- a/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs +++ b/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs @@ -18,8 +18,8 @@ namespace osu.Game.Rulesets.Osu.Scoring { } - public OsuScoreProcessor(HitRenderer hitRenderer) - : base(hitRenderer) + public OsuScoreProcessor(RulesetContainer rulesetContainer) + : base(rulesetContainer) { } diff --git a/osu.Game.Rulesets.Osu/UI/OsuHitRenderer.cs b/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs similarity index 88% rename from osu.Game.Rulesets.Osu/UI/OsuHitRenderer.cs rename to osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs index 1356e97907..d029524a32 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuHitRenderer.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs @@ -16,9 +16,9 @@ using osu.Game.Rulesets.UI; namespace osu.Game.Rulesets.Osu.UI { - public class OsuHitRenderer : HitRenderer + public class OsuRulesetContainer : RulesetContainer { - public OsuHitRenderer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset) + public OsuRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset) : base(ruleset, beatmap, isForCurrentRuleset) { } diff --git a/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj b/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj index 684060c981..b24d5b3a4a 100644 --- a/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj +++ b/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj @@ -80,7 +80,7 @@ - + diff --git a/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs b/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs index 70df3d8317..647a1381c6 100644 --- a/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs +++ b/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs @@ -113,8 +113,8 @@ namespace osu.Game.Rulesets.Taiko.Scoring { } - public TaikoScoreProcessor(HitRenderer hitRenderer) - : base(hitRenderer) + public TaikoScoreProcessor(RulesetContainer rulesetContainer) + : base(rulesetContainer) { } diff --git a/osu.Game.Rulesets.Taiko/TaikoRuleset.cs b/osu.Game.Rulesets.Taiko/TaikoRuleset.cs index 9b2536a7ec..4d4bbb7bc5 100644 --- a/osu.Game.Rulesets.Taiko/TaikoRuleset.cs +++ b/osu.Game.Rulesets.Taiko/TaikoRuleset.cs @@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Taiko { public class TaikoRuleset : Ruleset { - public override HitRenderer CreateHitRendererWith(WorkingBeatmap beatmap, bool isForCurrentRuleset) => new TaikoHitRenderer(this, beatmap, isForCurrentRuleset); + public override RulesetContainer CreateRulesetContainerWith(WorkingBeatmap beatmap, bool isForCurrentRuleset) => new TaikoRulesetContainer(this, beatmap, isForCurrentRuleset); public override IEnumerable GetModsFor(ModType type) { diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs index dca339f734..119cd64fef 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs @@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Taiko.UI public class TaikoPlayfield : Playfield { /// - /// Default height of a when inside a . + /// Default height of a when inside a . /// public const float DEFAULT_HEIGHT = 178; diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoHitRenderer.cs b/osu.Game.Rulesets.Taiko/UI/TaikoRulesetContainer.cs similarity index 93% rename from osu.Game.Rulesets.Taiko/UI/TaikoHitRenderer.cs rename to osu.Game.Rulesets.Taiko/UI/TaikoRulesetContainer.cs index cb89cfed72..29f563b735 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoHitRenderer.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoRulesetContainer.cs @@ -21,9 +21,9 @@ using System.Linq; namespace osu.Game.Rulesets.Taiko.UI { - public class TaikoHitRenderer : HitRenderer + public class TaikoRulesetContainer : RulesetContainer { - public TaikoHitRenderer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset) + public TaikoRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset) : base(ruleset, beatmap, isForCurrentRuleset) { } diff --git a/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj b/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj index f719f2002b..59c6f4db0a 100644 --- a/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj +++ b/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj @@ -91,7 +91,7 @@ - + diff --git a/osu.Game/Beatmaps/DummyWorkingBeatmap.cs b/osu.Game/Beatmaps/DummyWorkingBeatmap.cs index 7538893cb7..2fb9a568f8 100644 --- a/osu.Game/Beatmaps/DummyWorkingBeatmap.cs +++ b/osu.Game/Beatmaps/DummyWorkingBeatmap.cs @@ -62,7 +62,7 @@ namespace osu.Game.Beatmaps public override Mod GetAutoplayMod() => new ModAutoplay(); - public override HitRenderer CreateHitRendererWith(WorkingBeatmap beatmap, bool isForCurrentRuleset) + public override RulesetContainer CreateRulesetContainerWith(WorkingBeatmap beatmap, bool isForCurrentRuleset) { throw new NotImplementedException(); } diff --git a/osu.Game/Rulesets/Mods/IApplicableMod.cs b/osu.Game/Rulesets/Mods/IApplicableMod.cs index 18e1ae4b3d..1957952720 100644 --- a/osu.Game/Rulesets/Mods/IApplicableMod.cs +++ b/osu.Game/Rulesets/Mods/IApplicableMod.cs @@ -7,16 +7,16 @@ using osu.Game.Rulesets.UI; namespace osu.Game.Rulesets.Mods { /// - /// An interface for mods that are applied to a HitRenderer. + /// An interface for mods that are applied to a RulesetContainer. /// - /// The type of HitObject the HitRenderer contains. + /// The type of HitObject the RulesetContainer contains. public interface IApplicableMod where TObject : HitObject { /// - /// Applies the mod to a HitRenderer. + /// Applies the mod to a RulesetContainer. /// - /// The HitRenderer to apply the mod to. - void ApplyToHitRenderer(HitRenderer hitRenderer); + /// The RulesetContainer to apply the mod to. + void ApplyToRulesetContainer(RulesetContainer rulesetContainer); } } diff --git a/osu.Game/Rulesets/Mods/ModAutoplay.cs b/osu.Game/Rulesets/Mods/ModAutoplay.cs index 1217bf835f..ca120e446e 100644 --- a/osu.Game/Rulesets/Mods/ModAutoplay.cs +++ b/osu.Game/Rulesets/Mods/ModAutoplay.cs @@ -15,9 +15,9 @@ namespace osu.Game.Rulesets.Mods { protected abstract Score CreateReplayScore(Beatmap beatmap); - public void ApplyToHitRenderer(HitRenderer hitRenderer) + public void ApplyToRulesetContainer(RulesetContainer rulesetContainer) { - hitRenderer.SetReplay(CreateReplayScore(hitRenderer.Beatmap)?.Replay); + rulesetContainer.SetReplay(CreateReplayScore(rulesetContainer.Beatmap)?.Replay); } } diff --git a/osu.Game/Rulesets/Ruleset.cs b/osu.Game/Rulesets/Ruleset.cs index 4a492b84fb..ba040403ba 100644 --- a/osu.Game/Rulesets/Ruleset.cs +++ b/osu.Game/Rulesets/Ruleset.cs @@ -35,7 +35,7 @@ namespace osu.Game.Rulesets /// Whether the hit renderer should assume the beatmap is for the current ruleset. /// Unable to successfully load the beatmap to be usable with this ruleset. /// - public abstract HitRenderer CreateHitRendererWith(WorkingBeatmap beatmap, bool isForCurrentRuleset); + public abstract RulesetContainer CreateRulesetContainerWith(WorkingBeatmap beatmap, bool isForCurrentRuleset); public abstract DifficultyCalculator CreateDifficultyCalculator(Beatmap beatmap); diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index cd9089c859..5ccac2db32 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -150,13 +150,13 @@ namespace osu.Game.Rulesets.Scoring { } - protected ScoreProcessor(HitRenderer hitRenderer) + protected ScoreProcessor(RulesetContainer rulesetContainer) { - Judgements.Capacity = hitRenderer.Beatmap.HitObjects.Count; + Judgements.Capacity = rulesetContainer.Beatmap.HitObjects.Count; - hitRenderer.OnJudgement += AddJudgement; + rulesetContainer.OnJudgement += AddJudgement; - ComputeTargets(hitRenderer.Beatmap); + ComputeTargets(rulesetContainer.Beatmap); Reset(); } diff --git a/osu.Game/Rulesets/UI/HitRenderer.cs b/osu.Game/Rulesets/UI/RulesetContainer.cs similarity index 84% rename from osu.Game/Rulesets/UI/HitRenderer.cs rename to osu.Game/Rulesets/UI/RulesetContainer.cs index 00f8e8a469..16ea895fac 100644 --- a/osu.Game/Rulesets/UI/HitRenderer.cs +++ b/osu.Game/Rulesets/UI/RulesetContainer.cs @@ -23,12 +23,12 @@ using osu.Game.Rulesets.Beatmaps; namespace osu.Game.Rulesets.UI { /// - /// Base HitRenderer. Doesn't hold objects. + /// Base RulesetContainer. Doesn't hold objects. /// - /// Should not be derived - derive instead. + /// Should not be derived - derive instead. /// /// - public abstract class HitRenderer : Container + public abstract class RulesetContainer : Container { /// /// Invoked when all the judgeable HitObjects have been judged. @@ -41,12 +41,12 @@ namespace osu.Game.Rulesets.UI public bool AspectAdjust = true; /// - /// The input manager for this HitRenderer. + /// The input manager for this RulesetContainer. /// internal readonly PlayerInputManager InputManager = new PlayerInputManager(); /// - /// The key conversion input manager for this HitRenderer. + /// The key conversion input manager for this RulesetContainer. /// protected readonly PassThroughInputManager KeyConversionInputManager; @@ -73,7 +73,7 @@ namespace osu.Game.Rulesets.UI /// A visual representation of a . /// /// The ruleset being repesented. - internal HitRenderer(Ruleset ruleset) + internal RulesetContainer(Ruleset ruleset) { Ruleset = ruleset; KeyConversionInputManager = CreateActionMappingInputManager(); @@ -113,14 +113,14 @@ namespace osu.Game.Rulesets.UI } /// - /// HitRenderer that applies conversion to Beatmaps. Does not contain a Playfield + /// RulesetContainer that applies conversion to Beatmaps. Does not contain a Playfield /// and does not load drawable hit objects. /// - /// Should not be derived - derive instead. + /// Should not be derived - derive instead. /// /// - /// The type of HitObject contained by this HitRenderer. - public abstract class HitRenderer : HitRenderer + /// The type of HitObject contained by this RulesetContainer. + public abstract class RulesetContainer : RulesetContainer where TObject : HitObject { /// @@ -144,9 +144,9 @@ namespace osu.Game.Rulesets.UI /// The ruleset being repesented. /// The beatmap to create the hit renderer for. /// Whether to assume the beatmap is for the current ruleset. - internal HitRenderer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset) : base(ruleset) + internal RulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset) : base(ruleset) { - Debug.Assert(beatmap != null, "HitRenderer initialized with a null beatmap."); + Debug.Assert(beatmap != null, "RulesetContainer initialized with a null beatmap."); Mods = beatmap.Mods.Value; @@ -180,7 +180,7 @@ namespace osu.Game.Rulesets.UI } /// - /// Applies the active mods to this HitRenderer. + /// Applies the active mods to this RulesetContainer. /// /// private void applyMods(IEnumerable mods) @@ -189,7 +189,7 @@ namespace osu.Game.Rulesets.UI return; foreach (var mod in mods.OfType>()) - mod.ApplyToHitRenderer(this); + mod.ApplyToRulesetContainer(this); } /// @@ -212,11 +212,11 @@ namespace osu.Game.Rulesets.UI } /// - /// A derivable HitRenderer that manages the Playfield and HitObjects. + /// A derivable RulesetContainer that manages the Playfield and HitObjects. /// - /// The type of HitObject contained by this HitRenderer. - /// The type of Judgement of DrawableHitObjects contained by this HitRenderer. - public abstract class HitRenderer : HitRenderer + /// The type of HitObject contained by this RulesetContainer. + /// The type of Judgement of DrawableHitObjects contained by this RulesetContainer. + public abstract class RulesetContainer : RulesetContainer where TObject : HitObject where TJudgement : Judgement { @@ -247,7 +247,7 @@ namespace osu.Game.Rulesets.UI /// The ruleset being repesented. /// The beatmap to create the hit renderer for. /// Whether to assume the beatmap is for the current ruleset. - protected HitRenderer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset) + protected RulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset) : base(ruleset, beatmap, isForCurrentRuleset) { InputManager.Add(content = new Container @@ -334,12 +334,12 @@ namespace osu.Game.Rulesets.UI } /// - /// A derivable HitRenderer that manages the Playfield and HitObjects. + /// A derivable RulesetContainer that manages the Playfield and HitObjects. /// - /// The type of Playfield contained by this HitRenderer. - /// The type of HitObject contained by this HitRenderer. - /// The type of Judgement of DrawableHitObjects contained by this HitRenderer. - public abstract class HitRenderer : HitRenderer + /// The type of Playfield contained by this RulesetContainer. + /// The type of HitObject contained by this RulesetContainer. + /// The type of Judgement of DrawableHitObjects contained by this RulesetContainer. + public abstract class RulesetContainer : RulesetContainer where TObject : HitObject where TJudgement : Judgement where TPlayfield : Playfield @@ -355,7 +355,7 @@ namespace osu.Game.Rulesets.UI /// The ruleset being repesented. /// The beatmap to create the hit renderer for. /// Whether to assume the beatmap is for the current ruleset. - protected HitRenderer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset) + protected RulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset) : base(ruleset, beatmap, isForCurrentRuleset) { } diff --git a/osu.Game/Rulesets/UI/ScrollingHitRenderer.cs b/osu.Game/Rulesets/UI/ScrollingRulesetContainer.cs similarity index 87% rename from osu.Game/Rulesets/UI/ScrollingHitRenderer.cs rename to osu.Game/Rulesets/UI/ScrollingRulesetContainer.cs index 37df08ba21..64e865473d 100644 --- a/osu.Game/Rulesets/UI/ScrollingHitRenderer.cs +++ b/osu.Game/Rulesets/UI/ScrollingRulesetContainer.cs @@ -17,22 +17,22 @@ using osu.Game.Rulesets.Timing; namespace osu.Game.Rulesets.UI { /// - /// A type of that supports a . - /// s inside this will scroll within the playfield. + /// A type of that supports a . + /// s inside this will scroll within the playfield. /// - public abstract class ScrollingHitRenderer : HitRenderer + public abstract class ScrollingRulesetContainer : RulesetContainer where TObject : HitObject where TJudgement : Judgement where TPlayfield : ScrollingPlayfield { /// /// Provides the default s that adjust the scrolling rate of s - /// inside this . + /// inside this . /// /// protected readonly SortedList DefaultControlPoints = new SortedList(Comparer.Default); - protected ScrollingHitRenderer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset) + protected ScrollingRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset) : base(ruleset, beatmap, isForCurrentRuleset) { } diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index ea75c140db..cf6bc03c60 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -90,11 +90,11 @@ namespace osu.Game.Screens.Play } } - public virtual void BindHitRenderer(HitRenderer hitRenderer) + public virtual void BindRulesetContainer(RulesetContainer rulesetContainer) { - hitRenderer.InputManager.Add(KeyCounter.GetReceptor()); + rulesetContainer.InputManager.Add(KeyCounter.GetReceptor()); - replayLoaded = hitRenderer.HasReplayLoaded; + replayLoaded = rulesetContainer.HasReplayLoaded; // in the case a replay isn't loaded, we want some elements to only appear briefly. if (!replayLoaded) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index a13e9ed369..00f1bd1b6b 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -32,7 +32,7 @@ namespace osu.Game.Screens.Play internal override bool ShowOverlays => false; - internal override bool HasLocalCursorDisplayed => !pauseContainer.IsPaused && !HasFailed && HitRenderer.ProvidingUserCursor; + internal override bool HasLocalCursorDisplayed => !pauseContainer.IsPaused && !HasFailed && RulesetContainer.ProvidingUserCursor; public Action RestartRequested; @@ -51,7 +51,7 @@ namespace osu.Game.Screens.Play private RulesetInfo ruleset; private ScoreProcessor scoreProcessor; - protected HitRenderer HitRenderer; + protected RulesetContainer RulesetContainer; #region User Settings @@ -66,7 +66,7 @@ namespace osu.Game.Screens.Play private HUDOverlay hudOverlay; private FailOverlay failOverlay; - private bool loadedSuccessfully => HitRenderer?.Objects.Any() == true; + private bool loadedSuccessfully => RulesetContainer?.Objects.Any() == true; [BackgroundDependencyLoader(permitNulls: true)] private void load(AudioManager audio, OsuConfigManager config, OsuGame osu) @@ -93,18 +93,18 @@ namespace osu.Game.Screens.Play try { - HitRenderer = rulesetInstance.CreateHitRendererWith(working, ruleset.ID == beatmap.BeatmapInfo.Ruleset.ID); + RulesetContainer = rulesetInstance.CreateRulesetContainerWith(working, ruleset.ID == beatmap.BeatmapInfo.Ruleset.ID); } catch (BeatmapInvalidForRulesetException) { - // we may fail to create a HitRenderer if the beatmap cannot be loaded with the user's preferred ruleset + // we may fail to create a RulesetContainer if the beatmap cannot be loaded with the user's preferred ruleset // let's try again forcing the beatmap's ruleset. ruleset = beatmap.BeatmapInfo.Ruleset; rulesetInstance = ruleset.CreateInstance(); - HitRenderer = rulesetInstance.CreateHitRendererWith(Beatmap, true); + RulesetContainer = rulesetInstance.CreateRulesetContainerWith(Beatmap, true); } - if (!HitRenderer.Objects.Any()) + if (!RulesetContainer.Objects.Any()) throw new InvalidOperationException("Beatmap contains no hit objects!"); } catch (Exception e) @@ -119,7 +119,7 @@ namespace osu.Game.Screens.Play adjustableSourceClock = (IAdjustableClock)working.Track ?? new StopwatchClock(); decoupledClock = new DecoupleableInterpolatingFramedClock { IsCoupled = false }; - var firstObjectTime = HitRenderer.Objects.First().StartTime; + var firstObjectTime = RulesetContainer.Objects.First().StartTime; decoupledClock.Seek(Math.Min(0, firstObjectTime - Math.Max(beatmap.ControlPointInfo.TimingPointAt(firstObjectTime).BeatLength * 4, beatmap.BeatmapInfo.AudioLeadIn))); decoupledClock.ProcessFrame(); @@ -147,7 +147,7 @@ namespace osu.Game.Screens.Play FramedClock = offsetClock, OnRetry = Restart, OnQuit = Exit, - CheckCanPause = () => ValidForResume && !HasFailed && !HitRenderer.HasReplayLoaded, + CheckCanPause = () => ValidForResume && !HasFailed && !RulesetContainer.HasReplayLoaded, Retries = RestartCount, OnPause = () => { hudOverlay.KeyCounter.IsCounting = pauseContainer.IsPaused; @@ -164,7 +164,7 @@ namespace osu.Game.Screens.Play Clock = offsetClock, Children = new Drawable[] { - HitRenderer, + RulesetContainer, } }, hudOverlay = new HUDOverlay @@ -184,27 +184,27 @@ namespace osu.Game.Screens.Play Action = () => { //we want to hide the hitrenderer immediately (looks better). //we may be able to remove this once the mouse cursor trail is improved. - HitRenderer?.Hide(); + RulesetContainer?.Hide(); Restart(); }, } }; - scoreProcessor = HitRenderer.CreateScoreProcessor(); + scoreProcessor = RulesetContainer.CreateScoreProcessor(); hudOverlay.KeyCounter.AddRange(rulesetInstance.CreateGameplayKeys()); hudOverlay.BindProcessor(scoreProcessor); - hudOverlay.BindHitRenderer(HitRenderer); + hudOverlay.BindRulesetContainer(RulesetContainer); - hudOverlay.Progress.Objects = HitRenderer.Objects; + hudOverlay.Progress.Objects = RulesetContainer.Objects; hudOverlay.Progress.AudioClock = decoupledClock; - hudOverlay.Progress.AllowSeeking = HitRenderer.HasReplayLoaded; + hudOverlay.Progress.AllowSeeking = RulesetContainer.HasReplayLoaded; hudOverlay.Progress.OnSeek = pos => decoupledClock.Seek(pos); hudOverlay.ModDisplay.Current.BindTo(working.Mods); - //bind HitRenderer to ScoreProcessor and ourselves (for a pass situation) - HitRenderer.OnAllJudged += onCompletion; + //bind RulesetContainer to ScoreProcessor and ourselves (for a pass situation) + RulesetContainer.OnAllJudged += onCompletion; //bind ScoreProcessor to ourselves (for a fail situation) scoreProcessor.Failed += onFail; @@ -238,7 +238,7 @@ namespace osu.Game.Screens.Play Ruleset = ruleset }; scoreProcessor.PopulateScore(score); - score.User = HitRenderer.Replay?.User ?? (Game as OsuGame)?.API?.LocalUser?.Value; + score.User = RulesetContainer.Replay?.User ?? (Game as OsuGame)?.API?.LocalUser?.Value; Push(new Results(score)); }); } @@ -295,7 +295,7 @@ namespace osu.Game.Screens.Play protected override bool OnExiting(Screen next) { - if (HasFailed || !ValidForResume || pauseContainer?.AllowExit != false || HitRenderer?.HasReplayLoaded != false) + if (HasFailed || !ValidForResume || pauseContainer?.AllowExit != false || RulesetContainer?.HasReplayLoaded != false) { fadeOut(); return base.OnExiting(next); @@ -313,7 +313,7 @@ namespace osu.Game.Screens.Play { const float fade_out_duration = 250; - HitRenderer?.FadeOut(fade_out_duration); + RulesetContainer?.FadeOut(fade_out_duration); Content.FadeOut(fade_out_duration); hudOverlay?.ScaleTo(0.7f, fade_out_duration * 3, Easing.In); diff --git a/osu.Game/Screens/Play/ReplayPlayer.cs b/osu.Game/Screens/Play/ReplayPlayer.cs index 860675b62a..4748ddfd71 100644 --- a/osu.Game/Screens/Play/ReplayPlayer.cs +++ b/osu.Game/Screens/Play/ReplayPlayer.cs @@ -17,7 +17,7 @@ namespace osu.Game.Screens.Play protected override void LoadComplete() { base.LoadComplete(); - HitRenderer.SetReplay(Replay); + RulesetContainer.SetReplay(Replay); } } } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 0a73754e14..482422cfd9 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -338,9 +338,9 @@ - + - + From c70f96a9cd8df37cc048f5e1ab0c3598be6306ae Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 9 Aug 2017 14:50:10 +0900 Subject: [PATCH 16/18] Add basic documentation and split out classes. --- osu.Game/Input/ActionMappingInputManager.cs | 41 +++++---------------- osu.Game/Input/Binding.cs | 20 ++++++++++ osu.Game/Input/BindingStore.cs | 26 +++++++++++++ osu.Game/osu.Game.csproj | 2 + 4 files changed, 57 insertions(+), 32 deletions(-) create mode 100644 osu.Game/Input/Binding.cs create mode 100644 osu.Game/Input/BindingStore.cs diff --git a/osu.Game/Input/ActionMappingInputManager.cs b/osu.Game/Input/ActionMappingInputManager.cs index d926b888c5..836f0734fd 100644 --- a/osu.Game/Input/ActionMappingInputManager.cs +++ b/osu.Game/Input/ActionMappingInputManager.cs @@ -15,6 +15,10 @@ using SQLiteNetExtensions.Attributes; namespace osu.Game.Input { + /// + /// Maps custom action data of type and stores to . + /// + /// The type of the custom action. public class ActionMappingInputManager : PassThroughInputManager where T : struct { @@ -22,6 +26,11 @@ namespace osu.Game.Input private readonly int? variant; + /// + /// Create a new instance. + /// + /// A reference to identify the current . Used to lookup mappings. Null for global mappings. + /// An optional variant for the specified . Used when a ruleset has more than one possible keyboard layouts. protected ActionMappingInputManager(RulesetInfo ruleset = null, int? variant = null) { this.ruleset = ruleset; @@ -67,36 +76,4 @@ namespace osu.Game.Input return default(T); } } - - public class Binding - { - [ForeignKey(typeof(RulesetInfo))] - public int? RulesetID { get; set; } - - [Indexed] - public int? Variant { get; set; } - - public Key Key { get; set; } - - public int Action { get; set; } - } - - public class BindingStore : DatabaseBackedStore - { - public BindingStore(SQLiteConnection connection, Storage storage = null) - : base(connection, storage) - { - } - - protected override void Prepare(bool reset = false) - { - Connection.CreateTable(); - } - - protected override Type[] ValidTypes => new[] - { - typeof(Binding) - }; - - } } diff --git a/osu.Game/Input/Binding.cs b/osu.Game/Input/Binding.cs new file mode 100644 index 0000000000..6f7a1594b2 --- /dev/null +++ b/osu.Game/Input/Binding.cs @@ -0,0 +1,20 @@ +using osu.Game.Rulesets; +using OpenTK.Input; +using SQLite.Net.Attributes; +using SQLiteNetExtensions.Attributes; + +namespace osu.Game.Input +{ + public class Binding + { + [ForeignKey(typeof(RulesetInfo))] + public int? RulesetID { get; set; } + + [Indexed] + public int? Variant { get; set; } + + public Key Key { get; set; } + + public int Action { get; set; } + } +} \ No newline at end of file diff --git a/osu.Game/Input/BindingStore.cs b/osu.Game/Input/BindingStore.cs new file mode 100644 index 0000000000..e20ea2e68b --- /dev/null +++ b/osu.Game/Input/BindingStore.cs @@ -0,0 +1,26 @@ +using System; +using osu.Framework.Platform; +using osu.Game.Database; +using SQLite.Net; + +namespace osu.Game.Input +{ + public class BindingStore : DatabaseBackedStore + { + public BindingStore(SQLiteConnection connection, Storage storage = null) + : base(connection, storage) + { + } + + protected override void Prepare(bool reset = false) + { + Connection.CreateTable(); + } + + protected override Type[] ValidTypes => new[] + { + typeof(Binding) + }; + + } +} \ No newline at end of file diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 482422cfd9..aba4384b59 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -92,6 +92,8 @@ + + From 3b48a6c66885de27ba913ab15e1a911c5b595157 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 9 Aug 2017 15:15:41 +0900 Subject: [PATCH 17/18] Fix CI issues --- .../{RulesetInputManager.cs => CatchInputManager.cs} | 0 osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj | 2 +- osu.Game/Input/Binding.cs | 3 +++ osu.Game/Input/BindingStore.cs | 5 ++++- 4 files changed, 8 insertions(+), 2 deletions(-) rename osu.Game.Rulesets.Catch/{RulesetInputManager.cs => CatchInputManager.cs} (100%) diff --git a/osu.Game.Rulesets.Catch/RulesetInputManager.cs b/osu.Game.Rulesets.Catch/CatchInputManager.cs similarity index 100% rename from osu.Game.Rulesets.Catch/RulesetInputManager.cs rename to osu.Game.Rulesets.Catch/CatchInputManager.cs diff --git a/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj b/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj index 8fefdc7b3c..79ef5f4ba8 100644 --- a/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj +++ b/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj @@ -51,7 +51,7 @@ - + diff --git a/osu.Game/Input/Binding.cs b/osu.Game/Input/Binding.cs index 6f7a1594b2..e887d15a65 100644 --- a/osu.Game/Input/Binding.cs +++ b/osu.Game/Input/Binding.cs @@ -1,3 +1,6 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + using osu.Game.Rulesets; using OpenTK.Input; using SQLite.Net.Attributes; diff --git a/osu.Game/Input/BindingStore.cs b/osu.Game/Input/BindingStore.cs index e20ea2e68b..aa47bee068 100644 --- a/osu.Game/Input/BindingStore.cs +++ b/osu.Game/Input/BindingStore.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.Platform; using osu.Game.Database; using SQLite.Net; From 459a4cafb13085d0806c95becc5120bbba76c048 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 9 Aug 2017 15:17:05 +0900 Subject: [PATCH 18/18] Remove unnecessary HandleInput --- osu.Game.Rulesets.Catch/UI/CatcherArea.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs index f0a6b89d7e..776f2119ab 100644 --- a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs +++ b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs @@ -50,8 +50,6 @@ namespace osu.Game.Rulesets.Catch.UI private class Catcher : Container { - public override bool HandleInput => true; - private Texture texture; [BackgroundDependencyLoader]