diff --git a/osu.Game.Rulesets.Mania/ManiaSettingsSubsection.cs b/osu.Game.Rulesets.Mania/ManiaSettingsSubsection.cs index 791f46d407..b1884aab6f 100644 --- a/osu.Game.Rulesets.Mania/ManiaSettingsSubsection.cs +++ b/osu.Game.Rulesets.Mania/ManiaSettingsSubsection.cs @@ -7,7 +7,7 @@ using osu.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Localisation; -using osu.Game.Graphics.UserInterface; +using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Localisation; using osu.Game.Overlays.Settings; using osu.Game.Rulesets.Mania.Configuration; @@ -31,47 +31,45 @@ namespace osu.Game.Rulesets.Mania Children = new Drawable[] { - new SettingsEnumDropdown + new SettingsItemV2(new FormEnumDropdown { - LabelText = RulesetSettingsStrings.ScrollingDirection, + Caption = RulesetSettingsStrings.ScrollingDirection, Current = config.GetBindable(ManiaRulesetSetting.ScrollDirection) - }, - new SettingsSlider + }), + new SettingsItemV2(new FormSliderBar { - LabelText = RulesetSettingsStrings.ScrollSpeed, + Caption = RulesetSettingsStrings.ScrollSpeed, Current = config.GetBindable(ManiaRulesetSetting.ScrollSpeed), - KeyboardStep = 1 - }, - new SettingsCheckbox + KeyboardStep = 1, + LabelFormat = v => RulesetSettingsStrings.ScrollSpeedTooltip((int)DrawableManiaRuleset.ComputeScrollTime(v), v), + }), + new SettingsItemV2(new FormCheckBox + { + Caption = RulesetSettingsStrings.TimingBasedColouring, + Current = config.GetBindable(ManiaRulesetSetting.TimingBasedNoteColouring), + }) { Keywords = new[] { "color" }, - LabelText = RulesetSettingsStrings.TimingBasedColouring, - Current = config.GetBindable(ManiaRulesetSetting.TimingBasedNoteColouring), }, }; - Add(new SettingsCheckbox + Add(new SettingsItemV2(new FormCheckBox { - LabelText = RulesetSettingsStrings.TouchOverlay, + Caption = RulesetSettingsStrings.TouchOverlay, Current = config.GetBindable(ManiaRulesetSetting.TouchOverlay) - }); + })); if (RuntimeInfo.IsMobile) { - Add(new SettingsEnumDropdown + Add(new SettingsItemV2(new FormEnumDropdown { - LabelText = RulesetSettingsStrings.MobileLayout, + Caption = RulesetSettingsStrings.MobileLayout, Current = config.GetBindable(ManiaRulesetSetting.MobileLayout), #pragma warning disable CS0618 // Type or member is obsolete Items = Enum.GetValues().Where(l => l != ManiaMobileLayout.LandscapeWithOverlay), #pragma warning restore CS0618 // Type or member is obsolete - }); + })); } } - - private partial class ManiaScrollSlider : RoundedSliderBar - { - public override LocalisableString TooltipText => RulesetSettingsStrings.ScrollSpeedTooltip((int)DrawableManiaRuleset.ComputeScrollTime(Current.Value), Current.Value); - } } } diff --git a/osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs b/osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs index 0e410dbf57..56a30f89ac 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs @@ -4,6 +4,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Localisation; +using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Localisation; using osu.Game.Overlays.Settings; using osu.Game.Rulesets.Osu.Configuration; @@ -13,6 +14,8 @@ namespace osu.Game.Rulesets.Osu.UI { public partial class OsuSettingsSubsection : RulesetSettingsSubsection { + private FormCheckBox snakingOutSliders = null!; + protected override LocalisableString Header => "osu!"; public OsuSettingsSubsection(Ruleset ruleset) @@ -27,32 +30,34 @@ namespace osu.Game.Rulesets.Osu.UI Children = new Drawable[] { - new SettingsCheckbox + new SettingsItemV2(new FormCheckBox { - LabelText = RulesetSettingsStrings.SnakingInSliders, + Caption = RulesetSettingsStrings.SnakingInSliders, Current = config.GetBindable(OsuRulesetSetting.SnakingInSliders) - }, - new SettingsCheckbox + }), + new SettingsItemV2(snakingOutSliders = new FormCheckBox { - ClassicDefault = false, - LabelText = RulesetSettingsStrings.SnakingOutSliders, + Caption = RulesetSettingsStrings.SnakingOutSliders, Current = config.GetBindable(OsuRulesetSetting.SnakingOutSliders) - }, - new SettingsCheckbox + }) { - LabelText = RulesetSettingsStrings.CursorTrail, + ApplyClassicDefault = () => snakingOutSliders.Current.Value = false, + }, + new SettingsItemV2(new FormCheckBox + { + Caption = RulesetSettingsStrings.CursorTrail, Current = config.GetBindable(OsuRulesetSetting.ShowCursorTrail) - }, - new SettingsCheckbox + }), + new SettingsItemV2(new FormCheckBox { - LabelText = RulesetSettingsStrings.CursorRipples, + Caption = RulesetSettingsStrings.CursorRipples, Current = config.GetBindable(OsuRulesetSetting.ShowCursorRipples) - }, - new SettingsEnumDropdown + }), + new SettingsItemV2(new FormEnumDropdown { - LabelText = RulesetSettingsStrings.PlayfieldBorderStyle, + Caption = RulesetSettingsStrings.PlayfieldBorderStyle, Current = config.GetBindable(OsuRulesetSetting.PlayfieldBorderStyle), - }, + }), }; } } diff --git a/osu.Game.Rulesets.Taiko/TaikoSettingsSubsection.cs b/osu.Game.Rulesets.Taiko/TaikoSettingsSubsection.cs index 84dea474c5..58fb6a0246 100644 --- a/osu.Game.Rulesets.Taiko/TaikoSettingsSubsection.cs +++ b/osu.Game.Rulesets.Taiko/TaikoSettingsSubsection.cs @@ -4,6 +4,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Localisation; +using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Localisation; using osu.Game.Overlays.Settings; using osu.Game.Rulesets.Taiko.Configuration; @@ -26,11 +27,11 @@ namespace osu.Game.Rulesets.Taiko Children = new Drawable[] { - new SettingsEnumDropdown + new SettingsItemV2(new FormEnumDropdown { - LabelText = RulesetSettingsStrings.TouchControlScheme, + Caption = RulesetSettingsStrings.TouchControlScheme, Current = config.GetBindable(TaikoRulesetSetting.TouchControlScheme) - } + }) }; } } diff --git a/osu.Game.Tests/Visual/Settings/TestSceneAudioOffsetAdjustControl.cs b/osu.Game.Tests/Visual/Settings/TestSceneAudioOffsetAdjustControl.cs index 2fc5378ba1..ceca59dccf 100644 --- a/osu.Game.Tests/Visual/Settings/TestSceneAudioOffsetAdjustControl.cs +++ b/osu.Game.Tests/Visual/Settings/TestSceneAudioOffsetAdjustControl.cs @@ -11,6 +11,7 @@ using osu.Framework.Graphics.UserInterface; using osu.Framework.Testing; using osu.Framework.Utils; using osu.Game.Configuration; +using osu.Game.Overlays; using osu.Game.Overlays.Settings.Sections.Audio; using osu.Game.Scoring; using osu.Game.Tests.Visual.Ranking; @@ -25,6 +26,9 @@ namespace osu.Game.Tests.Visual.Settings [Cached] private SessionAverageHitErrorTracker tracker = new SessionAverageHitErrorTracker(); + [Cached] + private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Purple); + private Container content = null!; protected override Container Content => content; diff --git a/osu.Game/Graphics/UserInterfaceV2/FormSliderBar.cs b/osu.Game/Graphics/UserInterfaceV2/FormSliderBar.cs index 086bf7674f..116e283737 100644 --- a/osu.Game/Graphics/UserInterfaceV2/FormSliderBar.cs +++ b/osu.Game/Graphics/UserInterfaceV2/FormSliderBar.cs @@ -396,7 +396,7 @@ namespace osu.Game.Graphics.UserInterfaceV2 private LocalisableString defaultLabelFormat(T value) => currentNumberInstantaneous.Value.ToStandardFormattedString(OsuSliderBar.MAX_DECIMAL_DIGITS, DisplayAsPercentage); - private partial class InnerSlider : OsuSliderBar + public partial class InnerSlider : OsuSliderBar { public BindableBool Focused { get; } = new BindableBool(); diff --git a/osu.Game/Overlays/Settings/Sections/Audio/AudioDevicesSettings.cs b/osu.Game/Overlays/Settings/Sections/Audio/AudioDevicesSettings.cs index 811f6b606a..5742272e96 100644 --- a/osu.Game/Overlays/Settings/Sections/Audio/AudioDevicesSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Audio/AudioDevicesSettings.cs @@ -7,9 +7,10 @@ using osu.Framework.Graphics; using System.Collections.Generic; using System.Linq; using osu.Framework; +using osu.Framework.Bindables; using osu.Framework.Extensions.ObjectExtensions; using osu.Framework.Localisation; -using osu.Game.Graphics.UserInterface; +using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Localisation; namespace osu.Game.Overlays.Settings.Sections.Audio @@ -21,30 +22,37 @@ namespace osu.Game.Overlays.Settings.Sections.Audio [Resolved] private AudioManager audio { get; set; } = null!; - private SettingsDropdown dropdown = null!; + private AudioDeviceDropdown dropdown = null!; - private SettingsCheckbox? wasapiExperimental; + private FormCheckBox? wasapiExperimental; + + private readonly Bindable wasapiExperimentalNote = new Bindable(); [BackgroundDependencyLoader] private void load() { Children = new Drawable[] { - dropdown = new AudioDeviceSettingsDropdown + new SettingsItemV2(dropdown = new AudioDeviceDropdown + { + Caption = AudioSettingsStrings.OutputDevice, + }) { - LabelText = AudioSettingsStrings.OutputDevice, Keywords = new[] { "speaker", "headphone", "output" } }, }; if (RuntimeInfo.OS == RuntimeInfo.Platform.Windows) { - Add(wasapiExperimental = new SettingsCheckbox + Add(new SettingsItemV2(wasapiExperimental = new FormCheckBox { - LabelText = AudioSettingsStrings.WasapiLabel, - TooltipText = AudioSettingsStrings.WasapiTooltip, + Caption = AudioSettingsStrings.WasapiLabel, + HintText = AudioSettingsStrings.WasapiTooltip, Current = audio.UseExperimentalWasapi, - Keywords = new[] { "wasapi", "latency", "exclusive" } + }) + { + Keywords = new[] { "wasapi", "latency", "exclusive" }, + Note = { BindTarget = wasapiExperimentalNote }, }); wasapiExperimental.Current.ValueChanged += _ => onDeviceChanged(string.Empty); @@ -64,9 +72,9 @@ namespace osu.Game.Overlays.Settings.Sections.Audio if (wasapiExperimental != null) { if (wasapiExperimental.Current.Value) - wasapiExperimental.SetNoticeText(AudioSettingsStrings.WasapiNotice, true); + wasapiExperimentalNote.Value = new SettingsNote.Data(AudioSettingsStrings.WasapiNotice, SettingsNote.Type.Warning); else - wasapiExperimental.ClearNoticeText(); + wasapiExperimentalNote.Value = null; } } @@ -103,15 +111,10 @@ namespace osu.Game.Overlays.Settings.Sections.Audio } } - private partial class AudioDeviceSettingsDropdown : SettingsDropdown + private partial class AudioDeviceDropdown : FormDropdown { - protected override OsuDropdown CreateDropdown() => new AudioDeviceDropdownControl(); - - private partial class AudioDeviceDropdownControl : DropdownControl - { - protected override LocalisableString GenerateItemText(string item) - => string.IsNullOrEmpty(item) ? CommonStrings.Default : base.GenerateItemText(item); - } + protected override LocalisableString GenerateItemText(string item) + => string.IsNullOrEmpty(item) ? CommonStrings.Default : base.GenerateItemText(item); } } } diff --git a/osu.Game/Overlays/Settings/Sections/Audio/AudioOffsetAdjustControl.cs b/osu.Game/Overlays/Settings/Sections/Audio/AudioOffsetAdjustControl.cs index 6e5e010518..fca7aaffd9 100644 --- a/osu.Game/Overlays/Settings/Sections/Audio/AudioOffsetAdjustControl.cs +++ b/osu.Game/Overlays/Settings/Sections/Audio/AudioOffsetAdjustControl.cs @@ -11,13 +11,10 @@ using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Graphics.UserInterface; -using osu.Framework.Localisation; using osu.Game.Configuration; using osu.Game.Extensions; using osu.Game.Graphics; using osu.Game.Graphics.Containers; -using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Localisation; using osu.Game.Screens.Play.PlayerSettings; @@ -25,157 +22,157 @@ using osuTK; namespace osu.Game.Overlays.Settings.Sections.Audio { - public partial class AudioOffsetAdjustControl : SettingsItem + public partial class AudioOffsetAdjustControl : CompositeDrawable { - public IBindable SuggestedOffset => ((AudioOffsetPreview)Control).SuggestedOffset; - - [BackgroundDependencyLoader] - private void load() + public Bindable Current { - LabelText = AudioSettingsStrings.AudioOffset; + get => current.Current; + set => current.Current = value; } - protected override Drawable CreateControl() => new AudioOffsetPreview(); + private readonly BindableNumberWithCurrent current = new BindableNumberWithCurrent(); - private partial class AudioOffsetPreview : CompositeDrawable, IHasCurrentValue + private readonly IBindableList averageHitErrorHistory = new BindableList(); + + public readonly Bindable SuggestedOffset = new Bindable(); + + private Container notchContainer = null!; + private TextFlowContainer hintText = null!; + private RoundedButton applySuggestion = null!; + + [BackgroundDependencyLoader] + private void load(SessionAverageHitErrorTracker hitErrorTracker) { - public Bindable Current + averageHitErrorHistory.BindTo(hitErrorTracker.AverageHitErrorHistory); + + RelativeSizeAxes = Axes.X; + AutoSizeAxes = Axes.Y; + InternalChild = new FillFlowContainer { - get => current.Current; - set => current.Current = value; - } - - private readonly BindableNumberWithCurrent current = new BindableNumberWithCurrent(); - - private readonly IBindableList averageHitErrorHistory = new BindableList(); - - public readonly Bindable SuggestedOffset = new Bindable(); - - private Container notchContainer = null!; - private TextFlowContainer hintText = null!; - private RoundedButton applySuggestion = null!; - - [BackgroundDependencyLoader] - private void load(SessionAverageHitErrorTracker hitErrorTracker) - { - averageHitErrorHistory.BindTo(hitErrorTracker.AverageHitErrorHistory); - - RelativeSizeAxes = Axes.X; - AutoSizeAxes = Axes.Y; - InternalChild = new FillFlowContainer + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Spacing = new Vector2(7), + Direction = FillDirection.Vertical, + Children = new Drawable[] { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Spacing = new Vector2(10), - Direction = FillDirection.Vertical, - Children = new Drawable[] + new SettingsItemV2(new FormSliderBar { - new OffsetSliderBar + Caption = AudioSettingsStrings.AudioOffset, + RelativeSizeAxes = Axes.X, + Current = { BindTarget = Current }, + KeyboardStep = 1, + LabelFormat = v => $"{v:N0} ms", + TooltipFormat = BeatmapOffsetControl.GetOffsetExplanatoryText, + }), + new Container + { + RelativeSizeAxes = Axes.X, + Height = 10, + Padding = new MarginPadding { - RelativeSizeAxes = Axes.X, - Current = { BindTarget = Current }, - KeyboardStep = 1, + Left = SettingsPanel.ContentPaddingV2.Left + 9, + Right = SettingsPanel.ContentPaddingV2.Right + 5 }, - notchContainer = new Container + Child = notchContainer = new Container { - RelativeSizeAxes = Axes.X, - Height = 10, - Padding = new MarginPadding { Horizontal = Nub.DEFAULT_EXPANDED_SIZE / 2 }, - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - }, - hintText = new OsuTextFlowContainer(t => t.Font = OsuFont.Default.With(size: 16)) - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - }, - applySuggestion = new RoundedButton - { - RelativeSizeAxes = Axes.X, - Text = AudioSettingsStrings.ApplySuggestedOffset, - Action = () => + RelativeSizeAxes = Axes.Both, + Width = 0.5f, + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + Padding = new MarginPadding { - if (SuggestedOffset.Value.HasValue) - current.Value = SuggestedOffset.Value.Value; - hitErrorTracker.ClearHistory(); - } + Horizontal = FormSliderBar.InnerSlider.NUB_WIDTH / 2 + }, + }, + }, + hintText = new OsuTextFlowContainer(t => t.Font = OsuFont.Default.With(size: 16)) + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Padding = SettingsPanel.ContentPaddingV2, + }, + applySuggestion = new RoundedButton + { + RelativeSizeAxes = Axes.X, + Text = AudioSettingsStrings.ApplySuggestedOffset, + Padding = SettingsPanel.ContentPaddingV2, + Action = () => + { + if (SuggestedOffset.Value.HasValue) + current.Value = SuggestedOffset.Value.Value; + hitErrorTracker.ClearHistory(); } } - }; - } + } + }; + } - protected override void LoadComplete() + protected override void LoadComplete() + { + base.LoadComplete(); + + averageHitErrorHistory.BindCollectionChanged(updateDisplay, true); + current.BindValueChanged(_ => updateHintText()); + SuggestedOffset.BindValueChanged(_ => updateHintText(), true); + } + + private void updateDisplay(object? _, NotifyCollectionChangedEventArgs e) + { + switch (e.Action) { - base.LoadComplete(); - - averageHitErrorHistory.BindCollectionChanged(updateDisplay, true); - current.BindValueChanged(_ => updateHintText()); - SuggestedOffset.BindValueChanged(_ => updateHintText(), true); - } - - private void updateDisplay(object? _, NotifyCollectionChangedEventArgs e) - { - switch (e.Action) - { - case NotifyCollectionChangedAction.Add: - foreach (SessionAverageHitErrorTracker.DataPoint dataPoint in e.NewItems!) + case NotifyCollectionChangedAction.Add: + foreach (SessionAverageHitErrorTracker.DataPoint dataPoint in e.NewItems!) + { + notchContainer.ForEach(n => n.Alpha *= 0.95f); + notchContainer.Add(new Box { - notchContainer.ForEach(n => n.Alpha *= 0.95f); - notchContainer.Add(new Box - { - RelativeSizeAxes = Axes.Y, - Width = 2, - RelativePositionAxes = Axes.X, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - X = getXPositionForOffset(dataPoint.SuggestedGlobalAudioOffset) - }); - } + RelativeSizeAxes = Axes.Y, + Width = 2, + RelativePositionAxes = Axes.X, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + X = getXPositionForOffset(dataPoint.SuggestedGlobalAudioOffset) + }); + } - break; + break; - case NotifyCollectionChangedAction.Remove: - foreach (SessionAverageHitErrorTracker.DataPoint dataPoint in e.OldItems!) - { - var notch = notchContainer.FirstOrDefault(n => n.X == getXPositionForOffset(dataPoint.SuggestedGlobalAudioOffset)); - Debug.Assert(notch != null); - notchContainer.Remove(notch, true); - } + case NotifyCollectionChangedAction.Remove: + foreach (SessionAverageHitErrorTracker.DataPoint dataPoint in e.OldItems!) + { + var notch = notchContainer.FirstOrDefault(n => n.X == getXPositionForOffset(dataPoint.SuggestedGlobalAudioOffset)); + Debug.Assert(notch != null); + notchContainer.Remove(notch, true); + } - break; + break; - case NotifyCollectionChangedAction.Reset: - notchContainer.Clear(); - break; - } - - SuggestedOffset.Value = averageHitErrorHistory.Any() ? Math.Round(averageHitErrorHistory.Average(dataPoint => dataPoint.SuggestedGlobalAudioOffset)) : null; + case NotifyCollectionChangedAction.Reset: + notchContainer.Clear(); + break; } - private float getXPositionForOffset(double offset) => (float)(Math.Clamp(offset, current.MinValue, current.MaxValue) / (2 * current.MaxValue)); + SuggestedOffset.Value = averageHitErrorHistory.Any() ? Math.Round(averageHitErrorHistory.Average(dataPoint => dataPoint.SuggestedGlobalAudioOffset)) : null; + } - private void updateHintText() + private float getXPositionForOffset(double offset) => (float)(Math.Clamp(offset, current.MinValue, current.MaxValue) / (2 * current.MaxValue)); + + private void updateHintText() + { + if (SuggestedOffset.Value == null) { - if (SuggestedOffset.Value == null) - { - applySuggestion.Enabled.Value = false; - hintText.Text = AudioSettingsStrings.SuggestedOffsetNote; - } - else if (Math.Abs(SuggestedOffset.Value.Value - current.Value) < 1) - { - applySuggestion.Enabled.Value = false; - hintText.Text = AudioSettingsStrings.SuggestedOffsetCorrect(averageHitErrorHistory.Count); - } - else - { - applySuggestion.Enabled.Value = true; - hintText.Text = AudioSettingsStrings.SuggestedOffsetValueReceived(averageHitErrorHistory.Count, SuggestedOffset.Value.Value.ToStandardFormattedString(0)); - } + applySuggestion.Enabled.Value = false; + hintText.Text = AudioSettingsStrings.SuggestedOffsetNote; } - - private partial class OffsetSliderBar : RoundedSliderBar + else if (Math.Abs(SuggestedOffset.Value.Value - current.Value) < 1) { - public override LocalisableString TooltipText => BeatmapOffsetControl.GetOffsetExplanatoryText(Current.Value); + applySuggestion.Enabled.Value = false; + hintText.Text = AudioSettingsStrings.SuggestedOffsetCorrect(averageHitErrorHistory.Count); + } + else + { + applySuggestion.Enabled.Value = true; + hintText.Text = AudioSettingsStrings.SuggestedOffsetValueReceived(averageHitErrorHistory.Count, SuggestedOffset.Value.Value.ToStandardFormattedString(0)); } } } diff --git a/osu.Game/Overlays/Settings/Sections/Audio/OffsetSettings.cs b/osu.Game/Overlays/Settings/Sections/Audio/OffsetSettings.cs index b839c98f9f..498b04b7a8 100644 --- a/osu.Game/Overlays/Settings/Sections/Audio/OffsetSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Audio/OffsetSettings.cs @@ -7,6 +7,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Localisation; using osu.Game.Configuration; +using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Localisation; namespace osu.Game.Overlays.Settings.Sections.Audio @@ -26,12 +27,12 @@ namespace osu.Game.Overlays.Settings.Sections.Audio { Current = config.GetBindable(OsuSetting.AudioOffset), }, - new SettingsCheckbox + new SettingsItemV2(new FormCheckBox { - LabelText = AudioSettingsStrings.AdjustBeatmapOffsetAutomatically, - TooltipText = AudioSettingsStrings.AdjustBeatmapOffsetAutomaticallyTooltip, + Caption = AudioSettingsStrings.AdjustBeatmapOffsetAutomatically, + HintText = AudioSettingsStrings.AdjustBeatmapOffsetAutomaticallyTooltip, Current = config.GetBindable(OsuSetting.AutomaticallyAdjustBeatmapOffset), - } + }) }; } } diff --git a/osu.Game/Overlays/Settings/Sections/Audio/VolumeSettings.cs b/osu.Game/Overlays/Settings/Sections/Audio/VolumeSettings.cs index 2bb5fa983f..c0d38e50c1 100644 --- a/osu.Game/Overlays/Settings/Sections/Audio/VolumeSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Audio/VolumeSettings.cs @@ -6,7 +6,7 @@ using osu.Framework.Audio; using osu.Framework.Graphics; using osu.Framework.Localisation; using osu.Game.Configuration; -using osu.Game.Graphics.UserInterface; +using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Localisation; namespace osu.Game.Overlays.Settings.Sections.Audio @@ -20,46 +20,38 @@ namespace osu.Game.Overlays.Settings.Sections.Audio { Children = new Drawable[] { - new VolumeAdjustSlider + new SettingsItemV2(new FormSliderBar { - LabelText = AudioSettingsStrings.MasterVolume, + Caption = AudioSettingsStrings.MasterVolume, Current = audio.Volume, KeyboardStep = 0.01f, - DisplayAsPercentage = true - }, - new SettingsSlider + DisplayAsPercentage = true, + PlaySamplesOnAdjust = false, + }), + new SettingsItemV2(new FormSliderBar { - LabelText = AudioSettingsStrings.MasterVolumeInactive, + Caption = AudioSettingsStrings.MasterVolumeInactive, Current = config.GetBindable(OsuSetting.VolumeInactive), KeyboardStep = 0.01f, DisplayAsPercentage = true - }, - new VolumeAdjustSlider + }), + new SettingsItemV2(new FormSliderBar { - LabelText = AudioSettingsStrings.EffectVolume, + Caption = AudioSettingsStrings.EffectVolume, Current = audio.VolumeSample, KeyboardStep = 0.01f, - DisplayAsPercentage = true - }, - - new VolumeAdjustSlider + DisplayAsPercentage = true, + PlaySamplesOnAdjust = false, + }), + new SettingsItemV2(new FormSliderBar { - LabelText = AudioSettingsStrings.MusicVolume, + Caption = AudioSettingsStrings.MusicVolume, Current = audio.VolumeTrack, KeyboardStep = 0.01f, - DisplayAsPercentage = true - }, + DisplayAsPercentage = true, + PlaySamplesOnAdjust = false, + }), }; } - - private partial class VolumeAdjustSlider : SettingsSlider - { - protected override Drawable CreateControl() - { - var sliderBar = (RoundedSliderBar)base.CreateControl(); - sliderBar.PlaySamplesOnAdjust = false; - return sliderBar; - } - } } } diff --git a/osu.Game/Overlays/Settings/Sections/DebugSettings/BatchImportSettings.cs b/osu.Game/Overlays/Settings/Sections/DebugSettings/BatchImportSettings.cs index 1c17356313..86455c4585 100644 --- a/osu.Game/Overlays/Settings/Sections/DebugSettings/BatchImportSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/DebugSettings/BatchImportSettings.cs @@ -11,10 +11,10 @@ namespace osu.Game.Overlays.Settings.Sections.DebugSettings { protected override LocalisableString Header => @"Batch Import"; - private SettingsButton importBeatmapsButton = null!; - private SettingsButton importCollectionsButton = null!; - private SettingsButton importScoresButton = null!; - private SettingsButton importSkinsButton = null!; + private SettingsButtonV2 importBeatmapsButton = null!; + private SettingsButtonV2 importCollectionsButton = null!; + private SettingsButtonV2 importScoresButton = null!; + private SettingsButtonV2 importSkinsButton = null!; [BackgroundDependencyLoader] private void load(LegacyImportManager? legacyImportManager) @@ -24,7 +24,7 @@ namespace osu.Game.Overlays.Settings.Sections.DebugSettings AddRange(new[] { - importBeatmapsButton = new SettingsButton + importBeatmapsButton = new SettingsButtonV2 { Text = @"Import beatmaps from stable", Action = () => @@ -33,7 +33,7 @@ namespace osu.Game.Overlays.Settings.Sections.DebugSettings legacyImportManager.ImportFromStableAsync(StableContent.Beatmaps).ContinueWith(_ => Schedule(() => importBeatmapsButton.Enabled.Value = true)); } }, - importSkinsButton = new SettingsButton + importSkinsButton = new SettingsButtonV2 { Text = @"Import skins from stable", Action = () => @@ -42,7 +42,7 @@ namespace osu.Game.Overlays.Settings.Sections.DebugSettings legacyImportManager.ImportFromStableAsync(StableContent.Skins).ContinueWith(_ => Schedule(() => importSkinsButton.Enabled.Value = true)); } }, - importCollectionsButton = new SettingsButton + importCollectionsButton = new SettingsButtonV2 { Text = @"Import collections from stable", Action = () => @@ -51,7 +51,7 @@ namespace osu.Game.Overlays.Settings.Sections.DebugSettings legacyImportManager.ImportFromStableAsync(StableContent.Collections).ContinueWith(_ => Schedule(() => importCollectionsButton.Enabled.Value = true)); } }, - importScoresButton = new SettingsButton + importScoresButton = new SettingsButtonV2 { Text = @"Import scores from stable", Action = () => diff --git a/osu.Game/Overlays/Settings/Sections/DebugSettings/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/DebugSettings/GeneralSettings.cs index 914fc9d141..04b63ccb84 100644 --- a/osu.Game/Overlays/Settings/Sections/DebugSettings/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/DebugSettings/GeneralSettings.cs @@ -4,6 +4,7 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Localisation; +using osu.Game.Graphics.UserInterfaceV2; namespace osu.Game.Overlays.Settings.Sections.DebugSettings { @@ -14,17 +15,17 @@ namespace osu.Game.Overlays.Settings.Sections.DebugSettings [BackgroundDependencyLoader] private void load(FrameworkDebugConfigManager config, FrameworkConfigManager frameworkConfig) { - Add(new SettingsCheckbox + Add(new SettingsItemV2(new FormCheckBox { - LabelText = @"Show log overlay", + Caption = @"Show log overlay", Current = frameworkConfig.GetBindable(FrameworkSetting.ShowLogOverlay) - }); + })); - Add(new SettingsCheckbox + Add(new SettingsItemV2(new FormCheckBox { - LabelText = @"Bypass front-to-back render pass", + Caption = @"Bypass front-to-back render pass", Current = config.GetBindable(DebugSetting.BypassFrontToBackPass) - }); + })); } } } diff --git a/osu.Game/Overlays/Settings/Sections/DebugSettings/MemorySettings.cs b/osu.Game/Overlays/Settings/Sections/DebugSettings/MemorySettings.cs index 7b9b88a213..63b09872b7 100644 --- a/osu.Game/Overlays/Settings/Sections/DebugSettings/MemorySettings.cs +++ b/osu.Game/Overlays/Settings/Sections/DebugSettings/MemorySettings.cs @@ -13,6 +13,7 @@ using osu.Framework.Localisation; using osu.Framework.Logging; using osu.Framework.Platform; using osu.Game.Database; +using osu.Game.Graphics.UserInterfaceV2; namespace osu.Game.Overlays.Settings.Sections.DebugSettings { @@ -23,10 +24,10 @@ namespace osu.Game.Overlays.Settings.Sections.DebugSettings [BackgroundDependencyLoader] private void load(GameHost host, RealmAccess realm) { - SettingsButton blockAction; - SettingsButton unblockAction; + SettingsButtonV2 blockAction; + SettingsButtonV2 unblockAction; - Add(new SettingsButton + Add(new SettingsButtonV2 { Text = @"Clear all caches", Action = () => @@ -38,11 +39,11 @@ namespace osu.Game.Overlays.Settings.Sections.DebugSettings } }); - SettingsEnumDropdown latencyModeDropdown; - Add(latencyModeDropdown = new SettingsEnumDropdown + FormEnumDropdown latencyModeDropdown; + Add(new SettingsItemV2(latencyModeDropdown = new FormEnumDropdown { - LabelText = "GC mode", - }); + Caption = "GC mode", + })); latencyModeDropdown.Current.BindValueChanged(mode => { @@ -65,7 +66,7 @@ namespace osu.Game.Overlays.Settings.Sections.DebugSettings { AddRange(new Drawable[] { - new SettingsButton + new SettingsButtonV2 { Text = @"Compact realm", Action = () => @@ -76,11 +77,11 @@ namespace osu.Game.Overlays.Settings.Sections.DebugSettings } } }, - blockAction = new SettingsButton + blockAction = new SettingsButtonV2 { Text = @"Block realm", }, - unblockAction = new SettingsButton + unblockAction = new SettingsButtonV2 { Text = @"Unblock realm", } diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/AudioSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/AudioSettings.cs index 467c988020..403b4f2378 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/AudioSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/AudioSettings.cs @@ -5,12 +5,15 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Localisation; using osu.Game.Configuration; +using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Localisation; namespace osu.Game.Overlays.Settings.Sections.Gameplay { public partial class AudioSettings : SettingsSubsection { + private FormCheckBox alwaysPlayFirstComboBreak = null!; + protected override LocalisableString Header => GameplaySettingsStrings.AudioHeader; [BackgroundDependencyLoader] @@ -18,19 +21,23 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay { Children = new Drawable[] { - new SettingsSlider + new SettingsItemV2(new FormSliderBar { - LabelText = AudioSettingsStrings.PositionalLevel, - Keywords = new[] { @"positional", @"balance" }, + Caption = AudioSettingsStrings.PositionalLevel, Current = osuConfig.GetBindable(OsuSetting.PositionalHitsoundsLevel), KeyboardStep = 0.01f, DisplayAsPercentage = true - }, - new SettingsCheckbox + }) { - ClassicDefault = false, - LabelText = GameplaySettingsStrings.AlwaysPlayFirstComboBreak, + Keywords = new[] { @"positional", @"balance" }, + }, + new SettingsItemV2(alwaysPlayFirstComboBreak = new FormCheckBox + { + Caption = GameplaySettingsStrings.AlwaysPlayFirstComboBreak, Current = config.GetBindable(OsuSetting.AlwaysPlayFirstComboBreak) + }) + { + ApplyClassicDefault = () => alwaysPlayFirstComboBreak.Current.Value = false, } }; } diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/BackgroundSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/BackgroundSettings.cs index 830ccec279..23478fe954 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/BackgroundSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/BackgroundSettings.cs @@ -5,6 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Localisation; using osu.Game.Configuration; +using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Localisation; namespace osu.Game.Overlays.Settings.Sections.Gameplay @@ -18,31 +19,33 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay { Children = new Drawable[] { - new SettingsSlider + new SettingsItemV2(new FormSliderBar { - LabelText = GameplaySettingsStrings.BackgroundDim, + Caption = GameplaySettingsStrings.BackgroundDim, Current = config.GetBindable(OsuSetting.DimLevel), KeyboardStep = 0.01f, DisplayAsPercentage = true - }, - new SettingsSlider + }), + new SettingsItemV2(new FormSliderBar { - LabelText = GameplaySettingsStrings.BackgroundBlur, + Caption = GameplaySettingsStrings.BackgroundBlur, Current = config.GetBindable(OsuSetting.BlurLevel), KeyboardStep = 0.01f, DisplayAsPercentage = true - }, - new SettingsCheckbox + }), + new SettingsItemV2(new FormCheckBox { - LabelText = GameplaySettingsStrings.LightenDuringBreaks, + Caption = GameplaySettingsStrings.LightenDuringBreaks, Current = config.GetBindable(OsuSetting.LightenDuringBreaks), + }) + { Keywords = new[] { "dim", "level" } }, - new SettingsCheckbox + new SettingsItemV2(new FormCheckBox { - LabelText = GameplaySettingsStrings.FadePlayfieldWhenHealthLow, + Caption = GameplaySettingsStrings.FadePlayfieldWhenHealthLow, Current = config.GetBindable(OsuSetting.FadePlayfieldWhenHealthLow), - }, + }), }; } } diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/BeatmapSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/BeatmapSettings.cs index 69566d85f4..32e79809e5 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/BeatmapSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/BeatmapSettings.cs @@ -6,6 +6,7 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Localisation; using osu.Game.Configuration; +using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Localisation; namespace osu.Game.Overlays.Settings.Sections.Gameplay @@ -23,35 +24,41 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay Children = new Drawable[] { - new SettingsCheckbox + new SettingsItemV2(new FormCheckBox { - LabelText = SkinSettingsStrings.BeatmapSkins, + Caption = SkinSettingsStrings.BeatmapSkins, Current = config.GetBindable(OsuSetting.BeatmapSkins) - }, - new SettingsCheckbox + }), + new SettingsItemV2(new FormCheckBox + { + Caption = SkinSettingsStrings.BeatmapColours, + Current = config.GetBindable(OsuSetting.BeatmapColours) + }) { Keywords = new[] { "combo", "override", "color" }, - LabelText = SkinSettingsStrings.BeatmapColours, - Current = config.GetBindable(OsuSetting.BeatmapColours) }, - new SettingsCheckbox + new SettingsItemV2(new FormCheckBox + { + Caption = SkinSettingsStrings.BeatmapHitsounds, + Current = config.GetBindable(OsuSetting.BeatmapHitsounds) + }) { Keywords = new[] { "samples", "override" }, - LabelText = SkinSettingsStrings.BeatmapHitsounds, - Current = config.GetBindable(OsuSetting.BeatmapHitsounds) }, - new SettingsCheckbox + new SettingsItemV2(new FormCheckBox { - LabelText = GraphicsSettingsStrings.StoryboardVideo, + Caption = GraphicsSettingsStrings.StoryboardVideo, Current = config.GetBindable(OsuSetting.ShowStoryboard) - }, - new SettingsSlider + }), + new SettingsItemV2(new FormSliderBar { - Keywords = new[] { "color" }, - LabelText = GraphicsSettingsStrings.ComboColourNormalisation, + Caption = GraphicsSettingsStrings.ComboColourNormalisation, Current = comboColourNormalisation, DisplayAsPercentage = true, - } + }) + { + Keywords = new[] { "color" }, + }, }; } } diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs index 779d5cdf00..34879ffa99 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs @@ -5,6 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Localisation; using osu.Game.Configuration; +using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Localisation; using osu.Game.Rulesets.Scoring; @@ -12,6 +13,8 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay { public partial class GeneralSettings : SettingsSubsection { + private FormEnumDropdown scoringModeDropdown = null!; + protected override LocalisableString Header => CommonStrings.General; [BackgroundDependencyLoader] @@ -19,23 +22,25 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay { Children = new Drawable[] { - new SettingsEnumDropdown + new SettingsItemV2(scoringModeDropdown = new FormEnumDropdown { - ClassicDefault = ScoringMode.Classic, - LabelText = GameplaySettingsStrings.ScoreDisplayMode, + Caption = GameplaySettingsStrings.ScoreDisplayMode, Current = config.GetBindable(OsuSetting.ScoreDisplayMode), - Keywords = new[] { "scoring" } - }, - new SettingsCheckbox + }) { - LabelText = GraphicsSettingsStrings.HitLighting, + Keywords = new[] { "scoring" }, + ApplyClassicDefault = () => scoringModeDropdown.Current.Value = ScoringMode.Classic, + }, + new SettingsItemV2(new FormCheckBox + { + Caption = GraphicsSettingsStrings.HitLighting, Current = config.GetBindable(OsuSetting.HitLighting) - }, - new SettingsCheckbox + }), + new SettingsItemV2(new FormCheckBox { - LabelText = GameplaySettingsStrings.StarFountains, + Caption = GameplaySettingsStrings.StarFountains, Current = config.GetBindable(OsuSetting.StarFountains) - }, + }), }; } } diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/HUDSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/HUDSettings.cs index b4caaf7983..7c9fad624c 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/HUDSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/HUDSettings.cs @@ -5,12 +5,15 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Localisation; using osu.Game.Configuration; +using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Localisation; namespace osu.Game.Overlays.Settings.Sections.Gameplay { public partial class HUDSettings : SettingsSubsection { + private FormCheckBox showHealthDisplayWhenCantFail = null!; + protected override LocalisableString Header => GameplaySettingsStrings.HUDHeader; [BackgroundDependencyLoader] @@ -18,44 +21,50 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay { Children = new Drawable[] { - new SettingsEnumDropdown + new SettingsItemV2(new FormEnumDropdown { - LabelText = GameplaySettingsStrings.HUDVisibilityMode, + Caption = GameplaySettingsStrings.HUDVisibilityMode, Current = config.GetBindable(OsuSetting.HUDVisibilityMode) - }, - new SettingsCheckbox + }), + new SettingsItemV2(new FormCheckBox { - LabelText = GameplaySettingsStrings.ShowReplaySettingsOverlay, + Caption = GameplaySettingsStrings.ShowReplaySettingsOverlay, Current = config.GetBindable(OsuSetting.ReplaySettingsOverlay), + }) + { Keywords = new[] { "hide" }, }, - new SettingsCheckbox + new SettingsItemV2(new FormCheckBox { - LabelText = GameplaySettingsStrings.AlwaysShowKeyOverlay, + Caption = GameplaySettingsStrings.AlwaysShowKeyOverlay, Current = config.GetBindable(OsuSetting.KeyOverlay), + }) + { Keywords = new[] { "counter" }, }, - new SettingsCheckbox + new SettingsItemV2(new FormCheckBox { - LabelText = GameplaySettingsStrings.AlwaysShowGameplayLeaderboard, + Caption = GameplaySettingsStrings.AlwaysShowGameplayLeaderboard, Current = config.GetBindable(OsuSetting.GameplayLeaderboard), - }, - new SettingsCheckbox + }), + new SettingsItemV2(new FormCheckBox { - LabelText = GameplaySettingsStrings.AlwaysRequireHoldForMenu, + Caption = GameplaySettingsStrings.AlwaysRequireHoldForMenu, Current = config.GetBindable(OsuSetting.AlwaysRequireHoldingForPause), - }, - new SettingsCheckbox + }), + new SettingsItemV2(new FormCheckBox { - LabelText = GameplaySettingsStrings.AlwaysShowHoldForMenuButton, + Caption = GameplaySettingsStrings.AlwaysShowHoldForMenuButton, Current = config.GetBindable(OsuSetting.AlwaysShowHoldForMenuButton), - }, - new SettingsCheckbox + }), + new SettingsItemV2(showHealthDisplayWhenCantFail = new FormCheckBox { - ClassicDefault = false, - LabelText = GameplaySettingsStrings.ShowHealthDisplayWhenCantFail, + Caption = GameplaySettingsStrings.ShowHealthDisplayWhenCantFail, Current = config.GetBindable(OsuSetting.ShowHealthDisplayWhenCantFail), - Keywords = new[] { "hp", "bar" } + }) + { + Keywords = new[] { "hp", "bar" }, + ApplyClassicDefault = () => showHealthDisplayWhenCantFail.Current.Value = false, }, }; } diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/InputSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/InputSettings.cs index c245a1a9ea..bed050fac5 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/InputSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/InputSettings.cs @@ -6,6 +6,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Localisation; using osu.Game.Configuration; +using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Localisation; namespace osu.Game.Overlays.Settings.Sections.Gameplay @@ -19,32 +20,35 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay { Children = new Drawable[] { - new SettingsSlider> + new SettingsItemV2(new FormSliderBar { - LabelText = SkinSettingsStrings.GameplayCursorSize, + Caption = SkinSettingsStrings.GameplayCursorSize, Current = config.GetBindable(OsuSetting.GameplayCursorSize), - KeyboardStep = 0.01f - }, - new SettingsCheckbox + KeyboardStep = 0.01f, + LabelFormat = v => $"{v:0.##}x" + }), + new SettingsItemV2(new FormCheckBox { - LabelText = SkinSettingsStrings.AutoCursorSize, + Caption = SkinSettingsStrings.AutoCursorSize, Current = config.GetBindable(OsuSetting.AutoCursorSize) - }, - new SettingsCheckbox + }), + new SettingsItemV2(new FormCheckBox { - LabelText = SkinSettingsStrings.GameplayCursorDuringTouch, - Keywords = new[] { @"touchscreen" }, + Caption = SkinSettingsStrings.GameplayCursorDuringTouch, Current = config.GetBindable(OsuSetting.GameplayCursorDuringTouch) + }) + { + Keywords = new[] { @"touchscreen" }, }, }; if (RuntimeInfo.OS == RuntimeInfo.Platform.Windows) { - Add(new SettingsCheckbox + Add(new SettingsItemV2(new FormCheckBox { - LabelText = GameplaySettingsStrings.DisableWinKey, + Caption = GameplaySettingsStrings.DisableWinKey, Current = config.GetBindable(OsuSetting.GameplayDisableWinKey) - }); + })); } } } diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/ModsSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/ModsSettings.cs index 79a971510f..136108e0ab 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/ModsSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/ModsSettings.cs @@ -6,6 +6,7 @@ using System.Linq; using osu.Framework.Allocation; using osu.Framework.Localisation; using osu.Game.Configuration; +using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Localisation; namespace osu.Game.Overlays.Settings.Sections.Gameplay @@ -21,10 +22,12 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay { Children = new[] { - new SettingsCheckbox + new SettingsItemV2(new FormCheckBox { - LabelText = GameplaySettingsStrings.IncreaseFirstObjectVisibility, + Caption = GameplaySettingsStrings.IncreaseFirstObjectVisibility, Current = config.GetBindable(OsuSetting.IncreaseFirstObjectVisibility), + }) + { Keywords = new[] { @"approach", @"circle", @"hidden" }, }, }; diff --git a/osu.Game/Overlays/Settings/Sections/General/InstallationSettings.cs b/osu.Game/Overlays/Settings/Sections/General/InstallationSettings.cs index 68f3ba9b17..99d04398df 100644 --- a/osu.Game/Overlays/Settings/Sections/General/InstallationSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/InstallationSettings.cs @@ -20,14 +20,14 @@ namespace osu.Game.Overlays.Settings.Sections.General [BackgroundDependencyLoader] private void load(Storage storage) { - Add(new SettingsButton + Add(new SettingsButtonV2 { Text = GeneralSettingsStrings.OpenOsuFolder, Keywords = new[] { @"logs", @"files", @"access", "directory" }, Action = () => storage.PresentExternally(), }); - Add(new DangerousSettingsButton + Add(new DangerousSettingsButtonV2 { Text = GeneralSettingsStrings.ChangeFolderLocation, Action = () => game?.PerformFromScreen(menu => menu.Push(new MigrationSelectScreen())) diff --git a/osu.Game/Overlays/Settings/Sections/General/LanguageSettings.cs b/osu.Game/Overlays/Settings/Sections/General/LanguageSettings.cs index 2af6e36b7f..515302239b 100644 --- a/osu.Game/Overlays/Settings/Sections/General/LanguageSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/LanguageSettings.cs @@ -6,6 +6,7 @@ using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Localisation; using osu.Game.Configuration; +using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Localisation; namespace osu.Game.Overlays.Settings.Sections.General @@ -19,22 +20,22 @@ namespace osu.Game.Overlays.Settings.Sections.General { Children = new Drawable[] { - new SettingsEnumDropdown + new SettingsItemV2(new FormEnumDropdown { - LabelText = GeneralSettingsStrings.LanguageDropdown, + Caption = GeneralSettingsStrings.LanguageDropdown, Current = game.CurrentLanguage, AlwaysShowSearchBar = true, - }, - new SettingsCheckbox + }), + new SettingsItemV2(new FormCheckBox { - LabelText = GeneralSettingsStrings.PreferOriginalMetadataLanguage, + Caption = GeneralSettingsStrings.PreferOriginalMetadataLanguage, Current = frameworkConfig.GetBindable(FrameworkSetting.ShowUnicode) - }, - new SettingsCheckbox + }), + new SettingsItemV2(new FormCheckBox { - LabelText = GeneralSettingsStrings.Prefer24HourTimeDisplay, + Caption = GeneralSettingsStrings.Prefer24HourTimeDisplay, Current = config.GetBindable(OsuSetting.Prefer24HourTime) - }, + }), }; } } diff --git a/osu.Game/Overlays/Settings/Sections/General/QuickActionSettings.cs b/osu.Game/Overlays/Settings/Sections/General/QuickActionSettings.cs index b6b78a6d00..4b504a7e9e 100644 --- a/osu.Game/Overlays/Settings/Sections/General/QuickActionSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/QuickActionSettings.cs @@ -35,21 +35,21 @@ namespace osu.Game.Overlays.Settings.Sections.General { AddRange(new Drawable[] { - new SettingsButton + new SettingsButtonV2 { Text = GeneralSettingsStrings.RunSetupWizard, Keywords = new[] { @"first run", @"initial", @"getting started", @"import", @"tutorial", @"recommended beatmaps" }, TooltipText = FirstRunSetupOverlayStrings.FirstRunSetupDescription, Action = () => firstRunSetupOverlay?.Show(), }, - new SettingsButton + new SettingsButtonV2 { Text = GeneralSettingsStrings.LearnMoreAboutLazer, TooltipText = GeneralSettingsStrings.LearnMoreAboutLazerTooltip, BackgroundColour = colours.YellowDark, Action = () => game?.ShowWiki(@"Help_centre/Upgrading_to_lazer") }, - new SettingsButton + new SettingsButtonV2 { Text = GeneralSettingsStrings.ReportIssue, TooltipText = GeneralSettingsStrings.ReportIssueTooltip, @@ -62,7 +62,7 @@ namespace osu.Game.Overlays.Settings.Sections.General if (supportsExport) { - Add(new SettingsButton + Add(new SettingsButtonV2 { Text = GeneralSettingsStrings.ExportLogs, BackgroundColour = colours.YellowDarker.Darken(0.5f), diff --git a/osu.Game/Overlays/Settings/Sections/General/UpdateSettings.cs b/osu.Game/Overlays/Settings/Sections/General/UpdateSettings.cs index 87b1acc23a..c8efb50acc 100644 --- a/osu.Game/Overlays/Settings/Sections/General/UpdateSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/UpdateSettings.cs @@ -8,6 +8,7 @@ using osu.Framework.Bindables; using osu.Framework.Graphics.Sprites; using osu.Framework.Localisation; using osu.Game.Configuration; +using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Localisation; using osu.Game.Online.Multiplayer; using osu.Game.Overlays.Dialog; @@ -20,8 +21,10 @@ namespace osu.Game.Overlays.Settings.Sections.General { protected override LocalisableString Header => GeneralSettingsStrings.UpdateHeader; - private SettingsButton checkForUpdatesButton = null!; - private SettingsEnumDropdown releaseStreamDropdown = null!; + private SettingsButtonV2 checkForUpdatesButton = null!; + private FormEnumDropdown releaseStreamDropdown = null!; + + private readonly Bindable releaseStreamDropdownNote = new Bindable(); private readonly Bindable configReleaseStream = new Bindable(); @@ -47,26 +50,28 @@ namespace osu.Game.Overlays.Settings.Sections.General // For simplicity, hide the concept of release streams from mobile users. if (isDesktop) { - Add(releaseStreamDropdown = new SettingsEnumDropdown + Add(new SettingsItemV2(releaseStreamDropdown = new FormEnumDropdown { - LabelText = GeneralSettingsStrings.ReleaseStream, + Caption = GeneralSettingsStrings.ReleaseStream, Current = { Value = configReleaseStream.Value }, + }) + { Keywords = new[] { @"version" }, + ShowRevertToDefaultButton = updateManager!.FixedReleaseStream == null }); if (updateManager!.FixedReleaseStream != null) { configReleaseStream.Value = updateManager.FixedReleaseStream.Value; - releaseStreamDropdown.ShowsDefaultIndicator = false; releaseStreamDropdown.Items = [updateManager.FixedReleaseStream.Value]; - releaseStreamDropdown.SetNoticeText(GeneralSettingsStrings.ChangeReleaseStreamPackageManagerWarning); + releaseStreamDropdownNote.Value = new SettingsNote.Data(GeneralSettingsStrings.ChangeReleaseStreamPackageManagerWarning, SettingsNote.Type.Warning); } releaseStreamDropdown.Current.BindValueChanged(releaseStreamChanged); } - Add(checkForUpdatesButton = new SettingsButton + Add(checkForUpdatesButton = new SettingsButtonV2 { Text = GeneralSettingsStrings.CheckUpdate, Action = () => checkForUpdates().FireAndForget() diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/RendererSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/RendererSettings.cs index 69697bd9a3..f1cec99f38 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/RendererSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/RendererSettings.cs @@ -9,7 +9,7 @@ using osu.Framework.Graphics; using osu.Framework.Localisation; using osu.Framework.Platform; using osu.Game.Configuration; -using osu.Game.Graphics.UserInterface; +using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Localisation; using osu.Game.Overlays.Dialog; @@ -29,32 +29,38 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics Children = new Drawable[] { - new RendererSettingsDropdown + new SettingsItemV2(new RendererDropdown { - LabelText = GraphicsSettingsStrings.Renderer, + Caption = GraphicsSettingsStrings.Renderer, Current = renderer, Items = host.GetPreferredRenderersForCurrentPlatform().Order() #pragma warning disable CS0612 // Type or member is obsolete .Where(t => t != RendererType.Vulkan && t != RendererType.OpenGLLegacy), #pragma warning restore CS0612 // Type or member is obsolete + }) + { Keywords = new[] { @"compatibility", @"directx" }, }, // TODO: this needs to be a custom dropdown at some point - new SettingsEnumDropdown + new SettingsItemV2(new FormEnumDropdown { - LabelText = GraphicsSettingsStrings.FrameLimiter, + Caption = GraphicsSettingsStrings.FrameLimiter, Current = config.GetBindable(FrameworkSetting.FrameSync), + }) + { Keywords = new[] { @"fps", @"framerate" }, }, - new SettingsEnumDropdown + new SettingsItemV2(new FormEnumDropdown { - LabelText = GraphicsSettingsStrings.ThreadingMode, + Caption = GraphicsSettingsStrings.ThreadingMode, Current = config.GetBindable(FrameworkSetting.ExecutionMode) - }, - new SettingsCheckbox + }), + new SettingsItemV2(new FormCheckBox { - LabelText = GraphicsSettingsStrings.ShowFPS, + Caption = GraphicsSettingsStrings.ShowFPS, Current = osuConfig.GetBindable(OsuSetting.ShowFpsDisplay), + }) + { Keywords = new[] { @"framerate", @"counter" }, }, }; @@ -82,30 +88,25 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics }); } - private partial class RendererSettingsDropdown : SettingsEnumDropdown + private partial class RendererDropdown : FormEnumDropdown { - protected override OsuDropdown CreateDropdown() => new RendererDropdown(); + private RendererType hostResolvedRenderer; + private bool automaticRendererInUse; - protected partial class RendererDropdown : DropdownControl + [BackgroundDependencyLoader] + private void load(FrameworkConfigManager config, GameHost host) { - private RendererType hostResolvedRenderer; - private bool automaticRendererInUse; + var renderer = config.GetBindable(FrameworkSetting.Renderer); + automaticRendererInUse = renderer.Value == RendererType.Automatic; + hostResolvedRenderer = host.ResolvedRenderer; + } - [BackgroundDependencyLoader] - private void load(FrameworkConfigManager config, GameHost host) - { - var renderer = config.GetBindable(FrameworkSetting.Renderer); - automaticRendererInUse = renderer.Value == RendererType.Automatic; - hostResolvedRenderer = host.ResolvedRenderer; - } + protected override LocalisableString GenerateItemText(RendererType item) + { + if (item == RendererType.Automatic && automaticRendererInUse) + return LocalisableString.Interpolate($"{base.GenerateItemText(item)} ({hostResolvedRenderer.GetDescription()})"); - protected override LocalisableString GenerateItemText(RendererType item) - { - if (item == RendererType.Automatic && automaticRendererInUse) - return LocalisableString.Interpolate($"{base.GenerateItemText(item)} ({hostResolvedRenderer.GetDescription()})"); - - return base.GenerateItemText(item); - } + return base.GenerateItemText(item); } } } diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/ScreenshotSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/ScreenshotSettings.cs index c7180ec51b..f5dd19dc99 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/ScreenshotSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/ScreenshotSettings.cs @@ -5,6 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Localisation; using osu.Game.Configuration; +using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Localisation; namespace osu.Game.Overlays.Settings.Sections.Graphics @@ -18,16 +19,16 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics { Children = new Drawable[] { - new SettingsEnumDropdown + new SettingsItemV2(new FormEnumDropdown { - LabelText = GraphicsSettingsStrings.ScreenshotFormat, + Caption = GraphicsSettingsStrings.ScreenshotFormat, Current = config.GetBindable(OsuSetting.ScreenshotFormat) - }, - new SettingsCheckbox + }), + new SettingsItemV2(new FormCheckBox { - LabelText = GraphicsSettingsStrings.ShowCursorInScreenshots, + Caption = GraphicsSettingsStrings.ShowCursorInScreenshots, Current = config.GetBindable(OsuSetting.ScreenshotCaptureMenuCursor) - } + }) }; } } diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/VideoSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/VideoSettings.cs index 2e0bbe3c16..0481b45037 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/VideoSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/VideoSettings.cs @@ -9,6 +9,7 @@ using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Video; using osu.Framework.Localisation; +using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Localisation; namespace osu.Game.Overlays.Settings.Sections.Graphics @@ -18,7 +19,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics protected override LocalisableString Header => GraphicsSettingsStrings.VideoHeader; private Bindable hardwareVideoDecoder; - private SettingsCheckbox hwAccelCheckbox; + private FormCheckBox hwAccelCheckbox; [BackgroundDependencyLoader] private void load(FrameworkConfigManager config) @@ -27,10 +28,10 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics Children = new Drawable[] { - hwAccelCheckbox = new SettingsCheckbox + new SettingsItemV2(hwAccelCheckbox = new FormCheckBox { - LabelText = GraphicsSettingsStrings.UseHardwareAcceleration, - }, + Caption = GraphicsSettingsStrings.UseHardwareAcceleration, + }), }; hwAccelCheckbox.Current.Default = hardwareVideoDecoder.Default != HardwareVideoDecoder.None; diff --git a/osu.Game/Overlays/Settings/Sections/Input/BindingSettings.cs b/osu.Game/Overlays/Settings/Sections/Input/BindingSettings.cs index 704fa6e907..c892e8fa21 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/BindingSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/BindingSettings.cs @@ -19,7 +19,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input { Children = new Drawable[] { - new SettingsButton + new SettingsButtonV2 { Text = BindingSettingsStrings.Configure, TooltipText = BindingSettingsStrings.ChangeBindingsButton, diff --git a/osu.Game/Overlays/Settings/Sections/Input/KeyBindingsSubsection.cs b/osu.Game/Overlays/Settings/Sections/Input/KeyBindingsSubsection.cs index cde9f10549..873ecc3f47 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/KeyBindingsSubsection.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/KeyBindingsSubsection.cs @@ -111,7 +111,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input } } - public partial class ResetButton : DangerousSettingsButton + public partial class ResetButton : DangerousSettingsButtonV2 { [BackgroundDependencyLoader] private void load() diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/BeatmapSettings.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/BeatmapSettings.cs index 597e03fab2..a4d20fb459 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/BeatmapSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/BeatmapSettings.cs @@ -14,16 +14,16 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance { protected override LocalisableString Header => CommonStrings.Beatmaps; - private SettingsButton deleteBeatmapsButton = null!; - private SettingsButton deleteBeatmapVideosButton = null!; - private SettingsButton resetOffsetsButton = null!; - private SettingsButton restoreButton = null!; - private SettingsButton undeleteButton = null!; + private SettingsButtonV2 deleteBeatmapsButton = null!; + private SettingsButtonV2 deleteBeatmapVideosButton = null!; + private SettingsButtonV2 resetOffsetsButton = null!; + private SettingsButtonV2 restoreButton = null!; + private SettingsButtonV2 undeleteButton = null!; [BackgroundDependencyLoader] private void load(BeatmapManager beatmaps, IDialogOverlay? dialogOverlay) { - Add(deleteBeatmapsButton = new DangerousSettingsButton + Add(deleteBeatmapsButton = new DangerousSettingsButtonV2 { Text = MaintenanceSettingsStrings.DeleteAllBeatmaps, Action = () => @@ -36,7 +36,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance } }); - Add(deleteBeatmapVideosButton = new DangerousSettingsButton + Add(deleteBeatmapVideosButton = new DangerousSettingsButtonV2 { Text = MaintenanceSettingsStrings.DeleteAllBeatmapVideos, Action = () => @@ -49,7 +49,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance } }); - Add(resetOffsetsButton = new DangerousSettingsButton + Add(resetOffsetsButton = new DangerousSettingsButtonV2 { Text = MaintenanceSettingsStrings.ResetAllOffsets, Action = () => @@ -64,7 +64,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance AddRange(new Drawable[] { - restoreButton = new SettingsButton + restoreButton = new SettingsButtonV2 { Text = MaintenanceSettingsStrings.RestoreAllHiddenDifficulties, Action = () => @@ -73,7 +73,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance Task.Run(beatmaps.RestoreAll).ContinueWith(_ => Schedule(() => restoreButton.Enabled.Value = true)); } }, - undeleteButton = new SettingsButton + undeleteButton = new SettingsButtonV2 { Text = MaintenanceSettingsStrings.RestoreAllRecentlyDeletedBeatmaps, Action = () => diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/CollectionsSettings.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/CollectionsSettings.cs index b1c44aa93c..922969035d 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/CollectionsSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/CollectionsSettings.cs @@ -24,7 +24,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance [BackgroundDependencyLoader] private void load(IDialogOverlay? dialogOverlay) { - Add(new DangerousSettingsButton + Add(new DangerousSettingsButtonV2 { Text = MaintenanceSettingsStrings.DeleteAllCollections, Action = () => diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs index 47314dcafe..2c79daffb6 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs @@ -29,7 +29,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance AddRange(new Drawable[] { - new SettingsButton + new SettingsButtonV2 { Text = DebugSettingsStrings.ImportFiles, Action = () => @@ -40,7 +40,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance performer?.PerformFromScreen(menu => menu.Push(new FileImportScreen())); }, }, - new SettingsButton + new SettingsButtonV2 { Text = DebugSettingsStrings.RunLatencyCertifier, Action = () => performer?.PerformFromScreen(menu => menu.Push(new LatencyCertifierScreen())) diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/ModPresetSettings.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/ModPresetSettings.cs index 9c55308abe..17101c6526 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/ModPresetSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/ModPresetSettings.cs @@ -25,15 +25,15 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance [Resolved] private INotificationOverlay? notificationOverlay { get; set; } - private SettingsButton undeleteButton = null!; - private SettingsButton deleteAllButton = null!; + private SettingsButtonV2 undeleteButton = null!; + private SettingsButtonV2 deleteAllButton = null!; [BackgroundDependencyLoader] private void load(IDialogOverlay? dialogOverlay) { AddRange(new Drawable[] { - deleteAllButton = new DangerousSettingsButton + deleteAllButton = new DangerousSettingsButtonV2 { Text = MaintenanceSettingsStrings.DeleteAllModPresets, Action = () => @@ -45,7 +45,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance }, DeleteConfirmationContentStrings.ModPresets)); } }, - undeleteButton = new SettingsButton + undeleteButton = new SettingsButtonV2 { Text = MaintenanceSettingsStrings.RestoreAllRecentlyDeletedModPresets, Action = () => Task.Run(undeleteModPresets).ContinueWith(t => Schedule(onModPresetsUndeleted, t)) diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/ScoreSettings.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/ScoreSettings.cs index 235f239c7c..b4a1d449ed 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/ScoreSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/ScoreSettings.cs @@ -13,12 +13,12 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance { protected override LocalisableString Header => CommonStrings.Scores; - private SettingsButton deleteScoresButton = null!; + private SettingsButtonV2 deleteScoresButton = null!; [BackgroundDependencyLoader] private void load(ScoreManager scores, IDialogOverlay? dialogOverlay) { - Add(deleteScoresButton = new DangerousSettingsButton + Add(deleteScoresButton = new DangerousSettingsButtonV2 { Text = MaintenanceSettingsStrings.DeleteAllScores, Action = () => diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/SkinSettings.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/SkinSettings.cs index e962118a36..85b4898e05 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/SkinSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/SkinSettings.cs @@ -13,12 +13,12 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance { protected override LocalisableString Header => CommonStrings.Skins; - private SettingsButton deleteSkinsButton = null!; + private SettingsButtonV2 deleteSkinsButton = null!; [BackgroundDependencyLoader] private void load(SkinManager skins, IDialogOverlay? dialogOverlay) { - Add(deleteSkinsButton = new DangerousSettingsButton + Add(deleteSkinsButton = new DangerousSettingsButtonV2 { Text = MaintenanceSettingsStrings.DeleteAllSkins, Action = () => diff --git a/osu.Game/Overlays/Settings/Sections/Online/AlertsAndPrivacySettings.cs b/osu.Game/Overlays/Settings/Sections/Online/AlertsAndPrivacySettings.cs index 608c6ef1b2..227d3feeaf 100644 --- a/osu.Game/Overlays/Settings/Sections/Online/AlertsAndPrivacySettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Online/AlertsAndPrivacySettings.cs @@ -5,6 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Localisation; using osu.Game.Configuration; +using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Localisation; namespace osu.Game.Overlays.Settings.Sections.Online @@ -18,27 +19,27 @@ namespace osu.Game.Overlays.Settings.Sections.Online { Children = new Drawable[] { - new SettingsCheckbox + new SettingsItemV2(new FormCheckBox { - LabelText = OnlineSettingsStrings.NotifyOnMentioned, + Caption = OnlineSettingsStrings.NotifyOnMentioned, Current = config.GetBindable(OsuSetting.NotifyOnUsernameMentioned) - }, - new SettingsCheckbox + }), + new SettingsItemV2(new FormCheckBox { - LabelText = OnlineSettingsStrings.NotifyOnPrivateMessage, + Caption = OnlineSettingsStrings.NotifyOnPrivateMessage, Current = config.GetBindable(OsuSetting.NotifyOnPrivateMessage) - }, - new SettingsCheckbox + }), + new SettingsItemV2(new FormCheckBox { - LabelText = OnlineSettingsStrings.NotifyOnFriendPresenceChange, - TooltipText = OnlineSettingsStrings.NotifyOnFriendPresenceChangeTooltip, + Caption = OnlineSettingsStrings.NotifyOnFriendPresenceChange, + HintText = OnlineSettingsStrings.NotifyOnFriendPresenceChangeTooltip, Current = config.GetBindable(OsuSetting.NotifyOnFriendPresenceChange), - }, - new SettingsCheckbox + }), + new SettingsItemV2(new FormCheckBox { - LabelText = OnlineSettingsStrings.HideCountryFlags, + Caption = OnlineSettingsStrings.HideCountryFlags, Current = config.GetBindable(OsuSetting.HideCountryFlags) - }, + }), }; } } diff --git a/osu.Game/Overlays/Settings/Sections/Online/IntegrationSettings.cs b/osu.Game/Overlays/Settings/Sections/Online/IntegrationSettings.cs index 3d0fac32cf..3445c67b95 100644 --- a/osu.Game/Overlays/Settings/Sections/Online/IntegrationSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Online/IntegrationSettings.cs @@ -5,6 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Localisation; using osu.Game.Configuration; +using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Localisation; namespace osu.Game.Overlays.Settings.Sections.Online @@ -18,11 +19,11 @@ namespace osu.Game.Overlays.Settings.Sections.Online { Children = new Drawable[] { - new SettingsEnumDropdown + new SettingsItemV2(new FormEnumDropdown { - LabelText = OnlineSettingsStrings.DiscordRichPresence, + Caption = OnlineSettingsStrings.DiscordRichPresence, Current = config.GetBindable(OsuSetting.DiscordRichPresence) - } + }), }; } } diff --git a/osu.Game/Overlays/Settings/Sections/Online/WebSettings.cs b/osu.Game/Overlays/Settings/Sections/Online/WebSettings.cs index ce5c85bed0..bcb1d91547 100644 --- a/osu.Game/Overlays/Settings/Sections/Online/WebSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Online/WebSettings.cs @@ -5,6 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Localisation; using osu.Game.Configuration; +using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Localisation; namespace osu.Game.Overlays.Settings.Sections.Online @@ -18,28 +19,34 @@ namespace osu.Game.Overlays.Settings.Sections.Online { Children = new Drawable[] { - new SettingsCheckbox + new SettingsItemV2(new FormCheckBox { - LabelText = OnlineSettingsStrings.ExternalLinkWarning, + Caption = OnlineSettingsStrings.ExternalLinkWarning, Current = config.GetBindable(OsuSetting.ExternalLinkWarning) - }, - new SettingsCheckbox + }), + new SettingsItemV2(new FormCheckBox { - LabelText = OnlineSettingsStrings.PreferNoVideo, - Keywords = new[] { "no-video" }, + Caption = OnlineSettingsStrings.PreferNoVideo, Current = config.GetBindable(OsuSetting.PreferNoVideo) - }, - new SettingsCheckbox + }) { - LabelText = OnlineSettingsStrings.AutomaticallyDownloadMissingBeatmaps, - Keywords = new[] { "spectator", "replay" }, + Keywords = new[] { "no-video" }, + }, + new SettingsItemV2(new FormCheckBox + { + Caption = OnlineSettingsStrings.AutomaticallyDownloadMissingBeatmaps, Current = config.GetBindable(OsuSetting.AutomaticallyDownloadMissingBeatmaps), - }, - new SettingsCheckbox + }) { - LabelText = OnlineSettingsStrings.ShowExplicitContent, - Keywords = new[] { "nsfw", "18+", "offensive" }, + Keywords = new[] { "spectator", "replay" }, + }, + new SettingsItemV2(new FormCheckBox + { + Caption = OnlineSettingsStrings.ShowExplicitContent, Current = config.GetBindable(OsuSetting.ShowOnlineExplicitContent), + }) + { + Keywords = new[] { "nsfw", "18+", "offensive" }, } }; } diff --git a/osu.Game/Overlays/Settings/Sections/SkinSection.cs b/osu.Game/Overlays/Settings/Sections/SkinSection.cs index 4d7c0117e2..022d7d38c9 100644 --- a/osu.Game/Overlays/Settings/Sections/SkinSection.cs +++ b/osu.Game/Overlays/Settings/Sections/SkinSection.cs @@ -33,7 +33,7 @@ namespace osu.Game.Overlays.Settings.Sections { public partial class SkinSection : SettingsSection { - private SkinSettingsDropdown skinDropdown; + private SkinDropdown skinDropdown; public override LocalisableString Header => SkinSettingsStrings.SkinSectionHeader; @@ -65,29 +65,28 @@ namespace osu.Game.Overlays.Settings.Sections { Children = new Drawable[] { - skinDropdown = new SkinSettingsDropdown + new SettingsItemV2(skinDropdown = new SkinDropdown { AlwaysShowSearchBar = true, AllowNonContiguousMatching = true, - LabelText = SkinSettingsStrings.CurrentSkin, + Caption = SkinSettingsStrings.CurrentSkin, Current = skins.CurrentSkinInfo, - }, + }), new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Horizontal, - Spacing = new Vector2(5, 0), - Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS, Right = SettingsPanel.CONTENT_MARGINS }, + Padding = SettingsPanel.ContentPaddingV2, Children = new Drawable[] { // This is all super-temporary until we move skin settings to their own panel / overlay. - new RenameSkinButton { Padding = new MarginPadding(), RelativeSizeAxes = Axes.None, Width = 120 }, - new ExportSkinButton { Padding = new MarginPadding(), RelativeSizeAxes = Axes.None, Width = 120 }, - new DeleteSkinButton { Padding = new MarginPadding(), RelativeSizeAxes = Axes.None, Width = 110 }, + new RenameSkinButton { Padding = new MarginPadding { Right = 2.5f }, RelativeSizeAxes = Axes.X, Width = 1 / 3f }, + new ExportSkinButton { Padding = new MarginPadding { Horizontal = 2.5f }, RelativeSizeAxes = Axes.X, Width = 1 / 3f }, + new DeleteSkinButton { Padding = new MarginPadding { Left = 2.5f }, RelativeSizeAxes = Axes.X, Width = 1 / 3f }, } }, - new SettingsButton + new SettingsButtonV2 { Text = SkinSettingsStrings.SkinLayoutEditor, Action = () => skinEditor?.ToggleVisibility(), @@ -148,17 +147,12 @@ namespace osu.Game.Overlays.Settings.Sections realmSubscription?.Dispose(); } - private partial class SkinSettingsDropdown : SettingsDropdown> + private partial class SkinDropdown : FormDropdown> { - protected override OsuDropdown> CreateDropdown() => new SkinDropdownControl(); - - private partial class SkinDropdownControl : DropdownControl - { - protected override LocalisableString GenerateItemText(Live item) => item.ToString(); - } + protected override LocalisableString GenerateItemText(Live item) => item.ToString(); } - public partial class RenameSkinButton : SettingsButton, IHasPopover + public partial class RenameSkinButton : SettingsButtonV2, IHasPopover { [Resolved] private SkinManager skins { get; set; } @@ -189,7 +183,7 @@ namespace osu.Game.Overlays.Settings.Sections } } - public partial class ExportSkinButton : SettingsButton + public partial class ExportSkinButton : SettingsButtonV2 { [Resolved] private SkinManager skins { get; set; } @@ -227,7 +221,7 @@ namespace osu.Game.Overlays.Settings.Sections } } - public partial class DeleteSkinButton : DangerousSettingsButton + public partial class DeleteSkinButton : DangerousSettingsButtonV2 { [Resolved] private SkinManager skins { get; set; } diff --git a/osu.Game/Overlays/Settings/Sections/UserInterface/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/UserInterface/GeneralSettings.cs index 3f39980b43..1e8852d4b7 100644 --- a/osu.Game/Overlays/Settings/Sections/UserInterface/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/UserInterface/GeneralSettings.cs @@ -5,13 +5,15 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Localisation; using osu.Game.Configuration; -using osu.Game.Graphics.UserInterface; +using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Localisation; namespace osu.Game.Overlays.Settings.Sections.UserInterface { public partial class GeneralSettings : SettingsSubsection { + private FormSliderBar holdToConfirmSlider = null!; + protected override LocalisableString Header => CommonStrings.General; [BackgroundDependencyLoader] @@ -19,29 +21,33 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface { Children = new Drawable[] { - new SettingsCheckbox + new SettingsItemV2(new FormCheckBox { - LabelText = UserInterfaceStrings.CursorRotation, + Caption = UserInterfaceStrings.CursorRotation, Current = config.GetBindable(OsuSetting.CursorRotation) - }, - new SettingsSlider> + }), + new SettingsItemV2(new FormSliderBar { - LabelText = UserInterfaceStrings.MenuCursorSize, + Caption = UserInterfaceStrings.MenuCursorSize, Current = config.GetBindable(OsuSetting.MenuCursorSize), - KeyboardStep = 0.01f - }, - new SettingsCheckbox + KeyboardStep = 0.01f, + LabelFormat = v => $"{v:0.##}x" + }), + new SettingsItemV2(new FormCheckBox { - LabelText = UserInterfaceStrings.Parallax, + Caption = UserInterfaceStrings.Parallax, Current = config.GetBindable(OsuSetting.MenuParallax) - }, - new SettingsSlider + }), + new SettingsItemV2(holdToConfirmSlider = new FormSliderBar { - ClassicDefault = 0, - LabelText = UserInterfaceStrings.HoldToConfirmActivationTime, + Caption = UserInterfaceStrings.HoldToConfirmActivationTime, Current = config.GetBindable(OsuSetting.UIHoldActivationDelay), + KeyboardStep = 50, + LabelFormat = v => $"{v:N0} ms", + }) + { Keywords = new[] { @"delay" }, - KeyboardStep = 50 + ApplyClassicDefault = () => holdToConfirmSlider.Current.Value = 0, }, }; } diff --git a/osu.Game/Overlays/Settings/Sections/UserInterface/MainMenuSettings.cs b/osu.Game/Overlays/Settings/Sections/UserInterface/MainMenuSettings.cs index c50d56b458..f9f57d07f8 100644 --- a/osu.Game/Overlays/Settings/Sections/UserInterface/MainMenuSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/UserInterface/MainMenuSettings.cs @@ -1,13 +1,12 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Localisation; using osu.Game.Configuration; +using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Localisation; using osu.Game.Online.API; using osu.Game.Online.API.Requests.Responses; @@ -18,9 +17,9 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface { protected override LocalisableString Header => UserInterfaceStrings.MainMenuHeader; - private IBindable user; + private IBindable user = null!; - private SettingsEnumDropdown backgroundSourceDropdown; + private readonly Bindable backgroundSourceNote = new Bindable(); [BackgroundDependencyLoader] private void load(OsuConfigManager config, IAPIProvider api) @@ -29,38 +28,45 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface Children = new Drawable[] { - new SettingsCheckbox + new SettingsItemV2(new FormCheckBox { - LabelText = UserInterfaceStrings.ShowMenuTips, + Caption = UserInterfaceStrings.ShowMenuTips, Current = config.GetBindable(OsuSetting.MenuTips) - }, - new SettingsCheckbox + }), + new SettingsItemV2(new FormCheckBox { - Keywords = new[] { "intro", "welcome" }, - LabelText = UserInterfaceStrings.InterfaceVoices, + Caption = UserInterfaceStrings.InterfaceVoices, Current = config.GetBindable(OsuSetting.MenuVoice) - }, - new SettingsCheckbox + }) { Keywords = new[] { "intro", "welcome" }, - LabelText = UserInterfaceStrings.OsuMusicTheme, + }, + new SettingsItemV2(new FormCheckBox + { + Caption = UserInterfaceStrings.OsuMusicTheme, Current = config.GetBindable(OsuSetting.MenuMusic) - }, - new SettingsEnumDropdown + }) { - LabelText = UserInterfaceStrings.IntroSequence, + Keywords = new[] { "intro", "welcome" }, + }, + new SettingsItemV2(new FormEnumDropdown + { + Caption = UserInterfaceStrings.IntroSequence, Current = config.GetBindable(OsuSetting.IntroSequence), - }, - backgroundSourceDropdown = new SettingsEnumDropdown + }), + new SettingsItemV2(new FormEnumDropdown { - LabelText = UserInterfaceStrings.BackgroundSource, + Caption = UserInterfaceStrings.BackgroundSource, Current = config.GetBindable(OsuSetting.MenuBackgroundSource), - }, - new SettingsEnumDropdown + }) { - LabelText = UserInterfaceStrings.SeasonalBackgrounds, + Note = { BindTarget = backgroundSourceNote }, + }, + new SettingsItemV2(new FormEnumDropdown + { + Caption = UserInterfaceStrings.SeasonalBackgrounds, Current = config.GetBindable(OsuSetting.SeasonalBackgroundMode), - } + }) }; } @@ -71,9 +77,9 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface user.BindValueChanged(u => { if (u.NewValue?.IsSupporter != true) - backgroundSourceDropdown.SetNoticeText(UserInterfaceStrings.NotSupporterNote, true); + backgroundSourceNote.Value = new SettingsNote.Data(UserInterfaceStrings.NotSupporterNote, SettingsNote.Type.Warning); else - backgroundSourceDropdown.ClearNoticeText(); + backgroundSourceNote.Value = null; }, true); } } diff --git a/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs b/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs index d15008f858..72ebe33491 100644 --- a/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs @@ -5,6 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Localisation; using osu.Game.Configuration; +using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Localisation; using osu.Game.Overlays.Mods.Input; @@ -12,6 +13,9 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface { public partial class SongSelectSettings : SettingsSubsection { + private FormEnumDropdown modSelectHotkeyStyle = null!; + private FormCheckBox modSelectTextSearchStartsActive = null!; + protected override LocalisableString Header => UserInterfaceStrings.SongSelectHeader; [BackgroundDependencyLoader] @@ -19,35 +23,43 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface { Children = new Drawable[] { - new SettingsCheckbox + new SettingsItemV2(new FormCheckBox { - LabelText = UserInterfaceStrings.ShowConvertedBeatmaps, + Caption = UserInterfaceStrings.ShowConvertedBeatmaps, Current = config.GetBindable(OsuSetting.ShowConvertedBeatmaps), + }) + { Keywords = new[] { "converts", "converted" } }, - new SettingsEnumDropdown + new SettingsItemV2(new FormEnumDropdown { - LabelText = UserInterfaceStrings.RandomSelectionAlgorithm, + Caption = UserInterfaceStrings.RandomSelectionAlgorithm, Current = config.GetBindable(OsuSetting.RandomSelectAlgorithm), - }, - new SettingsEnumDropdown + }), + new SettingsItemV2(modSelectHotkeyStyle = new FormEnumDropdown { - LabelText = UserInterfaceStrings.ModSelectHotkeyStyle, + Caption = UserInterfaceStrings.ModSelectHotkeyStyle, Current = config.GetBindable(OsuSetting.ModSelectHotkeyStyle), - ClassicDefault = ModSelectHotkeyStyle.Classic - }, - new SettingsCheckbox + }) { - LabelText = UserInterfaceStrings.ModSelectTextSearchStartsActive, + ApplyClassicDefault = () => modSelectHotkeyStyle.Current.Value = ModSelectHotkeyStyle.Classic, + }, + new SettingsItemV2(modSelectTextSearchStartsActive = new FormCheckBox + { + Caption = UserInterfaceStrings.ModSelectTextSearchStartsActive, Current = config.GetBindable(OsuSetting.ModSelectTextSearchStartsActive), - ClassicDefault = false - }, - new SettingsCheckbox + }) { - LabelText = GameplaySettingsStrings.BackgroundBlur, + ApplyClassicDefault = () => modSelectTextSearchStartsActive.Current.Value = false, + }, + new SettingsItemV2(new FormCheckBox + { + Caption = GameplaySettingsStrings.BackgroundBlur, Current = config.GetBindable(OsuSetting.SongSelectBackgroundBlur), - ClassicDefault = false, - } + }) + { + ApplyClassicDefault = () => backgroundBlurCheckbox.Current.Value = false, + }, }; } }