diff --git a/osu-framework b/osu-framework index d29abdf0d0..67d89a3601 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit d29abdf0d042d832f0849c013d14762db04730e7 +Subproject commit 67d89a36016f98c0ede576b859a2ccafe114fce8 diff --git a/osu.Desktop.Tests/Visual/TestCaseScrollingPlayfield.cs b/osu.Desktop.Tests/Visual/TestCaseScrollingPlayfield.cs index 861e79b0b1..43bd921cfc 100644 --- a/osu.Desktop.Tests/Visual/TestCaseScrollingPlayfield.cs +++ b/osu.Desktop.Tests/Visual/TestCaseScrollingPlayfield.cs @@ -50,17 +50,27 @@ namespace osu.Desktop.Tests.Visual WorkingBeatmap beatmap = new TestWorkingBeatmap(b); - TestRulesetContainer rulesetContainer; - Add(rulesetContainer = new TestRulesetContainer(beatmap, true)); + TestRulesetContainer horizontalRulesetContainer; + Add(horizontalRulesetContainer = new TestRulesetContainer(Axes.X, beatmap, true)); - AddStep("Reverse direction", () => rulesetContainer.Playfield.Reversed.Value = !rulesetContainer.Playfield.Reversed); + TestRulesetContainer verticalRulesetContainer; + Add(verticalRulesetContainer = new TestRulesetContainer(Axes.Y, beatmap, true)); + + AddStep("Reverse direction", () => + { + horizontalRulesetContainer.Playfield.Reversed.Toggle(); + verticalRulesetContainer.Playfield.Reversed.Toggle(); + }); } private class TestRulesetContainer : ScrollingRulesetContainer { - public TestRulesetContainer(WorkingBeatmap beatmap, bool isForCurrentRuleset) + private readonly Axes scrollingAxes; + + public TestRulesetContainer(Axes scrollingAxes, WorkingBeatmap beatmap, bool isForCurrentRuleset) : base(null, beatmap, isForCurrentRuleset) { + this.scrollingAxes = scrollingAxes; } public new TestPlayfield Playfield => base.Playfield; @@ -69,9 +79,9 @@ namespace osu.Desktop.Tests.Visual protected override BeatmapConverter CreateBeatmapConverter() => new TestBeatmapConverter(); - protected override Playfield CreatePlayfield() => new TestPlayfield(); + protected override Playfield CreatePlayfield() => new TestPlayfield(scrollingAxes); - protected override DrawableHitObject GetVisualRepresentation(TestHitObject h) => new DrawableTestHitObject(h); + protected override DrawableHitObject GetVisualRepresentation(TestHitObject h) => new DrawableTestHitObject(scrollingAxes, h); } private class TestScoreProcessor : ScoreProcessor @@ -93,10 +103,10 @@ namespace osu.Desktop.Tests.Visual private class DrawableTestHitObject : DrawableScrollingHitObject { - public DrawableTestHitObject(TestHitObject hitObject) + public DrawableTestHitObject(Axes scrollingAxes, TestHitObject hitObject) : base(hitObject) { - Anchor = Anchor.CentreLeft; + Anchor = scrollingAxes == Axes.Y ? Anchor.TopCentre : Anchor.CentreLeft; Origin = Anchor.Centre; AutoSizeAxes = Axes.Both; @@ -119,8 +129,8 @@ namespace osu.Desktop.Tests.Visual protected override Container Content => content; private readonly Container content; - public TestPlayfield() - : base(Axes.X) + public TestPlayfield(Axes scrollingAxes) + : base(scrollingAxes) { InternalChildren = new Drawable[] { diff --git a/osu.Game/Input/ActionMappingInputManager.cs b/osu.Game/Input/ActionMappingInputManager.cs index 836f0734fd..c918982fab 100644 --- a/osu.Game/Input/ActionMappingInputManager.cs +++ b/osu.Game/Input/ActionMappingInputManager.cs @@ -5,13 +5,8 @@ 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 SQLite.Net.Attributes; -using SQLiteNetExtensions.Attributes; namespace osu.Game.Input { diff --git a/osu.Game/Rulesets/Timing/ScrollingContainer.cs b/osu.Game/Rulesets/Timing/ScrollingContainer.cs index 1cb5e42251..843f307d0d 100644 --- a/osu.Game/Rulesets/Timing/ScrollingContainer.cs +++ b/osu.Game/Rulesets/Timing/ScrollingContainer.cs @@ -17,15 +17,10 @@ namespace osu.Game.Rulesets.Timing /// public abstract class ScrollingContainer : Container { - private readonly BindableDouble visibleTimeRange = new BindableDouble { Default = 1000 }; /// /// Gets or sets the range of time that is visible by the length of the scrolling axes. /// - public BindableDouble VisibleTimeRange - { - get { return visibleTimeRange; } - set { visibleTimeRange.BindTo(value); } - } + public readonly BindableDouble VisibleTimeRange = new BindableDouble { Default = 1000 }; /// /// The axes through which this scrolls. This is set by the . diff --git a/osu.Game/Rulesets/Timing/SpeedAdjustmentContainer.cs b/osu.Game/Rulesets/Timing/SpeedAdjustmentContainer.cs index d582f19660..9d5f49e155 100644 --- a/osu.Game/Rulesets/Timing/SpeedAdjustmentContainer.cs +++ b/osu.Game/Rulesets/Timing/SpeedAdjustmentContainer.cs @@ -16,25 +16,15 @@ namespace osu.Game.Rulesets.Timing /// public class SpeedAdjustmentContainer : Container { - private readonly Bindable visibleTimeRange = new Bindable { Default = 1000 }; /// /// Gets or sets the range of time that is visible by the length of the scrolling axes. /// - public Bindable VisibleTimeRange - { - get { return visibleTimeRange; } - set { visibleTimeRange.BindTo(value); } - } + public readonly Bindable VisibleTimeRange = new Bindable { Default = 1000 }; - private readonly BindableBool reversed = new BindableBool(); /// /// Whether to reverse the scrolling direction is reversed. /// - public BindableBool Reversed - { - get { return reversed; } - set { reversed.BindTo(value); } - } + public readonly BindableBool Reversed = new BindableBool(); protected override Container Content => content; private Container content; @@ -85,13 +75,13 @@ namespace osu.Game.Rulesets.Timing { RelativeChildSize = new Vector2((ScrollingAxes & Axes.X) > 0 ? (float)-VisibleTimeRange : 1, (ScrollingAxes & Axes.Y) > 0 ? (float)-VisibleTimeRange : 1); RelativeChildOffset = new Vector2((ScrollingAxes & Axes.X) > 0 ? (float)VisibleTimeRange : 0, (ScrollingAxes & Axes.Y) > 0 ? (float)VisibleTimeRange : 0); - Origin = Anchor = Anchor.BottomLeft; + Origin = Anchor = Anchor.BottomRight; } else { RelativeChildSize = new Vector2((ScrollingAxes & Axes.X) > 0 ? (float)VisibleTimeRange : 1, (ScrollingAxes & Axes.Y) > 0 ? (float)VisibleTimeRange : 1); RelativeChildOffset = Vector2.Zero; - Anchor = Anchor = Anchor.TopLeft; + Origin = Anchor = Anchor.TopLeft; } } diff --git a/osu.Game/Rulesets/UI/RulesetContainer.cs b/osu.Game/Rulesets/UI/RulesetContainer.cs index 16ea895fac..387fa15191 100644 --- a/osu.Game/Rulesets/UI/RulesetContainer.cs +++ b/osu.Game/Rulesets/UI/RulesetContainer.cs @@ -234,7 +234,7 @@ namespace osu.Game.Rulesets.UI /// /// The playfield. /// - protected Playfield Playfield { get; private set; } + public Playfield Playfield { get; private set; } protected override Container Content => content; private readonly Container content; diff --git a/osu.Game/Rulesets/UI/ScrollingPlayfield.cs b/osu.Game/Rulesets/UI/ScrollingPlayfield.cs index a54ece4c05..66ca2dd7c4 100644 --- a/osu.Game/Rulesets/UI/ScrollingPlayfield.cs +++ b/osu.Game/Rulesets/UI/ScrollingPlayfield.cs @@ -7,7 +7,6 @@ using System.Linq; using OpenTK.Input; using osu.Framework.Configuration; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Transforms; using osu.Framework.Input; using osu.Framework.MathUtils; @@ -72,12 +71,9 @@ namespace osu.Game.Rulesets.UI protected ScrollingPlayfield(Axes scrollingAxes, float? customWidth = null) : base(customWidth) { - base.HitObjects = HitObjects = new ScrollingHitObjectContainer(scrollingAxes) - { - RelativeSizeAxes = Axes.Both, - VisibleTimeRange = VisibleTimeRange, - Reversed = Reversed - }; + base.HitObjects = HitObjects = new ScrollingHitObjectContainer(scrollingAxes) { RelativeSizeAxes = Axes.Both }; + HitObjects.VisibleTimeRange.BindTo(VisibleTimeRange); + HitObjects.Reversed.BindTo(Reversed); } private List> nestedPlayfields; @@ -143,32 +139,22 @@ namespace osu.Game.Rulesets.UI /// internal class ScrollingHitObjectContainer : HitObjectContainer { - private readonly BindableDouble visibleTimeRange = new BindableDouble { Default = 1000 }; /// /// Gets or sets the range of time that is visible by the length of the scrolling axes. /// For example, only hit objects with start time less than or equal to 1000 will be visible with = 1000. /// - public Bindable VisibleTimeRange - { - get { return visibleTimeRange; } - set { visibleTimeRange.BindTo(value); } - } + public readonly BindableDouble VisibleTimeRange = new BindableDouble { Default = 1000 }; - private readonly BindableBool reversed = new BindableBool(); /// /// Whether to reverse the scrolling direction is reversed. /// - public BindableBool Reversed - { - get { return reversed; } - set { reversed.BindTo(value); } - } + public readonly BindableBool Reversed = new BindableBool(); /// /// Hit objects that are to be re-processed on the next update. /// private readonly List queuedHitObjects = new List(); - private readonly Container speedAdjustments; + private readonly List speedAdjustments = new List(); private readonly Axes scrollingAxes; @@ -179,8 +165,6 @@ namespace osu.Game.Rulesets.UI public ScrollingHitObjectContainer(Axes scrollingAxes) { this.scrollingAxes = scrollingAxes; - - AddInternal(speedAdjustments = new Container { RelativeSizeAxes = Axes.Both }); } /// @@ -189,10 +173,12 @@ namespace osu.Game.Rulesets.UI /// The . public void AddSpeedAdjustment(SpeedAdjustmentContainer speedAdjustment) { - speedAdjustment.VisibleTimeRange.BindTo(VisibleTimeRange); speedAdjustment.ScrollingAxes = scrollingAxes; - speedAdjustment.Reversed = Reversed; + speedAdjustment.VisibleTimeRange.BindTo(VisibleTimeRange); + speedAdjustment.Reversed.BindTo(Reversed); + speedAdjustments.Add(speedAdjustment); + AddInternal(speedAdjustment); } public override IEnumerable Objects => speedAdjustments.SelectMany(s => s.Children);