From ddd37bb3190419cc93b9ea49e4ad14e205b61efb Mon Sep 17 00:00:00 2001 From: Maximilian Kruse Date: Sat, 18 Feb 2023 19:43:45 +0100 Subject: [PATCH 01/10] Add setting to disable automatic seeking after object placement --- osu.Game/Configuration/OsuConfigManager.cs | 2 ++ osu.Game/Localisation/EditorStrings.cs | 5 +++++ osu.Game/Rulesets/Edit/HitObjectComposer.cs | 9 ++++++++- osu.Game/Screens/Edit/Editor.cs | 6 ++++++ 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 565a919fb8..a4544200c7 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -178,6 +178,7 @@ namespace osu.Game.Configuration SetDefault(OsuSetting.EditorDim, 0.25f, 0f, 0.75f, 0.25f); SetDefault(OsuSetting.EditorWaveformOpacity, 0.25f, 0f, 1f, 0.25f); SetDefault(OsuSetting.EditorShowHitMarkers, true); + SetDefault(OsuSetting.EditorSeekToHitobject, true); SetDefault(OsuSetting.LastProcessedMetadataId, -1); @@ -374,6 +375,7 @@ namespace osu.Game.Configuration SeasonalBackgroundMode, EditorWaveformOpacity, EditorShowHitMarkers, + EditorSeekToHitobject, DiscordRichPresence, AutomaticallyDownloadWhenSpectating, ShowOnlineExplicitContent, diff --git a/osu.Game/Localisation/EditorStrings.cs b/osu.Game/Localisation/EditorStrings.cs index 96c08aa6f8..65cecd27d6 100644 --- a/osu.Game/Localisation/EditorStrings.cs +++ b/osu.Game/Localisation/EditorStrings.cs @@ -19,6 +19,11 @@ namespace osu.Game.Localisation /// public static LocalisableString ShowHitMarkers => new TranslatableString(getKey(@"show_hit_markers"), @"Show hit markers"); + /// + /// "Seek to Object after placement" + /// + public static LocalisableString SeekToHitobject => new TranslatableString(getKey(@"seek_to_hitobject"), @"Seek to Object after placement"); + /// /// "Timing" /// diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index b5b7400f64..528088dbda 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -17,6 +17,7 @@ using osu.Framework.Input; using osu.Framework.Input.Events; using osu.Framework.Logging; using osu.Game.Beatmaps; +using osu.Game.Configuration; using osu.Game.Overlays; using osu.Game.Rulesets.Configuration; using osu.Game.Rulesets.Edit.Tools; @@ -70,6 +71,7 @@ namespace osu.Game.Rulesets.Edit private FillFlowContainer togglesCollection; private IBindable hasTiming; + protected Bindable SeekToHitobject { get; private set; } protected HitObjectComposer(Ruleset ruleset) : base(ruleset) @@ -80,8 +82,10 @@ namespace osu.Game.Rulesets.Edit dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); [BackgroundDependencyLoader] - private void load(OverlayColourProvider colourProvider) + private void load(OverlayColourProvider colourProvider, OsuConfigManager config) { + SeekToHitobject = config.GetBindable(OsuSetting.EditorSeekToHitobject); + Config = Dependencies.Get().GetConfigFor(Ruleset); try @@ -365,6 +369,9 @@ namespace osu.Game.Rulesets.Edit { EditorBeatmap.Add(hitObject); + // conditionally seek based on setting + if (!SeekToHitobject.Value) return; + if (EditorClock.CurrentTime < hitObject.StartTime) EditorClock.SeekSmoothlyTo(hitObject.StartTime); } diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index bd133383d1..d6c698c139 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -185,6 +185,7 @@ namespace osu.Game.Screens.Edit private Bindable editorBackgroundDim; private Bindable editorHitMarkers; + private Bindable editorSeekToHitobject; public Editor(EditorLoader loader = null) { @@ -272,6 +273,7 @@ namespace osu.Game.Screens.Edit editorBackgroundDim = config.GetBindable(OsuSetting.EditorDim); editorHitMarkers = config.GetBindable(OsuSetting.EditorShowHitMarkers); + editorSeekToHitobject = config.GetBindable(OsuSetting.EditorSeekToHitobject); AddInternal(new OsuContextMenuContainer { @@ -329,6 +331,10 @@ namespace osu.Game.Screens.Edit new ToggleMenuItem(EditorStrings.ShowHitMarkers) { State = { BindTarget = editorHitMarkers }, + }, + new ToggleMenuItem(EditorStrings.SeekToHitobject) + { + State = { BindTarget = editorSeekToHitobject }, } } }, From 55e9a71f388a7c5aed00f8fadcb1ce76bd725a73 Mon Sep 17 00:00:00 2001 From: Maximilian Kruse Date: Sat, 18 Feb 2023 20:42:13 +0100 Subject: [PATCH 02/10] Add test for seeking setting in mania placement test --- .../TestScenePlacementBeforeTrackStart.cs | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/osu.Game.Rulesets.Mania.Tests/Editor/TestScenePlacementBeforeTrackStart.cs b/osu.Game.Rulesets.Mania.Tests/Editor/TestScenePlacementBeforeTrackStart.cs index 00dd75ceee..4c48a361b8 100644 --- a/osu.Game.Rulesets.Mania.Tests/Editor/TestScenePlacementBeforeTrackStart.cs +++ b/osu.Game.Rulesets.Mania.Tests/Editor/TestScenePlacementBeforeTrackStart.cs @@ -3,8 +3,11 @@ using System.Linq; using NUnit.Framework; +using osu.Framework.Allocation; using osu.Framework.Graphics.Containers; using osu.Framework.Testing; +using osu.Game.Configuration; +using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Tests.Visual; using osuTK.Input; @@ -14,6 +17,9 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor { protected override Ruleset CreateEditorRuleset() => new ManiaRuleset(); + [Resolved] + private OsuConfigManager config { get; set; } = null!; + [Test] public void TestPlacement() { @@ -26,5 +32,36 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor AddStep("Click", () => InputManager.Click(MouseButton.Left)); AddAssert("No notes placed", () => EditorBeatmap.HitObjects.All(x => x.StartTime >= 0)); } + + [Test] + public void TestSeekOnNotePlacement() + { + AddStep("Seek to 1935", () => EditorClock.Seek(1935)); + AddStep("Change seek setting to true", () => config.SetValue(OsuSetting.EditorSeekToHitobject, true)); + seekSetup(); + AddUntilStep("Wait for seeking to end", () => !EditorClock.IsSeeking); + AddAssert("Seeked to object", () => + { + return EditorClock.CurrentTimeAccurate == 2287.1875; + }); + } + + [Test] + public void TestNoSeekOnNotePlacement() + { + AddStep("Seek to 1935", () => EditorClock.Seek(1935)); + AddStep("Change seek setting to false", () => config.SetValue(OsuSetting.EditorSeekToHitobject, false)); + seekSetup(); + AddAssert("Not seeking", () => !EditorClock.IsSeeking); + AddAssert("Not seeked to object", () => EditorClock.CurrentTime == 1935); + } + + private void seekSetup() + { + AddStep("Seek to 1935", () => EditorClock.Seek(1935)); + AddStep("Select note", () => InputManager.Key(Key.Number2)); + AddStep("Place note", () => InputManager.MoveMouseTo(this.ChildrenOfType().First(x => x.HitObject.StartTime == 2170))); + AddStep("Click", () => InputManager.Click(MouseButton.Left)); + } } } From 025061ba66766fad6a1b3521693956c09d69592e Mon Sep 17 00:00:00 2001 From: Maximilian Kruse Date: Sun, 19 Feb 2023 10:17:33 +0100 Subject: [PATCH 03/10] fix formating in SeekOnNote test --- .../Editor/TestScenePlacementBeforeTrackStart.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/osu.Game.Rulesets.Mania.Tests/Editor/TestScenePlacementBeforeTrackStart.cs b/osu.Game.Rulesets.Mania.Tests/Editor/TestScenePlacementBeforeTrackStart.cs index 4c48a361b8..142fa5ce07 100644 --- a/osu.Game.Rulesets.Mania.Tests/Editor/TestScenePlacementBeforeTrackStart.cs +++ b/osu.Game.Rulesets.Mania.Tests/Editor/TestScenePlacementBeforeTrackStart.cs @@ -37,20 +37,17 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor public void TestSeekOnNotePlacement() { AddStep("Seek to 1935", () => EditorClock.Seek(1935)); - AddStep("Change seek setting to true", () => config.SetValue(OsuSetting.EditorSeekToHitobject, true)); + AddStep("Change seek setting to true", () => config.SetValue(OsuSetting.EditorSeekToHitObject, true)); seekSetup(); AddUntilStep("Wait for seeking to end", () => !EditorClock.IsSeeking); - AddAssert("Seeked to object", () => - { - return EditorClock.CurrentTimeAccurate == 2287.1875; - }); + AddAssert("Seeked to object", () => EditorClock.CurrentTimeAccurate == 2287.1875); } [Test] public void TestNoSeekOnNotePlacement() { AddStep("Seek to 1935", () => EditorClock.Seek(1935)); - AddStep("Change seek setting to false", () => config.SetValue(OsuSetting.EditorSeekToHitobject, false)); + AddStep("Change seek setting to false", () => config.SetValue(OsuSetting.EditorSeekToHitObject, false)); seekSetup(); AddAssert("Not seeking", () => !EditorClock.IsSeeking); AddAssert("Not seeked to object", () => EditorClock.CurrentTime == 1935); From f3522c41629ea1f4ba1cde94b4b4b1509d7074c9 Mon Sep 17 00:00:00 2001 From: Maximilian Kruse Date: Sun, 19 Feb 2023 10:18:02 +0100 Subject: [PATCH 04/10] change bindable seekToHitObject to private --- osu.Game/Rulesets/Edit/HitObjectComposer.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index 528088dbda..f989c81da8 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -71,7 +71,7 @@ namespace osu.Game.Rulesets.Edit private FillFlowContainer togglesCollection; private IBindable hasTiming; - protected Bindable SeekToHitobject { get; private set; } + private Bindable seekToHitObject; protected HitObjectComposer(Ruleset ruleset) : base(ruleset) @@ -84,7 +84,7 @@ namespace osu.Game.Rulesets.Edit [BackgroundDependencyLoader] private void load(OverlayColourProvider colourProvider, OsuConfigManager config) { - SeekToHitobject = config.GetBindable(OsuSetting.EditorSeekToHitobject); + seekToHitObject = config.GetBindable(OsuSetting.EditorSeekToHitObject); Config = Dependencies.Get().GetConfigFor(Ruleset); @@ -369,8 +369,7 @@ namespace osu.Game.Rulesets.Edit { EditorBeatmap.Add(hitObject); - // conditionally seek based on setting - if (!SeekToHitobject.Value) return; + if (!seekToHitObject.Value) return; if (EditorClock.CurrentTime < hitObject.StartTime) EditorClock.SeekSmoothlyTo(hitObject.StartTime); From 723a043c4351da62b8c16913b42d3e27f2e1b843 Mon Sep 17 00:00:00 2001 From: Maximilian Kruse Date: Sun, 19 Feb 2023 10:18:22 +0100 Subject: [PATCH 05/10] naming change from Hitobject to HitObject --- osu.Game/Configuration/OsuConfigManager.cs | 4 ++-- osu.Game/Localisation/EditorStrings.cs | 4 ++-- osu.Game/Screens/Edit/Editor.cs | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index a4544200c7..9093c017d2 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -178,7 +178,7 @@ namespace osu.Game.Configuration SetDefault(OsuSetting.EditorDim, 0.25f, 0f, 0.75f, 0.25f); SetDefault(OsuSetting.EditorWaveformOpacity, 0.25f, 0f, 1f, 0.25f); SetDefault(OsuSetting.EditorShowHitMarkers, true); - SetDefault(OsuSetting.EditorSeekToHitobject, true); + SetDefault(OsuSetting.EditorSeekToHitObject, true); SetDefault(OsuSetting.LastProcessedMetadataId, -1); @@ -375,7 +375,7 @@ namespace osu.Game.Configuration SeasonalBackgroundMode, EditorWaveformOpacity, EditorShowHitMarkers, - EditorSeekToHitobject, + EditorSeekToHitObject, DiscordRichPresence, AutomaticallyDownloadWhenSpectating, ShowOnlineExplicitContent, diff --git a/osu.Game/Localisation/EditorStrings.cs b/osu.Game/Localisation/EditorStrings.cs index 65cecd27d6..4557cb532f 100644 --- a/osu.Game/Localisation/EditorStrings.cs +++ b/osu.Game/Localisation/EditorStrings.cs @@ -20,9 +20,9 @@ namespace osu.Game.Localisation public static LocalisableString ShowHitMarkers => new TranslatableString(getKey(@"show_hit_markers"), @"Show hit markers"); /// - /// "Seek to Object after placement" + /// "Seek to object after placement" /// - public static LocalisableString SeekToHitobject => new TranslatableString(getKey(@"seek_to_hitobject"), @"Seek to Object after placement"); + public static LocalisableString SeekToHitObject => new TranslatableString(getKey(@"seek_to_hit_object"), @"Seek to object after placement"); /// /// "Timing" diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index d6c698c139..e9a0fbf6fa 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -185,7 +185,7 @@ namespace osu.Game.Screens.Edit private Bindable editorBackgroundDim; private Bindable editorHitMarkers; - private Bindable editorSeekToHitobject; + private Bindable editorSeekToHitObject; public Editor(EditorLoader loader = null) { @@ -273,7 +273,7 @@ namespace osu.Game.Screens.Edit editorBackgroundDim = config.GetBindable(OsuSetting.EditorDim); editorHitMarkers = config.GetBindable(OsuSetting.EditorShowHitMarkers); - editorSeekToHitobject = config.GetBindable(OsuSetting.EditorSeekToHitobject); + editorSeekToHitObject = config.GetBindable(OsuSetting.EditorSeekToHitObject); AddInternal(new OsuContextMenuContainer { @@ -332,9 +332,9 @@ namespace osu.Game.Screens.Edit { State = { BindTarget = editorHitMarkers }, }, - new ToggleMenuItem(EditorStrings.SeekToHitobject) + new ToggleMenuItem(EditorStrings.SeekToHitObject) { - State = { BindTarget = editorSeekToHitobject }, + State = { BindTarget = editorSeekToHitObject }, } } }, From aac32a2c9f49795e60a2f397bf833060299f2d9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 19 Feb 2023 13:14:51 +0100 Subject: [PATCH 06/10] Combine config and time checks into one Functionally equivalent right now, but the combined variant is more localised to what it actually needs to do, and less error-prone if any new code gets appended to the method. --- osu.Game/Rulesets/Edit/HitObjectComposer.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index f989c81da8..eb10d09560 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -369,9 +369,7 @@ namespace osu.Game.Rulesets.Edit { EditorBeatmap.Add(hitObject); - if (!seekToHitObject.Value) return; - - if (EditorClock.CurrentTime < hitObject.StartTime) + if (seekToHitObject.Value && EditorClock.CurrentTime < hitObject.StartTime) EditorClock.SeekSmoothlyTo(hitObject.StartTime); } } From 80b329f06924952df70fcb926cf2cc4fdaaf6fbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 19 Feb 2023 13:16:40 +0100 Subject: [PATCH 07/10] Rename test scene to match contents It does not only test "placement before track start" anymore. --- ...PlacementBeforeTrackStart.cs => TestSceneObjectPlacement.cs} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename osu.Game.Rulesets.Mania.Tests/Editor/{TestScenePlacementBeforeTrackStart.cs => TestSceneObjectPlacement.cs} (97%) diff --git a/osu.Game.Rulesets.Mania.Tests/Editor/TestScenePlacementBeforeTrackStart.cs b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneObjectPlacement.cs similarity index 97% rename from osu.Game.Rulesets.Mania.Tests/Editor/TestScenePlacementBeforeTrackStart.cs rename to osu.Game.Rulesets.Mania.Tests/Editor/TestSceneObjectPlacement.cs index 142fa5ce07..02980f3ac8 100644 --- a/osu.Game.Rulesets.Mania.Tests/Editor/TestScenePlacementBeforeTrackStart.cs +++ b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneObjectPlacement.cs @@ -13,7 +13,7 @@ using osuTK.Input; namespace osu.Game.Rulesets.Mania.Tests.Editor { - public partial class TestScenePlacementBeforeTrackStart : EditorTestScene + public partial class TestSceneObjectPlacement : EditorTestScene { protected override Ruleset CreateEditorRuleset() => new ManiaRuleset(); From 80ee917c7780e0e5da061312312430ead795f44a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 19 Feb 2023 13:33:06 +0100 Subject: [PATCH 08/10] Rewrite test cases - Depend less on arbitrary timings - Remove unnecessary seeks - Change method name to make more sense - Use nunit style assertions --- .../Editor/TestSceneObjectPlacement.cs | 35 ++++++++++--------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneObjectPlacement.cs b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneObjectPlacement.cs index 02980f3ac8..ec2995924d 100644 --- a/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneObjectPlacement.cs +++ b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneObjectPlacement.cs @@ -7,7 +7,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics.Containers; using osu.Framework.Testing; using osu.Game.Configuration; -using osu.Game.Rulesets.Mania.Objects.Drawables; +using osu.Game.Rulesets.Mania.UI; using osu.Game.Tests.Visual; using osuTK.Input; @@ -36,29 +36,32 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor [Test] public void TestSeekOnNotePlacement() { - AddStep("Seek to 1935", () => EditorClock.Seek(1935)); - AddStep("Change seek setting to true", () => config.SetValue(OsuSetting.EditorSeekToHitObject, true)); - seekSetup(); - AddUntilStep("Wait for seeking to end", () => !EditorClock.IsSeeking); - AddAssert("Seeked to object", () => EditorClock.CurrentTimeAccurate == 2287.1875); + double? initialTime = null; + + AddStep("store initial time", () => initialTime = EditorClock.CurrentTime); + AddStep("change seek setting to true", () => config.SetValue(OsuSetting.EditorSeekToHitObject, true)); + placeObject(); + AddUntilStep("wait for seek to complete", () => !EditorClock.IsSeeking); + AddAssert("seeked forward to object", () => EditorClock.CurrentTime, () => Is.GreaterThan(initialTime)); } [Test] public void TestNoSeekOnNotePlacement() { - AddStep("Seek to 1935", () => EditorClock.Seek(1935)); - AddStep("Change seek setting to false", () => config.SetValue(OsuSetting.EditorSeekToHitObject, false)); - seekSetup(); - AddAssert("Not seeking", () => !EditorClock.IsSeeking); - AddAssert("Not seeked to object", () => EditorClock.CurrentTime == 1935); + double? initialTime = null; + + AddStep("store initial time", () => initialTime = EditorClock.CurrentTime); + AddStep("change seek setting to false", () => config.SetValue(OsuSetting.EditorSeekToHitObject, false)); + placeObject(); + AddAssert("not seeking", () => !EditorClock.IsSeeking); + AddAssert("time is unchanged", () => EditorClock.CurrentTime, () => Is.EqualTo(initialTime)); } - private void seekSetup() + private void placeObject() { - AddStep("Seek to 1935", () => EditorClock.Seek(1935)); - AddStep("Select note", () => InputManager.Key(Key.Number2)); - AddStep("Place note", () => InputManager.MoveMouseTo(this.ChildrenOfType().First(x => x.HitObject.StartTime == 2170))); - AddStep("Click", () => InputManager.Click(MouseButton.Left)); + AddStep("select note placement tool", () => InputManager.Key(Key.Number2)); + AddStep("move mouse to centre of last column", () => InputManager.MoveMouseTo(this.ChildrenOfType().Last().ScreenSpaceDrawQuad.Centre)); + AddStep("place note", () => InputManager.Click(MouseButton.Left)); } } } From 8b25598d8251b0459528ea69053b25bcb62f923b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 19 Feb 2023 13:54:48 +0100 Subject: [PATCH 09/10] Rename moved test method to describe its purpose better --- .../Editor/TestSceneObjectPlacement.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneObjectPlacement.cs b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneObjectPlacement.cs index ec2995924d..6ddcabfc4d 100644 --- a/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneObjectPlacement.cs +++ b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneObjectPlacement.cs @@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor private OsuConfigManager config { get; set; } = null!; [Test] - public void TestPlacement() + public void TestPlacementBeforeTrackStart() { AddStep("Seek to 0", () => EditorClock.Seek(0)); AddStep("Select note", () => InputManager.Key(Key.Number2)); From d9ca7102f048e1deb0ba79493866998043cde238 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 19 Feb 2023 15:06:40 +0100 Subject: [PATCH 10/10] Use more generic wording for future-proofing --- .../Editor/TestSceneObjectPlacement.cs | 4 ++-- osu.Game/Configuration/OsuConfigManager.cs | 4 ++-- osu.Game/Localisation/EditorStrings.cs | 4 ++-- osu.Game/Rulesets/Edit/HitObjectComposer.cs | 6 +++--- osu.Game/Screens/Edit/Editor.cs | 8 ++++---- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneObjectPlacement.cs b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneObjectPlacement.cs index 6ddcabfc4d..13a116b209 100644 --- a/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneObjectPlacement.cs +++ b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneObjectPlacement.cs @@ -39,7 +39,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor double? initialTime = null; AddStep("store initial time", () => initialTime = EditorClock.CurrentTime); - AddStep("change seek setting to true", () => config.SetValue(OsuSetting.EditorSeekToHitObject, true)); + AddStep("change seek setting to true", () => config.SetValue(OsuSetting.EditorAutoSeekOnPlacement, true)); placeObject(); AddUntilStep("wait for seek to complete", () => !EditorClock.IsSeeking); AddAssert("seeked forward to object", () => EditorClock.CurrentTime, () => Is.GreaterThan(initialTime)); @@ -51,7 +51,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor double? initialTime = null; AddStep("store initial time", () => initialTime = EditorClock.CurrentTime); - AddStep("change seek setting to false", () => config.SetValue(OsuSetting.EditorSeekToHitObject, false)); + AddStep("change seek setting to false", () => config.SetValue(OsuSetting.EditorAutoSeekOnPlacement, false)); placeObject(); AddAssert("not seeking", () => !EditorClock.IsSeeking); AddAssert("time is unchanged", () => EditorClock.CurrentTime, () => Is.EqualTo(initialTime)); diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 9093c017d2..70ad6bfc96 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -178,7 +178,7 @@ namespace osu.Game.Configuration SetDefault(OsuSetting.EditorDim, 0.25f, 0f, 0.75f, 0.25f); SetDefault(OsuSetting.EditorWaveformOpacity, 0.25f, 0f, 1f, 0.25f); SetDefault(OsuSetting.EditorShowHitMarkers, true); - SetDefault(OsuSetting.EditorSeekToHitObject, true); + SetDefault(OsuSetting.EditorAutoSeekOnPlacement, true); SetDefault(OsuSetting.LastProcessedMetadataId, -1); @@ -375,7 +375,7 @@ namespace osu.Game.Configuration SeasonalBackgroundMode, EditorWaveformOpacity, EditorShowHitMarkers, - EditorSeekToHitObject, + EditorAutoSeekOnPlacement, DiscordRichPresence, AutomaticallyDownloadWhenSpectating, ShowOnlineExplicitContent, diff --git a/osu.Game/Localisation/EditorStrings.cs b/osu.Game/Localisation/EditorStrings.cs index 4557cb532f..f4e23ae7cb 100644 --- a/osu.Game/Localisation/EditorStrings.cs +++ b/osu.Game/Localisation/EditorStrings.cs @@ -20,9 +20,9 @@ namespace osu.Game.Localisation public static LocalisableString ShowHitMarkers => new TranslatableString(getKey(@"show_hit_markers"), @"Show hit markers"); /// - /// "Seek to object after placement" + /// "Automatically seek after placing objects" /// - public static LocalisableString SeekToHitObject => new TranslatableString(getKey(@"seek_to_hit_object"), @"Seek to object after placement"); + public static LocalisableString AutoSeekOnPlacement => new TranslatableString(getKey(@"auto_seek_on_placement"), @"Automatically seek after placing objects"); /// /// "Timing" diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index eb10d09560..aee86fd942 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -71,7 +71,7 @@ namespace osu.Game.Rulesets.Edit private FillFlowContainer togglesCollection; private IBindable hasTiming; - private Bindable seekToHitObject; + private Bindable autoSeekOnPlacement; protected HitObjectComposer(Ruleset ruleset) : base(ruleset) @@ -84,7 +84,7 @@ namespace osu.Game.Rulesets.Edit [BackgroundDependencyLoader] private void load(OverlayColourProvider colourProvider, OsuConfigManager config) { - seekToHitObject = config.GetBindable(OsuSetting.EditorSeekToHitObject); + autoSeekOnPlacement = config.GetBindable(OsuSetting.EditorAutoSeekOnPlacement); Config = Dependencies.Get().GetConfigFor(Ruleset); @@ -369,7 +369,7 @@ namespace osu.Game.Rulesets.Edit { EditorBeatmap.Add(hitObject); - if (seekToHitObject.Value && EditorClock.CurrentTime < hitObject.StartTime) + if (autoSeekOnPlacement.Value && EditorClock.CurrentTime < hitObject.StartTime) EditorClock.SeekSmoothlyTo(hitObject.StartTime); } } diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index e9a0fbf6fa..d89392f757 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -185,7 +185,7 @@ namespace osu.Game.Screens.Edit private Bindable editorBackgroundDim; private Bindable editorHitMarkers; - private Bindable editorSeekToHitObject; + private Bindable editorAutoSeekOnPlacement; public Editor(EditorLoader loader = null) { @@ -273,7 +273,7 @@ namespace osu.Game.Screens.Edit editorBackgroundDim = config.GetBindable(OsuSetting.EditorDim); editorHitMarkers = config.GetBindable(OsuSetting.EditorShowHitMarkers); - editorSeekToHitObject = config.GetBindable(OsuSetting.EditorSeekToHitObject); + editorAutoSeekOnPlacement = config.GetBindable(OsuSetting.EditorAutoSeekOnPlacement); AddInternal(new OsuContextMenuContainer { @@ -332,9 +332,9 @@ namespace osu.Game.Screens.Edit { State = { BindTarget = editorHitMarkers }, }, - new ToggleMenuItem(EditorStrings.SeekToHitObject) + new ToggleMenuItem(EditorStrings.AutoSeekOnPlacement) { - State = { BindTarget = editorSeekToHitObject }, + State = { BindTarget = editorAutoSeekOnPlacement }, } } },