From 85396ba9d4016552504babdef678a8b7fbd65a2e Mon Sep 17 00:00:00 2001 From: OpenSauce04 Date: Mon, 9 Jan 2023 19:26:43 +0000 Subject: [PATCH 01/66] Added ruleset config stuff for Taiko; Added ruleset settings entry for Taiko touch control scheme --- .../TaikoRulesetConfigManager.cs | 28 +++++++++++++++ .../Configuration/TaikoTouchControlScheme.cs | 14 ++++++++ osu.Game.Rulesets.Taiko/TaikoRuleset.cs | 8 +++++ .../TaikoSettingsSubsection.cs | 36 +++++++++++++++++++ 4 files changed, 86 insertions(+) create mode 100644 osu.Game.Rulesets.Taiko/Configuration/TaikoRulesetConfigManager.cs create mode 100644 osu.Game.Rulesets.Taiko/Configuration/TaikoTouchControlScheme.cs create mode 100644 osu.Game.Rulesets.Taiko/TaikoSettingsSubsection.cs diff --git a/osu.Game.Rulesets.Taiko/Configuration/TaikoRulesetConfigManager.cs b/osu.Game.Rulesets.Taiko/Configuration/TaikoRulesetConfigManager.cs new file mode 100644 index 0000000000..c3bc7f6439 --- /dev/null +++ b/osu.Game.Rulesets.Taiko/Configuration/TaikoRulesetConfigManager.cs @@ -0,0 +1,28 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Game.Configuration; +using osu.Game.Rulesets.Configuration; + +namespace osu.Game.Rulesets.Taiko.Configuration +{ + public class TaikoRulesetConfigManager : RulesetConfigManager + { + public TaikoRulesetConfigManager(SettingsStore? settings, RulesetInfo ruleset, int? variant = null) + : base(settings, ruleset, variant) + { + } + + protected override void InitialiseDefaults() + { + base.InitialiseDefaults(); + + SetDefault(TaikoRulesetSetting.TouchControlScheme, TaikoTouchControlScheme.KDDK); + } + } + + public enum TaikoRulesetSetting + { + TouchControlScheme + } +} diff --git a/osu.Game.Rulesets.Taiko/Configuration/TaikoTouchControlScheme.cs b/osu.Game.Rulesets.Taiko/Configuration/TaikoTouchControlScheme.cs new file mode 100644 index 0000000000..b9aee7eff7 --- /dev/null +++ b/osu.Game.Rulesets.Taiko/Configuration/TaikoTouchControlScheme.cs @@ -0,0 +1,14 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +#nullable disable + +namespace osu.Game.Rulesets.Taiko.Configuration +{ + public enum TaikoTouchControlScheme + { + KDDK, + DDKK, + KKDD + } +} diff --git a/osu.Game.Rulesets.Taiko/TaikoRuleset.cs b/osu.Game.Rulesets.Taiko/TaikoRuleset.cs index fe12cf9765..e5a1a5d7ce 100644 --- a/osu.Game.Rulesets.Taiko/TaikoRuleset.cs +++ b/osu.Game.Rulesets.Taiko/TaikoRuleset.cs @@ -28,9 +28,13 @@ using osu.Game.Rulesets.Taiko.Skinning.Argon; using osu.Game.Rulesets.Taiko.Skinning.Legacy; using osu.Game.Rulesets.Taiko.UI; using osu.Game.Rulesets.UI; +using osu.Game.Overlays.Settings; using osu.Game.Scoring; using osu.Game.Screens.Ranking.Statistics; using osu.Game.Skinning; +using osu.Game.Rulesets.Configuration; +using osu.Game.Configuration; +using osu.Game.Rulesets.Taiko.Configuration; namespace osu.Game.Rulesets.Taiko { @@ -193,6 +197,10 @@ namespace osu.Game.Rulesets.Taiko public override IConvertibleReplayFrame CreateConvertibleReplayFrame() => new TaikoReplayFrame(); + public override IRulesetConfigManager CreateConfig(SettingsStore? settings) => new TaikoRulesetConfigManager(settings, RulesetInfo); + + public override RulesetSettingsSubsection CreateSettings() => new TaikoSettingsSubsection(this); + protected override IEnumerable GetValidHitResults() { return new[] diff --git a/osu.Game.Rulesets.Taiko/TaikoSettingsSubsection.cs b/osu.Game.Rulesets.Taiko/TaikoSettingsSubsection.cs new file mode 100644 index 0000000000..297a02df5b --- /dev/null +++ b/osu.Game.Rulesets.Taiko/TaikoSettingsSubsection.cs @@ -0,0 +1,36 @@ +// 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.Graphics; +using osu.Framework.Localisation; +using osu.Game.Overlays.Settings; +using osu.Game.Rulesets.Taiko.Configuration; + +namespace osu.Game.Rulesets.Taiko +{ + public partial class TaikoSettingsSubsection : RulesetSettingsSubsection + { + protected override LocalisableString Header => "osu!taiko"; + + public TaikoSettingsSubsection(TaikoRuleset ruleset) + : base(ruleset) + { + } + + [BackgroundDependencyLoader] + private void load() + { + var config = (TaikoRulesetConfigManager)Config; + + Children = new Drawable[] + { + new SettingsEnumDropdown + { + LabelText = "Touch Control Scheme", + Current = config.GetBindable(TaikoRulesetSetting.TouchControlScheme) + } + }; + } + } +} From 46ffded1db0b8486800b9e5baa71bf87f9c838d4 Mon Sep 17 00:00:00 2001 From: OpenSauce04 Date: Tue, 10 Jan 2023 08:27:21 +0000 Subject: [PATCH 02/66] Taiko touch control scheme setting now *almost* works (need to implement getting control scheme from config); Drum display is incorrect --- osu.Game.Rulesets.Taiko/TaikoRuleset.cs | 2 +- .../UI/DrumTouchInputArea.cs | 93 ++++++++++++++++--- 2 files changed, 82 insertions(+), 13 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/TaikoRuleset.cs b/osu.Game.Rulesets.Taiko/TaikoRuleset.cs index e5a1a5d7ce..094a84d3fa 100644 --- a/osu.Game.Rulesets.Taiko/TaikoRuleset.cs +++ b/osu.Game.Rulesets.Taiko/TaikoRuleset.cs @@ -198,7 +198,7 @@ namespace osu.Game.Rulesets.Taiko public override IConvertibleReplayFrame CreateConvertibleReplayFrame() => new TaikoReplayFrame(); public override IRulesetConfigManager CreateConfig(SettingsStore? settings) => new TaikoRulesetConfigManager(settings, RulesetInfo); - + public override RulesetSettingsSubsection CreateSettings() => new TaikoSettingsSubsection(this); protected override IEnumerable GetValidHitResults() diff --git a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs index 0232c10d65..91829fd66a 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs @@ -1,6 +1,10 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable +#pragma warning disable IDE0001 // Simplify Names + +using System; using System.Collections.Generic; using System.Diagnostics; using osu.Framework.Allocation; @@ -11,11 +15,13 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; using osu.Game.Graphics; +using osu.Game.Rulesets.Taiko.Configuration; using osuTK; using osuTK.Graphics; namespace osu.Game.Rulesets.Taiko.UI { + using TaikoInput = TaikoAction; /// /// An overlay that captures and displays osu!taiko mouse and touch input. /// @@ -27,6 +33,7 @@ namespace osu.Game.Rulesets.Taiko.UI private KeyBindingContainer keyBindingContainer = null!; + private readonly Dictionary trackedActions = new Dictionary(); private Container mainContent = null!; @@ -37,7 +44,7 @@ namespace osu.Game.Rulesets.Taiko.UI private QuarterCircle rightRim = null!; [BackgroundDependencyLoader] - private void load(TaikoInputManager taikoInputManager, OsuColour colours) + private void load(TaikoInputManager taikoInputManager, TaikoRulesetConfigManager config, OsuColour colours) { Debug.Assert(taikoInputManager.KeyBindingContainer != null); keyBindingContainer = taikoInputManager.KeyBindingContainer; @@ -47,6 +54,7 @@ namespace osu.Game.Rulesets.Taiko.UI const float centre_region = 0.80f; + var touchControlScheme = config.GetBindable(TaikoRulesetSetting.TouchControlScheme).Value; Children = new Drawable[] { new Container @@ -65,27 +73,27 @@ namespace osu.Game.Rulesets.Taiko.UI RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - leftRim = new QuarterCircle(TaikoAction.LeftRim, colours.Blue) + leftRim = new QuarterCircle(TaikoInput.LeftRim, touchControlScheme, colours) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, X = -2, }, - rightRim = new QuarterCircle(TaikoAction.RightRim, colours.Blue) + rightRim = new QuarterCircle(TaikoInput.RightRim, touchControlScheme, colours) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, X = 2, Rotation = 90, }, - leftCentre = new QuarterCircle(TaikoAction.LeftCentre, colours.Pink) + leftCentre = new QuarterCircle(TaikoInput.LeftCentre, touchControlScheme, colours) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, X = -2, Scale = new Vector2(centre_region), }, - rightCentre = new QuarterCircle(TaikoAction.RightCentre, colours.Pink) + rightCentre = new QuarterCircle(TaikoInput.RightCentre, touchControlScheme, colours) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, @@ -123,14 +131,14 @@ namespace osu.Game.Rulesets.Taiko.UI { Show(); - TaikoAction taikoAction = getTaikoActionFromInput(position); + TaikoInput taikoInput = getTaikoActionFromPosition(position); // Not too sure how this can happen, but let's avoid throwing. if (trackedActions.ContainsKey(source)) return; - trackedActions.Add(source, taikoAction); - keyBindingContainer.TriggerPressed(taikoAction); + trackedActions.Add(source, taikoInput); + keyBindingContainer.TriggerPressed(taikoInput); } private void handleUp(object source) @@ -142,15 +150,61 @@ namespace osu.Game.Rulesets.Taiko.UI private bool validMouse(MouseButtonEvent e) => leftRim.Contains(e.ScreenSpaceMouseDownPosition) || rightRim.Contains(e.ScreenSpaceMouseDownPosition); - private TaikoAction getTaikoActionFromInput(Vector2 inputPosition) +#pragma warning disable format + private TaikoAction getTaikoActionFromPosition(TaikoInput input) + { + switch (TaikoTouchControlScheme.DDKK) + { + case TaikoTouchControlScheme.KDDK: +#pragma warning disable CS0162 // Unreachable code detected + switch (input) + { + case TaikoInput.LeftRim: return TaikoAction.LeftRim; + case TaikoInput.LeftCentre: return TaikoAction.LeftCentre; + case TaikoInput.RightCentre: return TaikoAction.RightCentre; + case TaikoInput.RightRim: return TaikoAction.RightRim; + } +#pragma warning restore CS0162 // Unreachable code detected + break; + + case TaikoTouchControlScheme.DDKK: + switch (input) + { + case TaikoInput.LeftRim: return TaikoAction.LeftCentre; + case TaikoInput.LeftCentre: return TaikoAction.RightCentre; + case TaikoInput.RightCentre: return TaikoAction.LeftRim; + case TaikoInput.RightRim: return TaikoAction.RightRim; + } + break; + + case TaikoTouchControlScheme.KKDD: +#pragma warning disable CS0162 // Unreachable code detected + switch (input) + { + case TaikoInput.LeftRim: return TaikoAction.LeftRim; + case TaikoInput.LeftCentre: return TaikoAction.RightRim; + case TaikoInput.RightCentre: return TaikoAction.LeftCentre; + case TaikoInput.RightRim: return TaikoAction.RightCentre; + } +#pragma warning restore CS0162 // Unreachable code detected + break; + } + return TaikoAction.LeftCentre; + } + +#pragma warning restore format + private TaikoAction getTaikoActionFromPosition(Vector2 inputPosition) { bool centreHit = leftCentre.Contains(inputPosition) || rightCentre.Contains(inputPosition); bool leftSide = ToLocalSpace(inputPosition).X < DrawWidth / 2; + TaikoInput input; if (leftSide) - return centreHit ? TaikoAction.LeftCentre : TaikoAction.LeftRim; + input = centreHit ? TaikoInput.LeftCentre : TaikoInput.LeftRim; + else + input = centreHit ? TaikoInput.RightCentre : TaikoInput.RightRim; - return centreHit ? TaikoAction.RightCentre : TaikoAction.RightRim; + return getTaikoActionFromPosition(input); } protected override void PopIn() @@ -173,8 +227,23 @@ namespace osu.Game.Rulesets.Taiko.UI public override bool Contains(Vector2 screenSpacePos) => circle.Contains(screenSpacePos); - public QuarterCircle(TaikoAction handledAction, Color4 colour) + public QuarterCircle(TaikoAction handledAction, TaikoTouchControlScheme touchControlScheme, OsuColour colours) { + Color4 colour = ((Func)(() => + { +#pragma warning disable format + switch (handledAction) + { + case TaikoAction.LeftRim: return colours.Blue; + case TaikoAction.LeftCentre: return colours.Red; + case TaikoAction.RightCentre: return colours.Red; + case TaikoAction.RightRim: return colours.Blue; + } +#pragma warning restore format + return colours.Red; + }))(); + + this.handledAction = handledAction; RelativeSizeAxes = Axes.Both; From ee80cc988ec80a78e0303e42ccfafb9cdfa0260f Mon Sep 17 00:00:00 2001 From: OpenSauce Date: Tue, 10 Jan 2023 10:32:00 +0000 Subject: [PATCH 03/66] Fixed drums not displaying correctly; Fixed typo on a function name --- osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs index 91829fd66a..69c2942e45 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs @@ -73,27 +73,27 @@ namespace osu.Game.Rulesets.Taiko.UI RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - leftRim = new QuarterCircle(TaikoInput.LeftRim, touchControlScheme, colours) + leftRim = new QuarterCircle(getTaikoActionFromInput(TaikoInput.LeftRim), touchControlScheme, colours) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, X = -2, }, - rightRim = new QuarterCircle(TaikoInput.RightRim, touchControlScheme, colours) + rightRim = new QuarterCircle(getTaikoActionFromInput(TaikoInput.RightRim), touchControlScheme, colours) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, X = 2, Rotation = 90, }, - leftCentre = new QuarterCircle(TaikoInput.LeftCentre, touchControlScheme, colours) + leftCentre = new QuarterCircle(getTaikoActionFromInput(TaikoInput.LeftCentre), touchControlScheme, colours) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, X = -2, Scale = new Vector2(centre_region), }, - rightCentre = new QuarterCircle(TaikoInput.RightCentre, touchControlScheme, colours) + rightCentre = new QuarterCircle(getTaikoActionFromInput(TaikoInput.RightCentre), touchControlScheme, colours) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, @@ -151,7 +151,7 @@ namespace osu.Game.Rulesets.Taiko.UI leftRim.Contains(e.ScreenSpaceMouseDownPosition) || rightRim.Contains(e.ScreenSpaceMouseDownPosition); #pragma warning disable format - private TaikoAction getTaikoActionFromPosition(TaikoInput input) + private TaikoAction getTaikoActionFromInput(TaikoInput input) { switch (TaikoTouchControlScheme.DDKK) { @@ -204,7 +204,7 @@ namespace osu.Game.Rulesets.Taiko.UI else input = centreHit ? TaikoInput.RightCentre : TaikoInput.RightRim; - return getTaikoActionFromPosition(input); + return getTaikoActionFromInput(input); } protected override void PopIn() From 3785dd01368a2faefffde17f2abbfab95140c814 Mon Sep 17 00:00:00 2001 From: OpenSauce Date: Tue, 10 Jan 2023 10:59:57 +0000 Subject: [PATCH 04/66] Taiko touch control scheme is now read from settings --- .../TaikoRulesetConfigManager.cs | 2 ++ .../UI/DrumTouchInputArea.cs | 21 ++++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Configuration/TaikoRulesetConfigManager.cs b/osu.Game.Rulesets.Taiko/Configuration/TaikoRulesetConfigManager.cs index c3bc7f6439..7e2c7e89b4 100644 --- a/osu.Game.Rulesets.Taiko/Configuration/TaikoRulesetConfigManager.cs +++ b/osu.Game.Rulesets.Taiko/Configuration/TaikoRulesetConfigManager.cs @@ -1,6 +1,8 @@ // 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.Configuration.Tracking; +using System; using osu.Game.Configuration; using osu.Game.Rulesets.Configuration; diff --git a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs index 69c2942e45..aa786f2573 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs @@ -8,6 +8,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -27,6 +28,7 @@ namespace osu.Game.Rulesets.Taiko.UI /// public partial class DrumTouchInputArea : VisibilityContainer { + // visibility state affects our child. we always want to handle input. public override bool PropagatePositionalInputSubTree => true; public override bool PropagateNonPositionalInputSubTree => true; @@ -43,6 +45,8 @@ namespace osu.Game.Rulesets.Taiko.UI private QuarterCircle leftRim = null!; private QuarterCircle rightRim = null!; + private Bindable touchControlScheme = new Bindable(); + [BackgroundDependencyLoader] private void load(TaikoInputManager taikoInputManager, TaikoRulesetConfigManager config, OsuColour colours) { @@ -54,7 +58,7 @@ namespace osu.Game.Rulesets.Taiko.UI const float centre_region = 0.80f; - var touchControlScheme = config.GetBindable(TaikoRulesetSetting.TouchControlScheme).Value; + config.BindWith(TaikoRulesetSetting.TouchControlScheme, touchControlScheme); Children = new Drawable[] { new Container @@ -73,27 +77,27 @@ namespace osu.Game.Rulesets.Taiko.UI RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - leftRim = new QuarterCircle(getTaikoActionFromInput(TaikoInput.LeftRim), touchControlScheme, colours) + leftRim = new QuarterCircle(getTaikoActionFromInput(TaikoInput.LeftRim), touchControlScheme.Value, colours) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, X = -2, }, - rightRim = new QuarterCircle(getTaikoActionFromInput(TaikoInput.RightRim), touchControlScheme, colours) + rightRim = new QuarterCircle(getTaikoActionFromInput(TaikoInput.RightRim), touchControlScheme.Value, colours) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, X = 2, Rotation = 90, }, - leftCentre = new QuarterCircle(getTaikoActionFromInput(TaikoInput.LeftCentre), touchControlScheme, colours) + leftCentre = new QuarterCircle(getTaikoActionFromInput(TaikoInput.LeftCentre), touchControlScheme.Value, colours) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, X = -2, Scale = new Vector2(centre_region), }, - rightCentre = new QuarterCircle(getTaikoActionFromInput(TaikoInput.RightCentre), touchControlScheme, colours) + rightCentre = new QuarterCircle(getTaikoActionFromInput(TaikoInput.RightCentre), touchControlScheme.Value, colours) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, @@ -153,10 +157,10 @@ namespace osu.Game.Rulesets.Taiko.UI #pragma warning disable format private TaikoAction getTaikoActionFromInput(TaikoInput input) { - switch (TaikoTouchControlScheme.DDKK) + switch (touchControlScheme.Value) { case TaikoTouchControlScheme.KDDK: -#pragma warning disable CS0162 // Unreachable code detected + switch (input) { case TaikoInput.LeftRim: return TaikoAction.LeftRim; @@ -164,7 +168,6 @@ namespace osu.Game.Rulesets.Taiko.UI case TaikoInput.RightCentre: return TaikoAction.RightCentre; case TaikoInput.RightRim: return TaikoAction.RightRim; } -#pragma warning restore CS0162 // Unreachable code detected break; case TaikoTouchControlScheme.DDKK: @@ -178,7 +181,6 @@ namespace osu.Game.Rulesets.Taiko.UI break; case TaikoTouchControlScheme.KKDD: -#pragma warning disable CS0162 // Unreachable code detected switch (input) { case TaikoInput.LeftRim: return TaikoAction.LeftRim; @@ -186,7 +188,6 @@ namespace osu.Game.Rulesets.Taiko.UI case TaikoInput.RightCentre: return TaikoAction.LeftCentre; case TaikoInput.RightRim: return TaikoAction.RightCentre; } -#pragma warning restore CS0162 // Unreachable code detected break; } return TaikoAction.LeftCentre; From fd054081b8ec8aad0604c6f596c3d3479c03b207 Mon Sep 17 00:00:00 2001 From: OpenSauce Date: Tue, 10 Jan 2023 11:29:38 +0000 Subject: [PATCH 05/66] Better name for touch control scheme config bindable --- osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs index aa786f2573..17efcba1d5 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs @@ -45,7 +45,7 @@ namespace osu.Game.Rulesets.Taiko.UI private QuarterCircle leftRim = null!; private QuarterCircle rightRim = null!; - private Bindable touchControlScheme = new Bindable(); + private Bindable configTouchControlScheme = new Bindable(); [BackgroundDependencyLoader] private void load(TaikoInputManager taikoInputManager, TaikoRulesetConfigManager config, OsuColour colours) @@ -58,7 +58,7 @@ namespace osu.Game.Rulesets.Taiko.UI const float centre_region = 0.80f; - config.BindWith(TaikoRulesetSetting.TouchControlScheme, touchControlScheme); + config.BindWith(TaikoRulesetSetting.TouchControlScheme, configTouchControlScheme); Children = new Drawable[] { new Container @@ -77,27 +77,27 @@ namespace osu.Game.Rulesets.Taiko.UI RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - leftRim = new QuarterCircle(getTaikoActionFromInput(TaikoInput.LeftRim), touchControlScheme.Value, colours) + leftRim = new QuarterCircle(getTaikoActionFromInput(TaikoInput.LeftRim), configTouchControlScheme.Value, colours) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, X = -2, }, - rightRim = new QuarterCircle(getTaikoActionFromInput(TaikoInput.RightRim), touchControlScheme.Value, colours) + rightRim = new QuarterCircle(getTaikoActionFromInput(TaikoInput.RightRim), configTouchControlScheme.Value, colours) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, X = 2, Rotation = 90, }, - leftCentre = new QuarterCircle(getTaikoActionFromInput(TaikoInput.LeftCentre), touchControlScheme.Value, colours) + leftCentre = new QuarterCircle(getTaikoActionFromInput(TaikoInput.LeftCentre), configTouchControlScheme.Value, colours) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, X = -2, Scale = new Vector2(centre_region), }, - rightCentre = new QuarterCircle(getTaikoActionFromInput(TaikoInput.RightCentre), touchControlScheme.Value, colours) + rightCentre = new QuarterCircle(getTaikoActionFromInput(TaikoInput.RightCentre), configTouchControlScheme.Value, colours) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, @@ -157,7 +157,7 @@ namespace osu.Game.Rulesets.Taiko.UI #pragma warning disable format private TaikoAction getTaikoActionFromInput(TaikoInput input) { - switch (touchControlScheme.Value) + switch (configTouchControlScheme.Value) { case TaikoTouchControlScheme.KDDK: From e3d14db285995ba6f86086b82d852ee45cae9265 Mon Sep 17 00:00:00 2001 From: OpenSauce Date: Tue, 10 Jan 2023 11:38:32 +0000 Subject: [PATCH 06/66] Removed unnecessary QuarterCircle paramenters --- osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs index 17efcba1d5..0f14e5d06f 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs @@ -47,8 +47,10 @@ namespace osu.Game.Rulesets.Taiko.UI private Bindable configTouchControlScheme = new Bindable(); + private static OsuColour colours; + [BackgroundDependencyLoader] - private void load(TaikoInputManager taikoInputManager, TaikoRulesetConfigManager config, OsuColour colours) + private void load(TaikoInputManager taikoInputManager, TaikoRulesetConfigManager config, OsuColour _colours) { Debug.Assert(taikoInputManager.KeyBindingContainer != null); keyBindingContainer = taikoInputManager.KeyBindingContainer; @@ -59,6 +61,8 @@ namespace osu.Game.Rulesets.Taiko.UI const float centre_region = 0.80f; config.BindWith(TaikoRulesetSetting.TouchControlScheme, configTouchControlScheme); + colours = _colours; + Children = new Drawable[] { new Container @@ -77,27 +81,27 @@ namespace osu.Game.Rulesets.Taiko.UI RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - leftRim = new QuarterCircle(getTaikoActionFromInput(TaikoInput.LeftRim), configTouchControlScheme.Value, colours) + leftRim = new QuarterCircle(getTaikoActionFromInput(TaikoInput.LeftRim)) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, X = -2, }, - rightRim = new QuarterCircle(getTaikoActionFromInput(TaikoInput.RightRim), configTouchControlScheme.Value, colours) + rightRim = new QuarterCircle(getTaikoActionFromInput(TaikoInput.RightRim)) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, X = 2, Rotation = 90, }, - leftCentre = new QuarterCircle(getTaikoActionFromInput(TaikoInput.LeftCentre), configTouchControlScheme.Value, colours) + leftCentre = new QuarterCircle(getTaikoActionFromInput(TaikoInput.LeftCentre)) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, X = -2, Scale = new Vector2(centre_region), }, - rightCentre = new QuarterCircle(getTaikoActionFromInput(TaikoInput.RightCentre), configTouchControlScheme.Value, colours) + rightCentre = new QuarterCircle(getTaikoActionFromInput(TaikoInput.RightCentre)) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, @@ -228,7 +232,7 @@ namespace osu.Game.Rulesets.Taiko.UI public override bool Contains(Vector2 screenSpacePos) => circle.Contains(screenSpacePos); - public QuarterCircle(TaikoAction handledAction, TaikoTouchControlScheme touchControlScheme, OsuColour colours) + public QuarterCircle(TaikoAction handledAction) { Color4 colour = ((Func)(() => { From b694e0d441c440fb84100c16f1ecd19f1cc5a3ba Mon Sep 17 00:00:00 2001 From: OpenSauce Date: Tue, 10 Jan 2023 11:43:28 +0000 Subject: [PATCH 07/66] Added a comment and fixed some wonky formatting --- .../UI/DrumTouchInputArea.cs | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs index 0f14e5d06f..5a6dc70ea3 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs @@ -22,7 +22,7 @@ using osuTK.Graphics; namespace osu.Game.Rulesets.Taiko.UI { - using TaikoInput = TaikoAction; + using TaikoInput = TaikoAction; // Functionally identical to TaikoAction, it's just a readability thing /// /// An overlay that captures and displays osu!taiko mouse and touch input. /// @@ -158,7 +158,7 @@ namespace osu.Game.Rulesets.Taiko.UI private bool validMouse(MouseButtonEvent e) => leftRim.Contains(e.ScreenSpaceMouseDownPosition) || rightRim.Contains(e.ScreenSpaceMouseDownPosition); -#pragma warning disable format + #pragma warning disable format private TaikoAction getTaikoActionFromInput(TaikoInput input) { switch (configTouchControlScheme.Value) @@ -177,28 +177,28 @@ namespace osu.Game.Rulesets.Taiko.UI case TaikoTouchControlScheme.DDKK: switch (input) { - case TaikoInput.LeftRim: return TaikoAction.LeftCentre; - case TaikoInput.LeftCentre: return TaikoAction.RightCentre; + case TaikoInput.LeftRim: return TaikoAction.LeftCentre; + case TaikoInput.LeftCentre: return TaikoAction.RightCentre; case TaikoInput.RightCentre: return TaikoAction.LeftRim; - case TaikoInput.RightRim: return TaikoAction.RightRim; + case TaikoInput.RightRim: return TaikoAction.RightRim; } break; case TaikoTouchControlScheme.KKDD: switch (input) { - case TaikoInput.LeftRim: return TaikoAction.LeftRim; - case TaikoInput.LeftCentre: return TaikoAction.RightRim; + case TaikoInput.LeftRim: return TaikoAction.LeftRim; + case TaikoInput.LeftCentre: return TaikoAction.RightRim; case TaikoInput.RightCentre: return TaikoAction.LeftCentre; - case TaikoInput.RightRim: return TaikoAction.RightCentre; + case TaikoInput.RightRim: return TaikoAction.RightCentre; } break; } return TaikoAction.LeftCentre; } + #pragma warning restore format -#pragma warning restore format - private TaikoAction getTaikoActionFromPosition(Vector2 inputPosition) + private TaikoAction getTaikoActionFromPosition(Vector2 inputPosition) { bool centreHit = leftCentre.Contains(inputPosition) || rightCentre.Contains(inputPosition); bool leftSide = ToLocalSpace(inputPosition).X < DrawWidth / 2; @@ -236,15 +236,15 @@ namespace osu.Game.Rulesets.Taiko.UI { Color4 colour = ((Func)(() => { -#pragma warning disable format + #pragma warning disable format switch (handledAction) { - case TaikoAction.LeftRim: return colours.Blue; - case TaikoAction.LeftCentre: return colours.Red; + case TaikoAction.LeftRim: return colours.Blue; + case TaikoAction.LeftCentre: return colours.Red; case TaikoAction.RightCentre: return colours.Red; - case TaikoAction.RightRim: return colours.Blue; + case TaikoAction.RightRim: return colours.Blue; } -#pragma warning restore format + #pragma warning restore format return colours.Red; }))(); From 4949b44888af25e824303b297222dcf83899a793 Mon Sep 17 00:00:00 2001 From: OpenSauce Date: Tue, 10 Jan 2023 11:57:21 +0000 Subject: [PATCH 08/66] Updated touch control scheme setting capitalization to be consistent with the rest of the settings menu --- osu.Game.Rulesets.Taiko/TaikoSettingsSubsection.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Taiko/TaikoSettingsSubsection.cs b/osu.Game.Rulesets.Taiko/TaikoSettingsSubsection.cs index 297a02df5b..9fe861c08c 100644 --- a/osu.Game.Rulesets.Taiko/TaikoSettingsSubsection.cs +++ b/osu.Game.Rulesets.Taiko/TaikoSettingsSubsection.cs @@ -27,7 +27,7 @@ namespace osu.Game.Rulesets.Taiko { new SettingsEnumDropdown { - LabelText = "Touch Control Scheme", + LabelText = "Touch control scheme", Current = config.GetBindable(TaikoRulesetSetting.TouchControlScheme) } }; From a8f4f0042179cc20045b9b66f77e6583fec7a2f3 Mon Sep 17 00:00:00 2001 From: OpenSauce Date: Tue, 10 Jan 2023 12:04:06 +0000 Subject: [PATCH 09/66] Removed nullable --- .../Configuration/TaikoTouchControlScheme.cs | 2 -- osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs | 1 - 2 files changed, 3 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Configuration/TaikoTouchControlScheme.cs b/osu.Game.Rulesets.Taiko/Configuration/TaikoTouchControlScheme.cs index b9aee7eff7..74e4a53746 100644 --- a/osu.Game.Rulesets.Taiko/Configuration/TaikoTouchControlScheme.cs +++ b/osu.Game.Rulesets.Taiko/Configuration/TaikoTouchControlScheme.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - namespace osu.Game.Rulesets.Taiko.Configuration { public enum TaikoTouchControlScheme diff --git a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs index 5a6dc70ea3..02454a5355 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable #pragma warning disable IDE0001 // Simplify Names using System; From 906ea80d52ca03d93feb05de12751a49200fa21e Mon Sep 17 00:00:00 2001 From: OpenSauce Date: Tue, 10 Jan 2023 12:11:33 +0000 Subject: [PATCH 10/66] Further improved method of getting OsuColour --- osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs index 02454a5355..523c28f8cb 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs @@ -46,8 +46,6 @@ namespace osu.Game.Rulesets.Taiko.UI private Bindable configTouchControlScheme = new Bindable(); - private static OsuColour colours; - [BackgroundDependencyLoader] private void load(TaikoInputManager taikoInputManager, TaikoRulesetConfigManager config, OsuColour _colours) { @@ -60,7 +58,6 @@ namespace osu.Game.Rulesets.Taiko.UI const float centre_region = 0.80f; config.BindWith(TaikoRulesetSetting.TouchControlScheme, configTouchControlScheme); - colours = _colours; Children = new Drawable[] { @@ -231,6 +228,9 @@ namespace osu.Game.Rulesets.Taiko.UI public override bool Contains(Vector2 screenSpacePos) => circle.Contains(screenSpacePos); + [Resolved] + private OsuColour colours { get; set; } = null!; + public QuarterCircle(TaikoAction handledAction) { Color4 colour = ((Func)(() => From ffd6168a618243faa33b27558adc17b312b995bf Mon Sep 17 00:00:00 2001 From: OpenSauce Date: Tue, 10 Jan 2023 12:13:51 +0000 Subject: [PATCH 11/66] Removed unnecessary newlines --- osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs index 523c28f8cb..29f64dab93 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs @@ -27,14 +27,12 @@ namespace osu.Game.Rulesets.Taiko.UI /// public partial class DrumTouchInputArea : VisibilityContainer { - // visibility state affects our child. we always want to handle input. public override bool PropagatePositionalInputSubTree => true; public override bool PropagateNonPositionalInputSubTree => true; private KeyBindingContainer keyBindingContainer = null!; - private readonly Dictionary trackedActions = new Dictionary(); private Container mainContent = null!; @@ -247,7 +245,6 @@ namespace osu.Game.Rulesets.Taiko.UI return colours.Red; }))(); - this.handledAction = handledAction; RelativeSizeAxes = Axes.Both; From bf555e4579ca2c05a14ed8fac5593ce2efbdd645 Mon Sep 17 00:00:00 2001 From: OpenSauce Date: Tue, 10 Jan 2023 12:44:27 +0000 Subject: [PATCH 12/66] Removed unnecessary directives that were added automatically and I forgot to remove --- .../Configuration/TaikoRulesetConfigManager.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Configuration/TaikoRulesetConfigManager.cs b/osu.Game.Rulesets.Taiko/Configuration/TaikoRulesetConfigManager.cs index 7e2c7e89b4..c3bc7f6439 100644 --- a/osu.Game.Rulesets.Taiko/Configuration/TaikoRulesetConfigManager.cs +++ b/osu.Game.Rulesets.Taiko/Configuration/TaikoRulesetConfigManager.cs @@ -1,8 +1,6 @@ // 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.Configuration.Tracking; -using System; using osu.Game.Configuration; using osu.Game.Rulesets.Configuration; From b3e620c8e57720b6caaa9ca50e912909b3fff429 Mon Sep 17 00:00:00 2001 From: OpenSauce Date: Tue, 10 Jan 2023 13:07:07 +0000 Subject: [PATCH 13/66] Removed unnecessary parameter --- osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs index 29f64dab93..cdd9024e9d 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs @@ -45,7 +45,7 @@ namespace osu.Game.Rulesets.Taiko.UI private Bindable configTouchControlScheme = new Bindable(); [BackgroundDependencyLoader] - private void load(TaikoInputManager taikoInputManager, TaikoRulesetConfigManager config, OsuColour _colours) + private void load(TaikoInputManager taikoInputManager, TaikoRulesetConfigManager config) { Debug.Assert(taikoInputManager.KeyBindingContainer != null); keyBindingContainer = taikoInputManager.KeyBindingContainer; From 362c9050df9b3ad1e889628db439203ab4b7e1c3 Mon Sep 17 00:00:00 2001 From: OpenSauce04 Date: Tue, 10 Jan 2023 15:08:18 +0000 Subject: [PATCH 14/66] Fixed OsuColour shenanigans --- .../UI/DrumTouchInputArea.cs | 43 +++++++++---------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs index cdd9024e9d..50c7a7f69b 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs @@ -3,7 +3,6 @@ #pragma warning disable IDE0001 // Simplify Names -using System; using System.Collections.Generic; using System.Diagnostics; using osu.Framework.Allocation; @@ -44,6 +43,9 @@ namespace osu.Game.Rulesets.Taiko.UI private Bindable configTouchControlScheme = new Bindable(); + [Resolved] + private OsuColour colours { get; set; } = null!; + [BackgroundDependencyLoader] private void load(TaikoInputManager taikoInputManager, TaikoRulesetConfigManager config) { @@ -75,27 +77,27 @@ namespace osu.Game.Rulesets.Taiko.UI RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - leftRim = new QuarterCircle(getTaikoActionFromInput(TaikoInput.LeftRim)) + leftRim = new QuarterCircle(getTaikoActionFromInput(TaikoInput.LeftRim), getColourFromTaikoAction(getTaikoActionFromInput(TaikoInput.LeftRim))) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, X = -2, }, - rightRim = new QuarterCircle(getTaikoActionFromInput(TaikoInput.RightRim)) + rightRim = new QuarterCircle(getTaikoActionFromInput(TaikoInput.RightRim), getColourFromTaikoAction(getTaikoActionFromInput(TaikoInput.RightRim))) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, X = 2, Rotation = 90, }, - leftCentre = new QuarterCircle(getTaikoActionFromInput(TaikoInput.LeftCentre)) + leftCentre = new QuarterCircle(getTaikoActionFromInput(TaikoInput.LeftCentre), getColourFromTaikoAction(getTaikoActionFromInput(TaikoInput.LeftCentre))) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, X = -2, Scale = new Vector2(centre_region), }, - rightCentre = new QuarterCircle(getTaikoActionFromInput(TaikoInput.RightCentre)) + rightCentre = new QuarterCircle(getTaikoActionFromInput(TaikoInput.RightCentre), getColourFromTaikoAction(getTaikoActionFromInput(TaikoInput.RightCentre))) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, @@ -216,6 +218,19 @@ namespace osu.Game.Rulesets.Taiko.UI mainContent.FadeOut(300); } + private Color4 getColourFromTaikoAction(TaikoAction handledAction) + { + #pragma warning disable format + switch (handledAction) + { + case TaikoAction.LeftRim: return colours.Blue; + case TaikoAction.LeftCentre: return colours.Red; + case TaikoAction.RightCentre: return colours.Red; + case TaikoAction.RightRim: return colours.Blue; + } + #pragma warning restore format + return colours.Red; + } private partial class QuarterCircle : CompositeDrawable, IKeyBindingHandler { private readonly Circle overlay; @@ -226,24 +241,8 @@ namespace osu.Game.Rulesets.Taiko.UI public override bool Contains(Vector2 screenSpacePos) => circle.Contains(screenSpacePos); - [Resolved] - private OsuColour colours { get; set; } = null!; - - public QuarterCircle(TaikoAction handledAction) + public QuarterCircle(TaikoAction handledAction, Color4 colour) { - Color4 colour = ((Func)(() => - { - #pragma warning disable format - switch (handledAction) - { - case TaikoAction.LeftRim: return colours.Blue; - case TaikoAction.LeftCentre: return colours.Red; - case TaikoAction.RightCentre: return colours.Red; - case TaikoAction.RightRim: return colours.Blue; - } - #pragma warning restore format - return colours.Red; - }))(); this.handledAction = handledAction; RelativeSizeAxes = Axes.Both; From 21b617062ac8b027320f23c658ee103004da8315 Mon Sep 17 00:00:00 2001 From: OpenSauce04 Date: Tue, 10 Jan 2023 16:24:02 +0000 Subject: [PATCH 15/66] Removed an unnecessary newline --- osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs index 50c7a7f69b..d92f99fc0b 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs @@ -243,7 +243,6 @@ namespace osu.Game.Rulesets.Taiko.UI public QuarterCircle(TaikoAction handledAction, Color4 colour) { - this.handledAction = handledAction; RelativeSizeAxes = Axes.Both; From 18e114904a6f24f14e5651b7ac764a3edefca987 Mon Sep 17 00:00:00 2001 From: OpenSauce <48618519+OpenSauce04@users.noreply.github.com> Date: Tue, 10 Jan 2023 19:13:10 +0000 Subject: [PATCH 16/66] configTouchControlScheme is now read only Co-authored-by: Stedoss <29103029+Stedoss@users.noreply.github.com> --- osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs index d92f99fc0b..76566b2ada 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs @@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Taiko.UI private QuarterCircle leftRim = null!; private QuarterCircle rightRim = null!; - private Bindable configTouchControlScheme = new Bindable(); + private readonly Bindable configTouchControlScheme = new Bindable(); [Resolved] private OsuColour colours { get; set; } = null!; From 7cb5ca905a4b1e976fcc9833e8106d99142e77a4 Mon Sep 17 00:00:00 2001 From: OpenSauce <48618519+OpenSauce04@users.noreply.github.com> Date: Tue, 10 Jan 2023 19:17:33 +0000 Subject: [PATCH 17/66] Simplified getColourFromTaikoAction switch case Co-authored-by: Stedoss <29103029+Stedoss@users.noreply.github.com> --- osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs index 76566b2ada..3a921267e2 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs @@ -223,10 +223,12 @@ namespace osu.Game.Rulesets.Taiko.UI #pragma warning disable format switch (handledAction) { - case TaikoAction.LeftRim: return colours.Blue; - case TaikoAction.LeftCentre: return colours.Red; - case TaikoAction.RightCentre: return colours.Red; - case TaikoAction.RightRim: return colours.Blue; + case TaikoAction.LeftRim: + case TaikoAction.RightRim: + return colours.Blue; + case TaikoAction.LeftCentre: + case TaikoAction.RightCentre: + return colours.Red; } #pragma warning restore format return colours.Red; From edd2084a0e6bb4b45041dcd3e2b965dd84080661 Mon Sep 17 00:00:00 2001 From: OpenSauce04 Date: Tue, 10 Jan 2023 19:21:04 +0000 Subject: [PATCH 18/66] Replaced all instances of TaikoInput with TaikoAction --- .../UI/DrumTouchInputArea.cs | 47 +++++++++---------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs index d92f99fc0b..87804a9389 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs @@ -20,7 +20,6 @@ using osuTK.Graphics; namespace osu.Game.Rulesets.Taiko.UI { - using TaikoInput = TaikoAction; // Functionally identical to TaikoAction, it's just a readability thing /// /// An overlay that captures and displays osu!taiko mouse and touch input. /// @@ -77,27 +76,27 @@ namespace osu.Game.Rulesets.Taiko.UI RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - leftRim = new QuarterCircle(getTaikoActionFromInput(TaikoInput.LeftRim), getColourFromTaikoAction(getTaikoActionFromInput(TaikoInput.LeftRim))) + leftRim = new QuarterCircle(getTaikoActionFromInput(TaikoAction.LeftRim), getColourFromTaikoAction(getTaikoActionFromInput(TaikoAction.LeftRim))) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, X = -2, }, - rightRim = new QuarterCircle(getTaikoActionFromInput(TaikoInput.RightRim), getColourFromTaikoAction(getTaikoActionFromInput(TaikoInput.RightRim))) + rightRim = new QuarterCircle(getTaikoActionFromInput(TaikoAction.RightRim), getColourFromTaikoAction(getTaikoActionFromInput(TaikoAction.RightRim))) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, X = 2, Rotation = 90, }, - leftCentre = new QuarterCircle(getTaikoActionFromInput(TaikoInput.LeftCentre), getColourFromTaikoAction(getTaikoActionFromInput(TaikoInput.LeftCentre))) + leftCentre = new QuarterCircle(getTaikoActionFromInput(TaikoAction.LeftCentre), getColourFromTaikoAction(getTaikoActionFromInput(TaikoAction.LeftCentre))) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, X = -2, Scale = new Vector2(centre_region), }, - rightCentre = new QuarterCircle(getTaikoActionFromInput(TaikoInput.RightCentre), getColourFromTaikoAction(getTaikoActionFromInput(TaikoInput.RightCentre))) + rightCentre = new QuarterCircle(getTaikoActionFromInput(TaikoAction.RightCentre), getColourFromTaikoAction(getTaikoActionFromInput(TaikoAction.RightCentre))) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, @@ -135,14 +134,14 @@ namespace osu.Game.Rulesets.Taiko.UI { Show(); - TaikoInput taikoInput = getTaikoActionFromPosition(position); + TaikoAction TaikoAction = getTaikoActionFromPosition(position); // Not too sure how this can happen, but let's avoid throwing. if (trackedActions.ContainsKey(source)) return; - trackedActions.Add(source, taikoInput); - keyBindingContainer.TriggerPressed(taikoInput); + trackedActions.Add(source, TaikoAction); + keyBindingContainer.TriggerPressed(TaikoAction); } private void handleUp(object source) @@ -155,7 +154,7 @@ namespace osu.Game.Rulesets.Taiko.UI leftRim.Contains(e.ScreenSpaceMouseDownPosition) || rightRim.Contains(e.ScreenSpaceMouseDownPosition); #pragma warning disable format - private TaikoAction getTaikoActionFromInput(TaikoInput input) + private TaikoAction getTaikoActionFromInput(TaikoAction input) { switch (configTouchControlScheme.Value) { @@ -163,30 +162,30 @@ namespace osu.Game.Rulesets.Taiko.UI switch (input) { - case TaikoInput.LeftRim: return TaikoAction.LeftRim; - case TaikoInput.LeftCentre: return TaikoAction.LeftCentre; - case TaikoInput.RightCentre: return TaikoAction.RightCentre; - case TaikoInput.RightRim: return TaikoAction.RightRim; + case TaikoAction.LeftRim: return TaikoAction.LeftRim; + case TaikoAction.LeftCentre: return TaikoAction.LeftCentre; + case TaikoAction.RightCentre: return TaikoAction.RightCentre; + case TaikoAction.RightRim: return TaikoAction.RightRim; } break; case TaikoTouchControlScheme.DDKK: switch (input) { - case TaikoInput.LeftRim: return TaikoAction.LeftCentre; - case TaikoInput.LeftCentre: return TaikoAction.RightCentre; - case TaikoInput.RightCentre: return TaikoAction.LeftRim; - case TaikoInput.RightRim: return TaikoAction.RightRim; + case TaikoAction.LeftRim: return TaikoAction.LeftCentre; + case TaikoAction.LeftCentre: return TaikoAction.RightCentre; + case TaikoAction.RightCentre: return TaikoAction.LeftRim; + case TaikoAction.RightRim: return TaikoAction.RightRim; } break; case TaikoTouchControlScheme.KKDD: switch (input) { - case TaikoInput.LeftRim: return TaikoAction.LeftRim; - case TaikoInput.LeftCentre: return TaikoAction.RightRim; - case TaikoInput.RightCentre: return TaikoAction.LeftCentre; - case TaikoInput.RightRim: return TaikoAction.RightCentre; + case TaikoAction.LeftRim: return TaikoAction.LeftRim; + case TaikoAction.LeftCentre: return TaikoAction.RightRim; + case TaikoAction.RightCentre: return TaikoAction.LeftCentre; + case TaikoAction.RightRim: return TaikoAction.RightCentre; } break; } @@ -198,12 +197,12 @@ namespace osu.Game.Rulesets.Taiko.UI { bool centreHit = leftCentre.Contains(inputPosition) || rightCentre.Contains(inputPosition); bool leftSide = ToLocalSpace(inputPosition).X < DrawWidth / 2; - TaikoInput input; + TaikoAction input; if (leftSide) - input = centreHit ? TaikoInput.LeftCentre : TaikoInput.LeftRim; + input = centreHit ? TaikoAction.LeftCentre : TaikoAction.LeftRim; else - input = centreHit ? TaikoInput.RightCentre : TaikoInput.RightRim; + input = centreHit ? TaikoAction.RightCentre : TaikoAction.RightRim; return getTaikoActionFromInput(input); } From 2800eeac560f8a498e480c3cb21982798b4ee605 Mon Sep 17 00:00:00 2001 From: OpenSauce04 Date: Tue, 10 Jan 2023 19:23:49 +0000 Subject: [PATCH 19/66] Simplified formatting; Removed warning suppressors --- .../UI/DrumTouchInputArea.cs | 24 +++++++------------ 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs index c1e98b7102..25ea930fe3 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#pragma warning disable IDE0001 // Simplify Names - using System.Collections.Generic; using System.Diagnostics; using osu.Framework.Allocation; @@ -153,7 +151,6 @@ namespace osu.Game.Rulesets.Taiko.UI private bool validMouse(MouseButtonEvent e) => leftRim.Contains(e.ScreenSpaceMouseDownPosition) || rightRim.Contains(e.ScreenSpaceMouseDownPosition); - #pragma warning disable format private TaikoAction getTaikoActionFromInput(TaikoAction input) { switch (configTouchControlScheme.Value) @@ -162,36 +159,35 @@ namespace osu.Game.Rulesets.Taiko.UI switch (input) { - case TaikoAction.LeftRim: return TaikoAction.LeftRim; - case TaikoAction.LeftCentre: return TaikoAction.LeftCentre; + case TaikoAction.LeftRim: return TaikoAction.LeftRim; + case TaikoAction.LeftCentre: return TaikoAction.LeftCentre; case TaikoAction.RightCentre: return TaikoAction.RightCentre; - case TaikoAction.RightRim: return TaikoAction.RightRim; + case TaikoAction.RightRim: return TaikoAction.RightRim; } break; case TaikoTouchControlScheme.DDKK: switch (input) { - case TaikoAction.LeftRim: return TaikoAction.LeftCentre; - case TaikoAction.LeftCentre: return TaikoAction.RightCentre; + case TaikoAction.LeftRim: return TaikoAction.LeftCentre; + case TaikoAction.LeftCentre: return TaikoAction.RightCentre; case TaikoAction.RightCentre: return TaikoAction.LeftRim; - case TaikoAction.RightRim: return TaikoAction.RightRim; + case TaikoAction.RightRim: return TaikoAction.RightRim; } break; case TaikoTouchControlScheme.KKDD: switch (input) { - case TaikoAction.LeftRim: return TaikoAction.LeftRim; - case TaikoAction.LeftCentre: return TaikoAction.RightRim; + case TaikoAction.LeftRim: return TaikoAction.LeftRim; + case TaikoAction.LeftCentre: return TaikoAction.RightRim; case TaikoAction.RightCentre: return TaikoAction.LeftCentre; - case TaikoAction.RightRim: return TaikoAction.RightCentre; + case TaikoAction.RightRim: return TaikoAction.RightCentre; } break; } return TaikoAction.LeftCentre; } - #pragma warning restore format private TaikoAction getTaikoActionFromPosition(Vector2 inputPosition) { @@ -219,7 +215,6 @@ namespace osu.Game.Rulesets.Taiko.UI private Color4 getColourFromTaikoAction(TaikoAction handledAction) { - #pragma warning disable format switch (handledAction) { case TaikoAction.LeftRim: @@ -229,7 +224,6 @@ namespace osu.Game.Rulesets.Taiko.UI case TaikoAction.RightCentre: return colours.Red; } - #pragma warning restore format return colours.Red; } private partial class QuarterCircle : CompositeDrawable, IKeyBindingHandler From 2b58862567e37ecd81fac5625f70155b74c2d902 Mon Sep 17 00:00:00 2001 From: OpenSauce04 Date: Tue, 10 Jan 2023 19:31:31 +0000 Subject: [PATCH 20/66] Added ArgumentOutOfRangeException throws --- osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs index 25ea930fe3..b39025e6dc 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using System.Collections.Generic; using System.Diagnostics; using osu.Framework.Allocation; @@ -186,7 +187,7 @@ namespace osu.Game.Rulesets.Taiko.UI } break; } - return TaikoAction.LeftCentre; + throw new ArgumentOutOfRangeException(); } private TaikoAction getTaikoActionFromPosition(Vector2 inputPosition) @@ -224,7 +225,7 @@ namespace osu.Game.Rulesets.Taiko.UI case TaikoAction.RightCentre: return colours.Red; } - return colours.Red; + throw new ArgumentOutOfRangeException(); } private partial class QuarterCircle : CompositeDrawable, IKeyBindingHandler { From 57467e7b3905ed6008dba82d6429050b29485ed3 Mon Sep 17 00:00:00 2001 From: OpenSauce04 Date: Tue, 10 Jan 2023 20:04:57 +0000 Subject: [PATCH 21/66] Touchscreen drum now uses a 2d array rather than nested switches to get TaikoActions for control scheme --- .../UI/DrumTouchInputArea.cs | 94 ++++++++----------- 1 file changed, 41 insertions(+), 53 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs index b39025e6dc..8dad25c8e4 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs @@ -75,34 +75,34 @@ namespace osu.Game.Rulesets.Taiko.UI RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - leftRim = new QuarterCircle(getTaikoActionFromInput(TaikoAction.LeftRim), getColourFromTaikoAction(getTaikoActionFromInput(TaikoAction.LeftRim))) + leftRim = new QuarterCircle(getTaikoActionFromDrumSegment(0), getColourFromTaikoAction(getTaikoActionFromDrumSegment(0))) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, X = -2, }, - rightRim = new QuarterCircle(getTaikoActionFromInput(TaikoAction.RightRim), getColourFromTaikoAction(getTaikoActionFromInput(TaikoAction.RightRim))) - { - Anchor = Anchor.BottomCentre, - Origin = Anchor.BottomRight, - X = 2, - Rotation = 90, - }, - leftCentre = new QuarterCircle(getTaikoActionFromInput(TaikoAction.LeftCentre), getColourFromTaikoAction(getTaikoActionFromInput(TaikoAction.LeftCentre))) + leftCentre = new QuarterCircle(getTaikoActionFromDrumSegment(1), getColourFromTaikoAction(getTaikoActionFromDrumSegment(1))) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, X = -2, Scale = new Vector2(centre_region), }, - rightCentre = new QuarterCircle(getTaikoActionFromInput(TaikoAction.RightCentre), getColourFromTaikoAction(getTaikoActionFromInput(TaikoAction.RightCentre))) + rightCentre = new QuarterCircle(getTaikoActionFromDrumSegment(2), getColourFromTaikoAction(getTaikoActionFromDrumSegment(2))) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, X = 2, Scale = new Vector2(centre_region), Rotation = 90, - } + }, + rightRim = new QuarterCircle(getTaikoActionFromDrumSegment(3), getColourFromTaikoAction(getTaikoActionFromDrumSegment(3))) + { + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomRight, + X = 2, + Rotation = 90, + }, } }, } @@ -110,6 +110,32 @@ namespace osu.Game.Rulesets.Taiko.UI }; } + private readonly TaikoAction[,] mappedTaikoAction = { + { // KDDK + TaikoAction.LeftRim, + TaikoAction.LeftCentre, + TaikoAction.RightCentre, + TaikoAction.RightRim + }, + { // DDKK + TaikoAction.LeftCentre, + TaikoAction.RightCentre, + TaikoAction.LeftRim, + TaikoAction.RightRim + }, + { // KKDD + TaikoAction.LeftRim, + TaikoAction.RightRim, + TaikoAction.LeftCentre, + TaikoAction.RightCentre + } + }; + + private TaikoAction getTaikoActionFromDrumSegment(int drumSegment) + { + return mappedTaikoAction[(int)configTouchControlScheme.Value, drumSegment]; + } + protected override bool OnKeyDown(KeyDownEvent e) { // Hide whenever the keyboard is used. @@ -152,56 +178,18 @@ namespace osu.Game.Rulesets.Taiko.UI private bool validMouse(MouseButtonEvent e) => leftRim.Contains(e.ScreenSpaceMouseDownPosition) || rightRim.Contains(e.ScreenSpaceMouseDownPosition); - private TaikoAction getTaikoActionFromInput(TaikoAction input) - { - switch (configTouchControlScheme.Value) - { - case TaikoTouchControlScheme.KDDK: - - switch (input) - { - case TaikoAction.LeftRim: return TaikoAction.LeftRim; - case TaikoAction.LeftCentre: return TaikoAction.LeftCentre; - case TaikoAction.RightCentre: return TaikoAction.RightCentre; - case TaikoAction.RightRim: return TaikoAction.RightRim; - } - break; - - case TaikoTouchControlScheme.DDKK: - switch (input) - { - case TaikoAction.LeftRim: return TaikoAction.LeftCentre; - case TaikoAction.LeftCentre: return TaikoAction.RightCentre; - case TaikoAction.RightCentre: return TaikoAction.LeftRim; - case TaikoAction.RightRim: return TaikoAction.RightRim; - } - break; - - case TaikoTouchControlScheme.KKDD: - switch (input) - { - case TaikoAction.LeftRim: return TaikoAction.LeftRim; - case TaikoAction.LeftCentre: return TaikoAction.RightRim; - case TaikoAction.RightCentre: return TaikoAction.LeftCentre; - case TaikoAction.RightRim: return TaikoAction.RightCentre; - } - break; - } - throw new ArgumentOutOfRangeException(); - } - private TaikoAction getTaikoActionFromPosition(Vector2 inputPosition) { bool centreHit = leftCentre.Contains(inputPosition) || rightCentre.Contains(inputPosition); bool leftSide = ToLocalSpace(inputPosition).X < DrawWidth / 2; - TaikoAction input; + int drumSegment; if (leftSide) - input = centreHit ? TaikoAction.LeftCentre : TaikoAction.LeftRim; + drumSegment = centreHit ? 1 : 0; else - input = centreHit ? TaikoAction.RightCentre : TaikoAction.RightRim; + drumSegment = centreHit ? 2 : 3; - return getTaikoActionFromInput(input); + return getTaikoActionFromDrumSegment(drumSegment); } protected override void PopIn() From ce37760b276b9c95d6215eca9ad1aafcae06f047 Mon Sep 17 00:00:00 2001 From: OpenSauce04 Date: Tue, 10 Jan 2023 20:05:41 +0000 Subject: [PATCH 22/66] Removed unnecessary coma --- osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs index 8dad25c8e4..31654ac17d 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs @@ -102,7 +102,7 @@ namespace osu.Game.Rulesets.Taiko.UI Origin = Anchor.BottomRight, X = 2, Rotation = 90, - }, + } } }, } From 944c6759d912934d7ce1fc99ab045e4ddd884e00 Mon Sep 17 00:00:00 2001 From: OpenSauce <48618519+OpenSauce04@users.noreply.github.com> Date: Tue, 10 Jan 2023 23:13:22 +0000 Subject: [PATCH 23/66] Fixed right rim being incorrectly layered above right centre --- osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs index 31654ac17d..b7a0d46d51 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs @@ -88,6 +88,13 @@ namespace osu.Game.Rulesets.Taiko.UI X = -2, Scale = new Vector2(centre_region), }, + rightRim = new QuarterCircle(getTaikoActionFromDrumSegment(3), getColourFromTaikoAction(getTaikoActionFromDrumSegment(3))) + { + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomRight, + X = 2, + Rotation = 90, + }, rightCentre = new QuarterCircle(getTaikoActionFromDrumSegment(2), getColourFromTaikoAction(getTaikoActionFromDrumSegment(2))) { Anchor = Anchor.BottomCentre, @@ -95,13 +102,6 @@ namespace osu.Game.Rulesets.Taiko.UI X = 2, Scale = new Vector2(centre_region), Rotation = 90, - }, - rightRim = new QuarterCircle(getTaikoActionFromDrumSegment(3), getColourFromTaikoAction(getTaikoActionFromDrumSegment(3))) - { - Anchor = Anchor.BottomCentre, - Origin = Anchor.BottomRight, - X = 2, - Rotation = 90, } } }, From d2247f704d2db5ca09cdffb9fe1103fa0f080aa5 Mon Sep 17 00:00:00 2001 From: OpenSauce Date: Wed, 11 Jan 2023 11:26:26 +0000 Subject: [PATCH 24/66] Fixed DrumTouchInputArea test crashing --- osu.Game.Rulesets.Taiko.Tests/TestSceneDrumTouchInputArea.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game.Rulesets.Taiko.Tests/TestSceneDrumTouchInputArea.cs b/osu.Game.Rulesets.Taiko.Tests/TestSceneDrumTouchInputArea.cs index 6514b760bb..ee780204a2 100644 --- a/osu.Game.Rulesets.Taiko.Tests/TestSceneDrumTouchInputArea.cs +++ b/osu.Game.Rulesets.Taiko.Tests/TestSceneDrumTouchInputArea.cs @@ -45,5 +45,7 @@ namespace osu.Game.Rulesets.Taiko.Tests { AddStep("show drum", () => drumTouchInputArea.Show()); } + + protected override Ruleset CreateRuleset() => new TaikoRuleset(); } } From 32d1d5a34a874e9c868bcf414ae1478c9e6b58bc Mon Sep 17 00:00:00 2001 From: OpenSauce Date: Wed, 11 Jan 2023 12:04:52 +0000 Subject: [PATCH 25/66] Added tests for new Taiko touch control schemes --- .../TestSceneDrumTouchInputArea.cs | 44 ++++++++++--------- .../UI/DrumTouchInputArea.cs | 6 ++- 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/osu.Game.Rulesets.Taiko.Tests/TestSceneDrumTouchInputArea.cs b/osu.Game.Rulesets.Taiko.Tests/TestSceneDrumTouchInputArea.cs index ee780204a2..6b02b0078a 100644 --- a/osu.Game.Rulesets.Taiko.Tests/TestSceneDrumTouchInputArea.cs +++ b/osu.Game.Rulesets.Taiko.Tests/TestSceneDrumTouchInputArea.cs @@ -3,7 +3,7 @@ using NUnit.Framework; using osu.Framework.Graphics; -using osu.Framework.Testing; +using osu.Game.Rulesets.Taiko.Configuration; using osu.Game.Rulesets.Taiko.UI; using osu.Game.Tests.Visual; @@ -14,35 +14,37 @@ namespace osu.Game.Rulesets.Taiko.Tests { private DrumTouchInputArea drumTouchInputArea = null!; - [SetUpSteps] - public void SetUpSteps() + private void createDrum(TaikoTouchControlScheme _forcedControlScheme) { - AddStep("create drum", () => + Child = new TaikoInputManager(new TaikoRuleset().RulesetInfo) { - Child = new TaikoInputManager(new TaikoRuleset().RulesetInfo) - { - RelativeSizeAxes = Axes.Both, - Children = new Drawable[] + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + new InputDrum { - new InputDrum - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - Height = 0.2f, - }, - drumTouchInputArea = new DrumTouchInputArea - { - Anchor = Anchor.BottomCentre, - Origin = Anchor.BottomCentre, - }, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Height = 0.2f, }, - }; - }); + drumTouchInputArea = new DrumTouchInputArea + { + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + ForceControlScheme = _forcedControlScheme + } + } + }; } [Test] public void TestDrum() { + AddStep("create drum (kddk)", () => createDrum(TaikoTouchControlScheme.KDDK)); + AddStep("show drum", () => drumTouchInputArea.Show()); + AddStep("create drum (ddkk)", () => createDrum(TaikoTouchControlScheme.DDKK)); + AddStep("show drum", () => drumTouchInputArea.Show()); + AddStep("create drum (kkdd)", () => createDrum(TaikoTouchControlScheme.KKDD)); AddStep("show drum", () => drumTouchInputArea.Show()); } diff --git a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs index b7a0d46d51..8208aaba39 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs @@ -24,6 +24,7 @@ namespace osu.Game.Rulesets.Taiko.UI /// public partial class DrumTouchInputArea : VisibilityContainer { + public TaikoTouchControlScheme? ForceControlScheme { get; set; } // visibility state affects our child. we always want to handle input. public override bool PropagatePositionalInputSubTree => true; public override bool PropagateNonPositionalInputSubTree => true; @@ -55,7 +56,10 @@ namespace osu.Game.Rulesets.Taiko.UI const float centre_region = 0.80f; - config.BindWith(TaikoRulesetSetting.TouchControlScheme, configTouchControlScheme); + if (ForceControlScheme == null) + config.BindWith(TaikoRulesetSetting.TouchControlScheme, configTouchControlScheme); + else + configTouchControlScheme.Value = (TaikoTouchControlScheme)ForceControlScheme; Children = new Drawable[] { From a0ff03def3b5ab3defc691b3715c931e5cf9c099 Mon Sep 17 00:00:00 2001 From: OpenSauce04 Date: Wed, 11 Jan 2023 20:06:43 +0000 Subject: [PATCH 26/66] Fixed some formatting --- osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs index 8208aaba39..681ddb65ad 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs @@ -114,20 +114,24 @@ namespace osu.Game.Rulesets.Taiko.UI }; } - private readonly TaikoAction[,] mappedTaikoAction = { - { // KDDK + private readonly TaikoAction[,] mappedTaikoAction = + { + { + // KDDK TaikoAction.LeftRim, TaikoAction.LeftCentre, TaikoAction.RightCentre, TaikoAction.RightRim }, - { // DDKK + { + // DDKK TaikoAction.LeftCentre, TaikoAction.RightCentre, TaikoAction.LeftRim, TaikoAction.RightRim }, - { // KKDD + { + // KKDD TaikoAction.LeftRim, TaikoAction.RightRim, TaikoAction.LeftCentre, From 026a223129658b44528ea5dffad105b0699f80ea Mon Sep 17 00:00:00 2001 From: OpenSauce <48618519+OpenSauce04@users.noreply.github.com> Date: Wed, 11 Jan 2023 20:39:45 +0000 Subject: [PATCH 27/66] Cleaner way of getting ForceControlScheme value Co-authored-by: Susko3 --- osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs index 681ddb65ad..a8bad36381 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs @@ -59,7 +59,7 @@ namespace osu.Game.Rulesets.Taiko.UI if (ForceControlScheme == null) config.BindWith(TaikoRulesetSetting.TouchControlScheme, configTouchControlScheme); else - configTouchControlScheme.Value = (TaikoTouchControlScheme)ForceControlScheme; + configTouchControlScheme.Value = ForceControlScheme.Value; Children = new Drawable[] { From 985b126cba7568018769942fb1bf0cdf10d37036 Mon Sep 17 00:00:00 2001 From: OpenSauce04 Date: Thu, 12 Jan 2023 16:06:03 +0000 Subject: [PATCH 28/66] getTaikoActionFromDrumSegment and getColorFromTaikoAction are now run from within QuarterCircle constructor --- .../UI/DrumTouchInputArea.cs | 63 +++++++++++-------- 1 file changed, 38 insertions(+), 25 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs index a8bad36381..99a21e231d 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs @@ -40,7 +40,7 @@ namespace osu.Game.Rulesets.Taiko.UI private QuarterCircle leftRim = null!; private QuarterCircle rightRim = null!; - private readonly Bindable configTouchControlScheme = new Bindable(); + private static readonly Bindable configTouchControlScheme = new Bindable(); [Resolved] private OsuColour colours { get; set; } = null!; @@ -79,27 +79,27 @@ namespace osu.Game.Rulesets.Taiko.UI RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - leftRim = new QuarterCircle(getTaikoActionFromDrumSegment(0), getColourFromTaikoAction(getTaikoActionFromDrumSegment(0))) + leftRim = new QuarterCircle(0, colours) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, X = -2, }, - leftCentre = new QuarterCircle(getTaikoActionFromDrumSegment(1), getColourFromTaikoAction(getTaikoActionFromDrumSegment(1))) + leftCentre = new QuarterCircle(1, colours) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, X = -2, Scale = new Vector2(centre_region), }, - rightRim = new QuarterCircle(getTaikoActionFromDrumSegment(3), getColourFromTaikoAction(getTaikoActionFromDrumSegment(3))) + rightRim = new QuarterCircle(3, colours) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, X = 2, Rotation = 90, }, - rightCentre = new QuarterCircle(getTaikoActionFromDrumSegment(2), getColourFromTaikoAction(getTaikoActionFromDrumSegment(2))) + rightCentre = new QuarterCircle(2, colours) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, @@ -114,7 +114,7 @@ namespace osu.Game.Rulesets.Taiko.UI }; } - private readonly TaikoAction[,] mappedTaikoAction = + private static readonly TaikoAction[,] mappedTaikoAction = { { // KDDK @@ -139,7 +139,7 @@ namespace osu.Game.Rulesets.Taiko.UI } }; - private TaikoAction getTaikoActionFromDrumSegment(int drumSegment) + private static TaikoAction getTaikoActionFromDrumSegment(int drumSegment) { return mappedTaikoAction[(int)configTouchControlScheme.Value, drumSegment]; } @@ -210,36 +210,35 @@ namespace osu.Game.Rulesets.Taiko.UI mainContent.FadeOut(300); } - private Color4 getColourFromTaikoAction(TaikoAction handledAction) - { - switch (handledAction) - { - case TaikoAction.LeftRim: - case TaikoAction.RightRim: - return colours.Blue; - case TaikoAction.LeftCentre: - case TaikoAction.RightCentre: - return colours.Red; - } - throw new ArgumentOutOfRangeException(); - } private partial class QuarterCircle : CompositeDrawable, IKeyBindingHandler { private readonly Circle overlay; - private readonly TaikoAction handledAction; + private readonly int drumSegment; + + private readonly TaikoAction taikoAction; + + private readonly OsuColour colours; + + private readonly Color4 colour; private readonly Circle circle; public override bool Contains(Vector2 screenSpacePos) => circle.Contains(screenSpacePos); - public QuarterCircle(TaikoAction handledAction, Color4 colour) + public QuarterCircle(int drumSegment, OsuColour colours) { - this.handledAction = handledAction; + this.drumSegment = drumSegment; + this.colours = colours; + RelativeSizeAxes = Axes.Both; FillMode = FillMode.Fit; + taikoAction = getTaikoActionFromDrumSegment(drumSegment); + + colour = getColorFromTaikoAction(taikoAction); + InternalChildren = new Drawable[] { new Container @@ -268,16 +267,30 @@ namespace osu.Game.Rulesets.Taiko.UI }; } + private Color4 getColorFromTaikoAction(TaikoAction handledAction) + { + switch (handledAction) + { + case TaikoAction.LeftRim: + case TaikoAction.RightRim: + return colours.Blue; + case TaikoAction.LeftCentre: + case TaikoAction.RightCentre: + return colours.Red; + } + throw new ArgumentOutOfRangeException(); + } + public bool OnPressed(KeyBindingPressEvent e) { - if (e.Action == handledAction) + if (e.Action == taikoAction) overlay.FadeTo(1f, 80, Easing.OutQuint); return false; } public void OnReleased(KeyBindingReleaseEvent e) { - if (e.Action == handledAction) + if (e.Action == taikoAction) overlay.FadeOut(1000, Easing.OutQuint); } } From 767c3cb523913350eee131dcff80b6bcd758dd2e Mon Sep 17 00:00:00 2001 From: OpenSauce Date: Thu, 12 Jan 2023 17:20:07 +0000 Subject: [PATCH 29/66] Revert "getTaikoActionFromDrumSegment and getColorFromTaikoAction are now run from within QuarterCircle constructor" This reverts commit 985b126cba7568018769942fb1bf0cdf10d37036. I really don't think this is going to work cleanly --- .../UI/DrumTouchInputArea.cs | 63 ++++++++----------- 1 file changed, 25 insertions(+), 38 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs index 99a21e231d..a8bad36381 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs @@ -40,7 +40,7 @@ namespace osu.Game.Rulesets.Taiko.UI private QuarterCircle leftRim = null!; private QuarterCircle rightRim = null!; - private static readonly Bindable configTouchControlScheme = new Bindable(); + private readonly Bindable configTouchControlScheme = new Bindable(); [Resolved] private OsuColour colours { get; set; } = null!; @@ -79,27 +79,27 @@ namespace osu.Game.Rulesets.Taiko.UI RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - leftRim = new QuarterCircle(0, colours) + leftRim = new QuarterCircle(getTaikoActionFromDrumSegment(0), getColourFromTaikoAction(getTaikoActionFromDrumSegment(0))) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, X = -2, }, - leftCentre = new QuarterCircle(1, colours) + leftCentre = new QuarterCircle(getTaikoActionFromDrumSegment(1), getColourFromTaikoAction(getTaikoActionFromDrumSegment(1))) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, X = -2, Scale = new Vector2(centre_region), }, - rightRim = new QuarterCircle(3, colours) + rightRim = new QuarterCircle(getTaikoActionFromDrumSegment(3), getColourFromTaikoAction(getTaikoActionFromDrumSegment(3))) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, X = 2, Rotation = 90, }, - rightCentre = new QuarterCircle(2, colours) + rightCentre = new QuarterCircle(getTaikoActionFromDrumSegment(2), getColourFromTaikoAction(getTaikoActionFromDrumSegment(2))) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, @@ -114,7 +114,7 @@ namespace osu.Game.Rulesets.Taiko.UI }; } - private static readonly TaikoAction[,] mappedTaikoAction = + private readonly TaikoAction[,] mappedTaikoAction = { { // KDDK @@ -139,7 +139,7 @@ namespace osu.Game.Rulesets.Taiko.UI } }; - private static TaikoAction getTaikoActionFromDrumSegment(int drumSegment) + private TaikoAction getTaikoActionFromDrumSegment(int drumSegment) { return mappedTaikoAction[(int)configTouchControlScheme.Value, drumSegment]; } @@ -210,35 +210,36 @@ namespace osu.Game.Rulesets.Taiko.UI mainContent.FadeOut(300); } + private Color4 getColourFromTaikoAction(TaikoAction handledAction) + { + switch (handledAction) + { + case TaikoAction.LeftRim: + case TaikoAction.RightRim: + return colours.Blue; + case TaikoAction.LeftCentre: + case TaikoAction.RightCentre: + return colours.Red; + } + throw new ArgumentOutOfRangeException(); + } private partial class QuarterCircle : CompositeDrawable, IKeyBindingHandler { private readonly Circle overlay; - private readonly int drumSegment; - - private readonly TaikoAction taikoAction; - - private readonly OsuColour colours; - - private readonly Color4 colour; + private readonly TaikoAction handledAction; private readonly Circle circle; public override bool Contains(Vector2 screenSpacePos) => circle.Contains(screenSpacePos); - public QuarterCircle(int drumSegment, OsuColour colours) + public QuarterCircle(TaikoAction handledAction, Color4 colour) { - this.drumSegment = drumSegment; - this.colours = colours; - + this.handledAction = handledAction; RelativeSizeAxes = Axes.Both; FillMode = FillMode.Fit; - taikoAction = getTaikoActionFromDrumSegment(drumSegment); - - colour = getColorFromTaikoAction(taikoAction); - InternalChildren = new Drawable[] { new Container @@ -267,30 +268,16 @@ namespace osu.Game.Rulesets.Taiko.UI }; } - private Color4 getColorFromTaikoAction(TaikoAction handledAction) - { - switch (handledAction) - { - case TaikoAction.LeftRim: - case TaikoAction.RightRim: - return colours.Blue; - case TaikoAction.LeftCentre: - case TaikoAction.RightCentre: - return colours.Red; - } - throw new ArgumentOutOfRangeException(); - } - public bool OnPressed(KeyBindingPressEvent e) { - if (e.Action == taikoAction) + if (e.Action == handledAction) overlay.FadeTo(1f, 80, Easing.OutQuint); return false; } public void OnReleased(KeyBindingReleaseEvent e) { - if (e.Action == taikoAction) + if (e.Action == handledAction) overlay.FadeOut(1000, Easing.OutQuint); } } From 927fccb7be4bcf5589a9b7593b1dc9506a2543fe Mon Sep 17 00:00:00 2001 From: OpenSauce Date: Thu, 12 Jan 2023 17:55:05 +0000 Subject: [PATCH 30/66] Taiko touch control scheme can now be changed mid-map --- .../UI/DrumTouchInputArea.cs | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs index a8bad36381..1fe45a96dd 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs @@ -57,7 +57,10 @@ namespace osu.Game.Rulesets.Taiko.UI const float centre_region = 0.80f; if (ForceControlScheme == null) + { config.BindWith(TaikoRulesetSetting.TouchControlScheme, configTouchControlScheme); + configTouchControlScheme.ValueChanged += reloadTouchDrums; + } else configTouchControlScheme.Value = ForceControlScheme.Value; @@ -225,11 +228,11 @@ namespace osu.Game.Rulesets.Taiko.UI } private partial class QuarterCircle : CompositeDrawable, IKeyBindingHandler { - private readonly Circle overlay; + private TaikoAction handledAction; - private readonly TaikoAction handledAction; + private Circle overlay; - private readonly Circle circle; + private Circle circle; public override bool Contains(Vector2 screenSpacePos) => circle.Contains(screenSpacePos); @@ -280,6 +283,22 @@ namespace osu.Game.Rulesets.Taiko.UI if (e.Action == handledAction) overlay.FadeOut(1000, Easing.OutQuint); } + + public void ReloadDrumSegmentProperties(TaikoAction handledAction, Color4 colour) + { + this.handledAction = handledAction; + + circle.Colour = colour.Multiply(1.4f).Darken(2.8f); + overlay.Colour = colour; + } + } + + private void reloadTouchDrums(object _) + { + leftRim.ReloadDrumSegmentProperties(getTaikoActionFromDrumSegment(0), getColourFromTaikoAction(getTaikoActionFromDrumSegment(0))); + leftCentre.ReloadDrumSegmentProperties(getTaikoActionFromDrumSegment(1), getColourFromTaikoAction(getTaikoActionFromDrumSegment(1))); + rightRim.ReloadDrumSegmentProperties(getTaikoActionFromDrumSegment(3), getColourFromTaikoAction(getTaikoActionFromDrumSegment(3))); + rightCentre.ReloadDrumSegmentProperties(getTaikoActionFromDrumSegment(2), getColourFromTaikoAction(getTaikoActionFromDrumSegment(2))); } } } From f2ec0b21766c1c00856b98e01607e1c6b9a36a34 Mon Sep 17 00:00:00 2001 From: OpenSauce Date: Thu, 12 Jan 2023 18:17:50 +0000 Subject: [PATCH 31/66] Made QuarterCircle property loading less clapped --- .../UI/DrumTouchInputArea.cs | 46 ++++++++++++++----- 1 file changed, 34 insertions(+), 12 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs index 1fe45a96dd..6e91ed10a5 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs @@ -45,6 +45,23 @@ namespace osu.Game.Rulesets.Taiko.UI [Resolved] private OsuColour colours { get; set; } = null!; + private class DrumSegmentProperties + { + public TaikoAction TaikoAction { get; set; } + public Color4 Color { get; set; } + + public DrumSegmentProperties(TaikoAction taikoAction, Color4 color) + { + TaikoAction = taikoAction; + Color = color; + } + } + + private DrumSegmentProperties getDrumSegmentProperties(int drumSegment) + { + var taikoAction = getTaikoActionFromDrumSegment(drumSegment); + return new DrumSegmentProperties(taikoAction, getColourFromTaikoAction(taikoAction)); + } [BackgroundDependencyLoader] private void load(TaikoInputManager taikoInputManager, TaikoRulesetConfigManager config) { @@ -82,27 +99,27 @@ namespace osu.Game.Rulesets.Taiko.UI RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - leftRim = new QuarterCircle(getTaikoActionFromDrumSegment(0), getColourFromTaikoAction(getTaikoActionFromDrumSegment(0))) + leftRim = new QuarterCircle(getDrumSegmentProperties(0)) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, X = -2, }, - leftCentre = new QuarterCircle(getTaikoActionFromDrumSegment(1), getColourFromTaikoAction(getTaikoActionFromDrumSegment(1))) + leftCentre = new QuarterCircle(getDrumSegmentProperties(1)) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, X = -2, Scale = new Vector2(centre_region), }, - rightRim = new QuarterCircle(getTaikoActionFromDrumSegment(3), getColourFromTaikoAction(getTaikoActionFromDrumSegment(3))) + rightRim = new QuarterCircle(getDrumSegmentProperties(3)) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, X = 2, Rotation = 90, }, - rightCentre = new QuarterCircle(getTaikoActionFromDrumSegment(2), getColourFromTaikoAction(getTaikoActionFromDrumSegment(2))) + rightCentre = new QuarterCircle(getDrumSegmentProperties(2)) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, @@ -236,13 +253,16 @@ namespace osu.Game.Rulesets.Taiko.UI public override bool Contains(Vector2 screenSpacePos) => circle.Contains(screenSpacePos); - public QuarterCircle(TaikoAction handledAction, Color4 colour) + public QuarterCircle(DrumSegmentProperties properties) { - this.handledAction = handledAction; + handledAction = properties.TaikoAction; + RelativeSizeAxes = Axes.Both; FillMode = FillMode.Fit; + var colour = properties.Color; + InternalChildren = new Drawable[] { new Container @@ -284,9 +304,11 @@ namespace osu.Game.Rulesets.Taiko.UI overlay.FadeOut(1000, Easing.OutQuint); } - public void ReloadDrumSegmentProperties(TaikoAction handledAction, Color4 colour) + public void SetProperties(DrumSegmentProperties properties) { - this.handledAction = handledAction; + handledAction = properties.TaikoAction; + + var colour = properties.Color; circle.Colour = colour.Multiply(1.4f).Darken(2.8f); overlay.Colour = colour; @@ -295,10 +317,10 @@ namespace osu.Game.Rulesets.Taiko.UI private void reloadTouchDrums(object _) { - leftRim.ReloadDrumSegmentProperties(getTaikoActionFromDrumSegment(0), getColourFromTaikoAction(getTaikoActionFromDrumSegment(0))); - leftCentre.ReloadDrumSegmentProperties(getTaikoActionFromDrumSegment(1), getColourFromTaikoAction(getTaikoActionFromDrumSegment(1))); - rightRim.ReloadDrumSegmentProperties(getTaikoActionFromDrumSegment(3), getColourFromTaikoAction(getTaikoActionFromDrumSegment(3))); - rightCentre.ReloadDrumSegmentProperties(getTaikoActionFromDrumSegment(2), getColourFromTaikoAction(getTaikoActionFromDrumSegment(2))); + leftRim.SetProperties(getDrumSegmentProperties(0)); + leftCentre.SetProperties(getDrumSegmentProperties(1)); + rightRim.SetProperties(getDrumSegmentProperties(3)); + rightCentre.SetProperties(getDrumSegmentProperties(2)); } } } From 92def3daf4720535073cb264dd485f9672eabf9a Mon Sep 17 00:00:00 2001 From: OpenSauce Date: Thu, 12 Jan 2023 18:20:03 +0000 Subject: [PATCH 32/66] Renamed QuarterCircle class to DrumSegment --- .../UI/DrumTouchInputArea.cs | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs index 6e91ed10a5..753b7f2da9 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs @@ -35,10 +35,10 @@ namespace osu.Game.Rulesets.Taiko.UI private Container mainContent = null!; - private QuarterCircle leftCentre = null!; - private QuarterCircle rightCentre = null!; - private QuarterCircle leftRim = null!; - private QuarterCircle rightRim = null!; + private DrumSegment leftCentre = null!; + private DrumSegment rightCentre = null!; + private DrumSegment leftRim = null!; + private DrumSegment rightRim = null!; private readonly Bindable configTouchControlScheme = new Bindable(); @@ -99,27 +99,27 @@ namespace osu.Game.Rulesets.Taiko.UI RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - leftRim = new QuarterCircle(getDrumSegmentProperties(0)) + leftRim = new DrumSegment(getDrumSegmentProperties(0)) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, X = -2, }, - leftCentre = new QuarterCircle(getDrumSegmentProperties(1)) + leftCentre = new DrumSegment(getDrumSegmentProperties(1)) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, X = -2, Scale = new Vector2(centre_region), }, - rightRim = new QuarterCircle(getDrumSegmentProperties(3)) + rightRim = new DrumSegment(getDrumSegmentProperties(3)) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, X = 2, Rotation = 90, }, - rightCentre = new QuarterCircle(getDrumSegmentProperties(2)) + rightCentre = new DrumSegment(getDrumSegmentProperties(2)) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, @@ -243,7 +243,7 @@ namespace osu.Game.Rulesets.Taiko.UI } throw new ArgumentOutOfRangeException(); } - private partial class QuarterCircle : CompositeDrawable, IKeyBindingHandler + private partial class DrumSegment : CompositeDrawable, IKeyBindingHandler { private TaikoAction handledAction; @@ -253,7 +253,7 @@ namespace osu.Game.Rulesets.Taiko.UI public override bool Contains(Vector2 screenSpacePos) => circle.Contains(screenSpacePos); - public QuarterCircle(DrumSegmentProperties properties) + public DrumSegment(DrumSegmentProperties properties) { handledAction = properties.TaikoAction; From 25a920732fa6cba7c51ab1eaf44f16b0df79e627 Mon Sep 17 00:00:00 2001 From: OpenSauce04 Date: Thu, 12 Jan 2023 19:04:37 +0000 Subject: [PATCH 33/66] Addressed code formatting issues --- .../TestSceneDrumTouchInputArea.cs | 6 +++--- .../UI/DrumTouchInputArea.cs | 18 +++++++++++++----- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/osu.Game.Rulesets.Taiko.Tests/TestSceneDrumTouchInputArea.cs b/osu.Game.Rulesets.Taiko.Tests/TestSceneDrumTouchInputArea.cs index 6b02b0078a..23b871dcd8 100644 --- a/osu.Game.Rulesets.Taiko.Tests/TestSceneDrumTouchInputArea.cs +++ b/osu.Game.Rulesets.Taiko.Tests/TestSceneDrumTouchInputArea.cs @@ -14,13 +14,13 @@ namespace osu.Game.Rulesets.Taiko.Tests { private DrumTouchInputArea drumTouchInputArea = null!; - private void createDrum(TaikoTouchControlScheme _forcedControlScheme) + private void createDrum(TaikoTouchControlScheme forcedControlScheme) { Child = new TaikoInputManager(new TaikoRuleset().RulesetInfo) { RelativeSizeAxes = Axes.Both, Children = new Drawable[] - { + { new InputDrum { Anchor = Anchor.TopCentre, @@ -31,7 +31,7 @@ namespace osu.Game.Rulesets.Taiko.Tests { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, - ForceControlScheme = _forcedControlScheme + ForceControlScheme = forcedControlScheme } } }; diff --git a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs index 753b7f2da9..e4c20dd1bf 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs @@ -25,6 +25,7 @@ namespace osu.Game.Rulesets.Taiko.UI public partial class DrumTouchInputArea : VisibilityContainer { public TaikoTouchControlScheme? ForceControlScheme { get; set; } + // visibility state affects our child. we always want to handle input. public override bool PropagatePositionalInputSubTree => true; public override bool PropagateNonPositionalInputSubTree => true; @@ -62,10 +63,12 @@ namespace osu.Game.Rulesets.Taiko.UI var taikoAction = getTaikoActionFromDrumSegment(drumSegment); return new DrumSegmentProperties(taikoAction, getColourFromTaikoAction(taikoAction)); } + [BackgroundDependencyLoader] private void load(TaikoInputManager taikoInputManager, TaikoRulesetConfigManager config) { Debug.Assert(taikoInputManager.KeyBindingContainer != null); + keyBindingContainer = taikoInputManager.KeyBindingContainer; // Container should handle input everywhere. @@ -187,14 +190,14 @@ namespace osu.Game.Rulesets.Taiko.UI { Show(); - TaikoAction TaikoAction = getTaikoActionFromPosition(position); + TaikoAction taikoAction = getTaikoActionFromPosition(position); // Not too sure how this can happen, but let's avoid throwing. if (trackedActions.ContainsKey(source)) return; - trackedActions.Add(source, TaikoAction); - keyBindingContainer.TriggerPressed(TaikoAction); + trackedActions.Add(source, taikoAction); + keyBindingContainer.TriggerPressed(taikoAction); } private void handleUp(object source) @@ -236,20 +239,25 @@ namespace osu.Game.Rulesets.Taiko.UI { case TaikoAction.LeftRim: case TaikoAction.RightRim: + return colours.Blue; + case TaikoAction.LeftCentre: case TaikoAction.RightCentre: + return colours.Red; } + throw new ArgumentOutOfRangeException(); } + private partial class DrumSegment : CompositeDrawable, IKeyBindingHandler { private TaikoAction handledAction; - private Circle overlay; + private readonly Circle overlay; - private Circle circle; + private readonly Circle circle; public override bool Contains(Vector2 screenSpacePos) => circle.Contains(screenSpacePos); From 87ee9ab813e023d0d51bea755ba3f5db16356353 Mon Sep 17 00:00:00 2001 From: OliBomby Date: Wed, 12 Oct 2022 19:04:45 +0200 Subject: [PATCH 34/66] Added custom menu items in DrawableCarouselBeatmap --- .../Carousel/DrawableCarouselBeatmap.cs | 19 ++++++++----------- osu.Game/Screens/Select/PlaySongSelect.cs | 12 ++++++++++++ osu.Game/Screens/Select/SongSelect.cs | 3 +++ 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs index 4e10961e55..4c8f986563 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs @@ -49,8 +49,9 @@ namespace osu.Game.Screens.Select.Carousel private Sprite background; - private Action startRequested; - private Action editRequested; + private MenuItem[] customMenuItems; + + private Action selectRequested; private Action hideRequested; private Triangles triangles; @@ -86,9 +87,8 @@ namespace osu.Game.Screens.Select.Carousel if (songSelect != null) { - startRequested = b => songSelect.FinaliseSelection(b); - if (songSelect.AllowEditing) - editRequested = songSelect.Edit; + customMenuItems = songSelect.CustomMenuItems.Select(f => f.Invoke(beatmapInfo)).ToArray(); + selectRequested = b => songSelect.FinaliseSelection(b); } if (manager != null) @@ -195,7 +195,7 @@ namespace osu.Game.Screens.Select.Carousel protected override bool OnClick(ClickEvent e) { if (Item.State.Value == CarouselItemState.Selected) - startRequested?.Invoke(beatmapInfo); + selectRequested?.Invoke(beatmapInfo); return base.OnClick(e); } @@ -229,11 +229,8 @@ namespace osu.Game.Screens.Select.Carousel { List items = new List(); - if (startRequested != null) - items.Add(new OsuMenuItem("Play", MenuItemType.Highlighted, () => startRequested(beatmapInfo))); - - if (editRequested != null) - items.Add(new OsuMenuItem(CommonStrings.ButtonsEdit, MenuItemType.Standard, () => editRequested(beatmapInfo))); + if (customMenuItems != null) + items.AddRange(customMenuItems); if (beatmapInfo.OnlineID > 0 && beatmapOverlay != null) items.Add(new OsuMenuItem("Details...", MenuItemType.Standard, () => beatmapOverlay.FetchAndShowBeatmap(beatmapInfo.OnlineID))); diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index f73cfe8d55..15356baf44 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -1,15 +1,20 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Events; using osu.Framework.Screens; +using osu.Game.Beatmaps; using osu.Game.Graphics; +using osu.Game.Graphics.UserInterface; using osu.Game.Overlays; using osu.Game.Overlays.Notifications; +using osu.Game.Resources.Localisation.Web; using osu.Game.Rulesets.Mods; using osu.Game.Scoring; using osu.Game.Screens.Play; @@ -29,6 +34,13 @@ namespace osu.Game.Screens.Select public override bool AllowExternalScreenChange => true; + public override Func[] CustomMenuItems => + new Func[] + { + b => new OsuMenuItem("Play", MenuItemType.Highlighted, () => FinaliseSelection(b)), + b => new OsuMenuItem(CommonStrings.ButtonsEdit, MenuItemType.Standard, () => Edit(b)) + }; + protected override UserActivity InitialActivity => new UserActivity.ChoosingBeatmap(); private PlayBeatmapDetailArea playBeatmapDetailArea = null!; diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index f4804c6a6c..38f4b8ef40 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -37,6 +37,7 @@ using osu.Game.Collections; using osu.Game.Graphics.UserInterface; using System.Diagnostics; using JetBrains.Annotations; +using osu.Framework.Graphics.UserInterface; using osu.Game.Screens.Play; using osu.Game.Skinning; @@ -84,6 +85,8 @@ namespace osu.Game.Screens.Select public bool BeatmapSetsLoaded => IsLoaded && Carousel?.BeatmapSetsLoaded == true; + public virtual Func[] CustomMenuItems => new Func[] { b => new OsuMenuItem(@"Select", MenuItemType.Highlighted, () => FinaliseSelection(b)) }; + [Resolved] private Bindable> selectedMods { get; set; } From 1c0a6505756ef2ace70ae5d24dbddca14ef961e1 Mon Sep 17 00:00:00 2001 From: OliBomby Date: Mon, 16 Jan 2023 00:17:26 +0100 Subject: [PATCH 35/66] Fix typo --- osu.Game/Screens/Select/PlaySongSelect.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index 15356baf44..92a23048c7 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -101,7 +101,7 @@ namespace osu.Game.Screens.Select { notifications?.Post(new SimpleNotification { - Text = "The current ruleset doesn't have an autoplay mod avalaible!" + Text = "The current ruleset doesn't have an autoplay mod available!" }); return false; } From 832d033777eeeffff5e419343416a876d4deb43a Mon Sep 17 00:00:00 2001 From: OliBomby Date: Mon, 16 Jan 2023 01:09:04 +0100 Subject: [PATCH 36/66] Fix merge issues --- .../Screens/Select/Carousel/DrawableCarouselBeatmap.cs | 8 ++++---- osu.Game/Screens/Select/PlaySongSelect.cs | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs index 75c367acba..a831271bb4 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs @@ -47,10 +47,10 @@ namespace osu.Game.Screens.Select.Carousel private Sprite background = null!; - private MenuItem[] customMenuItems; + private MenuItem[]? customMenuItems; - private Action selectRequested; - private Action hideRequested; + private Action? selectRequested; + private Action? hideRequested; private Triangles triangles = null!; @@ -192,7 +192,7 @@ namespace osu.Game.Screens.Select.Carousel protected override bool OnClick(ClickEvent e) { - if (Item.State.Value == CarouselItemState.Selected) + if (Item?.State.Value == CarouselItemState.Selected) selectRequested?.Invoke(beatmapInfo); return base.OnClick(e); diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index aebdfb8a04..c6c2b69fd8 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -15,7 +15,6 @@ using osu.Game.Graphics.UserInterface; using osu.Game.Localisation; using osu.Game.Overlays; using osu.Game.Overlays.Notifications; -using osu.Game.Resources.Localisation.Web; using osu.Game.Rulesets.Mods; using osu.Game.Scoring; using osu.Game.Screens.Play; @@ -39,7 +38,7 @@ namespace osu.Game.Screens.Select new Func[] { b => new OsuMenuItem("Play", MenuItemType.Highlighted, () => FinaliseSelection(b)), - b => new OsuMenuItem(CommonStrings.ButtonsEdit, MenuItemType.Standard, () => Edit(b)) + b => new OsuMenuItem(Resources.Localisation.Web.CommonStrings.ButtonsEdit, MenuItemType.Standard, () => Edit(b)) }; protected override UserActivity InitialActivity => new UserActivity.ChoosingBeatmap(); From 8645e705fd73e2dde122c4905fb0a78d06f6a336 Mon Sep 17 00:00:00 2001 From: tsrk Date: Wed, 1 Feb 2023 23:44:00 +0000 Subject: [PATCH 37/66] feat: add localisation for Skin editor components --- .../BarHitErrorMeterStrings.cs | 89 +++++++++++++++++++ .../BeatmapAttributeTextStrings.cs | 34 +++++++ .../ColourHitErrorMeterStrings.cs | 54 +++++++++++ .../FontAdjustableSkinComponentStrings.cs | 24 +++++ .../GameplayAccuracyCounterStrings.cs | 39 ++++++++ .../JudgementCounterDisplayStrings.cs | 50 +++++++++++ .../SkinnableSpriteStrings.cs | 24 +++++ .../SongProgressStrings.cs | 24 +++++ .../TextElementStrings.cs | 24 +++++ osu.Game/Localisation/SkinEditorStrings.cs | 5 ++ .../Screens/Play/HUD/ArgonSongProgress.cs | 3 +- .../Screens/Play/HUD/DefaultSongProgress.cs | 3 +- .../Play/HUD/GameplayAccuracyCounter.cs | 11 +-- .../HUD/HitErrorMeters/BarHitErrorMeter.cs | 22 +++-- .../HUD/HitErrorMeters/ColourHitErrorMeter.cs | 11 ++- .../JudgementCounterDisplay.cs | 15 +++- .../Components/BeatmapAttributeText.cs | 5 +- osu.Game/Skinning/Components/TextElement.cs | 3 +- osu.Game/Skinning/Editor/SkinEditor.cs | 4 +- .../Skinning/FontAdjustableSkinComponent.cs | 3 +- osu.Game/Skinning/SkinnableSprite.cs | 3 +- 21 files changed, 424 insertions(+), 26 deletions(-) create mode 100644 osu.Game/Localisation/SkinEditorComponents/BarHitErrorMeterStrings.cs create mode 100644 osu.Game/Localisation/SkinEditorComponents/BeatmapAttributeTextStrings.cs create mode 100644 osu.Game/Localisation/SkinEditorComponents/ColourHitErrorMeterStrings.cs create mode 100644 osu.Game/Localisation/SkinEditorComponents/FontAdjustableSkinComponentStrings.cs create mode 100644 osu.Game/Localisation/SkinEditorComponents/GameplayAccuracyCounterStrings.cs create mode 100644 osu.Game/Localisation/SkinEditorComponents/JudgementCounterDisplayStrings.cs create mode 100644 osu.Game/Localisation/SkinEditorComponents/SkinnableSpriteStrings.cs create mode 100644 osu.Game/Localisation/SkinEditorComponents/SongProgressStrings.cs create mode 100644 osu.Game/Localisation/SkinEditorComponents/TextElementStrings.cs diff --git a/osu.Game/Localisation/SkinEditorComponents/BarHitErrorMeterStrings.cs b/osu.Game/Localisation/SkinEditorComponents/BarHitErrorMeterStrings.cs new file mode 100644 index 0000000000..ea372a5207 --- /dev/null +++ b/osu.Game/Localisation/SkinEditorComponents/BarHitErrorMeterStrings.cs @@ -0,0 +1,89 @@ +// 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.Localisation; + +namespace osu.Game.Localisation.SkinEditorComponents +{ + public static class BarHitErrorMeterStrings + { + private const string prefix = @"osu.Game.Resources.Localisation.BarHitErrorMeter"; + + /// + /// "Judgement line thickness" + /// + public static LocalisableString JudgementLineThickness => new TranslatableString(getKey(@"judgement_line_thickness"), "Judgement line thickness"); + + /// + /// "How thick the individual lines should be." + /// + public static LocalisableString JudgementLineThicknessDescription => new TranslatableString(getKey(@"judgement_line_thickness_description"), "How thick the individual lines should be."); + + /// + /// "Show colour bars" + /// + public static LocalisableString ColourBarVisibility => new TranslatableString(getKey(@"colour_bar_visibility"), "Show colour bars"); + + /// + /// "Show moving average arrow" + /// + public static LocalisableString ShowMovingAverage => new TranslatableString(getKey(@"show_moving_average"), "Show moving average arrow"); + + /// + /// "Whether an arrow should move beneath the bar showing the average error." + /// + public static LocalisableString ShowMovingAverageDescription => new TranslatableString(getKey(@"show_moving_average_description"), "Whether an arrow should move beneath the bar showing the average error."); + + /// + /// "Centre marker style" + /// + public static LocalisableString CentreMarkerStyle => new TranslatableString(getKey(@"centre_marker_style"), "Centre marker style"); + + /// + /// "How to signify the centre of the display" + /// + public static LocalisableString CentreMarkerStyleDescription => new TranslatableString(getKey(@"centre_marker_style_description"), "How to signify the centre of the display"); + + /// + /// "None" + /// + public static LocalisableString CentreMarkerStylesNone => new TranslatableString(getKey(@"centre_marker_styles_none"), "None"); + + /// + /// "Circle" + /// + public static LocalisableString CentreMarkerStylesCircle => new TranslatableString(getKey(@"centre_marker_styles_circle"), "Circle"); + + /// + /// "Line" + /// + public static LocalisableString CentreMarkerStylesLine => new TranslatableString(getKey(@"centre_marker_styles_line"), "Line"); + + /// + /// "Label style" + /// + public static LocalisableString LabelStyle => new TranslatableString(getKey(@"label_style"), "Label style"); + + /// + /// "How to show early/late extremities" + /// + public static LocalisableString LabelStyleDescription => new TranslatableString(getKey(@"label_style_description"), "How to show early/late extremities"); + + /// + /// "None" + /// + public static LocalisableString LabelStylesNone => new TranslatableString(getKey(@"label_styles_none"), "None"); + + /// + /// "Icons" + /// + public static LocalisableString LabelStylesIcons => new TranslatableString(getKey(@"label_styles_icons"), "Icons"); + + /// + /// "Text" + /// + public static LocalisableString LabelStylesText => new TranslatableString(getKey(@"label_styles_text"), "Text"); + + private static string getKey(string key) => $"{prefix}:{key}"; + } +} diff --git a/osu.Game/Localisation/SkinEditorComponents/BeatmapAttributeTextStrings.cs b/osu.Game/Localisation/SkinEditorComponents/BeatmapAttributeTextStrings.cs new file mode 100644 index 0000000000..faafa7e304 --- /dev/null +++ b/osu.Game/Localisation/SkinEditorComponents/BeatmapAttributeTextStrings.cs @@ -0,0 +1,34 @@ +// 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.Localisation; + +namespace osu.Game.Localisation.SkinEditorComponents +{ + public static class BeatmapAttributeTextStrings + { + private const string prefix = @"osu.Game.Resources.Localisation.BeatmapAttributeText"; + + /// + /// "Attribute" + /// + public static LocalisableString Attribute => new TranslatableString(getKey(@"attribute"), "Attribute"); + + /// + /// "The attribute to be displayed." + /// + public static LocalisableString AttributeDescription => new TranslatableString(getKey(@"attribute_description"), "The attribute to be displayed."); + + /// + /// "Template" + /// + public static LocalisableString Template => new TranslatableString(getKey(@"template"), "Template"); + + /// + /// "Supports {{Label}} and {{Value}}, but also including arbitrary attributes like {{StarRating}} (see attribute list for supported values)." + /// + public static LocalisableString TemplateDescription => new TranslatableString(getKey(@"template_description"), @"Supports {{Label}} and {{Value}}, but also including arbitrary attributes like {{StarRating}} (see attribute list for supported values)."); + + private static string getKey(string key) => $"{prefix}:{key}"; + } +} diff --git a/osu.Game/Localisation/SkinEditorComponents/ColourHitErrorMeterStrings.cs b/osu.Game/Localisation/SkinEditorComponents/ColourHitErrorMeterStrings.cs new file mode 100644 index 0000000000..fec5781c3d --- /dev/null +++ b/osu.Game/Localisation/SkinEditorComponents/ColourHitErrorMeterStrings.cs @@ -0,0 +1,54 @@ +// 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.Localisation; + +namespace osu.Game.Localisation.SkinEditorComponents +{ + public static class ColourHitErrorMeterStrings + { + private const string prefix = @"osu.Game.Resources.Localisation.ColourHitError"; + + /// + /// "Judgement count" + /// + public static LocalisableString JudgementCount => new TranslatableString(getKey(@"judgement_count"), "Judgement count"); + + /// + /// "The number of displayed judgements" + /// + public static LocalisableString JudgementCountDescription => new TranslatableString(getKey(@"judgement_count_description"), "The number of displayed judgements"); + + /// + /// "Judgement spacing" + /// + public static LocalisableString JudgementSpacing => new TranslatableString(getKey(@"judgement_spacing"), "Judgement spacing"); + + /// + /// "The space between each displayed judgement" + /// + public static LocalisableString JudgementSpacingDescription => new TranslatableString(getKey(@"judgement_spacing_description"), "The space between each displayed judgement"); + + /// + /// "Judgement shape" + /// + public static LocalisableString JudgementShape => new TranslatableString(getKey(@"judgement_shape"), "Judgement shape"); + + /// + /// "The shape of each displayed judgement" + /// + public static LocalisableString JudgementShapeDescription => new TranslatableString(getKey(@"judgement_shape_description"), "The shape of each displayed judgement"); + + /// + /// "Circle" + /// + public static LocalisableString ShapeStyleCircle => new TranslatableString(getKey(@"shape_style_cricle"), "Circle"); + + /// + /// "Square" + /// + public static LocalisableString ShapeStyleSquare => new TranslatableString(getKey(@"shape_style_square"), "Square"); + + private static string getKey(string key) => $"{prefix}:{key}"; + } +} diff --git a/osu.Game/Localisation/SkinEditorComponents/FontAdjustableSkinComponentStrings.cs b/osu.Game/Localisation/SkinEditorComponents/FontAdjustableSkinComponentStrings.cs new file mode 100644 index 0000000000..9b92854faa --- /dev/null +++ b/osu.Game/Localisation/SkinEditorComponents/FontAdjustableSkinComponentStrings.cs @@ -0,0 +1,24 @@ +// 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.Localisation; + +namespace osu.Game.Localisation.SkinEditorComponents +{ + public static class FontAdjustableSkinComponentStrings + { + private const string prefix = @"osu.Game.Resources.Localisation.FontAdjustableSkinComponent"; + + /// + /// "Font" + /// + public static LocalisableString Font => new TranslatableString(getKey(@"font"), "Font"); + + /// + /// "The font to use." + /// + public static LocalisableString FontDescription => new TranslatableString(getKey(@"font_description"), "The font to use."); + + private static string getKey(string key) => $"{prefix}:{key}"; + } +} diff --git a/osu.Game/Localisation/SkinEditorComponents/GameplayAccuracyCounterStrings.cs b/osu.Game/Localisation/SkinEditorComponents/GameplayAccuracyCounterStrings.cs new file mode 100644 index 0000000000..33a742a95e --- /dev/null +++ b/osu.Game/Localisation/SkinEditorComponents/GameplayAccuracyCounterStrings.cs @@ -0,0 +1,39 @@ +// 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.Localisation; + +namespace osu.Game.Localisation.SkinEditorComponents +{ + public static class GameplayAccuracyCounterStrings + { + private const string prefix = @"osu.Game.Resources.Localisation.GameplayAccuracyCounter"; + + /// + /// "Accuracy display mode" + /// + public static LocalisableString AccuracyDisplay => new TranslatableString(getKey(@"accuracy_display"), "Accuracy display mode"); + + /// + /// "Which accuracy mode should be displayed." + /// + public static LocalisableString AccuracyDisplayDescription => new TranslatableString(getKey(@"accuracy_display_description"), "Which accuracy mode should be displayed."); + + /// + /// "Standard" + /// + public static LocalisableString AccuracyDisplayModeStandard => new TranslatableString(getKey(@"accuracy_display_mode_standard"), "Standard"); + + /// + /// "Maximum achievable" + /// + public static LocalisableString AccuracyDisplayModeMax => new TranslatableString(getKey(@"accuracy_display_mode_max"), "Maximum achievable"); + + /// + /// "Minimum achievable" + /// + public static LocalisableString AccuracyDisplayModeMin => new TranslatableString(getKey(@"accuracy_display_mode_min"), "Minimum achievable"); + + private static string getKey(string key) => $"{prefix}:{key}"; + } +} diff --git a/osu.Game/Localisation/SkinEditorComponents/JudgementCounterDisplayStrings.cs b/osu.Game/Localisation/SkinEditorComponents/JudgementCounterDisplayStrings.cs new file mode 100644 index 0000000000..75f0241e56 --- /dev/null +++ b/osu.Game/Localisation/SkinEditorComponents/JudgementCounterDisplayStrings.cs @@ -0,0 +1,50 @@ +// 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.Localisation; + +namespace osu.Game.Localisation.SkinEditorComponents +{ + public static class JudgementCounterDisplayStrings + { + private const string prefix = @"osu.Game.Resources.Localisation.JudgementCounterDisplay"; + + /// + /// "Display mode" + /// + public static LocalisableString JudgementDisplayMode => new TranslatableString(getKey(@"judgement_display_mode"), "Display mode"); + + /// + /// "Counter direction" + /// + public static LocalisableString FlowDirection => new TranslatableString(getKey(@"flow_direction"), "Counter direction"); + + /// + /// "Show judgement names" + /// + public static LocalisableString ShowJudgementNames => new TranslatableString(getKey(@"show_judgement_names"), "Show judgement names"); + + /// + /// "Show max judgement" + /// + public static LocalisableString ShowMaxJudgement => new TranslatableString(getKey(@"show_max_judgement"), "Show max judgement"); + + /// + /// "Simple" + /// + public static LocalisableString JudgementDisplayModeSimple => new TranslatableString(getKey(@"judgement_display_mode_simple"), "Simple"); + + /// + /// "Normal" + /// + public static LocalisableString JudgementDisplayModeNormal => new TranslatableString(getKey(@"judgement_display_mode_normal"), "Normal"); + + /// + /// "All" + /// + public static LocalisableString JudgementDisplayModeAll => new TranslatableString(getKey(@"judgement_display_mode_all"), "All"); + + private static string getKey(string key) => $"{prefix}:{key}"; + } +} + diff --git a/osu.Game/Localisation/SkinEditorComponents/SkinnableSpriteStrings.cs b/osu.Game/Localisation/SkinEditorComponents/SkinnableSpriteStrings.cs new file mode 100644 index 0000000000..f67acb493c --- /dev/null +++ b/osu.Game/Localisation/SkinEditorComponents/SkinnableSpriteStrings.cs @@ -0,0 +1,24 @@ +// 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.Localisation; + +namespace osu.Game.Localisation.SkinEditorComponents +{ + public static class SkinnableSpriteStrings + { + private const string prefix = @"osu.Game.Resources.Localisation.SkinnableSprite"; + + /// + /// "Sprite name" + /// + public static LocalisableString SpriteName => new TranslatableString(getKey(@"sprite_name"), "Sprite name"); + + /// + /// "The filename of the sprite" + /// + public static LocalisableString SpriteNameDescription => new TranslatableString(getKey(@"sprite_name_description"), "The filename of the sprite"); + + private static string getKey(string key) => $"{prefix}:{key}"; + } +} diff --git a/osu.Game/Localisation/SkinEditorComponents/SongProgressStrings.cs b/osu.Game/Localisation/SkinEditorComponents/SongProgressStrings.cs new file mode 100644 index 0000000000..9719cdef52 --- /dev/null +++ b/osu.Game/Localisation/SkinEditorComponents/SongProgressStrings.cs @@ -0,0 +1,24 @@ +// 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.Localisation; + +namespace osu.Game.Localisation.SkinEditorComponents +{ + public static class SongProgressStrings + { + private const string prefix = @"osu.Game.Resources.Localisation.SongProgressStrings"; + + /// + /// "Show difficulty graph" + /// + public static LocalisableString ShowGraph => new TranslatableString(getKey(@"show_graph"), "Show difficulty graph"); + + /// + /// "Whether a graph displaying difficulty throughout the beatmap should be shown" + /// + public static LocalisableString ShowGraphDescription => new TranslatableString(getKey(@"show_graph_description"), "Whether a graph displaying difficulty throughout the beatmap should be shown"); + + private static string getKey(string key) => $"{prefix}:{key}"; + } +} diff --git a/osu.Game/Localisation/SkinEditorComponents/TextElementStrings.cs b/osu.Game/Localisation/SkinEditorComponents/TextElementStrings.cs new file mode 100644 index 0000000000..e969da60bf --- /dev/null +++ b/osu.Game/Localisation/SkinEditorComponents/TextElementStrings.cs @@ -0,0 +1,24 @@ +// 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.Localisation; + +namespace osu.Game.Localisation.SkinEditorComponents +{ + public static class TextElementStrings + { + private const string prefix = @"osu.Game.Resources.Localisation.TextElement"; + + /// + /// "Text" + /// + public static LocalisableString TextElementText => new TranslatableString(getKey(@"text_element_text"), "Text"); + + /// + /// "The text to be displayed." + /// + public static LocalisableString TextElementTextDescription => new TranslatableString(getKey(@"text_element_text_description"), "The text to be displayed."); + + private static string getKey(string key) => $"{prefix}:{key}"; + } +} diff --git a/osu.Game/Localisation/SkinEditorStrings.cs b/osu.Game/Localisation/SkinEditorStrings.cs index b2e5f3aeb6..d9744cf6c8 100644 --- a/osu.Game/Localisation/SkinEditorStrings.cs +++ b/osu.Game/Localisation/SkinEditorStrings.cs @@ -39,6 +39,11 @@ namespace osu.Game.Localisation /// public static LocalisableString Settings(string arg0) => new TranslatableString(getKey(@"settings"), @"Settings ({0})", arg0); + /// + /// "Curently editing" + /// + public static LocalisableString CurrentlyEditing => new TranslatableString(getKey(@"currently_editing"), "Curently editing"); + private static string getKey(string key) => $@"{prefix}:{key}"; } } diff --git a/osu.Game/Screens/Play/HUD/ArgonSongProgress.cs b/osu.Game/Screens/Play/HUD/ArgonSongProgress.cs index bfee6d295e..075e5af163 100644 --- a/osu.Game/Screens/Play/HUD/ArgonSongProgress.cs +++ b/osu.Game/Screens/Play/HUD/ArgonSongProgress.cs @@ -8,6 +8,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Configuration; using osu.Game.Graphics; +using osu.Game.Localisation.SkinEditorComponents; using osu.Game.Rulesets.Objects; namespace osu.Game.Screens.Play.HUD @@ -21,7 +22,7 @@ namespace osu.Game.Screens.Play.HUD private const float bar_height = 10; - [SettingSource("Show difficulty graph", "Whether a graph displaying difficulty throughout the beatmap should be shown")] + [SettingSource(typeof(SongProgressStrings), nameof(SongProgressStrings.ShowGraph), nameof(SongProgressStrings.ShowGraphDescription))] public Bindable ShowGraph { get; } = new BindableBool(true); [Resolved] diff --git a/osu.Game/Screens/Play/HUD/DefaultSongProgress.cs b/osu.Game/Screens/Play/HUD/DefaultSongProgress.cs index 91a34fe374..1c051c24ae 100644 --- a/osu.Game/Screens/Play/HUD/DefaultSongProgress.cs +++ b/osu.Game/Screens/Play/HUD/DefaultSongProgress.cs @@ -7,6 +7,7 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Configuration; using osu.Game.Graphics; +using osu.Game.Localisation.SkinEditorComponents; using osu.Game.Rulesets.Objects; using osuTK; @@ -26,7 +27,7 @@ namespace osu.Game.Screens.Play.HUD private readonly DefaultSongProgressGraph graph; private readonly SongProgressInfo info; - [SettingSource("Show difficulty graph", "Whether a graph displaying difficulty throughout the beatmap should be shown")] + [SettingSource(typeof(SongProgressStrings), nameof(SongProgressStrings.ShowGraph), nameof(SongProgressStrings.ShowGraphDescription))] public Bindable ShowGraph { get; } = new BindableBool(true); [Resolved] diff --git a/osu.Game/Screens/Play/HUD/GameplayAccuracyCounter.cs b/osu.Game/Screens/Play/HUD/GameplayAccuracyCounter.cs index ca7fef8f73..d044b3d98a 100644 --- a/osu.Game/Screens/Play/HUD/GameplayAccuracyCounter.cs +++ b/osu.Game/Screens/Play/HUD/GameplayAccuracyCounter.cs @@ -1,18 +1,19 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System.ComponentModel; using osu.Framework.Allocation; using osu.Framework.Bindables; +using osu.Framework.Localisation; using osu.Game.Configuration; using osu.Game.Graphics.UserInterface; +using osu.Game.Localisation.SkinEditorComponents; using osu.Game.Rulesets.Scoring; namespace osu.Game.Screens.Play.HUD { public abstract partial class GameplayAccuracyCounter : PercentageCounter { - [SettingSource("Accuracy display mode", "Which accuracy mode should be displayed.")] + [SettingSource(typeof(GameplayAccuracyCounterStrings), nameof(GameplayAccuracyCounterStrings.AccuracyDisplay), nameof(GameplayAccuracyCounterStrings.AccuracyDisplayDescription))] public Bindable AccuracyDisplay { get; } = new Bindable(); [Resolved] @@ -51,13 +52,13 @@ namespace osu.Game.Screens.Play.HUD public enum AccuracyDisplayMode { - [Description("Standard")] + [LocalisableDescription(typeof(GameplayAccuracyCounterStrings), nameof(GameplayAccuracyCounterStrings.AccuracyDisplayModeStandard))] Standard, - [Description("Maximum achievable")] + [LocalisableDescription(typeof(GameplayAccuracyCounterStrings), nameof(GameplayAccuracyCounterStrings.AccuracyDisplayModeMax))] MaximumAchievable, - [Description("Minimum achievable")] + [LocalisableDescription(typeof(GameplayAccuracyCounterStrings), nameof(GameplayAccuracyCounterStrings.AccuracyDisplayModeMin))] MinimumAchievable } } diff --git a/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs b/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs index 0337f66bd9..5d0efe7b77 100644 --- a/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs +++ b/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs @@ -12,10 +12,12 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Pooling; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; +using osu.Framework.Localisation; using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; +using osu.Game.Localisation.SkinEditorComponents; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Scoring; using osuTK; @@ -25,7 +27,7 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters [Cached] public partial class BarHitErrorMeter : HitErrorMeter { - [SettingSource("Judgement line thickness", "How thick the individual lines should be.")] + [SettingSource(typeof(BarHitErrorMeterStrings), nameof(BarHitErrorMeterStrings.JudgementLineThickness), nameof(BarHitErrorMeterStrings.JudgementLineThicknessDescription))] public BindableNumber JudgementLineThickness { get; } = new BindableNumber(4) { MinValue = 1, @@ -33,16 +35,16 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters Precision = 0.1f, }; - [SettingSource("Show colour bars")] + [SettingSource(typeof(BarHitErrorMeterStrings), nameof(BarHitErrorMeterStrings.ColourBarVisibility))] public Bindable ColourBarVisibility { get; } = new Bindable(true); - [SettingSource("Show moving average arrow", "Whether an arrow should move beneath the bar showing the average error.")] + [SettingSource(typeof(BarHitErrorMeterStrings), nameof(BarHitErrorMeterStrings.ShowMovingAverage), nameof(BarHitErrorMeterStrings.ShowMovingAverageDescription))] public Bindable ShowMovingAverage { get; } = new BindableBool(true); - [SettingSource("Centre marker style", "How to signify the centre of the display")] + [SettingSource(typeof(BarHitErrorMeterStrings), nameof(BarHitErrorMeterStrings.CentreMarkerStyle), nameof(BarHitErrorMeterStrings.CentreMarkerStyleDescription))] public Bindable CentreMarkerStyle { get; } = new Bindable(CentreMarkerStyles.Circle); - [SettingSource("Label style", "How to show early/late extremities")] + [SettingSource(typeof(BarHitErrorMeterStrings), nameof(BarHitErrorMeterStrings.LabelStyle), nameof(BarHitErrorMeterStrings.LabelStyleDescription))] public Bindable LabelStyle { get; } = new Bindable(LabelStyles.Icons); private const int judgement_line_width = 14; @@ -487,15 +489,25 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters public enum CentreMarkerStyles { + [LocalisableDescription(typeof(BarHitErrorMeterStrings), nameof(BarHitErrorMeterStrings.CentreMarkerStylesNone))] None, + + [LocalisableDescription(typeof(BarHitErrorMeterStrings), nameof(BarHitErrorMeterStrings.CentreMarkerStylesCircle))] Circle, + + [LocalisableDescription(typeof(BarHitErrorMeterStrings), nameof(BarHitErrorMeterStrings.CentreMarkerStylesLine))] Line } public enum LabelStyles { + [LocalisableDescription(typeof(BarHitErrorMeterStrings), nameof(BarHitErrorMeterStrings.LabelStylesNone))] None, + + [LocalisableDescription(typeof(BarHitErrorMeterStrings), nameof(BarHitErrorMeterStrings.LabelStylesIcons))] Icons, + + [LocalisableDescription(typeof(BarHitErrorMeterStrings), nameof(BarHitErrorMeterStrings.LabelStylesIcons))] Text } } diff --git a/osu.Game/Screens/Play/HUD/HitErrorMeters/ColourHitErrorMeter.cs b/osu.Game/Screens/Play/HUD/HitErrorMeters/ColourHitErrorMeter.cs index ec5dc5f52f..28e2006c2f 100644 --- a/osu.Game/Screens/Play/HUD/HitErrorMeters/ColourHitErrorMeter.cs +++ b/osu.Game/Screens/Play/HUD/HitErrorMeters/ColourHitErrorMeter.cs @@ -9,7 +9,9 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Pooling; using osu.Framework.Graphics.Shapes; +using osu.Framework.Localisation; using osu.Game.Configuration; +using osu.Game.Localisation.SkinEditorComponents; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Scoring; using osuTK; @@ -23,21 +25,21 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters private const int animation_duration = 200; private const int drawable_judgement_size = 8; - [SettingSource("Judgement count", "The number of displayed judgements")] + [SettingSource(typeof(ColourHitErrorMeterStrings), nameof(ColourHitErrorMeterStrings.JudgementCount), nameof(ColourHitErrorMeterStrings.JudgementCountDescription))] public BindableNumber JudgementCount { get; } = new BindableNumber(20) { MinValue = 1, MaxValue = 50, }; - [SettingSource("Judgement spacing", "The space between each displayed judgement")] + [SettingSource(typeof(ColourHitErrorMeterStrings), nameof(ColourHitErrorMeterStrings.JudgementSpacing), nameof(ColourHitErrorMeterStrings.JudgementSpacingDescription))] public BindableNumber JudgementSpacing { get; } = new BindableNumber(2) { MinValue = 0, MaxValue = 10, }; - [SettingSource("Judgement shape", "The shape of each displayed judgement")] + [SettingSource(typeof(ColourHitErrorMeterStrings), nameof(ColourHitErrorMeterStrings.JudgementShape), nameof(ColourHitErrorMeterStrings.JudgementShapeDescription))] public Bindable JudgementShape { get; } = new Bindable(); private readonly JudgementFlow judgementsFlow; @@ -192,7 +194,10 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters public enum ShapeStyle { + [LocalisableDescription(typeof(ColourHitErrorMeterStrings), nameof(ColourHitErrorMeterStrings.ShapeStyleCircle))] Circle, + + [LocalisableDescription(typeof(ColourHitErrorMeterStrings), nameof(ColourHitErrorMeterStrings.ShapeStyleSquare))] Square } } diff --git a/osu.Game/Screens/Play/HUD/JudgementCounter/JudgementCounterDisplay.cs b/osu.Game/Screens/Play/HUD/JudgementCounter/JudgementCounterDisplay.cs index 82f24c736e..d047b8e5fb 100644 --- a/osu.Game/Screens/Play/HUD/JudgementCounter/JudgementCounterDisplay.cs +++ b/osu.Game/Screens/Play/HUD/JudgementCounter/JudgementCounterDisplay.cs @@ -6,7 +6,9 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Localisation; using osu.Game.Configuration; +using osu.Game.Localisation.SkinEditorComponents; using osu.Game.Rulesets.Scoring; using osu.Game.Skinning; using osuTK; @@ -19,16 +21,16 @@ namespace osu.Game.Screens.Play.HUD.JudgementCounter public bool UsesFixedAnchor { get; set; } - [SettingSource("Display mode")] + [SettingSource(typeof(JudgementCounterDisplayStrings), nameof(JudgementCounterDisplayStrings.JudgementDisplayMode))] public Bindable Mode { get; set; } = new Bindable(); - [SettingSource("Counter direction")] + [SettingSource(typeof(JudgementCounterDisplayStrings), nameof(JudgementCounterDisplayStrings.FlowDirection))] public Bindable FlowDirection { get; set; } = new Bindable(); - [SettingSource("Show judgement names")] + [SettingSource(typeof(JudgementCounterDisplayStrings), nameof(JudgementCounterDisplayStrings.ShowJudgementNames))] public BindableBool ShowJudgementNames { get; set; } = new BindableBool(true); - [SettingSource("Show max judgement")] + [SettingSource(typeof(JudgementCounterDisplayStrings), nameof(JudgementCounterDisplayStrings.ShowMaxJudgement))] public BindableBool ShowMaxJudgement { get; set; } = new BindableBool(true); [Resolved] @@ -130,8 +132,13 @@ namespace osu.Game.Screens.Play.HUD.JudgementCounter public enum DisplayMode { + [LocalisableDescription(typeof(JudgementCounterDisplayStrings), nameof(JudgementCounterDisplayStrings.JudgementDisplayModeSimple))] Simple, + + [LocalisableDescription(typeof(JudgementCounterDisplayStrings), nameof(JudgementCounterDisplayStrings.JudgementDisplayModeNormal))] Normal, + + [LocalisableDescription(typeof(JudgementCounterDisplayStrings), nameof(JudgementCounterDisplayStrings.JudgementDisplayModeAll))] All } } diff --git a/osu.Game/Skinning/Components/BeatmapAttributeText.cs b/osu.Game/Skinning/Components/BeatmapAttributeText.cs index 68bb1e7ddc..d2e724f760 100644 --- a/osu.Game/Skinning/Components/BeatmapAttributeText.cs +++ b/osu.Game/Skinning/Components/BeatmapAttributeText.cs @@ -18,6 +18,7 @@ using osu.Game.Configuration; using osu.Game.Extensions; using osu.Game.Graphics.Sprites; using osu.Game.Localisation; +using osu.Game.Localisation.SkinEditorComponents; using osu.Game.Resources.Localisation.Web; namespace osu.Game.Skinning.Components @@ -25,10 +26,10 @@ namespace osu.Game.Skinning.Components [UsedImplicitly] public partial class BeatmapAttributeText : FontAdjustableSkinComponent { - [SettingSource("Attribute", "The attribute to be displayed.")] + [SettingSource(typeof(BeatmapAttributeTextStrings), nameof(BeatmapAttributeTextStrings.Attribute), nameof(BeatmapAttributeTextStrings.AttributeDescription))] public Bindable Attribute { get; } = new Bindable(BeatmapAttribute.StarRating); - [SettingSource("Template", "Supports {Label} and {Value}, but also including arbitrary attributes like {StarRating} (see attribute list for supported values).")] + [SettingSource(typeof(BeatmapAttributeTextStrings), nameof(BeatmapAttributeTextStrings.Template), nameof(BeatmapAttributeTextStrings.TemplateDescription))] public Bindable Template { get; set; } = new Bindable("{Label}: {Value}"); [Resolved] diff --git a/osu.Game/Skinning/Components/TextElement.cs b/osu.Game/Skinning/Components/TextElement.cs index d87fb125bb..9adc065b88 100644 --- a/osu.Game/Skinning/Components/TextElement.cs +++ b/osu.Game/Skinning/Components/TextElement.cs @@ -8,13 +8,14 @@ using osu.Framework.Graphics.Sprites; using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; +using osu.Game.Localisation.SkinEditorComponents; namespace osu.Game.Skinning.Components { [UsedImplicitly] public partial class TextElement : FontAdjustableSkinComponent { - [SettingSource("Text", "The text to be displayed.")] + [SettingSource(typeof(TextElementStrings), nameof(TextElementStrings.TextElementText), nameof(TextElementStrings.TextElementTextDescription))] public Bindable Text { get; } = new Bindable("Circles!"); private readonly OsuSpriteText text; diff --git a/osu.Game/Skinning/Editor/SkinEditor.cs b/osu.Game/Skinning/Editor/SkinEditor.cs index 98b4e960dd..74391e5269 100644 --- a/osu.Game/Skinning/Editor/SkinEditor.cs +++ b/osu.Game/Skinning/Editor/SkinEditor.cs @@ -254,13 +254,13 @@ namespace osu.Game.Skinning.Editor headerText.AddParagraph(SkinEditorStrings.SkinEditor, cp => cp.Font = OsuFont.Default.With(size: 16)); headerText.NewParagraph(); - headerText.AddText("Currently editing ", cp => + headerText.AddText(SkinEditorStrings.CurrentlyEditing, cp => { cp.Font = OsuFont.Default.With(size: 12); cp.Colour = colours.Yellow; }); - headerText.AddText($"{currentSkin.Value.SkinInfo}", cp => + headerText.AddText($" {currentSkin.Value.SkinInfo}", cp => { cp.Font = OsuFont.Default.With(size: 12, weight: FontWeight.Bold); cp.Colour = colours.Yellow; diff --git a/osu.Game/Skinning/FontAdjustableSkinComponent.cs b/osu.Game/Skinning/FontAdjustableSkinComponent.cs index ee73417bfe..51d4aa9fee 100644 --- a/osu.Game/Skinning/FontAdjustableSkinComponent.cs +++ b/osu.Game/Skinning/FontAdjustableSkinComponent.cs @@ -6,6 +6,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Game.Configuration; using osu.Game.Graphics; +using osu.Game.Localisation.SkinEditorComponents; namespace osu.Game.Skinning { @@ -16,7 +17,7 @@ namespace osu.Game.Skinning { public bool UsesFixedAnchor { get; set; } - [SettingSource("Font", "The font to use.")] + [SettingSource(typeof(FontAdjustableSkinComponentStrings), nameof(FontAdjustableSkinComponentStrings.Font), nameof(FontAdjustableSkinComponentStrings.FontDescription))] public Bindable Font { get; } = new Bindable(Typeface.Torus); /// diff --git a/osu.Game/Skinning/SkinnableSprite.cs b/osu.Game/Skinning/SkinnableSprite.cs index a66f3e0549..a5ed2a4b64 100644 --- a/osu.Game/Skinning/SkinnableSprite.cs +++ b/osu.Game/Skinning/SkinnableSprite.cs @@ -12,6 +12,7 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Game.Configuration; using osu.Game.Graphics.Sprites; +using osu.Game.Localisation.SkinEditorComponents; using osu.Game.Overlays.Settings; using osuTK; @@ -27,7 +28,7 @@ namespace osu.Game.Skinning [Resolved] private TextureStore textures { get; set; } = null!; - [SettingSource("Sprite name", "The filename of the sprite", SettingControlType = typeof(SpriteSelectorControl))] + [SettingSource(typeof(SkinnableSpriteStrings), nameof(SkinnableSpriteStrings.SpriteName), nameof(SkinnableSpriteStrings.SpriteNameDescription), SettingControlType = typeof(SpriteSelectorControl))] public Bindable SpriteName { get; } = new Bindable(string.Empty); [Resolved] From ddfa95e6ef280939d8a19d146e8c8a07727ef8b9 Mon Sep 17 00:00:00 2001 From: tsrk Date: Thu, 2 Feb 2023 00:01:48 +0000 Subject: [PATCH 38/66] refactor: fix typos --- .../Localisation/SkinEditorComponents/SongProgressStrings.cs | 2 +- osu.Game/Localisation/SkinEditorStrings.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Localisation/SkinEditorComponents/SongProgressStrings.cs b/osu.Game/Localisation/SkinEditorComponents/SongProgressStrings.cs index 9719cdef52..0e4d7ea34d 100644 --- a/osu.Game/Localisation/SkinEditorComponents/SongProgressStrings.cs +++ b/osu.Game/Localisation/SkinEditorComponents/SongProgressStrings.cs @@ -7,7 +7,7 @@ namespace osu.Game.Localisation.SkinEditorComponents { public static class SongProgressStrings { - private const string prefix = @"osu.Game.Resources.Localisation.SongProgressStrings"; + private const string prefix = @"osu.Game.Resources.Localisation.SongProgress"; /// /// "Show difficulty graph" diff --git a/osu.Game/Localisation/SkinEditorStrings.cs b/osu.Game/Localisation/SkinEditorStrings.cs index d9744cf6c8..5cf2e5b5c5 100644 --- a/osu.Game/Localisation/SkinEditorStrings.cs +++ b/osu.Game/Localisation/SkinEditorStrings.cs @@ -40,9 +40,9 @@ namespace osu.Game.Localisation public static LocalisableString Settings(string arg0) => new TranslatableString(getKey(@"settings"), @"Settings ({0})", arg0); /// - /// "Curently editing" + /// "Currently editing" /// - public static LocalisableString CurrentlyEditing => new TranslatableString(getKey(@"currently_editing"), "Curently editing"); + public static LocalisableString CurrentlyEditing => new TranslatableString(getKey(@"currently_editing"), "Currently editing"); private static string getKey(string key) => $@"{prefix}:{key}"; } From 0fb6a637091235afc715db3c1a3e67544acc00ad Mon Sep 17 00:00:00 2001 From: tsrk Date: Thu, 2 Feb 2023 00:46:14 +0000 Subject: [PATCH 39/66] refactor: change namespacing to allow osu-localisation-analyzer to process all strings --- .../{SkinEditorComponents => }/BarHitErrorMeterStrings.cs | 2 +- .../{SkinEditorComponents => }/BeatmapAttributeTextStrings.cs | 2 +- .../{SkinEditorComponents => }/ColourHitErrorMeterStrings.cs | 2 +- .../FontAdjustableSkinComponentStrings.cs | 2 +- .../GameplayAccuracyCounterStrings.cs | 2 +- .../JudgementCounterDisplayStrings.cs | 2 +- .../{SkinEditorComponents => }/SkinnableSpriteStrings.cs | 2 +- .../{SkinEditorComponents => }/SongProgressStrings.cs | 2 +- .../{SkinEditorComponents => }/TextElementStrings.cs | 2 +- osu.Game/Screens/Play/HUD/ArgonSongProgress.cs | 2 +- osu.Game/Screens/Play/HUD/DefaultSongProgress.cs | 2 +- osu.Game/Screens/Play/HUD/GameplayAccuracyCounter.cs | 2 +- osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs | 2 +- osu.Game/Screens/Play/HUD/HitErrorMeters/ColourHitErrorMeter.cs | 2 +- .../Play/HUD/JudgementCounter/JudgementCounterDisplay.cs | 2 +- osu.Game/Skinning/Components/BeatmapAttributeText.cs | 1 - osu.Game/Skinning/Components/TextElement.cs | 2 +- osu.Game/Skinning/FontAdjustableSkinComponent.cs | 2 +- osu.Game/Skinning/SkinnableSprite.cs | 2 +- 19 files changed, 18 insertions(+), 19 deletions(-) rename osu.Game/Localisation/{SkinEditorComponents => }/BarHitErrorMeterStrings.cs (98%) rename osu.Game/Localisation/{SkinEditorComponents => }/BeatmapAttributeTextStrings.cs (96%) rename osu.Game/Localisation/{SkinEditorComponents => }/ColourHitErrorMeterStrings.cs (97%) rename osu.Game/Localisation/{SkinEditorComponents => }/FontAdjustableSkinComponentStrings.cs (93%) rename osu.Game/Localisation/{SkinEditorComponents => }/GameplayAccuracyCounterStrings.cs (96%) rename osu.Game/Localisation/{SkinEditorComponents => }/JudgementCounterDisplayStrings.cs (97%) rename osu.Game/Localisation/{SkinEditorComponents => }/SkinnableSpriteStrings.cs (94%) rename osu.Game/Localisation/{SkinEditorComponents => }/SongProgressStrings.cs (94%) rename osu.Game/Localisation/{SkinEditorComponents => }/TextElementStrings.cs (94%) diff --git a/osu.Game/Localisation/SkinEditorComponents/BarHitErrorMeterStrings.cs b/osu.Game/Localisation/BarHitErrorMeterStrings.cs similarity index 98% rename from osu.Game/Localisation/SkinEditorComponents/BarHitErrorMeterStrings.cs rename to osu.Game/Localisation/BarHitErrorMeterStrings.cs index ea372a5207..171c3e223e 100644 --- a/osu.Game/Localisation/SkinEditorComponents/BarHitErrorMeterStrings.cs +++ b/osu.Game/Localisation/BarHitErrorMeterStrings.cs @@ -3,7 +3,7 @@ using osu.Framework.Localisation; -namespace osu.Game.Localisation.SkinEditorComponents +namespace osu.Game.Localisation { public static class BarHitErrorMeterStrings { diff --git a/osu.Game/Localisation/SkinEditorComponents/BeatmapAttributeTextStrings.cs b/osu.Game/Localisation/BeatmapAttributeTextStrings.cs similarity index 96% rename from osu.Game/Localisation/SkinEditorComponents/BeatmapAttributeTextStrings.cs rename to osu.Game/Localisation/BeatmapAttributeTextStrings.cs index faafa7e304..1ceb482cf4 100644 --- a/osu.Game/Localisation/SkinEditorComponents/BeatmapAttributeTextStrings.cs +++ b/osu.Game/Localisation/BeatmapAttributeTextStrings.cs @@ -3,7 +3,7 @@ using osu.Framework.Localisation; -namespace osu.Game.Localisation.SkinEditorComponents +namespace osu.Game.Localisation { public static class BeatmapAttributeTextStrings { diff --git a/osu.Game/Localisation/SkinEditorComponents/ColourHitErrorMeterStrings.cs b/osu.Game/Localisation/ColourHitErrorMeterStrings.cs similarity index 97% rename from osu.Game/Localisation/SkinEditorComponents/ColourHitErrorMeterStrings.cs rename to osu.Game/Localisation/ColourHitErrorMeterStrings.cs index fec5781c3d..13682c9c85 100644 --- a/osu.Game/Localisation/SkinEditorComponents/ColourHitErrorMeterStrings.cs +++ b/osu.Game/Localisation/ColourHitErrorMeterStrings.cs @@ -3,7 +3,7 @@ using osu.Framework.Localisation; -namespace osu.Game.Localisation.SkinEditorComponents +namespace osu.Game.Localisation { public static class ColourHitErrorMeterStrings { diff --git a/osu.Game/Localisation/SkinEditorComponents/FontAdjustableSkinComponentStrings.cs b/osu.Game/Localisation/FontAdjustableSkinComponentStrings.cs similarity index 93% rename from osu.Game/Localisation/SkinEditorComponents/FontAdjustableSkinComponentStrings.cs rename to osu.Game/Localisation/FontAdjustableSkinComponentStrings.cs index 9b92854faa..76f9f2f8b9 100644 --- a/osu.Game/Localisation/SkinEditorComponents/FontAdjustableSkinComponentStrings.cs +++ b/osu.Game/Localisation/FontAdjustableSkinComponentStrings.cs @@ -3,7 +3,7 @@ using osu.Framework.Localisation; -namespace osu.Game.Localisation.SkinEditorComponents +namespace osu.Game.Localisation { public static class FontAdjustableSkinComponentStrings { diff --git a/osu.Game/Localisation/SkinEditorComponents/GameplayAccuracyCounterStrings.cs b/osu.Game/Localisation/GameplayAccuracyCounterStrings.cs similarity index 96% rename from osu.Game/Localisation/SkinEditorComponents/GameplayAccuracyCounterStrings.cs rename to osu.Game/Localisation/GameplayAccuracyCounterStrings.cs index 33a742a95e..c9e936d8af 100644 --- a/osu.Game/Localisation/SkinEditorComponents/GameplayAccuracyCounterStrings.cs +++ b/osu.Game/Localisation/GameplayAccuracyCounterStrings.cs @@ -3,7 +3,7 @@ using osu.Framework.Localisation; -namespace osu.Game.Localisation.SkinEditorComponents +namespace osu.Game.Localisation { public static class GameplayAccuracyCounterStrings { diff --git a/osu.Game/Localisation/SkinEditorComponents/JudgementCounterDisplayStrings.cs b/osu.Game/Localisation/JudgementCounterDisplayStrings.cs similarity index 97% rename from osu.Game/Localisation/SkinEditorComponents/JudgementCounterDisplayStrings.cs rename to osu.Game/Localisation/JudgementCounterDisplayStrings.cs index 75f0241e56..fbc22e96fd 100644 --- a/osu.Game/Localisation/SkinEditorComponents/JudgementCounterDisplayStrings.cs +++ b/osu.Game/Localisation/JudgementCounterDisplayStrings.cs @@ -3,7 +3,7 @@ using osu.Framework.Localisation; -namespace osu.Game.Localisation.SkinEditorComponents +namespace osu.Game.Localisation { public static class JudgementCounterDisplayStrings { diff --git a/osu.Game/Localisation/SkinEditorComponents/SkinnableSpriteStrings.cs b/osu.Game/Localisation/SkinnableSpriteStrings.cs similarity index 94% rename from osu.Game/Localisation/SkinEditorComponents/SkinnableSpriteStrings.cs rename to osu.Game/Localisation/SkinnableSpriteStrings.cs index f67acb493c..6192f5e43d 100644 --- a/osu.Game/Localisation/SkinEditorComponents/SkinnableSpriteStrings.cs +++ b/osu.Game/Localisation/SkinnableSpriteStrings.cs @@ -3,7 +3,7 @@ using osu.Framework.Localisation; -namespace osu.Game.Localisation.SkinEditorComponents +namespace osu.Game.Localisation { public static class SkinnableSpriteStrings { diff --git a/osu.Game/Localisation/SkinEditorComponents/SongProgressStrings.cs b/osu.Game/Localisation/SongProgressStrings.cs similarity index 94% rename from osu.Game/Localisation/SkinEditorComponents/SongProgressStrings.cs rename to osu.Game/Localisation/SongProgressStrings.cs index 0e4d7ea34d..033560ebb0 100644 --- a/osu.Game/Localisation/SkinEditorComponents/SongProgressStrings.cs +++ b/osu.Game/Localisation/SongProgressStrings.cs @@ -3,7 +3,7 @@ using osu.Framework.Localisation; -namespace osu.Game.Localisation.SkinEditorComponents +namespace osu.Game.Localisation { public static class SongProgressStrings { diff --git a/osu.Game/Localisation/SkinEditorComponents/TextElementStrings.cs b/osu.Game/Localisation/TextElementStrings.cs similarity index 94% rename from osu.Game/Localisation/SkinEditorComponents/TextElementStrings.cs rename to osu.Game/Localisation/TextElementStrings.cs index e969da60bf..6257b80d72 100644 --- a/osu.Game/Localisation/SkinEditorComponents/TextElementStrings.cs +++ b/osu.Game/Localisation/TextElementStrings.cs @@ -3,7 +3,7 @@ using osu.Framework.Localisation; -namespace osu.Game.Localisation.SkinEditorComponents +namespace osu.Game.Localisation { public static class TextElementStrings { diff --git a/osu.Game/Screens/Play/HUD/ArgonSongProgress.cs b/osu.Game/Screens/Play/HUD/ArgonSongProgress.cs index 075e5af163..6c5ba52f27 100644 --- a/osu.Game/Screens/Play/HUD/ArgonSongProgress.cs +++ b/osu.Game/Screens/Play/HUD/ArgonSongProgress.cs @@ -8,7 +8,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Configuration; using osu.Game.Graphics; -using osu.Game.Localisation.SkinEditorComponents; +using osu.Game.Localisation; using osu.Game.Rulesets.Objects; namespace osu.Game.Screens.Play.HUD diff --git a/osu.Game/Screens/Play/HUD/DefaultSongProgress.cs b/osu.Game/Screens/Play/HUD/DefaultSongProgress.cs index 1c051c24ae..fccefd49a4 100644 --- a/osu.Game/Screens/Play/HUD/DefaultSongProgress.cs +++ b/osu.Game/Screens/Play/HUD/DefaultSongProgress.cs @@ -7,7 +7,7 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Configuration; using osu.Game.Graphics; -using osu.Game.Localisation.SkinEditorComponents; +using osu.Game.Localisation; using osu.Game.Rulesets.Objects; using osuTK; diff --git a/osu.Game/Screens/Play/HUD/GameplayAccuracyCounter.cs b/osu.Game/Screens/Play/HUD/GameplayAccuracyCounter.cs index d044b3d98a..3a7c97632d 100644 --- a/osu.Game/Screens/Play/HUD/GameplayAccuracyCounter.cs +++ b/osu.Game/Screens/Play/HUD/GameplayAccuracyCounter.cs @@ -6,7 +6,7 @@ using osu.Framework.Bindables; using osu.Framework.Localisation; using osu.Game.Configuration; using osu.Game.Graphics.UserInterface; -using osu.Game.Localisation.SkinEditorComponents; +using osu.Game.Localisation; using osu.Game.Rulesets.Scoring; namespace osu.Game.Screens.Play.HUD diff --git a/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs b/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs index 5d0efe7b77..3507987fe4 100644 --- a/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs +++ b/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs @@ -17,7 +17,7 @@ using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; -using osu.Game.Localisation.SkinEditorComponents; +using osu.Game.Localisation; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Scoring; using osuTK; diff --git a/osu.Game/Screens/Play/HUD/HitErrorMeters/ColourHitErrorMeter.cs b/osu.Game/Screens/Play/HUD/HitErrorMeters/ColourHitErrorMeter.cs index 28e2006c2f..ac49e9ca5e 100644 --- a/osu.Game/Screens/Play/HUD/HitErrorMeters/ColourHitErrorMeter.cs +++ b/osu.Game/Screens/Play/HUD/HitErrorMeters/ColourHitErrorMeter.cs @@ -11,7 +11,7 @@ using osu.Framework.Graphics.Pooling; using osu.Framework.Graphics.Shapes; using osu.Framework.Localisation; using osu.Game.Configuration; -using osu.Game.Localisation.SkinEditorComponents; +using osu.Game.Localisation; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Scoring; using osuTK; diff --git a/osu.Game/Screens/Play/HUD/JudgementCounter/JudgementCounterDisplay.cs b/osu.Game/Screens/Play/HUD/JudgementCounter/JudgementCounterDisplay.cs index d047b8e5fb..31b0b9ebc5 100644 --- a/osu.Game/Screens/Play/HUD/JudgementCounter/JudgementCounterDisplay.cs +++ b/osu.Game/Screens/Play/HUD/JudgementCounter/JudgementCounterDisplay.cs @@ -8,7 +8,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Localisation; using osu.Game.Configuration; -using osu.Game.Localisation.SkinEditorComponents; +using osu.Game.Localisation; using osu.Game.Rulesets.Scoring; using osu.Game.Skinning; using osuTK; diff --git a/osu.Game/Skinning/Components/BeatmapAttributeText.cs b/osu.Game/Skinning/Components/BeatmapAttributeText.cs index d2e724f760..e8b2d547a9 100644 --- a/osu.Game/Skinning/Components/BeatmapAttributeText.cs +++ b/osu.Game/Skinning/Components/BeatmapAttributeText.cs @@ -18,7 +18,6 @@ using osu.Game.Configuration; using osu.Game.Extensions; using osu.Game.Graphics.Sprites; using osu.Game.Localisation; -using osu.Game.Localisation.SkinEditorComponents; using osu.Game.Resources.Localisation.Web; namespace osu.Game.Skinning.Components diff --git a/osu.Game/Skinning/Components/TextElement.cs b/osu.Game/Skinning/Components/TextElement.cs index 9adc065b88..c160f3f9d0 100644 --- a/osu.Game/Skinning/Components/TextElement.cs +++ b/osu.Game/Skinning/Components/TextElement.cs @@ -8,7 +8,7 @@ using osu.Framework.Graphics.Sprites; using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; -using osu.Game.Localisation.SkinEditorComponents; +using osu.Game.Localisation; namespace osu.Game.Skinning.Components { diff --git a/osu.Game/Skinning/FontAdjustableSkinComponent.cs b/osu.Game/Skinning/FontAdjustableSkinComponent.cs index 51d4aa9fee..9c28621d48 100644 --- a/osu.Game/Skinning/FontAdjustableSkinComponent.cs +++ b/osu.Game/Skinning/FontAdjustableSkinComponent.cs @@ -6,7 +6,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Game.Configuration; using osu.Game.Graphics; -using osu.Game.Localisation.SkinEditorComponents; +using osu.Game.Localisation; namespace osu.Game.Skinning { diff --git a/osu.Game/Skinning/SkinnableSprite.cs b/osu.Game/Skinning/SkinnableSprite.cs index a5ed2a4b64..3deb264bc8 100644 --- a/osu.Game/Skinning/SkinnableSprite.cs +++ b/osu.Game/Skinning/SkinnableSprite.cs @@ -12,7 +12,7 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Game.Configuration; using osu.Game.Graphics.Sprites; -using osu.Game.Localisation.SkinEditorComponents; +using osu.Game.Localisation; using osu.Game.Overlays.Settings; using osuTK; From 175b9fc5c918a1a4601912dc3b7dcbe16a85f7b5 Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Thu, 2 Feb 2023 08:34:38 +0300 Subject: [PATCH 40/66] Specify texelSize value in the Triangles background --- osu.Game/Graphics/Backgrounds/Triangles.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Graphics/Backgrounds/Triangles.cs b/osu.Game/Graphics/Backgrounds/Triangles.cs index 6750d74a08..ca5f5d06d3 100644 --- a/osu.Game/Graphics/Backgrounds/Triangles.cs +++ b/osu.Game/Graphics/Backgrounds/Triangles.cs @@ -253,6 +253,7 @@ namespace osu.Game.Graphics.Backgrounds private class TrianglesDrawNode : DrawNode { private float fill = 1f; + private float texelSize = 0f; protected new Triangles Source => (Triangles)base.Source; @@ -296,6 +297,7 @@ namespace osu.Game.Graphics.Backgrounds shader.Bind(); shader.GetUniform("thickness").UpdateValue(ref fill); + shader.GetUniform("texelSize").UpdateValue(ref texelSize); foreach (TriangleParticle particle in parts) { From 500e9c7944be4ba4f43cc2c5b0db5ce4aa54c60f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 2 Feb 2023 14:53:58 +0900 Subject: [PATCH 41/66] Refactor into a method rather than property --- .../Select/Carousel/DrawableCarouselBeatmap.cs | 8 ++++---- osu.Game/Screens/Select/PlaySongSelect.cs | 15 +++++++-------- osu.Game/Screens/Select/SongSelect.cs | 5 ++++- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs index a831271bb4..94a91205b9 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs @@ -47,7 +47,7 @@ namespace osu.Game.Screens.Select.Carousel private Sprite background = null!; - private MenuItem[]? customMenuItems; + private MenuItem[]? mainMenuItems; private Action? selectRequested; private Action? hideRequested; @@ -85,7 +85,7 @@ namespace osu.Game.Screens.Select.Carousel if (songSelect != null) { - customMenuItems = songSelect.CustomMenuItems.Select(f => f.Invoke(beatmapInfo)).ToArray(); + mainMenuItems = songSelect.CreateMenuItemsForBeatmap(beatmapInfo); selectRequested = b => songSelect.FinaliseSelection(b); } @@ -227,8 +227,8 @@ namespace osu.Game.Screens.Select.Carousel { List items = new List(); - if (customMenuItems != null) - items.AddRange(customMenuItems); + if (mainMenuItems != null) + items.AddRange(mainMenuItems); if (beatmapInfo.OnlineID > 0 && beatmapOverlay != null) items.Add(new OsuMenuItem("Details...", MenuItemType.Standard, () => beatmapOverlay.FetchAndShowBeatmap(beatmapInfo.OnlineID))); diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index c6c2b69fd8..e2d89609c2 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; @@ -12,9 +11,9 @@ using osu.Framework.Screens; using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; -using osu.Game.Localisation; using osu.Game.Overlays; using osu.Game.Overlays.Notifications; +using osu.Game.Resources.Localisation.Web; using osu.Game.Rulesets.Mods; using osu.Game.Scoring; using osu.Game.Screens.Play; @@ -22,6 +21,7 @@ using osu.Game.Screens.Ranking; using osu.Game.Users; using osu.Game.Utils; using osuTK.Input; +using NotificationsStrings = osu.Game.Localisation.NotificationsStrings; namespace osu.Game.Screens.Select { @@ -34,12 +34,11 @@ namespace osu.Game.Screens.Select public override bool AllowExternalScreenChange => true; - public override Func[] CustomMenuItems => - new Func[] - { - b => new OsuMenuItem("Play", MenuItemType.Highlighted, () => FinaliseSelection(b)), - b => new OsuMenuItem(Resources.Localisation.Web.CommonStrings.ButtonsEdit, MenuItemType.Standard, () => Edit(b)) - }; + public override MenuItem[] CreateMenuItemsForBeatmap(BeatmapInfo b) => new MenuItem[] + { + new OsuMenuItem("Play", MenuItemType.Highlighted, () => FinaliseSelection(b)), + new OsuMenuItem(CommonStrings.ButtonsEdit, MenuItemType.Standard, () => Edit(b)) + }; protected override UserActivity InitialActivity => new UserActivity.ChoosingBeatmap(); diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 61728dd9fd..56616ea323 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -84,7 +84,10 @@ namespace osu.Game.Screens.Select public bool BeatmapSetsLoaded => IsLoaded && Carousel.BeatmapSetsLoaded; - public virtual Func[] CustomMenuItems => new Func[] { b => new OsuMenuItem(@"Select", MenuItemType.Highlighted, () => FinaliseSelection(b)) }; + public virtual MenuItem[] CreateMenuItemsForBeatmap(BeatmapInfo b) => new MenuItem[] + { + new OsuMenuItem(@"Select", MenuItemType.Highlighted, () => FinaliseSelection(b)) + }; [Resolved] private Bindable> selectedMods { get; set; } = null!; From 91fbf388da5cfdd6071c5f6f99330634aaa74934 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 2 Feb 2023 14:58:52 +0900 Subject: [PATCH 42/66] Use localisation strings from `ButtonSystem` for better consistency --- osu.Game/Screens/Select/PlaySongSelect.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index e2d89609c2..b855325d00 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; +using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Events; @@ -11,9 +12,9 @@ using osu.Framework.Screens; using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; +using osu.Game.Localisation; using osu.Game.Overlays; using osu.Game.Overlays.Notifications; -using osu.Game.Resources.Localisation.Web; using osu.Game.Rulesets.Mods; using osu.Game.Scoring; using osu.Game.Screens.Play; @@ -21,7 +22,6 @@ using osu.Game.Screens.Ranking; using osu.Game.Users; using osu.Game.Utils; using osuTK.Input; -using NotificationsStrings = osu.Game.Localisation.NotificationsStrings; namespace osu.Game.Screens.Select { @@ -36,8 +36,8 @@ namespace osu.Game.Screens.Select public override MenuItem[] CreateMenuItemsForBeatmap(BeatmapInfo b) => new MenuItem[] { - new OsuMenuItem("Play", MenuItemType.Highlighted, () => FinaliseSelection(b)), - new OsuMenuItem(CommonStrings.ButtonsEdit, MenuItemType.Standard, () => Edit(b)) + new OsuMenuItem(ButtonSystemStrings.Play.ToSentence(), MenuItemType.Highlighted, () => FinaliseSelection(b)), + new OsuMenuItem(ButtonSystemStrings.Edit.ToSentence(), MenuItemType.Standard, () => Edit(b)) }; protected override UserActivity InitialActivity => new UserActivity.ChoosingBeatmap(); @@ -47,7 +47,7 @@ namespace osu.Game.Screens.Select [BackgroundDependencyLoader] private void load(OsuColour colours) { - BeatmapOptions.AddButton(@"Edit", @"beatmap", FontAwesome.Solid.PencilAlt, colours.Yellow, () => Edit()); + BeatmapOptions.AddButton(ButtonSystemStrings.Edit.ToSentence(), @"beatmap", FontAwesome.Solid.PencilAlt, colours.Yellow, () => Edit()); } protected void PresentScore(ScoreInfo score) => From eb62ba09aa8feb6604e16cf32602bd6be0fd769e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 2 Feb 2023 16:20:36 +0900 Subject: [PATCH 43/66] Completely refactor to match project code standards --- .../TestSceneDrumTouchInputArea.cs | 25 ++- .../UI/DrumTouchInputArea.cs | 209 +++++++++--------- 2 files changed, 121 insertions(+), 113 deletions(-) diff --git a/osu.Game.Rulesets.Taiko.Tests/TestSceneDrumTouchInputArea.cs b/osu.Game.Rulesets.Taiko.Tests/TestSceneDrumTouchInputArea.cs index 23b871dcd8..5fb85df82b 100644 --- a/osu.Game.Rulesets.Taiko.Tests/TestSceneDrumTouchInputArea.cs +++ b/osu.Game.Rulesets.Taiko.Tests/TestSceneDrumTouchInputArea.cs @@ -2,6 +2,9 @@ // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; +using osu.Framework.Allocation; +using osu.Framework.Bindables; +using osu.Framework.Extensions.ObjectExtensions; using osu.Framework.Graphics; using osu.Game.Rulesets.Taiko.Configuration; using osu.Game.Rulesets.Taiko.UI; @@ -14,7 +17,16 @@ namespace osu.Game.Rulesets.Taiko.Tests { private DrumTouchInputArea drumTouchInputArea = null!; - private void createDrum(TaikoTouchControlScheme forcedControlScheme) + private readonly Bindable controlScheme = new Bindable(); + + [BackgroundDependencyLoader] + private void load() + { + var config = (TaikoRulesetConfigManager)RulesetConfigs.GetConfigFor(Ruleset.Value.CreateInstance()).AsNonNull(); + config.BindWith(TaikoRulesetSetting.TouchControlScheme, controlScheme); + } + + private void createDrum() { Child = new TaikoInputManager(new TaikoRuleset().RulesetInfo) { @@ -31,7 +43,6 @@ namespace osu.Game.Rulesets.Taiko.Tests { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, - ForceControlScheme = forcedControlScheme } } }; @@ -40,12 +51,12 @@ namespace osu.Game.Rulesets.Taiko.Tests [Test] public void TestDrum() { - AddStep("create drum (kddk)", () => createDrum(TaikoTouchControlScheme.KDDK)); - AddStep("show drum", () => drumTouchInputArea.Show()); - AddStep("create drum (ddkk)", () => createDrum(TaikoTouchControlScheme.DDKK)); - AddStep("show drum", () => drumTouchInputArea.Show()); - AddStep("create drum (kkdd)", () => createDrum(TaikoTouchControlScheme.KKDD)); + AddStep("create drum", createDrum); AddStep("show drum", () => drumTouchInputArea.Show()); + + AddStep("change scheme (kddk)", () => controlScheme.Value = TaikoTouchControlScheme.KDDK); + AddStep("change scheme (kkdd)", () => controlScheme.Value = TaikoTouchControlScheme.KKDD); + AddStep("change scheme (ddkk)", () => controlScheme.Value = TaikoTouchControlScheme.DDKK); } protected override Ruleset CreateRuleset() => new TaikoRuleset(); diff --git a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs index e4c20dd1bf..a7a02895da 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs @@ -24,8 +24,6 @@ namespace osu.Game.Rulesets.Taiko.UI /// public partial class DrumTouchInputArea : VisibilityContainer { - public TaikoTouchControlScheme? ForceControlScheme { get; set; } - // visibility state affects our child. we always want to handle input. public override bool PropagatePositionalInputSubTree => true; public override bool PropagateNonPositionalInputSubTree => true; @@ -43,27 +41,6 @@ namespace osu.Game.Rulesets.Taiko.UI private readonly Bindable configTouchControlScheme = new Bindable(); - [Resolved] - private OsuColour colours { get; set; } = null!; - - private class DrumSegmentProperties - { - public TaikoAction TaikoAction { get; set; } - public Color4 Color { get; set; } - - public DrumSegmentProperties(TaikoAction taikoAction, Color4 color) - { - TaikoAction = taikoAction; - Color = color; - } - } - - private DrumSegmentProperties getDrumSegmentProperties(int drumSegment) - { - var taikoAction = getTaikoActionFromDrumSegment(drumSegment); - return new DrumSegmentProperties(taikoAction, getColourFromTaikoAction(taikoAction)); - } - [BackgroundDependencyLoader] private void load(TaikoInputManager taikoInputManager, TaikoRulesetConfigManager config) { @@ -76,14 +53,6 @@ namespace osu.Game.Rulesets.Taiko.UI const float centre_region = 0.80f; - if (ForceControlScheme == null) - { - config.BindWith(TaikoRulesetSetting.TouchControlScheme, configTouchControlScheme); - configTouchControlScheme.ValueChanged += reloadTouchDrums; - } - else - configTouchControlScheme.Value = ForceControlScheme.Value; - Children = new Drawable[] { new Container @@ -102,27 +71,27 @@ namespace osu.Game.Rulesets.Taiko.UI RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - leftRim = new DrumSegment(getDrumSegmentProperties(0)) + leftRim = new DrumSegment(TaikoAction.LeftRim) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, X = -2, }, - leftCentre = new DrumSegment(getDrumSegmentProperties(1)) + leftCentre = new DrumSegment(TaikoAction.LeftCentre) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, X = -2, Scale = new Vector2(centre_region), }, - rightRim = new DrumSegment(getDrumSegmentProperties(3)) + rightRim = new DrumSegment(TaikoAction.RightCentre) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, X = 2, Rotation = 90, }, - rightCentre = new DrumSegment(getDrumSegmentProperties(2)) + rightCentre = new DrumSegment(TaikoAction.RightRim) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, @@ -135,36 +104,17 @@ namespace osu.Game.Rulesets.Taiko.UI } }, }; - } - private readonly TaikoAction[,] mappedTaikoAction = - { + config.BindWith(TaikoRulesetSetting.TouchControlScheme, configTouchControlScheme); + configTouchControlScheme.BindValueChanged(scheme => { - // KDDK - TaikoAction.LeftRim, - TaikoAction.LeftCentre, - TaikoAction.RightCentre, - TaikoAction.RightRim - }, - { - // DDKK - TaikoAction.LeftCentre, - TaikoAction.RightCentre, - TaikoAction.LeftRim, - TaikoAction.RightRim - }, - { - // KKDD - TaikoAction.LeftRim, - TaikoAction.RightRim, - TaikoAction.LeftCentre, - TaikoAction.RightCentre - } - }; + var actions = getOrderedActionsForScheme(scheme.NewValue); - private TaikoAction getTaikoActionFromDrumSegment(int drumSegment) - { - return mappedTaikoAction[(int)configTouchControlScheme.Value, drumSegment]; + leftRim.Action = actions[0]; + leftCentre.Action = actions[1]; + rightCentre.Action = actions[2]; + rightRim.Action = actions[3]; + }, true); } protected override bool OnKeyDown(KeyDownEvent e) @@ -186,6 +136,42 @@ namespace osu.Game.Rulesets.Taiko.UI base.OnTouchUp(e); } + private static TaikoAction[] getOrderedActionsForScheme(TaikoTouchControlScheme scheme) + { + switch (scheme) + { + case TaikoTouchControlScheme.KDDK: + return new[] + { + TaikoAction.LeftRim, + TaikoAction.LeftCentre, + TaikoAction.RightCentre, + TaikoAction.RightRim + }; + + case TaikoTouchControlScheme.DDKK: + return new[] + { + TaikoAction.LeftCentre, + TaikoAction.RightCentre, + TaikoAction.LeftRim, + TaikoAction.RightRim + }; + + case TaikoTouchControlScheme.KKDD: + return new[] + { + TaikoAction.LeftRim, + TaikoAction.RightRim, + TaikoAction.LeftCentre, + TaikoAction.RightCentre + }; + + default: + throw new ArgumentOutOfRangeException(nameof(scheme), scheme, null); + } + } + private void handleDown(object source, Vector2 position) { Show(); @@ -213,14 +199,11 @@ namespace osu.Game.Rulesets.Taiko.UI { bool centreHit = leftCentre.Contains(inputPosition) || rightCentre.Contains(inputPosition); bool leftSide = ToLocalSpace(inputPosition).X < DrawWidth / 2; - int drumSegment; if (leftSide) - drumSegment = centreHit ? 1 : 0; - else - drumSegment = centreHit ? 2 : 3; + return centreHit ? leftCentre.Action : leftRim.Action; - return getTaikoActionFromDrumSegment(drumSegment); + return centreHit ? rightCentre.Action : rightRim.Action; } protected override void PopIn() @@ -233,44 +216,44 @@ namespace osu.Game.Rulesets.Taiko.UI mainContent.FadeOut(300); } - private Color4 getColourFromTaikoAction(TaikoAction handledAction) - { - switch (handledAction) - { - case TaikoAction.LeftRim: - case TaikoAction.RightRim: - - return colours.Blue; - - case TaikoAction.LeftCentre: - case TaikoAction.RightCentre: - - return colours.Red; - } - - throw new ArgumentOutOfRangeException(); - } - private partial class DrumSegment : CompositeDrawable, IKeyBindingHandler { - private TaikoAction handledAction; + private TaikoAction action; - private readonly Circle overlay; + public TaikoAction Action + { + get => action; + set + { + if (action == value) + return; - private readonly Circle circle; + action = value; + updateColoursFromAction(); + } + } + + private Circle overlay = null!; + + private Circle circle = null!; + + [Resolved] + private OsuColour colours { get; set; } = null!; public override bool Contains(Vector2 screenSpacePos) => circle.Contains(screenSpacePos); - public DrumSegment(DrumSegmentProperties properties) + public DrumSegment(TaikoAction action) { - handledAction = properties.TaikoAction; + Action = action; RelativeSizeAxes = Axes.Both; FillMode = FillMode.Fit; + } - var colour = properties.Color; - + [BackgroundDependencyLoader] + private void load() + { InternalChildren = new Drawable[] { new Container @@ -282,7 +265,6 @@ namespace osu.Game.Rulesets.Taiko.UI circle = new Circle { RelativeSizeAxes = Axes.Both, - Colour = colour.Multiply(1.4f).Darken(2.8f), Alpha = 0.8f, Scale = new Vector2(2), }, @@ -291,7 +273,6 @@ namespace osu.Game.Rulesets.Taiko.UI Alpha = 0, RelativeSizeAxes = Axes.Both, Blending = BlendingParameters.Additive, - Colour = colour, Scale = new Vector2(2), } } @@ -299,36 +280,52 @@ namespace osu.Game.Rulesets.Taiko.UI }; } + protected override void LoadComplete() + { + base.LoadComplete(); + + updateColoursFromAction(); + } + public bool OnPressed(KeyBindingPressEvent e) { - if (e.Action == handledAction) + if (e.Action == Action) overlay.FadeTo(1f, 80, Easing.OutQuint); return false; } public void OnReleased(KeyBindingReleaseEvent e) { - if (e.Action == handledAction) + if (e.Action == Action) overlay.FadeOut(1000, Easing.OutQuint); } - public void SetProperties(DrumSegmentProperties properties) + private void updateColoursFromAction() { - handledAction = properties.TaikoAction; + if (!IsLoaded) + return; - var colour = properties.Color; + var colour = getColourFromTaikoAction(action); circle.Colour = colour.Multiply(1.4f).Darken(2.8f); overlay.Colour = colour; } - } - private void reloadTouchDrums(object _) - { - leftRim.SetProperties(getDrumSegmentProperties(0)); - leftCentre.SetProperties(getDrumSegmentProperties(1)); - rightRim.SetProperties(getDrumSegmentProperties(3)); - rightCentre.SetProperties(getDrumSegmentProperties(2)); + private Color4 getColourFromTaikoAction(TaikoAction handledAction) + { + switch (handledAction) + { + case TaikoAction.LeftRim: + case TaikoAction.RightRim: + return colours.Blue; + + case TaikoAction.LeftCentre: + case TaikoAction.RightCentre: + return colours.Pink; + } + + throw new ArgumentOutOfRangeException(); + } } } } From ffbaf453f8c21e8722345f80c6a4cee6f6064a4f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 2 Feb 2023 16:25:23 +0900 Subject: [PATCH 44/66] Revert misordered drawable order This will completely change the visual appearance of this control... not sure why it was changed. --- osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs index a7a02895da..cf697cf061 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs @@ -77,13 +77,6 @@ namespace osu.Game.Rulesets.Taiko.UI Origin = Anchor.BottomRight, X = -2, }, - leftCentre = new DrumSegment(TaikoAction.LeftCentre) - { - Anchor = Anchor.BottomCentre, - Origin = Anchor.BottomRight, - X = -2, - Scale = new Vector2(centre_region), - }, rightRim = new DrumSegment(TaikoAction.RightCentre) { Anchor = Anchor.BottomCentre, @@ -91,6 +84,13 @@ namespace osu.Game.Rulesets.Taiko.UI X = 2, Rotation = 90, }, + leftCentre = new DrumSegment(TaikoAction.LeftCentre) + { + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomRight, + X = -2, + Scale = new Vector2(centre_region), + }, rightCentre = new DrumSegment(TaikoAction.RightRim) { Anchor = Anchor.BottomCentre, From 843d9914c49c8c98c93fb7e5e0716e443ac972ab Mon Sep 17 00:00:00 2001 From: tsrk Date: Thu, 2 Feb 2023 08:18:56 +0000 Subject: [PATCH 45/66] quality: remove new line --- osu.Game/Localisation/JudgementCounterDisplayStrings.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Localisation/JudgementCounterDisplayStrings.cs b/osu.Game/Localisation/JudgementCounterDisplayStrings.cs index fbc22e96fd..aeba06b2e7 100644 --- a/osu.Game/Localisation/JudgementCounterDisplayStrings.cs +++ b/osu.Game/Localisation/JudgementCounterDisplayStrings.cs @@ -47,4 +47,3 @@ namespace osu.Game.Localisation private static string getKey(string key) => $"{prefix}:{key}"; } } - From 015f4f2b388a5de891f1fb58f6d3eb536e0dc8e1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 2 Feb 2023 18:42:33 +0900 Subject: [PATCH 46/66] Avoid showing skin save message when changing scenes after making no changes --- osu.Game/Overlays/SkinEditor/SkinEditor.cs | 9 +++++---- .../Overlays/SkinEditor/SkinEditorOverlay.cs | 2 +- osu.Game/Skinning/SkinImporter.cs | 16 ++++++++++++++-- osu.Game/Skinning/SkinManager.cs | 8 ++++++-- 4 files changed, 26 insertions(+), 9 deletions(-) diff --git a/osu.Game/Overlays/SkinEditor/SkinEditor.cs b/osu.Game/Overlays/SkinEditor/SkinEditor.cs index ad89057d12..4ef45b8df5 100644 --- a/osu.Game/Overlays/SkinEditor/SkinEditor.cs +++ b/osu.Game/Overlays/SkinEditor/SkinEditor.cs @@ -125,7 +125,7 @@ namespace osu.Game.Overlays.SkinEditor { Items = new[] { - new EditorMenuItem(Resources.Localisation.Web.CommonStrings.ButtonsSave, MenuItemType.Standard, Save), + new EditorMenuItem(Resources.Localisation.Web.CommonStrings.ButtonsSave, MenuItemType.Standard, () => Save()), new EditorMenuItem(CommonStrings.RevertToDefault, MenuItemType.Destructive, revert), new EditorMenuItemSpacer(), new EditorMenuItem(CommonStrings.Exit, MenuItemType.Standard, () => skinEditorOverlay?.Hide()), @@ -333,7 +333,7 @@ namespace osu.Game.Overlays.SkinEditor } } - public void Save() + public void Save(bool userTriggered = true) { if (!hasBegunMutating) return; @@ -343,8 +343,9 @@ namespace osu.Game.Overlays.SkinEditor foreach (var t in targetContainers) currentSkin.Value.UpdateDrawableTarget(t); - skins.Save(skins.CurrentSkin.Value); - onScreenDisplay?.Display(new SkinEditorToast(ToastStrings.SkinSaved, currentSkin.Value.SkinInfo.ToString() ?? "Unknown")); + // In the case the save was user triggered, always show the save message to make them feel confident. + if (skins.Save(skins.CurrentSkin.Value) || userTriggered) + onScreenDisplay?.Display(new SkinEditorToast(ToastStrings.SkinSaved, currentSkin.Value.SkinInfo.ToString() ?? "Unknown")); } protected override bool OnHover(HoverEvent e) => true; diff --git a/osu.Game/Overlays/SkinEditor/SkinEditorOverlay.cs b/osu.Game/Overlays/SkinEditor/SkinEditorOverlay.cs index 4eff87c5f4..b8da3e3f67 100644 --- a/osu.Game/Overlays/SkinEditor/SkinEditorOverlay.cs +++ b/osu.Game/Overlays/SkinEditor/SkinEditorOverlay.cs @@ -147,7 +147,7 @@ namespace osu.Game.Overlays.SkinEditor if (skinEditor == null) return; - skinEditor.Save(); + skinEditor.Save(false); // ensure the toolbar is re-hidden even if a new screen decides to try and show it. updateComponentVisibility(); diff --git a/osu.Game/Skinning/SkinImporter.cs b/osu.Game/Skinning/SkinImporter.cs index 1685562cc7..7485a89404 100644 --- a/osu.Game/Skinning/SkinImporter.cs +++ b/osu.Game/Skinning/SkinImporter.cs @@ -179,8 +179,14 @@ namespace osu.Game.Skinning private Skin createInstance(SkinInfo item) => item.CreateInstance(skinResources); - public void Save(Skin skin) + /// + /// Save a skin. Updates any drawable layouts that are out of date. + /// + /// Whether any change actually occurred. + public bool Save(Skin skin) { + bool hadChanges = false; + skin.SkinInfo.PerformWrite(s => { // Update for safety @@ -212,8 +218,14 @@ namespace osu.Game.Skinning } } - s.Hash = ComputeHash(s); + string newHash = ComputeHash(s); + + hadChanges = newHash != s.Hash; + + s.Hash = newHash; }); + + return hadChanges; } } } diff --git a/osu.Game/Skinning/SkinManager.cs b/osu.Game/Skinning/SkinManager.cs index a4cf83b32e..70173d9c2a 100644 --- a/osu.Game/Skinning/SkinManager.cs +++ b/osu.Game/Skinning/SkinManager.cs @@ -192,12 +192,16 @@ namespace osu.Game.Skinning }); } - public void Save(Skin skin) + /// + /// Save a skin. Updates any drawable layouts that are out of date. + /// + /// Whether any change actually occurred. + public bool Save(Skin skin) { if (!skin.SkinInfo.IsManaged) throw new InvalidOperationException($"Attempting to save a skin which is not yet tracked. Call {nameof(EnsureMutableSkin)} first."); - skinImporter.Save(skin); + return skinImporter.Save(skin); } /// From 23e9bdd5543b40b8054d88b8636aafee18c043c1 Mon Sep 17 00:00:00 2001 From: Wleter Date: Thu, 2 Feb 2023 14:22:30 +0100 Subject: [PATCH 47/66] check every snap position in blueprint --- .../Edit/OsuHitObjectComposer.cs | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs index 09ddc420a7..8a1d8f597c 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs @@ -187,28 +187,18 @@ namespace osu.Game.Rulesets.Osu.Edit if (b.IsSelected) continue; - var hitObject = (OsuHitObject)b.Item; + var snapPositions = b.ScreenSpaceSnapPoints; - Vector2? snap = checkSnap(hitObject.Position); - if (snap == null && hitObject.Position != hitObject.EndPosition) - snap = checkSnap(hitObject.EndPosition); + var filteredSnapPositions = snapPositions.Cast().FirstOrDefault(p => Vector2.Distance(p.Value, screenSpacePosition) < snapRadius); - if (snap != null) + if (filteredSnapPositions.HasValue) { + var snap = filteredSnapPositions.Value; + // only return distance portion, since time is not really valid - snapResult = new SnapResult(snap.Value, null, playfield); + snapResult = new SnapResult(snap, null, playfield); return true; } - - Vector2? checkSnap(Vector2 checkPos) - { - Vector2 checkScreenPos = playfield.GamefieldToScreenSpace(checkPos); - - if (Vector2.Distance(checkScreenPos, screenSpacePosition) < snapRadius) - return checkScreenPos; - - return null; - } } snapResult = null; From f7094567d7268ca663a34b10af4ff1dd182e886c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 3 Feb 2023 15:04:47 +0900 Subject: [PATCH 48/66] Rename and document method to limit scope --- .../Screens/Select/Carousel/DrawableCarouselBeatmap.cs | 2 +- osu.Game/Screens/Select/PlaySongSelect.cs | 6 +++--- osu.Game/Screens/Select/SongSelect.cs | 10 ++++++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs index 94a91205b9..f08d14720b 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs @@ -85,7 +85,7 @@ namespace osu.Game.Screens.Select.Carousel if (songSelect != null) { - mainMenuItems = songSelect.CreateMenuItemsForBeatmap(beatmapInfo); + mainMenuItems = songSelect.CreateForwardNavigationMenuItemsForBeatmap(beatmapInfo); selectRequested = b => songSelect.FinaliseSelection(b); } diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index b855325d00..b99d949b43 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -34,10 +34,10 @@ namespace osu.Game.Screens.Select public override bool AllowExternalScreenChange => true; - public override MenuItem[] CreateMenuItemsForBeatmap(BeatmapInfo b) => new MenuItem[] + public override MenuItem[] CreateForwardNavigationMenuItemsForBeatmap(BeatmapInfo beatmap) => new MenuItem[] { - new OsuMenuItem(ButtonSystemStrings.Play.ToSentence(), MenuItemType.Highlighted, () => FinaliseSelection(b)), - new OsuMenuItem(ButtonSystemStrings.Edit.ToSentence(), MenuItemType.Standard, () => Edit(b)) + new OsuMenuItem(ButtonSystemStrings.Play.ToSentence(), MenuItemType.Highlighted, () => FinaliseSelection(beatmap)), + new OsuMenuItem(ButtonSystemStrings.Edit.ToSentence(), MenuItemType.Standard, () => Edit(beatmap)) }; protected override UserActivity InitialActivity => new UserActivity.ChoosingBeatmap(); diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 56616ea323..8786821c77 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -84,9 +84,15 @@ namespace osu.Game.Screens.Select public bool BeatmapSetsLoaded => IsLoaded && Carousel.BeatmapSetsLoaded; - public virtual MenuItem[] CreateMenuItemsForBeatmap(BeatmapInfo b) => new MenuItem[] + /// + /// Creates any "action" menu items for the provided beatmap (ie. "Select", "Play", "Edit"). + /// These will always be placed at the top of the context menu, with common items added below them. + /// + /// The beatmap to create items for. + /// The menu items. + public virtual MenuItem[] CreateForwardNavigationMenuItemsForBeatmap(BeatmapInfo beatmap) => new MenuItem[] { - new OsuMenuItem(@"Select", MenuItemType.Highlighted, () => FinaliseSelection(b)) + new OsuMenuItem(@"Select", MenuItemType.Highlighted, () => FinaliseSelection(beatmap)) }; [Resolved] From 9c954a93e322095781571638e94beb21e9b710b2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 3 Feb 2023 15:18:01 +0900 Subject: [PATCH 49/66] Update `Save` method xmldoc to make more sense --- osu.Game/Skinning/SkinImporter.cs | 2 +- osu.Game/Skinning/SkinManager.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Skinning/SkinImporter.cs b/osu.Game/Skinning/SkinImporter.cs index 7485a89404..8ce265719c 100644 --- a/osu.Game/Skinning/SkinImporter.cs +++ b/osu.Game/Skinning/SkinImporter.cs @@ -180,7 +180,7 @@ namespace osu.Game.Skinning private Skin createInstance(SkinInfo item) => item.CreateInstance(skinResources); /// - /// Save a skin. Updates any drawable layouts that are out of date. + /// Save a skin, serialising any changes to skin layouts to relevant JSON structures. /// /// Whether any change actually occurred. public bool Save(Skin skin) diff --git a/osu.Game/Skinning/SkinManager.cs b/osu.Game/Skinning/SkinManager.cs index 70173d9c2a..fca7dc0f5e 100644 --- a/osu.Game/Skinning/SkinManager.cs +++ b/osu.Game/Skinning/SkinManager.cs @@ -193,7 +193,7 @@ namespace osu.Game.Skinning } /// - /// Save a skin. Updates any drawable layouts that are out of date. + /// Save a skin, serialising any changes to skin layouts to relevant JSON structures. /// /// Whether any change actually occurred. public bool Save(Skin skin) From 5ca5f04794791bc1e7b79b7d1ee7ae42dd4d74ce Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 3 Feb 2023 15:18:40 +0900 Subject: [PATCH 50/66] Add parameter hint for optional `bool` value --- osu.Game/Overlays/SkinEditor/SkinEditorOverlay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/SkinEditor/SkinEditorOverlay.cs b/osu.Game/Overlays/SkinEditor/SkinEditorOverlay.cs index b8da3e3f67..c87e60e47f 100644 --- a/osu.Game/Overlays/SkinEditor/SkinEditorOverlay.cs +++ b/osu.Game/Overlays/SkinEditor/SkinEditorOverlay.cs @@ -147,7 +147,7 @@ namespace osu.Game.Overlays.SkinEditor if (skinEditor == null) return; - skinEditor.Save(false); + skinEditor.Save(userTriggered: false); // ensure the toolbar is re-hidden even if a new screen decides to try and show it. updateComponentVisibility(); From 50559643bbb4f104fda7e7a577afbf26b755bdb3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 3 Feb 2023 15:27:11 +0900 Subject: [PATCH 51/66] Fix incorrectly applied enum localisation --- osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs b/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs index 3507987fe4..f380165a66 100644 --- a/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs +++ b/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs @@ -507,7 +507,7 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters [LocalisableDescription(typeof(BarHitErrorMeterStrings), nameof(BarHitErrorMeterStrings.LabelStylesIcons))] Icons, - [LocalisableDescription(typeof(BarHitErrorMeterStrings), nameof(BarHitErrorMeterStrings.LabelStylesIcons))] + [LocalisableDescription(typeof(BarHitErrorMeterStrings), nameof(BarHitErrorMeterStrings.LabelStylesText))] Text } } From cf8cfe0d2c7678f316faddc77eaff5d787bce6c6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 3 Feb 2023 15:34:57 +0900 Subject: [PATCH 52/66] Move skin component localisations to namespaces --- osu.Game/Localisation/{ => HUD}/BarHitErrorMeterStrings.cs | 4 ++-- osu.Game/Localisation/{ => HUD}/ColourHitErrorMeterStrings.cs | 4 ++-- .../Localisation/{ => HUD}/GameplayAccuracyCounterStrings.cs | 4 ++-- .../Localisation/{ => HUD}/JudgementCounterDisplayStrings.cs | 4 ++-- osu.Game/Localisation/{ => HUD}/SongProgressStrings.cs | 4 ++-- .../{ => SkinComponents}/BeatmapAttributeTextStrings.cs | 4 ++-- .../FontAdjustableSkinComponentStrings.cs | 4 ++-- .../{ => SkinComponents}/SkinnableSpriteStrings.cs | 4 ++-- .../Localisation/{ => SkinComponents}/TextElementStrings.cs | 4 ++-- osu.Game/Screens/Play/HUD/ArgonSongProgress.cs | 2 +- osu.Game/Screens/Play/HUD/DefaultSongProgress.cs | 2 +- osu.Game/Screens/Play/HUD/GameplayAccuracyCounter.cs | 2 +- osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs | 2 +- .../Screens/Play/HUD/HitErrorMeters/ColourHitErrorMeter.cs | 2 +- .../Play/HUD/JudgementCounter/JudgementCounterDisplay.cs | 2 +- osu.Game/Skinning/Components/BeatmapAttributeText.cs | 1 + osu.Game/Skinning/Components/TextElement.cs | 2 +- osu.Game/Skinning/FontAdjustableSkinComponent.cs | 2 +- osu.Game/Skinning/SkinnableSprite.cs | 2 +- 19 files changed, 28 insertions(+), 27 deletions(-) rename osu.Game/Localisation/{ => HUD}/BarHitErrorMeterStrings.cs (98%) rename osu.Game/Localisation/{ => HUD}/ColourHitErrorMeterStrings.cs (97%) rename osu.Game/Localisation/{ => HUD}/GameplayAccuracyCounterStrings.cs (95%) rename osu.Game/Localisation/{ => HUD}/JudgementCounterDisplayStrings.cs (96%) rename osu.Game/Localisation/{ => HUD}/SongProgressStrings.cs (93%) rename osu.Game/Localisation/{ => SkinComponents}/BeatmapAttributeTextStrings.cs (93%) rename osu.Game/Localisation/{ => SkinComponents}/FontAdjustableSkinComponentStrings.cs (88%) rename osu.Game/Localisation/{ => SkinComponents}/SkinnableSpriteStrings.cs (90%) rename osu.Game/Localisation/{ => SkinComponents}/TextElementStrings.cs (90%) diff --git a/osu.Game/Localisation/BarHitErrorMeterStrings.cs b/osu.Game/Localisation/HUD/BarHitErrorMeterStrings.cs similarity index 98% rename from osu.Game/Localisation/BarHitErrorMeterStrings.cs rename to osu.Game/Localisation/HUD/BarHitErrorMeterStrings.cs index 171c3e223e..2f77a287a0 100644 --- a/osu.Game/Localisation/BarHitErrorMeterStrings.cs +++ b/osu.Game/Localisation/HUD/BarHitErrorMeterStrings.cs @@ -3,11 +3,11 @@ using osu.Framework.Localisation; -namespace osu.Game.Localisation +namespace osu.Game.Localisation.HUD { public static class BarHitErrorMeterStrings { - private const string prefix = @"osu.Game.Resources.Localisation.BarHitErrorMeter"; + private const string prefix = @"osu.Game.Resources.Localisation.HUD.BarHitErrorMeter"; /// /// "Judgement line thickness" diff --git a/osu.Game/Localisation/ColourHitErrorMeterStrings.cs b/osu.Game/Localisation/HUD/ColourHitErrorMeterStrings.cs similarity index 97% rename from osu.Game/Localisation/ColourHitErrorMeterStrings.cs rename to osu.Game/Localisation/HUD/ColourHitErrorMeterStrings.cs index 13682c9c85..8fdcb34a49 100644 --- a/osu.Game/Localisation/ColourHitErrorMeterStrings.cs +++ b/osu.Game/Localisation/HUD/ColourHitErrorMeterStrings.cs @@ -3,11 +3,11 @@ using osu.Framework.Localisation; -namespace osu.Game.Localisation +namespace osu.Game.Localisation.HUD { public static class ColourHitErrorMeterStrings { - private const string prefix = @"osu.Game.Resources.Localisation.ColourHitError"; + private const string prefix = @"osu.Game.Resources.Localisation.HUD.ColourHitError"; /// /// "Judgement count" diff --git a/osu.Game/Localisation/GameplayAccuracyCounterStrings.cs b/osu.Game/Localisation/HUD/GameplayAccuracyCounterStrings.cs similarity index 95% rename from osu.Game/Localisation/GameplayAccuracyCounterStrings.cs rename to osu.Game/Localisation/HUD/GameplayAccuracyCounterStrings.cs index c9e936d8af..ec7f4a1af3 100644 --- a/osu.Game/Localisation/GameplayAccuracyCounterStrings.cs +++ b/osu.Game/Localisation/HUD/GameplayAccuracyCounterStrings.cs @@ -3,11 +3,11 @@ using osu.Framework.Localisation; -namespace osu.Game.Localisation +namespace osu.Game.Localisation.HUD { public static class GameplayAccuracyCounterStrings { - private const string prefix = @"osu.Game.Resources.Localisation.GameplayAccuracyCounter"; + private const string prefix = @"osu.Game.Resources.Localisation.HUD.GameplayAccuracyCounter"; /// /// "Accuracy display mode" diff --git a/osu.Game/Localisation/JudgementCounterDisplayStrings.cs b/osu.Game/Localisation/HUD/JudgementCounterDisplayStrings.cs similarity index 96% rename from osu.Game/Localisation/JudgementCounterDisplayStrings.cs rename to osu.Game/Localisation/HUD/JudgementCounterDisplayStrings.cs index aeba06b2e7..b1c756e48e 100644 --- a/osu.Game/Localisation/JudgementCounterDisplayStrings.cs +++ b/osu.Game/Localisation/HUD/JudgementCounterDisplayStrings.cs @@ -3,11 +3,11 @@ using osu.Framework.Localisation; -namespace osu.Game.Localisation +namespace osu.Game.Localisation.HUD { public static class JudgementCounterDisplayStrings { - private const string prefix = @"osu.Game.Resources.Localisation.JudgementCounterDisplay"; + private const string prefix = @"osu.Game.Resources.Localisation.HUD.JudgementCounterDisplay"; /// /// "Display mode" diff --git a/osu.Game/Localisation/SongProgressStrings.cs b/osu.Game/Localisation/HUD/SongProgressStrings.cs similarity index 93% rename from osu.Game/Localisation/SongProgressStrings.cs rename to osu.Game/Localisation/HUD/SongProgressStrings.cs index 033560ebb0..4c621e8e8c 100644 --- a/osu.Game/Localisation/SongProgressStrings.cs +++ b/osu.Game/Localisation/HUD/SongProgressStrings.cs @@ -3,11 +3,11 @@ using osu.Framework.Localisation; -namespace osu.Game.Localisation +namespace osu.Game.Localisation.HUD { public static class SongProgressStrings { - private const string prefix = @"osu.Game.Resources.Localisation.SongProgress"; + private const string prefix = @"osu.Game.Resources.Localisation.HUD.SongProgress"; /// /// "Show difficulty graph" diff --git a/osu.Game/Localisation/BeatmapAttributeTextStrings.cs b/osu.Game/Localisation/SkinComponents/BeatmapAttributeTextStrings.cs similarity index 93% rename from osu.Game/Localisation/BeatmapAttributeTextStrings.cs rename to osu.Game/Localisation/SkinComponents/BeatmapAttributeTextStrings.cs index 1ceb482cf4..b2e2285faf 100644 --- a/osu.Game/Localisation/BeatmapAttributeTextStrings.cs +++ b/osu.Game/Localisation/SkinComponents/BeatmapAttributeTextStrings.cs @@ -3,11 +3,11 @@ using osu.Framework.Localisation; -namespace osu.Game.Localisation +namespace osu.Game.Localisation.SkinComponents { public static class BeatmapAttributeTextStrings { - private const string prefix = @"osu.Game.Resources.Localisation.BeatmapAttributeText"; + private const string prefix = @"osu.Game.Resources.Localisation.SkinComponents.BeatmapAttributeText"; /// /// "Attribute" diff --git a/osu.Game/Localisation/FontAdjustableSkinComponentStrings.cs b/osu.Game/Localisation/SkinComponents/FontAdjustableSkinComponentStrings.cs similarity index 88% rename from osu.Game/Localisation/FontAdjustableSkinComponentStrings.cs rename to osu.Game/Localisation/SkinComponents/FontAdjustableSkinComponentStrings.cs index 76f9f2f8b9..8bcc45998a 100644 --- a/osu.Game/Localisation/FontAdjustableSkinComponentStrings.cs +++ b/osu.Game/Localisation/SkinComponents/FontAdjustableSkinComponentStrings.cs @@ -3,11 +3,11 @@ using osu.Framework.Localisation; -namespace osu.Game.Localisation +namespace osu.Game.Localisation.SkinComponents { public static class FontAdjustableSkinComponentStrings { - private const string prefix = @"osu.Game.Resources.Localisation.FontAdjustableSkinComponent"; + private const string prefix = @"osu.Game.Resources.Localisation.SkinComponents.FontAdjustableSkinComponent"; /// /// "Font" diff --git a/osu.Game/Localisation/SkinnableSpriteStrings.cs b/osu.Game/Localisation/SkinComponents/SkinnableSpriteStrings.cs similarity index 90% rename from osu.Game/Localisation/SkinnableSpriteStrings.cs rename to osu.Game/Localisation/SkinComponents/SkinnableSpriteStrings.cs index 6192f5e43d..f039c9044f 100644 --- a/osu.Game/Localisation/SkinnableSpriteStrings.cs +++ b/osu.Game/Localisation/SkinComponents/SkinnableSpriteStrings.cs @@ -3,11 +3,11 @@ using osu.Framework.Localisation; -namespace osu.Game.Localisation +namespace osu.Game.Localisation.SkinComponents { public static class SkinnableSpriteStrings { - private const string prefix = @"osu.Game.Resources.Localisation.SkinnableSprite"; + private const string prefix = @"osu.Game.Resources.Localisation.SkinComponents.SkinnableSprite"; /// /// "Sprite name" diff --git a/osu.Game/Localisation/TextElementStrings.cs b/osu.Game/Localisation/SkinComponents/TextElementStrings.cs similarity index 90% rename from osu.Game/Localisation/TextElementStrings.cs rename to osu.Game/Localisation/SkinComponents/TextElementStrings.cs index 6257b80d72..6417c1d923 100644 --- a/osu.Game/Localisation/TextElementStrings.cs +++ b/osu.Game/Localisation/SkinComponents/TextElementStrings.cs @@ -3,11 +3,11 @@ using osu.Framework.Localisation; -namespace osu.Game.Localisation +namespace osu.Game.Localisation.SkinComponents { public static class TextElementStrings { - private const string prefix = @"osu.Game.Resources.Localisation.TextElement"; + private const string prefix = @"osu.Game.Resources.Localisation.SkinComponents.TextElement"; /// /// "Text" diff --git a/osu.Game/Screens/Play/HUD/ArgonSongProgress.cs b/osu.Game/Screens/Play/HUD/ArgonSongProgress.cs index 6c5ba52f27..9dce8996c3 100644 --- a/osu.Game/Screens/Play/HUD/ArgonSongProgress.cs +++ b/osu.Game/Screens/Play/HUD/ArgonSongProgress.cs @@ -8,7 +8,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Configuration; using osu.Game.Graphics; -using osu.Game.Localisation; +using osu.Game.Localisation.HUD; using osu.Game.Rulesets.Objects; namespace osu.Game.Screens.Play.HUD diff --git a/osu.Game/Screens/Play/HUD/DefaultSongProgress.cs b/osu.Game/Screens/Play/HUD/DefaultSongProgress.cs index fccefd49a4..6eed563703 100644 --- a/osu.Game/Screens/Play/HUD/DefaultSongProgress.cs +++ b/osu.Game/Screens/Play/HUD/DefaultSongProgress.cs @@ -7,7 +7,7 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Configuration; using osu.Game.Graphics; -using osu.Game.Localisation; +using osu.Game.Localisation.HUD; using osu.Game.Rulesets.Objects; using osuTK; diff --git a/osu.Game/Screens/Play/HUD/GameplayAccuracyCounter.cs b/osu.Game/Screens/Play/HUD/GameplayAccuracyCounter.cs index 3a7c97632d..9da032e489 100644 --- a/osu.Game/Screens/Play/HUD/GameplayAccuracyCounter.cs +++ b/osu.Game/Screens/Play/HUD/GameplayAccuracyCounter.cs @@ -6,7 +6,7 @@ using osu.Framework.Bindables; using osu.Framework.Localisation; using osu.Game.Configuration; using osu.Game.Graphics.UserInterface; -using osu.Game.Localisation; +using osu.Game.Localisation.HUD; using osu.Game.Rulesets.Scoring; namespace osu.Game.Screens.Play.HUD diff --git a/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs b/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs index f380165a66..eb5221aa45 100644 --- a/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs +++ b/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs @@ -17,7 +17,7 @@ using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; -using osu.Game.Localisation; +using osu.Game.Localisation.HUD; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Scoring; using osuTK; diff --git a/osu.Game/Screens/Play/HUD/HitErrorMeters/ColourHitErrorMeter.cs b/osu.Game/Screens/Play/HUD/HitErrorMeters/ColourHitErrorMeter.cs index ac49e9ca5e..5793713fca 100644 --- a/osu.Game/Screens/Play/HUD/HitErrorMeters/ColourHitErrorMeter.cs +++ b/osu.Game/Screens/Play/HUD/HitErrorMeters/ColourHitErrorMeter.cs @@ -11,7 +11,7 @@ using osu.Framework.Graphics.Pooling; using osu.Framework.Graphics.Shapes; using osu.Framework.Localisation; using osu.Game.Configuration; -using osu.Game.Localisation; +using osu.Game.Localisation.HUD; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Scoring; using osuTK; diff --git a/osu.Game/Screens/Play/HUD/JudgementCounter/JudgementCounterDisplay.cs b/osu.Game/Screens/Play/HUD/JudgementCounter/JudgementCounterDisplay.cs index 31b0b9ebc5..80d2e0863f 100644 --- a/osu.Game/Screens/Play/HUD/JudgementCounter/JudgementCounterDisplay.cs +++ b/osu.Game/Screens/Play/HUD/JudgementCounter/JudgementCounterDisplay.cs @@ -8,7 +8,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Localisation; using osu.Game.Configuration; -using osu.Game.Localisation; +using osu.Game.Localisation.HUD; using osu.Game.Rulesets.Scoring; using osu.Game.Skinning; using osuTK; diff --git a/osu.Game/Skinning/Components/BeatmapAttributeText.cs b/osu.Game/Skinning/Components/BeatmapAttributeText.cs index e8b2d547a9..2c16a67cac 100644 --- a/osu.Game/Skinning/Components/BeatmapAttributeText.cs +++ b/osu.Game/Skinning/Components/BeatmapAttributeText.cs @@ -18,6 +18,7 @@ using osu.Game.Configuration; using osu.Game.Extensions; using osu.Game.Graphics.Sprites; using osu.Game.Localisation; +using osu.Game.Localisation.SkinComponents; using osu.Game.Resources.Localisation.Web; namespace osu.Game.Skinning.Components diff --git a/osu.Game/Skinning/Components/TextElement.cs b/osu.Game/Skinning/Components/TextElement.cs index c160f3f9d0..1e0a0d0ad1 100644 --- a/osu.Game/Skinning/Components/TextElement.cs +++ b/osu.Game/Skinning/Components/TextElement.cs @@ -8,7 +8,7 @@ using osu.Framework.Graphics.Sprites; using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; -using osu.Game.Localisation; +using osu.Game.Localisation.SkinComponents; namespace osu.Game.Skinning.Components { diff --git a/osu.Game/Skinning/FontAdjustableSkinComponent.cs b/osu.Game/Skinning/FontAdjustableSkinComponent.cs index 9c28621d48..11d3e36d9e 100644 --- a/osu.Game/Skinning/FontAdjustableSkinComponent.cs +++ b/osu.Game/Skinning/FontAdjustableSkinComponent.cs @@ -6,7 +6,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Game.Configuration; using osu.Game.Graphics; -using osu.Game.Localisation; +using osu.Game.Localisation.SkinComponents; namespace osu.Game.Skinning { diff --git a/osu.Game/Skinning/SkinnableSprite.cs b/osu.Game/Skinning/SkinnableSprite.cs index 3deb264bc8..31391755a3 100644 --- a/osu.Game/Skinning/SkinnableSprite.cs +++ b/osu.Game/Skinning/SkinnableSprite.cs @@ -12,7 +12,7 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Game.Configuration; using osu.Game.Graphics.Sprites; -using osu.Game.Localisation; +using osu.Game.Localisation.SkinComponents; using osu.Game.Overlays.Settings; using osuTK; From 92306b912329aec3fdb74a2cf88822b42bf54537 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 3 Feb 2023 16:02:16 +0900 Subject: [PATCH 53/66] Combine localisations for abstract skinnable components into a single file Generally we don't want localisation files with only one to two translations. It makes it harder for translators to handle in crowdin (a lot of file changes for small results). So for cases like this I believe we should be grouping translations where it makes sense. I've left individual components in their own files as I can see potential for more settings to be added in the future. Plus it gives a bit of extra context. --- .../FontAdjustableSkinComponentStrings.cs | 24 ---------- .../SkinnableComponentStrings.cs | 44 +++++++++++++++++++ .../SkinComponents/SkinnableSpriteStrings.cs | 24 ---------- .../SkinComponents/TextElementStrings.cs | 24 ---------- osu.Game/Skinning/Components/TextElement.cs | 2 +- .../Skinning/FontAdjustableSkinComponent.cs | 2 +- osu.Game/Skinning/SkinnableSprite.cs | 2 +- 7 files changed, 47 insertions(+), 75 deletions(-) delete mode 100644 osu.Game/Localisation/SkinComponents/FontAdjustableSkinComponentStrings.cs create mode 100644 osu.Game/Localisation/SkinComponents/SkinnableComponentStrings.cs delete mode 100644 osu.Game/Localisation/SkinComponents/SkinnableSpriteStrings.cs delete mode 100644 osu.Game/Localisation/SkinComponents/TextElementStrings.cs diff --git a/osu.Game/Localisation/SkinComponents/FontAdjustableSkinComponentStrings.cs b/osu.Game/Localisation/SkinComponents/FontAdjustableSkinComponentStrings.cs deleted file mode 100644 index 8bcc45998a..0000000000 --- a/osu.Game/Localisation/SkinComponents/FontAdjustableSkinComponentStrings.cs +++ /dev/null @@ -1,24 +0,0 @@ -// 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.Localisation; - -namespace osu.Game.Localisation.SkinComponents -{ - public static class FontAdjustableSkinComponentStrings - { - private const string prefix = @"osu.Game.Resources.Localisation.SkinComponents.FontAdjustableSkinComponent"; - - /// - /// "Font" - /// - public static LocalisableString Font => new TranslatableString(getKey(@"font"), "Font"); - - /// - /// "The font to use." - /// - public static LocalisableString FontDescription => new TranslatableString(getKey(@"font_description"), "The font to use."); - - private static string getKey(string key) => $"{prefix}:{key}"; - } -} diff --git a/osu.Game/Localisation/SkinComponents/SkinnableComponentStrings.cs b/osu.Game/Localisation/SkinComponents/SkinnableComponentStrings.cs new file mode 100644 index 0000000000..547df86fc7 --- /dev/null +++ b/osu.Game/Localisation/SkinComponents/SkinnableComponentStrings.cs @@ -0,0 +1,44 @@ +// 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.Localisation; + +namespace osu.Game.Localisation.SkinComponents +{ + public static class SkinnableComponentStrings + { + private const string prefix = @"osu.Game.Resources.Localisation.SkinComponents.SkinnableComponentStrings"; + + /// + /// "Sprite name" + /// + public static LocalisableString SpriteName => new TranslatableString(getKey(@"sprite_name"), "Sprite name"); + + /// + /// "The filename of the sprite" + /// + public static LocalisableString SpriteNameDescription => new TranslatableString(getKey(@"sprite_name_description"), "The filename of the sprite"); + + /// + /// "Font" + /// + public static LocalisableString Font => new TranslatableString(getKey(@"font"), "Font"); + + /// + /// "The font to use." + /// + public static LocalisableString FontDescription => new TranslatableString(getKey(@"font_description"), "The font to use."); + + /// + /// "Text" + /// + public static LocalisableString TextElementText => new TranslatableString(getKey(@"text_element_text"), "Text"); + + /// + /// "The text to be displayed." + /// + public static LocalisableString TextElementTextDescription => new TranslatableString(getKey(@"text_element_text_description"), "The text to be displayed."); + + private static string getKey(string key) => $"{prefix}:{key}"; + } +} diff --git a/osu.Game/Localisation/SkinComponents/SkinnableSpriteStrings.cs b/osu.Game/Localisation/SkinComponents/SkinnableSpriteStrings.cs deleted file mode 100644 index f039c9044f..0000000000 --- a/osu.Game/Localisation/SkinComponents/SkinnableSpriteStrings.cs +++ /dev/null @@ -1,24 +0,0 @@ -// 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.Localisation; - -namespace osu.Game.Localisation.SkinComponents -{ - public static class SkinnableSpriteStrings - { - private const string prefix = @"osu.Game.Resources.Localisation.SkinComponents.SkinnableSprite"; - - /// - /// "Sprite name" - /// - public static LocalisableString SpriteName => new TranslatableString(getKey(@"sprite_name"), "Sprite name"); - - /// - /// "The filename of the sprite" - /// - public static LocalisableString SpriteNameDescription => new TranslatableString(getKey(@"sprite_name_description"), "The filename of the sprite"); - - private static string getKey(string key) => $"{prefix}:{key}"; - } -} diff --git a/osu.Game/Localisation/SkinComponents/TextElementStrings.cs b/osu.Game/Localisation/SkinComponents/TextElementStrings.cs deleted file mode 100644 index 6417c1d923..0000000000 --- a/osu.Game/Localisation/SkinComponents/TextElementStrings.cs +++ /dev/null @@ -1,24 +0,0 @@ -// 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.Localisation; - -namespace osu.Game.Localisation.SkinComponents -{ - public static class TextElementStrings - { - private const string prefix = @"osu.Game.Resources.Localisation.SkinComponents.TextElement"; - - /// - /// "Text" - /// - public static LocalisableString TextElementText => new TranslatableString(getKey(@"text_element_text"), "Text"); - - /// - /// "The text to be displayed." - /// - public static LocalisableString TextElementTextDescription => new TranslatableString(getKey(@"text_element_text_description"), "The text to be displayed."); - - private static string getKey(string key) => $"{prefix}:{key}"; - } -} diff --git a/osu.Game/Skinning/Components/TextElement.cs b/osu.Game/Skinning/Components/TextElement.cs index 1e0a0d0ad1..936f6a529b 100644 --- a/osu.Game/Skinning/Components/TextElement.cs +++ b/osu.Game/Skinning/Components/TextElement.cs @@ -15,7 +15,7 @@ namespace osu.Game.Skinning.Components [UsedImplicitly] public partial class TextElement : FontAdjustableSkinComponent { - [SettingSource(typeof(TextElementStrings), nameof(TextElementStrings.TextElementText), nameof(TextElementStrings.TextElementTextDescription))] + [SettingSource(typeof(SkinnableComponentStrings), nameof(SkinnableComponentStrings.TextElementText), nameof(SkinnableComponentStrings.TextElementTextDescription))] public Bindable Text { get; } = new Bindable("Circles!"); private readonly OsuSpriteText text; diff --git a/osu.Game/Skinning/FontAdjustableSkinComponent.cs b/osu.Game/Skinning/FontAdjustableSkinComponent.cs index 11d3e36d9e..2e41b35abb 100644 --- a/osu.Game/Skinning/FontAdjustableSkinComponent.cs +++ b/osu.Game/Skinning/FontAdjustableSkinComponent.cs @@ -17,7 +17,7 @@ namespace osu.Game.Skinning { public bool UsesFixedAnchor { get; set; } - [SettingSource(typeof(FontAdjustableSkinComponentStrings), nameof(FontAdjustableSkinComponentStrings.Font), nameof(FontAdjustableSkinComponentStrings.FontDescription))] + [SettingSource(typeof(SkinnableComponentStrings), nameof(SkinnableComponentStrings.Font), nameof(SkinnableComponentStrings.FontDescription))] public Bindable Font { get; } = new Bindable(Typeface.Torus); /// diff --git a/osu.Game/Skinning/SkinnableSprite.cs b/osu.Game/Skinning/SkinnableSprite.cs index 31391755a3..c3449562c3 100644 --- a/osu.Game/Skinning/SkinnableSprite.cs +++ b/osu.Game/Skinning/SkinnableSprite.cs @@ -28,7 +28,7 @@ namespace osu.Game.Skinning [Resolved] private TextureStore textures { get; set; } = null!; - [SettingSource(typeof(SkinnableSpriteStrings), nameof(SkinnableSpriteStrings.SpriteName), nameof(SkinnableSpriteStrings.SpriteNameDescription), SettingControlType = typeof(SpriteSelectorControl))] + [SettingSource(typeof(SkinnableComponentStrings), nameof(SkinnableComponentStrings.SpriteName), nameof(SkinnableComponentStrings.SpriteNameDescription), SettingControlType = typeof(SpriteSelectorControl))] public Bindable SpriteName { get; } = new Bindable(string.Empty); [Resolved] From 14524237acb85e77c8253484d4c78c3adf5b6340 Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Fri, 3 Feb 2023 10:32:41 +0300 Subject: [PATCH 54/66] Add comment explaining texelSize value --- osu.Game/Graphics/Backgrounds/Triangles.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game/Graphics/Backgrounds/Triangles.cs b/osu.Game/Graphics/Backgrounds/Triangles.cs index ca5f5d06d3..598278b2e4 100644 --- a/osu.Game/Graphics/Backgrounds/Triangles.cs +++ b/osu.Game/Graphics/Backgrounds/Triangles.cs @@ -253,7 +253,6 @@ namespace osu.Game.Graphics.Backgrounds private class TrianglesDrawNode : DrawNode { private float fill = 1f; - private float texelSize = 0f; protected new Triangles Source => (Triangles)base.Source; @@ -295,6 +294,11 @@ namespace osu.Game.Graphics.Backgrounds vertexBatch = renderer.CreateQuadBatch(Source.AimCount, 1); } + //Due to triangles having various sizes we would need to set a different "texelSize" value for each of them, which is insanely expensive, thus we should use one single value. + //texelSize computed for an average triangle (size 100) will result in big triangles becoming blurry, so we may just use 0 for all of them. + //But we still need to specify at least something, because otherwise other shader usages will override this value. + float texelSize = 0f; + shader.Bind(); shader.GetUniform("thickness").UpdateValue(ref fill); shader.GetUniform("texelSize").UpdateValue(ref texelSize); From bc02fb0e3280fd2035e26e61168457e5f3c25d9f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 3 Feb 2023 16:37:02 +0900 Subject: [PATCH 55/66] Remove redundant parameter in `DrumSegment` constructor --- .../UI/DrumTouchInputArea.cs | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs index cf697cf061..29ccd96675 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs @@ -71,27 +71,27 @@ namespace osu.Game.Rulesets.Taiko.UI RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - leftRim = new DrumSegment(TaikoAction.LeftRim) + leftRim = new DrumSegment { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, X = -2, }, - rightRim = new DrumSegment(TaikoAction.RightCentre) + rightRim = new DrumSegment { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, X = 2, Rotation = 90, }, - leftCentre = new DrumSegment(TaikoAction.LeftCentre) + leftCentre = new DrumSegment { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, X = -2, Scale = new Vector2(centre_region), }, - rightCentre = new DrumSegment(TaikoAction.RightRim) + rightCentre = new DrumSegment { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomRight, @@ -192,9 +192,6 @@ namespace osu.Game.Rulesets.Taiko.UI trackedActions.Remove(source); } - private bool validMouse(MouseButtonEvent e) => - leftRim.Contains(e.ScreenSpaceMouseDownPosition) || rightRim.Contains(e.ScreenSpaceMouseDownPosition); - private TaikoAction getTaikoActionFromPosition(Vector2 inputPosition) { bool centreHit = leftCentre.Contains(inputPosition) || rightCentre.Contains(inputPosition); @@ -242,10 +239,8 @@ namespace osu.Game.Rulesets.Taiko.UI public override bool Contains(Vector2 screenSpacePos) => circle.Contains(screenSpacePos); - public DrumSegment(TaikoAction action) + public DrumSegment() { - Action = action; - RelativeSizeAxes = Axes.Both; FillMode = FillMode.Fit; @@ -305,7 +300,7 @@ namespace osu.Game.Rulesets.Taiko.UI if (!IsLoaded) return; - var colour = getColourFromTaikoAction(action); + var colour = getColourFromTaikoAction(Action); circle.Colour = colour.Multiply(1.4f).Darken(2.8f); overlay.Colour = colour; From 7b9239088bca1678a33227ac161f7c2a16cd098d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 3 Feb 2023 16:40:16 +0900 Subject: [PATCH 56/66] Comment space addition --- osu.Game/Graphics/Backgrounds/Triangles.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Graphics/Backgrounds/Triangles.cs b/osu.Game/Graphics/Backgrounds/Triangles.cs index 598278b2e4..68ece56d8a 100644 --- a/osu.Game/Graphics/Backgrounds/Triangles.cs +++ b/osu.Game/Graphics/Backgrounds/Triangles.cs @@ -294,9 +294,9 @@ namespace osu.Game.Graphics.Backgrounds vertexBatch = renderer.CreateQuadBatch(Source.AimCount, 1); } - //Due to triangles having various sizes we would need to set a different "texelSize" value for each of them, which is insanely expensive, thus we should use one single value. - //texelSize computed for an average triangle (size 100) will result in big triangles becoming blurry, so we may just use 0 for all of them. - //But we still need to specify at least something, because otherwise other shader usages will override this value. + // Due to triangles having various sizes we would need to set a different "texelSize" value for each of them, which is insanely expensive, thus we should use one single value. + // texelSize computed for an average triangle (size 100) will result in big triangles becoming blurry, so we may just use 0 for all of them. + // But we still need to specify at least something, because otherwise other shader usages will override this value. float texelSize = 0f; shader.Bind(); From 60ccf35125a5f95b5f6c5b6a973a336fcec07a9d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 3 Feb 2023 16:44:53 +0900 Subject: [PATCH 57/66] Update resources --- osu.Game/osu.Game.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index d4ea0abbb5..cdb3d9b66b 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -36,7 +36,7 @@ - + From b19047b90b9847e58cd2c98a9653aab908474dc9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 3 Feb 2023 16:55:51 +0900 Subject: [PATCH 58/66] Fix skin editor component list having uneven padding --- osu.Game/Overlays/SkinEditor/SkinComponentToolbox.cs | 2 +- osu.Game/Screens/Edit/Components/EditorSidebar.cs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/SkinEditor/SkinComponentToolbox.cs b/osu.Game/Overlays/SkinEditor/SkinComponentToolbox.cs index 6017a98944..a8d64c1de8 100644 --- a/osu.Game/Overlays/SkinEditor/SkinComponentToolbox.cs +++ b/osu.Game/Overlays/SkinEditor/SkinComponentToolbox.cs @@ -40,7 +40,7 @@ namespace osu.Game.Overlays.SkinEditor RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, - Spacing = new Vector2(2) + Spacing = new Vector2(EditorSidebar.PADDING) }; reloadComponents(); diff --git a/osu.Game/Screens/Edit/Components/EditorSidebar.cs b/osu.Game/Screens/Edit/Components/EditorSidebar.cs index 9a8c5115dd..24e21ceafe 100644 --- a/osu.Game/Screens/Edit/Components/EditorSidebar.cs +++ b/osu.Game/Screens/Edit/Components/EditorSidebar.cs @@ -18,6 +18,8 @@ namespace osu.Game.Screens.Edit.Components { public const float WIDTH = 250; + public const float PADDING = 3; + private readonly Box background; protected override Container Content { get; } @@ -35,13 +37,13 @@ namespace osu.Game.Screens.Edit.Components }, new OsuScrollContainer { - Padding = new MarginPadding { Left = 20 }, ScrollbarOverlapsContent = false, RelativeSizeAxes = Axes.Both, Child = Content = new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, + Padding = new MarginPadding(PADDING), Direction = FillDirection.Vertical, }, } From b437501b0fff6ee60211eda5c59d008a0db250d6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 3 Feb 2023 17:28:55 +0900 Subject: [PATCH 59/66] Fix beatmap editor positional nudging not being undoable --- .../Components/ComposeBlueprintContainer.cs | 29 +++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/ComposeBlueprintContainer.cs b/osu.Game/Screens/Edit/Compose/Components/ComposeBlueprintContainer.cs index 836fceea22..453e4b9130 100644 --- a/osu.Game/Screens/Edit/Compose/Components/ComposeBlueprintContainer.cs +++ b/osu.Game/Screens/Edit/Compose/Components/ComposeBlueprintContainer.cs @@ -91,6 +91,8 @@ namespace osu.Game.Screens.Edit.Compose.Components blueprint.DrawableObject = drawableObject; } + private bool nudgeMovementActive; + protected override bool OnKeyDown(KeyDownEvent e) { if (e.ControlPressed) @@ -98,19 +100,19 @@ namespace osu.Game.Screens.Edit.Compose.Components switch (e.Key) { case Key.Left: - moveSelection(new Vector2(-1, 0)); + nudgeSelection(new Vector2(-1, 0)); return true; case Key.Right: - moveSelection(new Vector2(1, 0)); + nudgeSelection(new Vector2(1, 0)); return true; case Key.Up: - moveSelection(new Vector2(0, -1)); + nudgeSelection(new Vector2(0, -1)); return true; case Key.Down: - moveSelection(new Vector2(0, 1)); + nudgeSelection(new Vector2(0, 1)); return true; } } @@ -118,12 +120,29 @@ namespace osu.Game.Screens.Edit.Compose.Components return false; } + protected override void OnKeyUp(KeyUpEvent e) + { + base.OnKeyUp(e); + + if (nudgeMovementActive && !e.ControlPressed) + { + Beatmap.EndChange(); + nudgeMovementActive = false; + } + } + /// /// Move the current selection spatially by the specified delta, in gamefield coordinates (ie. the same coordinates as the blueprints). /// /// - private void moveSelection(Vector2 delta) + private void nudgeSelection(Vector2 delta) { + if (!nudgeMovementActive) + { + nudgeMovementActive = true; + Beatmap.BeginChange(); + } + var firstBlueprint = SelectionHandler.SelectedBlueprints.FirstOrDefault(); if (firstBlueprint == null) From 20e220df56894ff137693d649a4d531bd76c736f Mon Sep 17 00:00:00 2001 From: Wleter Date: Fri, 3 Feb 2023 16:05:16 +0100 Subject: [PATCH 60/66] prioritize closest snap position --- osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs index 8a1d8f597c..f5bbac72d7 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs @@ -189,11 +189,14 @@ namespace osu.Game.Rulesets.Osu.Edit var snapPositions = b.ScreenSpaceSnapPoints; - var filteredSnapPositions = snapPositions.Cast().FirstOrDefault(p => Vector2.Distance(p.Value, screenSpacePosition) < snapRadius); + if (!snapPositions.Any()) + continue; + + var closestSnapPosition = snapPositions.MinBy(p => Vector2.Distance(p, screenSpacePosition)); - if (filteredSnapPositions.HasValue) + if (Vector2.Distance(closestSnapPosition, screenSpacePosition) < snapRadius) { - var snap = filteredSnapPositions.Value; + var snap = closestSnapPosition; // only return distance portion, since time is not really valid snapResult = new SnapResult(snap, null, playfield); From f7f13cb9d994521b31fb9c2cc9348b8bb3241ae9 Mon Sep 17 00:00:00 2001 From: Wleter Date: Fri, 3 Feb 2023 16:13:04 +0100 Subject: [PATCH 61/66] fix formatting --- osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs index f5bbac72d7..13e4ece73c 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs @@ -191,7 +191,7 @@ namespace osu.Game.Rulesets.Osu.Edit if (!snapPositions.Any()) continue; - + var closestSnapPosition = snapPositions.MinBy(p => Vector2.Distance(p, screenSpacePosition)); if (Vector2.Distance(closestSnapPosition, screenSpacePosition) < snapRadius) From 60f648407382b6f38204d418d8cd811fc378482b Mon Sep 17 00:00:00 2001 From: Wleter Date: Fri, 3 Feb 2023 16:13:37 +0100 Subject: [PATCH 62/66] fix spaces --- osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs index 13e4ece73c..1e6be988b4 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs @@ -191,7 +191,7 @@ namespace osu.Game.Rulesets.Osu.Edit if (!snapPositions.Any()) continue; - + var closestSnapPosition = snapPositions.MinBy(p => Vector2.Distance(p, screenSpacePosition)); if (Vector2.Distance(closestSnapPosition, screenSpacePosition) < snapRadius) From d9bee958dd55cd6dffcf0c4513549ae78fc2090e Mon Sep 17 00:00:00 2001 From: mk56-spn Date: Fri, 3 Feb 2023 23:56:34 +0100 Subject: [PATCH 63/66] Stop ```BPMCounter.cs```'s value from going to 0 after failing. --- osu.Game/Screens/Play/HUD/BPMCounter.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/HUD/BPMCounter.cs b/osu.Game/Screens/Play/HUD/BPMCounter.cs index c07b203341..5fcac6cd04 100644 --- a/osu.Game/Screens/Play/HUD/BPMCounter.cs +++ b/osu.Game/Screens/Play/HUD/BPMCounter.cs @@ -26,6 +26,9 @@ namespace osu.Game.Screens.Play.HUD [Resolved] private IGameplayClock gameplayClock { get; set; } = null!; + [Resolved] + private Player player { get; set; } = null!; + [BackgroundDependencyLoader] private void load(OsuColour colour) { @@ -38,7 +41,7 @@ namespace osu.Game.Screens.Play.HUD base.Update(); //We don't want it going to 0 when we pause. so we block the updates - if (gameplayClock.IsPaused.Value) return; + if (gameplayClock.IsPaused.Value || player.GameplayState.HasFailed) return; // We want to check Rate every update to cover windup/down Current.Value = beatmap.Value.Beatmap.ControlPointInfo.TimingPointAt(gameplayClock.CurrentTime).BPM * gameplayClock.Rate; From 88872cf1cf9dae9c4d9147c366727506db2e4c48 Mon Sep 17 00:00:00 2001 From: mk56-spn Date: Sat, 4 Feb 2023 00:53:54 +0100 Subject: [PATCH 64/66] Use ```GetTrueGameplayRate()``` to remove need for jank --- osu.Game/Screens/Play/HUD/BPMCounter.cs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/osu.Game/Screens/Play/HUD/BPMCounter.cs b/osu.Game/Screens/Play/HUD/BPMCounter.cs index 5fcac6cd04..500ab0169f 100644 --- a/osu.Game/Screens/Play/HUD/BPMCounter.cs +++ b/osu.Game/Screens/Play/HUD/BPMCounter.cs @@ -26,9 +26,6 @@ namespace osu.Game.Screens.Play.HUD [Resolved] private IGameplayClock gameplayClock { get; set; } = null!; - [Resolved] - private Player player { get; set; } = null!; - [BackgroundDependencyLoader] private void load(OsuColour colour) { @@ -40,11 +37,8 @@ namespace osu.Game.Screens.Play.HUD { base.Update(); - //We don't want it going to 0 when we pause. so we block the updates - if (gameplayClock.IsPaused.Value || player.GameplayState.HasFailed) return; - // We want to check Rate every update to cover windup/down - Current.Value = beatmap.Value.Beatmap.ControlPointInfo.TimingPointAt(gameplayClock.CurrentTime).BPM * gameplayClock.Rate; + Current.Value = beatmap.Value.Beatmap.ControlPointInfo.TimingPointAt(gameplayClock.CurrentTime).BPM * gameplayClock.GetTrueGameplayRate(); } protected override OsuSpriteText CreateSpriteText() From 4192388b20d7a7b00d62965ba5aa2383be3e2046 Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Fri, 3 Feb 2023 21:29:01 -0800 Subject: [PATCH 65/66] Fix expanded beatmap cards getting cut off at the end of profile sections --- osu.Game/Overlays/Profile/ProfileSection.cs | 25 ++++++++++++--------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/osu.Game/Overlays/Profile/ProfileSection.cs b/osu.Game/Overlays/Profile/ProfileSection.cs index 03917b75a4..4ac86924f8 100644 --- a/osu.Game/Overlays/Profile/ProfileSection.cs +++ b/osu.Game/Overlays/Profile/ProfileSection.cs @@ -36,21 +36,24 @@ namespace osu.Game.Overlays.Profile AutoSizeAxes = Axes.Y; RelativeSizeAxes = Axes.X; - Masking = true; - CornerRadius = 10; - EdgeEffect = new EdgeEffectParameters - { - Type = EdgeEffectType.Shadow, - Offset = new Vector2(0, 1), - Radius = 3, - Colour = Colour4.Black.Opacity(0.25f) - }; - InternalChildren = new Drawable[] { - background = new Box + new Container { RelativeSizeAxes = Axes.Both, + Masking = true, + CornerRadius = 10, + EdgeEffect = new EdgeEffectParameters + { + Type = EdgeEffectType.Shadow, + Offset = new Vector2(0, 1), + Radius = 3, + Colour = Colour4.Black.Opacity(0.25f) + }, + Child = background = new Box + { + RelativeSizeAxes = Axes.Both, + }, }, new FillFlowContainer { From 49443f0b5538a4bc49512a78bf604f3db682a58a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sat, 4 Feb 2023 14:36:30 +0100 Subject: [PATCH 66/66] Inline temporary variable --- osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs index 1e6be988b4..7a70257f3a 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs @@ -196,10 +196,8 @@ namespace osu.Game.Rulesets.Osu.Edit if (Vector2.Distance(closestSnapPosition, screenSpacePosition) < snapRadius) { - var snap = closestSnapPosition; - // only return distance portion, since time is not really valid - snapResult = new SnapResult(snap, null, playfield); + snapResult = new SnapResult(closestSnapPosition, null, playfield); return true; } }