From ec9e7f14a81165f3bdd21eeef6f8fd0f3ea5dae2 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 15 Aug 2023 18:51:24 +0900 Subject: [PATCH 1/8] Disable SVs from being visualised in mania editor --- osu.Game.Rulesets.Mania/Edit/DrawableManiaEditorRuleset.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game.Rulesets.Mania/Edit/DrawableManiaEditorRuleset.cs b/osu.Game.Rulesets.Mania/Edit/DrawableManiaEditorRuleset.cs index f480fa516b62..dadd725a2f15 100644 --- a/osu.Game.Rulesets.Mania/Edit/DrawableManiaEditorRuleset.cs +++ b/osu.Game.Rulesets.Mania/Edit/DrawableManiaEditorRuleset.cs @@ -5,6 +5,7 @@ using osu.Framework.Graphics; using osuTK; using osu.Game.Beatmaps; +using osu.Game.Configuration; using osu.Game.Rulesets.Mania.UI; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.UI; @@ -19,6 +20,7 @@ public partial class DrawableManiaEditorRuleset : DrawableManiaRuleset public DrawableManiaEditorRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList? mods) : base(ruleset, beatmap, mods) { + ScrollMethod = ScrollVisualisationMethod.Constant; } protected override Playfield CreatePlayfield() => new ManiaEditorPlayfield(Beatmap.Stages) From a2fd7707a16bccb055dd25997644173198851633 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 15 Aug 2023 20:38:17 +0900 Subject: [PATCH 2/8] Allow toggling SVs in the editor --- .../UI/DrawableCatchRuleset.cs | 3 +- .../Skinning/ManiaSkinnableTestScene.cs | 2 +- .../Edit/DrawableManiaEditorRuleset.cs | 17 ++++++- .../Edit/ManiaHitObjectComposer.cs | 28 +++++++++- .../Mods/ManiaModConstantSpeed.cs | 2 +- .../UI/DrawableManiaRuleset.cs | 17 ++----- .../UI/DrawableTaikoRuleset.cs | 3 +- .../TestSceneDrawableScrollingRuleset.cs | 3 +- .../UI/Scrolling/DrawableScrollingRuleset.cs | 51 ++++++++++++------- .../Rulesets/UI/Scrolling/IScrollingInfo.cs | 4 +- .../Scrolling/ScrollingHitObjectContainer.cs | 14 +++-- .../TernaryButtons/DrawableTernaryButton.cs | 2 +- .../Tests/Visual/ScrollingTestContainer.cs | 2 +- 13 files changed, 98 insertions(+), 50 deletions(-) diff --git a/osu.Game.Rulesets.Catch/UI/DrawableCatchRuleset.cs b/osu.Game.Rulesets.Catch/UI/DrawableCatchRuleset.cs index 7930a07551f0..f0a327d7acda 100644 --- a/osu.Game.Rulesets.Catch/UI/DrawableCatchRuleset.cs +++ b/osu.Game.Rulesets.Catch/UI/DrawableCatchRuleset.cs @@ -21,8 +21,6 @@ namespace osu.Game.Rulesets.Catch.UI { public partial class DrawableCatchRuleset : DrawableScrollingRuleset { - protected override ScrollVisualisationMethod VisualisationMethod => ScrollVisualisationMethod.Constant; - protected override bool UserScrollSpeedAdjustment => false; public DrawableCatchRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList? mods = null) @@ -30,6 +28,7 @@ public DrawableCatchRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList IScrollingInfo.Direction => Direction; IBindable IScrollingInfo.TimeRange { get; } = new Bindable(5000); - IScrollAlgorithm IScrollingInfo.Algorithm { get; } = new ConstantScrollAlgorithm(); + IBindable IScrollingInfo.Algorithm { get; } = new Bindable(new ConstantScrollAlgorithm()); } } } diff --git a/osu.Game.Rulesets.Mania/Edit/DrawableManiaEditorRuleset.cs b/osu.Game.Rulesets.Mania/Edit/DrawableManiaEditorRuleset.cs index dadd725a2f15..013dd3dcbd06 100644 --- a/osu.Game.Rulesets.Mania/Edit/DrawableManiaEditorRuleset.cs +++ b/osu.Game.Rulesets.Mania/Edit/DrawableManiaEditorRuleset.cs @@ -2,10 +2,12 @@ // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osuTK; using osu.Game.Beatmaps; using osu.Game.Configuration; +using osu.Game.Graphics.UserInterface; using osu.Game.Rulesets.Mania.UI; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.UI; @@ -15,12 +17,25 @@ namespace osu.Game.Rulesets.Mania.Edit { public partial class DrawableManiaEditorRuleset : DrawableManiaRuleset { + public readonly IBindable ShowSpeedChanges = new Bindable(); + public new IScrollingInfo ScrollingInfo => base.ScrollingInfo; public DrawableManiaEditorRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList? mods) : base(ruleset, beatmap, mods) { - ScrollMethod = ScrollVisualisationMethod.Constant; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + ShowSpeedChanges.BindValueChanged(state => + { + VisualisationMethod = state.NewValue == TernaryState.True + ? ScrollVisualisationMethod.Sequential + : ScrollVisualisationMethod.Constant; + }, true); } protected override Playfield CreatePlayfield() => new ManiaEditorPlayfield(Beatmap.Stages) diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs index 5e577a2964b7..44e238efac0c 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs @@ -6,8 +6,13 @@ using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; +using osu.Framework.Bindables; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; using osu.Framework.Input; using osu.Game.Beatmaps; +using osu.Game.Graphics.UserInterface; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit.Tools; using osu.Game.Rulesets.Mania.Objects; @@ -16,6 +21,7 @@ using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI.Scrolling; +using osu.Game.Screens.Edit.Components.TernaryButtons; using osu.Game.Screens.Edit.Compose.Components; using osuTK; @@ -23,6 +29,8 @@ namespace osu.Game.Rulesets.Mania.Edit { public partial class ManiaHitObjectComposer : HitObjectComposer { + private readonly Bindable showSpeedChanges = new Bindable(); + private DrawableManiaEditorRuleset drawableRuleset; private ManiaBeatSnapGrid beatSnapGrid; private InputManager inputManager; @@ -36,6 +44,21 @@ public ManiaHitObjectComposer(Ruleset ruleset) private void load() { AddInternal(beatSnapGrid = new ManiaBeatSnapGrid()); + + LeftToolbox.Add(new EditorToolboxGroup("playfield") + { + Child = new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Spacing = new Vector2(0, 5), + Children = new[] + { + new DrawableTernaryButton(new TernaryButton(showSpeedChanges, "Show speed changes", () => new SpriteIcon { Icon = FontAwesome.Solid.TachometerAlt })) + } + }, + }); } protected override void LoadComplete() @@ -59,7 +82,10 @@ protected override Playfield PlayfieldAtScreenSpacePosition(Vector2 screenSpaceP protected override DrawableRuleset CreateDrawableRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList mods = null) { - drawableRuleset = new DrawableManiaEditorRuleset(ruleset, beatmap, mods); + drawableRuleset = new DrawableManiaEditorRuleset(ruleset, beatmap, mods) + { + ShowSpeedChanges = { BindTarget = showSpeedChanges } + }; // This is the earliest we can cache the scrolling info to ourselves, before masks are added to the hierarchy and inject it dependencies.CacheAs(drawableRuleset.ScrollingInfo); diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModConstantSpeed.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModConstantSpeed.cs index 66269f5572c3..d8e6bcd424dd 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModConstantSpeed.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModConstantSpeed.cs @@ -28,7 +28,7 @@ public class ManiaModConstantSpeed : Mod, IApplicableToDrawableRuleset drawableRuleset) { var maniaRuleset = (DrawableManiaRuleset)drawableRuleset; - maniaRuleset.ScrollMethod = ScrollVisualisationMethod.Constant; + maniaRuleset.VisualisationMethod = ScrollVisualisationMethod.Constant; } } } diff --git a/osu.Game.Rulesets.Mania/UI/DrawableManiaRuleset.cs b/osu.Game.Rulesets.Mania/UI/DrawableManiaRuleset.cs index 2d373c047153..eb99434e04c8 100644 --- a/osu.Game.Rulesets.Mania/UI/DrawableManiaRuleset.cs +++ b/osu.Game.Rulesets.Mania/UI/DrawableManiaRuleset.cs @@ -3,7 +3,6 @@ #nullable disable -using System; using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; @@ -52,22 +51,12 @@ public partial class DrawableManiaRuleset : DrawableScrollingRuleset (ManiaRulesetConfigManager)base.Config; - public ScrollVisualisationMethod ScrollMethod + public new ScrollVisualisationMethod VisualisationMethod { - get => scrollMethod; - set - { - if (IsLoaded) - throw new InvalidOperationException($"Can't alter {nameof(ScrollMethod)} after ruleset is already loaded"); - - scrollMethod = value; - } + get => base.VisualisationMethod; + set => base.VisualisationMethod = value; } - private ScrollVisualisationMethod scrollMethod = ScrollVisualisationMethod.Sequential; - - protected override ScrollVisualisationMethod VisualisationMethod => scrollMethod; - private readonly Bindable configDirection = new Bindable(); private readonly BindableInt configScrollSpeed = new BindableInt(); private double smoothTimeRange; diff --git a/osu.Game.Rulesets.Taiko/UI/DrawableTaikoRuleset.cs b/osu.Game.Rulesets.Taiko/UI/DrawableTaikoRuleset.cs index 64d406a30847..979e03f20122 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrawableTaikoRuleset.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrawableTaikoRuleset.cs @@ -35,8 +35,6 @@ public partial class DrawableTaikoRuleset : DrawableScrollingRuleset (TaikoInputManager)base.KeyBindingInputManager; - protected override ScrollVisualisationMethod VisualisationMethod => ScrollVisualisationMethod.Overlapping; - protected override bool UserScrollSpeedAdjustment => false; private SkinnableDrawable scroller; @@ -45,6 +43,7 @@ public DrawableTaikoRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList RelativeScaleBeatLengthsOverride; - protected override ScrollVisualisationMethod VisualisationMethod => ScrollVisualisationMethod.Overlapping; - public new Bindable TimeRange => base.TimeRange; public TestDrawableScrollingRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList mods = null) : base(ruleset, beatmap, mods) { TimeRange.Value = time_range; + VisualisationMethod = ScrollVisualisationMethod.Overlapping; } public override DrawableHitObject CreateDrawableRepresentation(TestHitObject h) diff --git a/osu.Game/Rulesets/UI/Scrolling/DrawableScrollingRuleset.cs b/osu.Game/Rulesets/UI/Scrolling/DrawableScrollingRuleset.cs index 4c7564b791f3..d082d2679280 100644 --- a/osu.Game/Rulesets/UI/Scrolling/DrawableScrollingRuleset.cs +++ b/osu.Game/Rulesets/UI/Scrolling/DrawableScrollingRuleset.cs @@ -64,8 +64,6 @@ public abstract partial class DrawableScrollingRuleset : DrawableRulese MaxValue = time_span_max }; - protected virtual ScrollVisualisationMethod VisualisationMethod => ScrollVisualisationMethod.Sequential; - ScrollVisualisationMethod IDrawableScrollingRuleset.VisualisationMethod => VisualisationMethod; /// @@ -99,20 +97,7 @@ protected DrawableScrollingRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyL [BackgroundDependencyLoader] private void load() { - switch (VisualisationMethod) - { - case ScrollVisualisationMethod.Sequential: - scrollingInfo.Algorithm = new SequentialScrollAlgorithm(ControlPoints); - break; - - case ScrollVisualisationMethod.Overlapping: - scrollingInfo.Algorithm = new OverlappingScrollAlgorithm(ControlPoints); - break; - - case ScrollVisualisationMethod.Constant: - scrollingInfo.Algorithm = new ConstantScrollAlgorithm(); - break; - } + updateScrollAlgorithm(); double lastObjectTime = Beatmap.HitObjects.Any() ? Beatmap.GetLastObjectTime() : double.MaxValue; double baseBeatLength = TimingControlPoint.DEFAULT_BEAT_LENGTH; @@ -178,6 +163,36 @@ protected override void LoadComplete() throw new ArgumentException($"{nameof(Playfield)} must be a {nameof(ScrollingPlayfield)} when using {nameof(DrawableScrollingRuleset)}."); } + private ScrollVisualisationMethod visualisationMethod = ScrollVisualisationMethod.Sequential; + + protected ScrollVisualisationMethod VisualisationMethod + { + get => visualisationMethod; + set + { + visualisationMethod = value; + updateScrollAlgorithm(); + } + } + + private void updateScrollAlgorithm() + { + switch (VisualisationMethod) + { + case ScrollVisualisationMethod.Sequential: + scrollingInfo.Algorithm.Value = new SequentialScrollAlgorithm(ControlPoints); + break; + + case ScrollVisualisationMethod.Overlapping: + scrollingInfo.Algorithm.Value = new OverlappingScrollAlgorithm(ControlPoints); + break; + + case ScrollVisualisationMethod.Constant: + scrollingInfo.Algorithm.Value = new ConstantScrollAlgorithm(); + break; + } + } + /// /// Adjusts the scroll speed of s. /// @@ -217,7 +232,9 @@ private class LocalScrollingInfo : IScrollingInfo public IBindable TimeRange { get; } = new BindableDouble(); - public IScrollAlgorithm Algorithm { get; set; } + public readonly Bindable Algorithm = new Bindable(new ConstantScrollAlgorithm()); + + IBindable IScrollingInfo.Algorithm => Algorithm; } } } diff --git a/osu.Game/Rulesets/UI/Scrolling/IScrollingInfo.cs b/osu.Game/Rulesets/UI/Scrolling/IScrollingInfo.cs index cd85932599f2..4a79c1a44740 100644 --- a/osu.Game/Rulesets/UI/Scrolling/IScrollingInfo.cs +++ b/osu.Game/Rulesets/UI/Scrolling/IScrollingInfo.cs @@ -15,13 +15,13 @@ public interface IScrollingInfo IBindable Direction { get; } /// - /// + /// The span of time that is visible by the length of the scrolling axes. /// IBindable TimeRange { get; } /// /// The algorithm which controls positions and sizes. /// - IScrollAlgorithm Algorithm { get; } + IBindable Algorithm { get; } } } diff --git a/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs b/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs index b93a42719632..129918da1407 100644 --- a/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs +++ b/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs @@ -13,6 +13,7 @@ using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Types; +using osu.Game.Rulesets.UI.Scrolling.Algorithms; using osuTK; namespace osu.Game.Rulesets.UI.Scrolling @@ -21,6 +22,7 @@ public partial class ScrollingHitObjectContainer : HitObjectContainer { private readonly IBindable timeRange = new BindableDouble(); private readonly IBindable direction = new Bindable(); + private readonly IBindable algorithm = new Bindable(); /// /// Whether the scrolling direction is horizontal or vertical. @@ -59,9 +61,11 @@ private void load() { direction.BindTo(scrollingInfo.Direction); timeRange.BindTo(scrollingInfo.TimeRange); + algorithm.BindTo(scrollingInfo.Algorithm); direction.ValueChanged += _ => layoutCache.Invalidate(); timeRange.ValueChanged += _ => layoutCache.Invalidate(); + algorithm.ValueChanged += _ => layoutCache.Invalidate(); } /// @@ -73,7 +77,7 @@ private void load() public double TimeAtPosition(float localPosition, double currentTime) { float scrollPosition = axisInverted ? -localPosition : localPosition; - return scrollingInfo.Algorithm.TimeAt(scrollPosition, currentTime, timeRange.Value, scrollLength); + return algorithm.Value.TimeAt(scrollPosition, currentTime, timeRange.Value, scrollLength); } /// @@ -95,7 +99,7 @@ public double TimeAtScreenSpacePosition(Vector2 screenSpacePosition) /// public float PositionAtTime(double time, double currentTime, double? originTime = null) { - float scrollPosition = scrollingInfo.Algorithm.PositionAt(time, currentTime, timeRange.Value, scrollLength, originTime); + float scrollPosition = algorithm.Value.PositionAt(time, currentTime, timeRange.Value, scrollLength, originTime); return axisInverted ? -scrollPosition : scrollPosition; } @@ -122,7 +126,7 @@ public Vector2 ScreenSpacePositionAtTime(double time) /// public float LengthAtTime(double startTime, double endTime) { - return scrollingInfo.Algorithm.GetLength(startTime, endTime, timeRange.Value, scrollLength); + return algorithm.Value.GetLength(startTime, endTime, timeRange.Value, scrollLength); } private float scrollLength => scrollingAxis == Direction.Horizontal ? DrawWidth : DrawHeight; @@ -169,7 +173,7 @@ protected override void Update() foreach (var entry in Entries) setComputedLifetimeStart(entry); - scrollingInfo.Algorithm.Reset(); + algorithm.Value.Reset(); layoutCache.Validate(); } @@ -224,7 +228,7 @@ private double computeDisplayStartTime(HitObjectLifetimeEntry entry) break; } - return scrollingInfo.Algorithm.GetDisplayStartTime(entry.HitObject.StartTime, startOffset, timeRange.Value, scrollLength); + return algorithm.Value.GetDisplayStartTime(entry.HitObject.StartTime, startOffset, timeRange.Value, scrollLength); } private void setComputedLifetimeStart(HitObjectLifetimeEntry entry) diff --git a/osu.Game/Screens/Edit/Components/TernaryButtons/DrawableTernaryButton.cs b/osu.Game/Screens/Edit/Components/TernaryButtons/DrawableTernaryButton.cs index 873551db7732..95d5dd36d831 100644 --- a/osu.Game/Screens/Edit/Components/TernaryButtons/DrawableTernaryButton.cs +++ b/osu.Game/Screens/Edit/Components/TernaryButtons/DrawableTernaryButton.cs @@ -14,7 +14,7 @@ namespace osu.Game.Screens.Edit.Components.TernaryButtons { - internal partial class DrawableTernaryButton : OsuButton + public partial class DrawableTernaryButton : OsuButton { private Color4 defaultBackgroundColour; private Color4 defaultIconColour; diff --git a/osu.Game/Tests/Visual/ScrollingTestContainer.cs b/osu.Game/Tests/Visual/ScrollingTestContainer.cs index b8b39e16b5b6..bce42996884e 100644 --- a/osu.Game/Tests/Visual/ScrollingTestContainer.cs +++ b/osu.Game/Tests/Visual/ScrollingTestContainer.cs @@ -58,7 +58,7 @@ public class TestScrollingInfo : IScrollingInfo IBindable IScrollingInfo.TimeRange => TimeRange; public readonly TestScrollAlgorithm Algorithm = new TestScrollAlgorithm(); - IScrollAlgorithm IScrollingInfo.Algorithm => Algorithm; + IBindable IScrollingInfo.Algorithm => new Bindable(Algorithm); } public class TestScrollAlgorithm : IScrollAlgorithm From 6ce251fbb5023705bc01325741e61b548b33502d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 1 Sep 2023 19:17:53 +0900 Subject: [PATCH 3/8] Expose base `VisualisationMethod` so we don't need to `new` it locally per ruleset --- osu.Game.Rulesets.Mania/UI/DrawableManiaRuleset.cs | 7 ------- osu.Game/Rulesets/UI/Scrolling/DrawableScrollingRuleset.cs | 2 +- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/osu.Game.Rulesets.Mania/UI/DrawableManiaRuleset.cs b/osu.Game.Rulesets.Mania/UI/DrawableManiaRuleset.cs index eb99434e04c8..9169599798d6 100644 --- a/osu.Game.Rulesets.Mania/UI/DrawableManiaRuleset.cs +++ b/osu.Game.Rulesets.Mania/UI/DrawableManiaRuleset.cs @@ -13,7 +13,6 @@ using osu.Framework.Input; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; -using osu.Game.Configuration; using osu.Game.Input.Handlers; using osu.Game.Replays; using osu.Game.Rulesets.Mania.Beatmaps; @@ -51,12 +50,6 @@ public partial class DrawableManiaRuleset : DrawableScrollingRuleset (ManiaRulesetConfigManager)base.Config; - public new ScrollVisualisationMethod VisualisationMethod - { - get => base.VisualisationMethod; - set => base.VisualisationMethod = value; - } - private readonly Bindable configDirection = new Bindable(); private readonly BindableInt configScrollSpeed = new BindableInt(); private double smoothTimeRange; diff --git a/osu.Game/Rulesets/UI/Scrolling/DrawableScrollingRuleset.cs b/osu.Game/Rulesets/UI/Scrolling/DrawableScrollingRuleset.cs index d082d2679280..6abfc6ee4975 100644 --- a/osu.Game/Rulesets/UI/Scrolling/DrawableScrollingRuleset.cs +++ b/osu.Game/Rulesets/UI/Scrolling/DrawableScrollingRuleset.cs @@ -165,7 +165,7 @@ protected override void LoadComplete() private ScrollVisualisationMethod visualisationMethod = ScrollVisualisationMethod.Sequential; - protected ScrollVisualisationMethod VisualisationMethod + public ScrollVisualisationMethod VisualisationMethod { get => visualisationMethod; set From 37c2b330a235a99fe999be7975c256325fa8c50a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 1 Sep 2023 19:49:57 +0900 Subject: [PATCH 4/8] Move toggle implementation to work on all scrolling rulesets automatically --- .../Edit/CatchHitObjectComposer.cs | 1 + .../Mods/TestSceneManiaModConstantSpeed.cs | 2 +- .../Edit/DrawableManiaEditorRuleset.cs | 19 +----- .../Edit/ManiaHitObjectComposer.cs | 30 +-------- .../Edit/TaikoHitObjectComposer.cs | 2 +- .../Edit/DistancedHitObjectComposer.cs | 2 +- osu.Game/Rulesets/Edit/HitObjectComposer.cs | 5 +- .../Edit/ScrollingHitObjectComposer.cs | 62 +++++++++++++++++++ 8 files changed, 73 insertions(+), 50 deletions(-) create mode 100644 osu.Game/Rulesets/Edit/ScrollingHitObjectComposer.cs diff --git a/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs b/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs index f2877572e8a3..136a78b34314 100644 --- a/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs +++ b/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs @@ -26,6 +26,7 @@ namespace osu.Game.Rulesets.Catch.Edit { public partial class CatchHitObjectComposer : DistancedHitObjectComposer + // we're also a ScrollingHitObjectComposer candidate, but can't be everything can we? { private const float distance_snap_radius = 50; diff --git a/osu.Game.Rulesets.Mania.Tests/Mods/TestSceneManiaModConstantSpeed.cs b/osu.Game.Rulesets.Mania.Tests/Mods/TestSceneManiaModConstantSpeed.cs index dc4f660a45ea..474430414ca5 100644 --- a/osu.Game.Rulesets.Mania.Tests/Mods/TestSceneManiaModConstantSpeed.cs +++ b/osu.Game.Rulesets.Mania.Tests/Mods/TestSceneManiaModConstantSpeed.cs @@ -24,7 +24,7 @@ public void TestConstantScroll() => CreateModTest(new ModTestData PassCondition = () => { var hitObject = Player.ChildrenOfType().FirstOrDefault(); - return hitObject?.Dependencies.Get().Algorithm is ConstantScrollAlgorithm; + return hitObject?.Dependencies.Get().Algorithm.Value is ConstantScrollAlgorithm; } }); } diff --git a/osu.Game.Rulesets.Mania/Edit/DrawableManiaEditorRuleset.cs b/osu.Game.Rulesets.Mania/Edit/DrawableManiaEditorRuleset.cs index 013dd3dcbd06..1741dad5d66d 100644 --- a/osu.Game.Rulesets.Mania/Edit/DrawableManiaEditorRuleset.cs +++ b/osu.Game.Rulesets.Mania/Edit/DrawableManiaEditorRuleset.cs @@ -2,23 +2,18 @@ // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; -using osu.Framework.Bindables; using osu.Framework.Graphics; -using osuTK; using osu.Game.Beatmaps; -using osu.Game.Configuration; -using osu.Game.Graphics.UserInterface; using osu.Game.Rulesets.Mania.UI; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI.Scrolling; +using osuTK; namespace osu.Game.Rulesets.Mania.Edit { public partial class DrawableManiaEditorRuleset : DrawableManiaRuleset { - public readonly IBindable ShowSpeedChanges = new Bindable(); - public new IScrollingInfo ScrollingInfo => base.ScrollingInfo; public DrawableManiaEditorRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList? mods) @@ -26,18 +21,6 @@ public DrawableManiaEditorRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyLi { } - protected override void LoadComplete() - { - base.LoadComplete(); - - ShowSpeedChanges.BindValueChanged(state => - { - VisualisationMethod = state.NewValue == TernaryState.True - ? ScrollVisualisationMethod.Sequential - : ScrollVisualisationMethod.Constant; - }, true); - } - protected override Playfield CreatePlayfield() => new ManiaEditorPlayfield(Beatmap.Stages) { Anchor = Anchor.Centre, diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs index 44e238efac0c..9bde9485b24f 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs @@ -6,13 +6,8 @@ using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; -using osu.Framework.Bindables; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using osu.Framework.Input; using osu.Game.Beatmaps; -using osu.Game.Graphics.UserInterface; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit.Tools; using osu.Game.Rulesets.Mania.Objects; @@ -21,16 +16,13 @@ using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI.Scrolling; -using osu.Game.Screens.Edit.Components.TernaryButtons; using osu.Game.Screens.Edit.Compose.Components; using osuTK; namespace osu.Game.Rulesets.Mania.Edit { - public partial class ManiaHitObjectComposer : HitObjectComposer + public partial class ManiaHitObjectComposer : ScrollingHitObjectComposer { - private readonly Bindable showSpeedChanges = new Bindable(); - private DrawableManiaEditorRuleset drawableRuleset; private ManiaBeatSnapGrid beatSnapGrid; private InputManager inputManager; @@ -44,21 +36,6 @@ public ManiaHitObjectComposer(Ruleset ruleset) private void load() { AddInternal(beatSnapGrid = new ManiaBeatSnapGrid()); - - LeftToolbox.Add(new EditorToolboxGroup("playfield") - { - Child = new FillFlowContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Direction = FillDirection.Vertical, - Spacing = new Vector2(0, 5), - Children = new[] - { - new DrawableTernaryButton(new TernaryButton(showSpeedChanges, "Show speed changes", () => new SpriteIcon { Icon = FontAwesome.Solid.TachometerAlt })) - } - }, - }); } protected override void LoadComplete() @@ -82,10 +59,7 @@ protected override Playfield PlayfieldAtScreenSpacePosition(Vector2 screenSpaceP protected override DrawableRuleset CreateDrawableRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList mods = null) { - drawableRuleset = new DrawableManiaEditorRuleset(ruleset, beatmap, mods) - { - ShowSpeedChanges = { BindTarget = showSpeedChanges } - }; + drawableRuleset = new DrawableManiaEditorRuleset(ruleset, beatmap, mods); // This is the earliest we can cache the scrolling info to ourselves, before masks are added to the hierarchy and inject it dependencies.CacheAs(drawableRuleset.ScrollingInfo); diff --git a/osu.Game.Rulesets.Taiko/Edit/TaikoHitObjectComposer.cs b/osu.Game.Rulesets.Taiko/Edit/TaikoHitObjectComposer.cs index 3e63d624e732..fbad8c7fad10 100644 --- a/osu.Game.Rulesets.Taiko/Edit/TaikoHitObjectComposer.cs +++ b/osu.Game.Rulesets.Taiko/Edit/TaikoHitObjectComposer.cs @@ -9,7 +9,7 @@ namespace osu.Game.Rulesets.Taiko.Edit { - public partial class TaikoHitObjectComposer : HitObjectComposer + public partial class TaikoHitObjectComposer : ScrollingHitObjectComposer { protected override bool ApplyHorizontalCentering => false; diff --git a/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs b/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs index 817e8bd5fe64..d1db8cb1f11f 100644 --- a/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs @@ -62,7 +62,7 @@ protected DistancedHitObjectComposer(Ruleset ruleset) } [BackgroundDependencyLoader] - private void load(OverlayColourProvider colourProvider) + private void load() { RightToolbox.Add(new EditorToolboxGroup("snapping") { diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index c967187b5c22..295a016c7b36 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -87,6 +87,8 @@ public abstract partial class HitObjectComposer : HitObjectComposer, IP private IBindable hasTiming; private Bindable autoSeekOnPlacement; + protected DrawableRuleset DrawableRuleset { get; private set; } + protected HitObjectComposer(Ruleset ruleset) : base(ruleset) { @@ -104,7 +106,8 @@ private void load(OsuConfigManager config) try { - drawableRulesetWrapper = new DrawableEditorRulesetWrapper(CreateDrawableRuleset(Ruleset, EditorBeatmap.PlayableBeatmap, new[] { Ruleset.GetAutoplayMod() })) + DrawableRuleset = CreateDrawableRuleset(Ruleset, EditorBeatmap.PlayableBeatmap, new[] { Ruleset.GetAutoplayMod() }); + drawableRulesetWrapper = new DrawableEditorRulesetWrapper(DrawableRuleset) { Clock = EditorClock, ProcessCustomClock = false diff --git a/osu.Game/Rulesets/Edit/ScrollingHitObjectComposer.cs b/osu.Game/Rulesets/Edit/ScrollingHitObjectComposer.cs new file mode 100644 index 000000000000..034035401686 --- /dev/null +++ b/osu.Game/Rulesets/Edit/ScrollingHitObjectComposer.cs @@ -0,0 +1,62 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Bindables; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Game.Configuration; +using osu.Game.Graphics.UserInterface; +using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.UI.Scrolling; +using osu.Game.Screens.Edit.Components.TernaryButtons; +using osuTK; + +namespace osu.Game.Rulesets.Edit +{ + public abstract partial class ScrollingHitObjectComposer : HitObjectComposer + where TObject : HitObject + { + private readonly Bindable showSpeedChanges = new Bindable(); + + protected ScrollingHitObjectComposer(Ruleset ruleset) + : base(ruleset) + { + } + + [BackgroundDependencyLoader] + private void load() + { + if (DrawableRuleset is DrawableScrollingRuleset drawableScrollingRuleset) + { + var originalVisualisationMethod = drawableScrollingRuleset.VisualisationMethod; + + if (originalVisualisationMethod != ScrollVisualisationMethod.Constant) + { + LeftToolbox.Add(new EditorToolboxGroup("playfield") + { + Child = new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Spacing = new Vector2(0, 5), + Children = new[] + { + new DrawableTernaryButton(new TernaryButton(showSpeedChanges, "Show speed changes", () => new SpriteIcon { Icon = FontAwesome.Solid.TachometerAlt })) + } + }, + }); + + showSpeedChanges.BindValueChanged(state => + { + drawableScrollingRuleset.VisualisationMethod = state.NewValue == TernaryState.True + ? originalVisualisationMethod + : ScrollVisualisationMethod.Constant; + }, true); + } + } + } + } +} From c6cc858967ccc3068aa0b19a7e308451b6e16d97 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 20 Sep 2023 15:27:30 +0900 Subject: [PATCH 5/8] Change implementation of "show speed changes" to require explicit ruleset support --- .../Edit/ScrollingHitObjectComposer.cs | 37 +++++++------------ .../ISupportConstantAlgorithmToggle.cs | 15 ++++++++ 2 files changed, 28 insertions(+), 24 deletions(-) create mode 100644 osu.Game/Rulesets/UI/Scrolling/ISupportConstantAlgorithmToggle.cs diff --git a/osu.Game/Rulesets/Edit/ScrollingHitObjectComposer.cs b/osu.Game/Rulesets/Edit/ScrollingHitObjectComposer.cs index 034035401686..75305a0c2040 100644 --- a/osu.Game/Rulesets/Edit/ScrollingHitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/ScrollingHitObjectComposer.cs @@ -6,7 +6,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Game.Configuration; using osu.Game.Graphics.UserInterface; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.UI.Scrolling; @@ -28,34 +27,24 @@ protected ScrollingHitObjectComposer(Ruleset ruleset) [BackgroundDependencyLoader] private void load() { - if (DrawableRuleset is DrawableScrollingRuleset drawableScrollingRuleset) + if (DrawableRuleset is ISupportConstantAlgorithmToggle toggleRuleset) { - var originalVisualisationMethod = drawableScrollingRuleset.VisualisationMethod; - - if (originalVisualisationMethod != ScrollVisualisationMethod.Constant) + LeftToolbox.Add(new EditorToolboxGroup("playfield") { - LeftToolbox.Add(new EditorToolboxGroup("playfield") + Child = new FillFlowContainer { - Child = new FillFlowContainer + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Spacing = new Vector2(0, 5), + Children = new[] { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Direction = FillDirection.Vertical, - Spacing = new Vector2(0, 5), - Children = new[] - { - new DrawableTernaryButton(new TernaryButton(showSpeedChanges, "Show speed changes", () => new SpriteIcon { Icon = FontAwesome.Solid.TachometerAlt })) - } - }, - }); + new DrawableTernaryButton(new TernaryButton(showSpeedChanges, "Show speed changes", () => new SpriteIcon { Icon = FontAwesome.Solid.TachometerAlt })) + } + }, + }); - showSpeedChanges.BindValueChanged(state => - { - drawableScrollingRuleset.VisualisationMethod = state.NewValue == TernaryState.True - ? originalVisualisationMethod - : ScrollVisualisationMethod.Constant; - }, true); - } + showSpeedChanges.BindValueChanged(state => toggleRuleset.ShowSpeedChanges.Value = state.NewValue == TernaryState.True, true); } } } diff --git a/osu.Game/Rulesets/UI/Scrolling/ISupportConstantAlgorithmToggle.cs b/osu.Game/Rulesets/UI/Scrolling/ISupportConstantAlgorithmToggle.cs new file mode 100644 index 000000000000..aaa635350e85 --- /dev/null +++ b/osu.Game/Rulesets/UI/Scrolling/ISupportConstantAlgorithmToggle.cs @@ -0,0 +1,15 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Bindables; + +namespace osu.Game.Rulesets.UI.Scrolling +{ + /// + /// Denotes a which supports toggling constant algorithm for better display in the editor. + /// + public interface ISupportConstantAlgorithmToggle : IDrawableScrollingRuleset + { + public BindableBool ShowSpeedChanges { get; } + } +} From 41a8239e49d87fec622135874bddcf2660ae0000 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 20 Sep 2023 15:27:50 +0900 Subject: [PATCH 6/8] Remvoe null default for mods which can't be null --- osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs | 2 +- osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs | 2 +- osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs | 2 +- osu.Game/Rulesets/Edit/HitObjectComposer.cs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs b/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs index 136a78b34314..d74e6194fb2f 100644 --- a/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs +++ b/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs @@ -141,7 +141,7 @@ public override bool OnPressed(KeyBindingPressEvent e) return base.OnPressed(e); } - protected override DrawableRuleset CreateDrawableRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList? mods = null) => + protected override DrawableRuleset CreateDrawableRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList mods) => new DrawableCatchEditorRuleset(ruleset, beatmap, mods) { TimeRangeMultiplier = { BindTarget = timeRangeMultiplier, } diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs index 9bde9485b24f..8e61baca8191 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs @@ -57,7 +57,7 @@ protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnl protected override Playfield PlayfieldAtScreenSpacePosition(Vector2 screenSpacePosition) => Playfield.GetColumnByPosition(screenSpacePosition); - protected override DrawableRuleset CreateDrawableRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList mods = null) + protected override DrawableRuleset CreateDrawableRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList mods) { drawableRuleset = new DrawableManiaEditorRuleset(ruleset, beatmap, mods); diff --git a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs index cff2171cbd79..fdc11be42c62 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs @@ -37,7 +37,7 @@ public OsuHitObjectComposer(Ruleset ruleset) { } - protected override DrawableRuleset CreateDrawableRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList mods = null) + protected override DrawableRuleset CreateDrawableRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList mods) => new DrawableOsuEditorRuleset(ruleset, beatmap, mods); protected override IReadOnlyList CompositionTools => new HitObjectCompositionTool[] diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index 295a016c7b36..f9a6b5083ea5 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -307,7 +307,7 @@ protected override void Update() /// The loaded beatmap. /// The mods to be applied. /// An editor-relevant . - protected virtual DrawableRuleset CreateDrawableRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList mods = null) + protected virtual DrawableRuleset CreateDrawableRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList mods) => (DrawableRuleset)ruleset.CreateDrawableRulesetWith(beatmap, mods); #region Tool selection logic From cb0226f84356ae0fe991cae3664590b3c6dcc708 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 20 Sep 2023 15:28:13 +0900 Subject: [PATCH 7/8] Implement new interface-based speed change visualisation support on mania/taiko --- .../Edit/DrawableManiaEditorRuleset.cs | 13 ++++++- .../Edit/DrawableTaikoEditorRuleset.cs | 37 +++++++++++++++++++ .../Edit/TaikoHitObjectComposer.cs | 6 +++ .../UI/DrawableTaikoRuleset.cs | 7 +++- 4 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 osu.Game.Rulesets.Taiko/Edit/DrawableTaikoEditorRuleset.cs diff --git a/osu.Game.Rulesets.Mania/Edit/DrawableManiaEditorRuleset.cs b/osu.Game.Rulesets.Mania/Edit/DrawableManiaEditorRuleset.cs index 1741dad5d66d..7b019a2bdf02 100644 --- a/osu.Game.Rulesets.Mania/Edit/DrawableManiaEditorRuleset.cs +++ b/osu.Game.Rulesets.Mania/Edit/DrawableManiaEditorRuleset.cs @@ -2,8 +2,10 @@ // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Beatmaps; +using osu.Game.Configuration; using osu.Game.Rulesets.Mania.UI; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.UI; @@ -12,8 +14,10 @@ namespace osu.Game.Rulesets.Mania.Edit { - public partial class DrawableManiaEditorRuleset : DrawableManiaRuleset + public partial class DrawableManiaEditorRuleset : DrawableManiaRuleset, ISupportConstantAlgorithmToggle { + public BindableBool ShowSpeedChanges { get; set; } = new BindableBool(); + public new IScrollingInfo ScrollingInfo => base.ScrollingInfo; public DrawableManiaEditorRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList? mods) @@ -21,6 +25,13 @@ public DrawableManiaEditorRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyLi { } + protected override void LoadComplete() + { + base.LoadComplete(); + + ShowSpeedChanges.BindValueChanged(showChanges => VisualisationMethod = showChanges.NewValue ? ScrollVisualisationMethod.Sequential : ScrollVisualisationMethod.Constant, true); + } + protected override Playfield CreatePlayfield() => new ManiaEditorPlayfield(Beatmap.Stages) { Anchor = Anchor.Centre, diff --git a/osu.Game.Rulesets.Taiko/Edit/DrawableTaikoEditorRuleset.cs b/osu.Game.Rulesets.Taiko/Edit/DrawableTaikoEditorRuleset.cs new file mode 100644 index 000000000000..963ddec0b3b7 --- /dev/null +++ b/osu.Game.Rulesets.Taiko/Edit/DrawableTaikoEditorRuleset.cs @@ -0,0 +1,37 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.Collections.Generic; +using osu.Framework.Bindables; +using osu.Game.Beatmaps; +using osu.Game.Configuration; +using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Taiko.UI; +using osu.Game.Rulesets.UI.Scrolling; + +namespace osu.Game.Rulesets.Taiko.Edit +{ + public partial class DrawableTaikoEditorRuleset : DrawableTaikoRuleset, ISupportConstantAlgorithmToggle + { + public BindableBool ShowSpeedChanges { get; set; } = new BindableBool(); + + public DrawableTaikoEditorRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList mods) + : base(ruleset, beatmap, mods) + { + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + ShowSpeedChanges.BindValueChanged(showChanges => VisualisationMethod = showChanges.NewValue ? ScrollVisualisationMethod.Overlapping : ScrollVisualisationMethod.Constant, true); + } + + protected override double ComputeTimeRange() + { + // Adjust when we're using constant algorithm to not be sluggish. + double multiplier = ShowSpeedChanges.Value ? 1 : 4; + return base.ComputeTimeRange() / multiplier; + } + } +} diff --git a/osu.Game.Rulesets.Taiko/Edit/TaikoHitObjectComposer.cs b/osu.Game.Rulesets.Taiko/Edit/TaikoHitObjectComposer.cs index fbad8c7fad10..5ae4757b8f65 100644 --- a/osu.Game.Rulesets.Taiko/Edit/TaikoHitObjectComposer.cs +++ b/osu.Game.Rulesets.Taiko/Edit/TaikoHitObjectComposer.cs @@ -2,9 +2,12 @@ // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; +using osu.Game.Beatmaps; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit.Tools; +using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Taiko.Objects; +using osu.Game.Rulesets.UI; using osu.Game.Screens.Edit.Compose.Components; namespace osu.Game.Rulesets.Taiko.Edit @@ -25,6 +28,9 @@ public TaikoHitObjectComposer(TaikoRuleset ruleset) new SwellCompositionTool() }; + protected override DrawableRuleset CreateDrawableRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList mods) => + new DrawableTaikoEditorRuleset(ruleset, beatmap, mods); + protected override ComposeBlueprintContainer CreateBlueprintContainer() => new TaikoBlueprintContainer(this); } diff --git a/osu.Game.Rulesets.Taiko/UI/DrawableTaikoRuleset.cs b/osu.Game.Rulesets.Taiko/UI/DrawableTaikoRuleset.cs index 979e03f20122..2af4c0c2e8b3 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrawableTaikoRuleset.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrawableTaikoRuleset.cs @@ -64,6 +64,11 @@ protected override void Update() { base.Update(); + TimeRange.Value = ComputeTimeRange(); + } + + protected virtual double ComputeTimeRange() + { // Taiko scrolls at a constant 100px per 1000ms. More notes become visible as the playfield is lengthened. const float scroll_rate = 10; @@ -72,7 +77,7 @@ protected override void Update() // We clamp the ratio to the maximum aspect ratio to keep scroll speed consistent on widths lower than the default. float ratio = Math.Max(DrawSize.X / 768f, TaikoPlayfieldAdjustmentContainer.MAXIMUM_ASPECT); - TimeRange.Value = (Playfield.HitObjectContainer.DrawWidth / ratio) * scroll_rate; + return (Playfield.HitObjectContainer.DrawWidth / ratio) * scroll_rate; } protected override void UpdateAfterChildren() From f2791d4f3e1c3067d8a2b9fcbab013edcd5eeefb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 20 Sep 2023 12:22:05 +0200 Subject: [PATCH 8/8] Move comment a bit to fix formatting Would otherwise trigger IDE0055, but that isn't resolveable without an inspection cycle with resharper, so just move in a more sane place. --- osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs b/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs index d74e6194fb2f..dc3a4416a538 100644 --- a/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs +++ b/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs @@ -25,8 +25,8 @@ namespace osu.Game.Rulesets.Catch.Edit { + // we're also a ScrollingHitObjectComposer candidate, but can't be everything can we? public partial class CatchHitObjectComposer : DistancedHitObjectComposer - // we're also a ScrollingHitObjectComposer candidate, but can't be everything can we? { private const float distance_snap_radius = 50;