Update game settings to use new form controls

This commit is contained in:
Salman Alshamrani
2025-12-31 10:02:34 -05:00
parent 7ea1bbf91e
commit e548cd40dc
41 changed files with 590 additions and 513 deletions

View File

@@ -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<ManiaScrollingDirection>
new SettingsItemV2(new FormEnumDropdown<ManiaScrollingDirection>
{
LabelText = RulesetSettingsStrings.ScrollingDirection,
Caption = RulesetSettingsStrings.ScrollingDirection,
Current = config.GetBindable<ManiaScrollingDirection>(ManiaRulesetSetting.ScrollDirection)
},
new SettingsSlider<double, ManiaScrollSlider>
}),
new SettingsItemV2(new FormSliderBar<double>
{
LabelText = RulesetSettingsStrings.ScrollSpeed,
Caption = RulesetSettingsStrings.ScrollSpeed,
Current = config.GetBindable<double>(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<bool>(ManiaRulesetSetting.TimingBasedNoteColouring),
})
{
Keywords = new[] { "color" },
LabelText = RulesetSettingsStrings.TimingBasedColouring,
Current = config.GetBindable<bool>(ManiaRulesetSetting.TimingBasedNoteColouring),
},
};
Add(new SettingsCheckbox
Add(new SettingsItemV2(new FormCheckBox
{
LabelText = RulesetSettingsStrings.TouchOverlay,
Caption = RulesetSettingsStrings.TouchOverlay,
Current = config.GetBindable<bool>(ManiaRulesetSetting.TouchOverlay)
});
}));
if (RuntimeInfo.IsMobile)
{
Add(new SettingsEnumDropdown<ManiaMobileLayout>
Add(new SettingsItemV2(new FormEnumDropdown<ManiaMobileLayout>
{
LabelText = RulesetSettingsStrings.MobileLayout,
Caption = RulesetSettingsStrings.MobileLayout,
Current = config.GetBindable<ManiaMobileLayout>(ManiaRulesetSetting.MobileLayout),
#pragma warning disable CS0618 // Type or member is obsolete
Items = Enum.GetValues<ManiaMobileLayout>().Where(l => l != ManiaMobileLayout.LandscapeWithOverlay),
#pragma warning restore CS0618 // Type or member is obsolete
});
}));
}
}
private partial class ManiaScrollSlider : RoundedSliderBar<double>
{
public override LocalisableString TooltipText => RulesetSettingsStrings.ScrollSpeedTooltip((int)DrawableManiaRuleset.ComputeScrollTime(Current.Value), Current.Value);
}
}
}

View File

@@ -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<bool>(OsuRulesetSetting.SnakingInSliders)
},
new SettingsCheckbox
}),
new SettingsItemV2(snakingOutSliders = new FormCheckBox
{
ClassicDefault = false,
LabelText = RulesetSettingsStrings.SnakingOutSliders,
Caption = RulesetSettingsStrings.SnakingOutSliders,
Current = config.GetBindable<bool>(OsuRulesetSetting.SnakingOutSliders)
},
new SettingsCheckbox
})
{
LabelText = RulesetSettingsStrings.CursorTrail,
ApplyClassicDefault = () => snakingOutSliders.Current.Value = false,
},
new SettingsItemV2(new FormCheckBox
{
Caption = RulesetSettingsStrings.CursorTrail,
Current = config.GetBindable<bool>(OsuRulesetSetting.ShowCursorTrail)
},
new SettingsCheckbox
}),
new SettingsItemV2(new FormCheckBox
{
LabelText = RulesetSettingsStrings.CursorRipples,
Caption = RulesetSettingsStrings.CursorRipples,
Current = config.GetBindable<bool>(OsuRulesetSetting.ShowCursorRipples)
},
new SettingsEnumDropdown<PlayfieldBorderStyle>
}),
new SettingsItemV2(new FormEnumDropdown<PlayfieldBorderStyle>
{
LabelText = RulesetSettingsStrings.PlayfieldBorderStyle,
Caption = RulesetSettingsStrings.PlayfieldBorderStyle,
Current = config.GetBindable<PlayfieldBorderStyle>(OsuRulesetSetting.PlayfieldBorderStyle),
},
}),
};
}
}

View File

@@ -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<TaikoTouchControlScheme>
new SettingsItemV2(new FormEnumDropdown<TaikoTouchControlScheme>
{
LabelText = RulesetSettingsStrings.TouchControlScheme,
Caption = RulesetSettingsStrings.TouchControlScheme,
Current = config.GetBindable<TaikoTouchControlScheme>(TaikoRulesetSetting.TouchControlScheme)
}
})
};
}
}

View File

@@ -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;

View File

@@ -396,7 +396,7 @@ namespace osu.Game.Graphics.UserInterfaceV2
private LocalisableString defaultLabelFormat(T value) => currentNumberInstantaneous.Value.ToStandardFormattedString(OsuSliderBar<T>.MAX_DECIMAL_DIGITS, DisplayAsPercentage);
private partial class InnerSlider : OsuSliderBar<T>
public partial class InnerSlider : OsuSliderBar<T>
{
public BindableBool Focused { get; } = new BindableBool();

View File

@@ -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<string> dropdown = null!;
private AudioDeviceDropdown dropdown = null!;
private SettingsCheckbox? wasapiExperimental;
private FormCheckBox? wasapiExperimental;
private readonly Bindable<SettingsNote.Data?> wasapiExperimentalNote = new Bindable<SettingsNote.Data?>();
[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<string>
private partial class AudioDeviceDropdown : FormDropdown<string>
{
protected override OsuDropdown<string> 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);
}
}
}

View File

@@ -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<double>
public partial class AudioOffsetAdjustControl : CompositeDrawable
{
public IBindable<double?> SuggestedOffset => ((AudioOffsetPreview)Control).SuggestedOffset;
[BackgroundDependencyLoader]
private void load()
public Bindable<double> Current
{
LabelText = AudioSettingsStrings.AudioOffset;
get => current.Current;
set => current.Current = value;
}
protected override Drawable CreateControl() => new AudioOffsetPreview();
private readonly BindableNumberWithCurrent<double> current = new BindableNumberWithCurrent<double>();
private partial class AudioOffsetPreview : CompositeDrawable, IHasCurrentValue<double>
private readonly IBindableList<SessionAverageHitErrorTracker.DataPoint> averageHitErrorHistory = new BindableList<SessionAverageHitErrorTracker.DataPoint>();
public readonly Bindable<double?> SuggestedOffset = new Bindable<double?>();
private Container<Box> notchContainer = null!;
private TextFlowContainer hintText = null!;
private RoundedButton applySuggestion = null!;
[BackgroundDependencyLoader]
private void load(SessionAverageHitErrorTracker hitErrorTracker)
{
public Bindable<double> Current
averageHitErrorHistory.BindTo(hitErrorTracker.AverageHitErrorHistory);
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
InternalChild = new FillFlowContainer
{
get => current.Current;
set => current.Current = value;
}
private readonly BindableNumberWithCurrent<double> current = new BindableNumberWithCurrent<double>();
private readonly IBindableList<SessionAverageHitErrorTracker.DataPoint> averageHitErrorHistory = new BindableList<SessionAverageHitErrorTracker.DataPoint>();
public readonly Bindable<double?> SuggestedOffset = new Bindable<double?>();
private Container<Box> 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<double>
{
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<Box>
Child = notchContainer = new Container<Box>
{
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<double>.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<double>
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));
}
}
}

View File

@@ -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<double>(OsuSetting.AudioOffset),
},
new SettingsCheckbox
new SettingsItemV2(new FormCheckBox
{
LabelText = AudioSettingsStrings.AdjustBeatmapOffsetAutomatically,
TooltipText = AudioSettingsStrings.AdjustBeatmapOffsetAutomaticallyTooltip,
Caption = AudioSettingsStrings.AdjustBeatmapOffsetAutomatically,
HintText = AudioSettingsStrings.AdjustBeatmapOffsetAutomaticallyTooltip,
Current = config.GetBindable<bool>(OsuSetting.AutomaticallyAdjustBeatmapOffset),
}
})
};
}
}

View File

@@ -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<double>
{
LabelText = AudioSettingsStrings.MasterVolume,
Caption = AudioSettingsStrings.MasterVolume,
Current = audio.Volume,
KeyboardStep = 0.01f,
DisplayAsPercentage = true
},
new SettingsSlider<double>
DisplayAsPercentage = true,
PlaySamplesOnAdjust = false,
}),
new SettingsItemV2(new FormSliderBar<double>
{
LabelText = AudioSettingsStrings.MasterVolumeInactive,
Caption = AudioSettingsStrings.MasterVolumeInactive,
Current = config.GetBindable<double>(OsuSetting.VolumeInactive),
KeyboardStep = 0.01f,
DisplayAsPercentage = true
},
new VolumeAdjustSlider
}),
new SettingsItemV2(new FormSliderBar<double>
{
LabelText = AudioSettingsStrings.EffectVolume,
Caption = AudioSettingsStrings.EffectVolume,
Current = audio.VolumeSample,
KeyboardStep = 0.01f,
DisplayAsPercentage = true
},
new VolumeAdjustSlider
DisplayAsPercentage = true,
PlaySamplesOnAdjust = false,
}),
new SettingsItemV2(new FormSliderBar<double>
{
LabelText = AudioSettingsStrings.MusicVolume,
Caption = AudioSettingsStrings.MusicVolume,
Current = audio.VolumeTrack,
KeyboardStep = 0.01f,
DisplayAsPercentage = true
},
DisplayAsPercentage = true,
PlaySamplesOnAdjust = false,
}),
};
}
private partial class VolumeAdjustSlider : SettingsSlider<double>
{
protected override Drawable CreateControl()
{
var sliderBar = (RoundedSliderBar<double>)base.CreateControl();
sliderBar.PlaySamplesOnAdjust = false;
return sliderBar;
}
}
}
}

View File

@@ -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 = () =>

View File

@@ -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<bool>(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<bool>(DebugSetting.BypassFrontToBackPass)
});
}));
}
}
}

View File

@@ -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<GCLatencyMode> latencyModeDropdown;
Add(latencyModeDropdown = new SettingsEnumDropdown<GCLatencyMode>
FormEnumDropdown<GCLatencyMode> latencyModeDropdown;
Add(new SettingsItemV2(latencyModeDropdown = new FormEnumDropdown<GCLatencyMode>
{
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",
}

View File

@@ -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<float>
new SettingsItemV2(new FormSliderBar<float>
{
LabelText = AudioSettingsStrings.PositionalLevel,
Keywords = new[] { @"positional", @"balance" },
Caption = AudioSettingsStrings.PositionalLevel,
Current = osuConfig.GetBindable<float>(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<bool>(OsuSetting.AlwaysPlayFirstComboBreak)
})
{
ApplyClassicDefault = () => alwaysPlayFirstComboBreak.Current.Value = false,
}
};
}

View File

@@ -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<double>
new SettingsItemV2(new FormSliderBar<double>
{
LabelText = GameplaySettingsStrings.BackgroundDim,
Caption = GameplaySettingsStrings.BackgroundDim,
Current = config.GetBindable<double>(OsuSetting.DimLevel),
KeyboardStep = 0.01f,
DisplayAsPercentage = true
},
new SettingsSlider<double>
}),
new SettingsItemV2(new FormSliderBar<double>
{
LabelText = GameplaySettingsStrings.BackgroundBlur,
Caption = GameplaySettingsStrings.BackgroundBlur,
Current = config.GetBindable<double>(OsuSetting.BlurLevel),
KeyboardStep = 0.01f,
DisplayAsPercentage = true
},
new SettingsCheckbox
}),
new SettingsItemV2(new FormCheckBox
{
LabelText = GameplaySettingsStrings.LightenDuringBreaks,
Caption = GameplaySettingsStrings.LightenDuringBreaks,
Current = config.GetBindable<bool>(OsuSetting.LightenDuringBreaks),
})
{
Keywords = new[] { "dim", "level" }
},
new SettingsCheckbox
new SettingsItemV2(new FormCheckBox
{
LabelText = GameplaySettingsStrings.FadePlayfieldWhenHealthLow,
Caption = GameplaySettingsStrings.FadePlayfieldWhenHealthLow,
Current = config.GetBindable<bool>(OsuSetting.FadePlayfieldWhenHealthLow),
},
}),
};
}
}

View File

@@ -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<bool>(OsuSetting.BeatmapSkins)
},
new SettingsCheckbox
}),
new SettingsItemV2(new FormCheckBox
{
Caption = SkinSettingsStrings.BeatmapColours,
Current = config.GetBindable<bool>(OsuSetting.BeatmapColours)
})
{
Keywords = new[] { "combo", "override", "color" },
LabelText = SkinSettingsStrings.BeatmapColours,
Current = config.GetBindable<bool>(OsuSetting.BeatmapColours)
},
new SettingsCheckbox
new SettingsItemV2(new FormCheckBox
{
Caption = SkinSettingsStrings.BeatmapHitsounds,
Current = config.GetBindable<bool>(OsuSetting.BeatmapHitsounds)
})
{
Keywords = new[] { "samples", "override" },
LabelText = SkinSettingsStrings.BeatmapHitsounds,
Current = config.GetBindable<bool>(OsuSetting.BeatmapHitsounds)
},
new SettingsCheckbox
new SettingsItemV2(new FormCheckBox
{
LabelText = GraphicsSettingsStrings.StoryboardVideo,
Caption = GraphicsSettingsStrings.StoryboardVideo,
Current = config.GetBindable<bool>(OsuSetting.ShowStoryboard)
},
new SettingsSlider<float>
}),
new SettingsItemV2(new FormSliderBar<float>
{
Keywords = new[] { "color" },
LabelText = GraphicsSettingsStrings.ComboColourNormalisation,
Caption = GraphicsSettingsStrings.ComboColourNormalisation,
Current = comboColourNormalisation,
DisplayAsPercentage = true,
}
})
{
Keywords = new[] { "color" },
},
};
}
}

View File

@@ -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<ScoringMode> 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<ScoringMode>
new SettingsItemV2(scoringModeDropdown = new FormEnumDropdown<ScoringMode>
{
ClassicDefault = ScoringMode.Classic,
LabelText = GameplaySettingsStrings.ScoreDisplayMode,
Caption = GameplaySettingsStrings.ScoreDisplayMode,
Current = config.GetBindable<ScoringMode>(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<bool>(OsuSetting.HitLighting)
},
new SettingsCheckbox
}),
new SettingsItemV2(new FormCheckBox
{
LabelText = GameplaySettingsStrings.StarFountains,
Caption = GameplaySettingsStrings.StarFountains,
Current = config.GetBindable<bool>(OsuSetting.StarFountains)
},
}),
};
}
}

View File

@@ -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<HUDVisibilityMode>
new SettingsItemV2(new FormEnumDropdown<HUDVisibilityMode>
{
LabelText = GameplaySettingsStrings.HUDVisibilityMode,
Caption = GameplaySettingsStrings.HUDVisibilityMode,
Current = config.GetBindable<HUDVisibilityMode>(OsuSetting.HUDVisibilityMode)
},
new SettingsCheckbox
}),
new SettingsItemV2(new FormCheckBox
{
LabelText = GameplaySettingsStrings.ShowReplaySettingsOverlay,
Caption = GameplaySettingsStrings.ShowReplaySettingsOverlay,
Current = config.GetBindable<bool>(OsuSetting.ReplaySettingsOverlay),
})
{
Keywords = new[] { "hide" },
},
new SettingsCheckbox
new SettingsItemV2(new FormCheckBox
{
LabelText = GameplaySettingsStrings.AlwaysShowKeyOverlay,
Caption = GameplaySettingsStrings.AlwaysShowKeyOverlay,
Current = config.GetBindable<bool>(OsuSetting.KeyOverlay),
})
{
Keywords = new[] { "counter" },
},
new SettingsCheckbox
new SettingsItemV2(new FormCheckBox
{
LabelText = GameplaySettingsStrings.AlwaysShowGameplayLeaderboard,
Caption = GameplaySettingsStrings.AlwaysShowGameplayLeaderboard,
Current = config.GetBindable<bool>(OsuSetting.GameplayLeaderboard),
},
new SettingsCheckbox
}),
new SettingsItemV2(new FormCheckBox
{
LabelText = GameplaySettingsStrings.AlwaysRequireHoldForMenu,
Caption = GameplaySettingsStrings.AlwaysRequireHoldForMenu,
Current = config.GetBindable<bool>(OsuSetting.AlwaysRequireHoldingForPause),
},
new SettingsCheckbox
}),
new SettingsItemV2(new FormCheckBox
{
LabelText = GameplaySettingsStrings.AlwaysShowHoldForMenuButton,
Caption = GameplaySettingsStrings.AlwaysShowHoldForMenuButton,
Current = config.GetBindable<bool>(OsuSetting.AlwaysShowHoldForMenuButton),
},
new SettingsCheckbox
}),
new SettingsItemV2(showHealthDisplayWhenCantFail = new FormCheckBox
{
ClassicDefault = false,
LabelText = GameplaySettingsStrings.ShowHealthDisplayWhenCantFail,
Caption = GameplaySettingsStrings.ShowHealthDisplayWhenCantFail,
Current = config.GetBindable<bool>(OsuSetting.ShowHealthDisplayWhenCantFail),
Keywords = new[] { "hp", "bar" }
})
{
Keywords = new[] { "hp", "bar" },
ApplyClassicDefault = () => showHealthDisplayWhenCantFail.Current.Value = false,
},
};
}

View File

@@ -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<float, SizeSlider<float>>
new SettingsItemV2(new FormSliderBar<float>
{
LabelText = SkinSettingsStrings.GameplayCursorSize,
Caption = SkinSettingsStrings.GameplayCursorSize,
Current = config.GetBindable<float>(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<bool>(OsuSetting.AutoCursorSize)
},
new SettingsCheckbox
}),
new SettingsItemV2(new FormCheckBox
{
LabelText = SkinSettingsStrings.GameplayCursorDuringTouch,
Keywords = new[] { @"touchscreen" },
Caption = SkinSettingsStrings.GameplayCursorDuringTouch,
Current = config.GetBindable<bool>(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<bool>(OsuSetting.GameplayDisableWinKey)
});
}));
}
}
}

View File

@@ -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<bool>(OsuSetting.IncreaseFirstObjectVisibility),
})
{
Keywords = new[] { @"approach", @"circle", @"hidden" },
},
};

View File

@@ -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()))

View File

@@ -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<Language>
new SettingsItemV2(new FormEnumDropdown<Language>
{
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<bool>(FrameworkSetting.ShowUnicode)
},
new SettingsCheckbox
}),
new SettingsItemV2(new FormCheckBox
{
LabelText = GeneralSettingsStrings.Prefer24HourTimeDisplay,
Caption = GeneralSettingsStrings.Prefer24HourTimeDisplay,
Current = config.GetBindable<bool>(OsuSetting.Prefer24HourTime)
},
}),
};
}
}

View File

@@ -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),

View File

@@ -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<ReleaseStream> releaseStreamDropdown = null!;
private SettingsButtonV2 checkForUpdatesButton = null!;
private FormEnumDropdown<ReleaseStream> releaseStreamDropdown = null!;
private readonly Bindable<SettingsNote.Data?> releaseStreamDropdownNote = new Bindable<SettingsNote.Data?>();
private readonly Bindable<ReleaseStream> configReleaseStream = new Bindable<ReleaseStream>();
@@ -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<ReleaseStream>
Add(new SettingsItemV2(releaseStreamDropdown = new FormEnumDropdown<ReleaseStream>
{
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()

View File

@@ -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<FrameSync>
new SettingsItemV2(new FormEnumDropdown<FrameSync>
{
LabelText = GraphicsSettingsStrings.FrameLimiter,
Caption = GraphicsSettingsStrings.FrameLimiter,
Current = config.GetBindable<FrameSync>(FrameworkSetting.FrameSync),
})
{
Keywords = new[] { @"fps", @"framerate" },
},
new SettingsEnumDropdown<ExecutionMode>
new SettingsItemV2(new FormEnumDropdown<ExecutionMode>
{
LabelText = GraphicsSettingsStrings.ThreadingMode,
Caption = GraphicsSettingsStrings.ThreadingMode,
Current = config.GetBindable<ExecutionMode>(FrameworkSetting.ExecutionMode)
},
new SettingsCheckbox
}),
new SettingsItemV2(new FormCheckBox
{
LabelText = GraphicsSettingsStrings.ShowFPS,
Caption = GraphicsSettingsStrings.ShowFPS,
Current = osuConfig.GetBindable<bool>(OsuSetting.ShowFpsDisplay),
})
{
Keywords = new[] { @"framerate", @"counter" },
},
};
@@ -82,30 +88,25 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
});
}
private partial class RendererSettingsDropdown : SettingsEnumDropdown<RendererType>
private partial class RendererDropdown : FormEnumDropdown<RendererType>
{
protected override OsuDropdown<RendererType> 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<RendererType>(FrameworkSetting.Renderer);
automaticRendererInUse = renderer.Value == RendererType.Automatic;
hostResolvedRenderer = host.ResolvedRenderer;
}
[BackgroundDependencyLoader]
private void load(FrameworkConfigManager config, GameHost host)
{
var renderer = config.GetBindable<RendererType>(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);
}
}
}

View File

@@ -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<ScreenshotFormat>
new SettingsItemV2(new FormEnumDropdown<ScreenshotFormat>
{
LabelText = GraphicsSettingsStrings.ScreenshotFormat,
Caption = GraphicsSettingsStrings.ScreenshotFormat,
Current = config.GetBindable<ScreenshotFormat>(OsuSetting.ScreenshotFormat)
},
new SettingsCheckbox
}),
new SettingsItemV2(new FormCheckBox
{
LabelText = GraphicsSettingsStrings.ShowCursorInScreenshots,
Caption = GraphicsSettingsStrings.ShowCursorInScreenshots,
Current = config.GetBindable<bool>(OsuSetting.ScreenshotCaptureMenuCursor)
}
})
};
}
}

View File

@@ -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> 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;

View File

@@ -19,7 +19,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
{
Children = new Drawable[]
{
new SettingsButton
new SettingsButtonV2
{
Text = BindingSettingsStrings.Configure,
TooltipText = BindingSettingsStrings.ChangeBindingsButton,

View File

@@ -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()

View File

@@ -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 = () =>

View File

@@ -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 = () =>

View File

@@ -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()))

View File

@@ -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))

View File

@@ -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 = () =>

View File

@@ -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 = () =>

View File

@@ -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<bool>(OsuSetting.NotifyOnUsernameMentioned)
},
new SettingsCheckbox
}),
new SettingsItemV2(new FormCheckBox
{
LabelText = OnlineSettingsStrings.NotifyOnPrivateMessage,
Caption = OnlineSettingsStrings.NotifyOnPrivateMessage,
Current = config.GetBindable<bool>(OsuSetting.NotifyOnPrivateMessage)
},
new SettingsCheckbox
}),
new SettingsItemV2(new FormCheckBox
{
LabelText = OnlineSettingsStrings.NotifyOnFriendPresenceChange,
TooltipText = OnlineSettingsStrings.NotifyOnFriendPresenceChangeTooltip,
Caption = OnlineSettingsStrings.NotifyOnFriendPresenceChange,
HintText = OnlineSettingsStrings.NotifyOnFriendPresenceChangeTooltip,
Current = config.GetBindable<bool>(OsuSetting.NotifyOnFriendPresenceChange),
},
new SettingsCheckbox
}),
new SettingsItemV2(new FormCheckBox
{
LabelText = OnlineSettingsStrings.HideCountryFlags,
Caption = OnlineSettingsStrings.HideCountryFlags,
Current = config.GetBindable<bool>(OsuSetting.HideCountryFlags)
},
}),
};
}
}

View File

@@ -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<DiscordRichPresenceMode>
new SettingsItemV2(new FormEnumDropdown<DiscordRichPresenceMode>
{
LabelText = OnlineSettingsStrings.DiscordRichPresence,
Caption = OnlineSettingsStrings.DiscordRichPresence,
Current = config.GetBindable<DiscordRichPresenceMode>(OsuSetting.DiscordRichPresence)
}
}),
};
}
}

View File

@@ -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<bool>(OsuSetting.ExternalLinkWarning)
},
new SettingsCheckbox
}),
new SettingsItemV2(new FormCheckBox
{
LabelText = OnlineSettingsStrings.PreferNoVideo,
Keywords = new[] { "no-video" },
Caption = OnlineSettingsStrings.PreferNoVideo,
Current = config.GetBindable<bool>(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<bool>(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<bool>(OsuSetting.ShowOnlineExplicitContent),
})
{
Keywords = new[] { "nsfw", "18+", "offensive" },
}
};
}

View File

@@ -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<Live<SkinInfo>>
private partial class SkinDropdown : FormDropdown<Live<SkinInfo>>
{
protected override OsuDropdown<Live<SkinInfo>> CreateDropdown() => new SkinDropdownControl();
private partial class SkinDropdownControl : DropdownControl
{
protected override LocalisableString GenerateItemText(Live<SkinInfo> item) => item.ToString();
}
protected override LocalisableString GenerateItemText(Live<SkinInfo> 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; }

View File

@@ -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<double> 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<bool>(OsuSetting.CursorRotation)
},
new SettingsSlider<float, SizeSlider<float>>
}),
new SettingsItemV2(new FormSliderBar<float>
{
LabelText = UserInterfaceStrings.MenuCursorSize,
Caption = UserInterfaceStrings.MenuCursorSize,
Current = config.GetBindable<float>(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<bool>(OsuSetting.MenuParallax)
},
new SettingsSlider<double, TimeSlider>
}),
new SettingsItemV2(holdToConfirmSlider = new FormSliderBar<double>
{
ClassicDefault = 0,
LabelText = UserInterfaceStrings.HoldToConfirmActivationTime,
Caption = UserInterfaceStrings.HoldToConfirmActivationTime,
Current = config.GetBindable<double>(OsuSetting.UIHoldActivationDelay),
KeyboardStep = 50,
LabelFormat = v => $"{v:N0} ms",
})
{
Keywords = new[] { @"delay" },
KeyboardStep = 50
ApplyClassicDefault = () => holdToConfirmSlider.Current.Value = 0,
},
};
}

View File

@@ -1,13 +1,12 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. 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<APIUser> user;
private IBindable<APIUser> user = null!;
private SettingsEnumDropdown<BackgroundSource> backgroundSourceDropdown;
private readonly Bindable<SettingsNote.Data?> backgroundSourceNote = new Bindable<SettingsNote.Data?>();
[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<bool>(OsuSetting.MenuTips)
},
new SettingsCheckbox
}),
new SettingsItemV2(new FormCheckBox
{
Keywords = new[] { "intro", "welcome" },
LabelText = UserInterfaceStrings.InterfaceVoices,
Caption = UserInterfaceStrings.InterfaceVoices,
Current = config.GetBindable<bool>(OsuSetting.MenuVoice)
},
new SettingsCheckbox
})
{
Keywords = new[] { "intro", "welcome" },
LabelText = UserInterfaceStrings.OsuMusicTheme,
},
new SettingsItemV2(new FormCheckBox
{
Caption = UserInterfaceStrings.OsuMusicTheme,
Current = config.GetBindable<bool>(OsuSetting.MenuMusic)
},
new SettingsEnumDropdown<IntroSequence>
})
{
LabelText = UserInterfaceStrings.IntroSequence,
Keywords = new[] { "intro", "welcome" },
},
new SettingsItemV2(new FormEnumDropdown<IntroSequence>
{
Caption = UserInterfaceStrings.IntroSequence,
Current = config.GetBindable<IntroSequence>(OsuSetting.IntroSequence),
},
backgroundSourceDropdown = new SettingsEnumDropdown<BackgroundSource>
}),
new SettingsItemV2(new FormEnumDropdown<BackgroundSource>
{
LabelText = UserInterfaceStrings.BackgroundSource,
Caption = UserInterfaceStrings.BackgroundSource,
Current = config.GetBindable<BackgroundSource>(OsuSetting.MenuBackgroundSource),
},
new SettingsEnumDropdown<SeasonalBackgroundMode>
})
{
LabelText = UserInterfaceStrings.SeasonalBackgrounds,
Note = { BindTarget = backgroundSourceNote },
},
new SettingsItemV2(new FormEnumDropdown<SeasonalBackgroundMode>
{
Caption = UserInterfaceStrings.SeasonalBackgrounds,
Current = config.GetBindable<SeasonalBackgroundMode>(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);
}
}

View File

@@ -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> 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<bool>(OsuSetting.ShowConvertedBeatmaps),
})
{
Keywords = new[] { "converts", "converted" }
},
new SettingsEnumDropdown<RandomSelectAlgorithm>
new SettingsItemV2(new FormEnumDropdown<RandomSelectAlgorithm>
{
LabelText = UserInterfaceStrings.RandomSelectionAlgorithm,
Caption = UserInterfaceStrings.RandomSelectionAlgorithm,
Current = config.GetBindable<RandomSelectAlgorithm>(OsuSetting.RandomSelectAlgorithm),
},
new SettingsEnumDropdown<ModSelectHotkeyStyle>
}),
new SettingsItemV2(modSelectHotkeyStyle = new FormEnumDropdown<ModSelectHotkeyStyle>
{
LabelText = UserInterfaceStrings.ModSelectHotkeyStyle,
Caption = UserInterfaceStrings.ModSelectHotkeyStyle,
Current = config.GetBindable<ModSelectHotkeyStyle>(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<bool>(OsuSetting.ModSelectTextSearchStartsActive),
ClassicDefault = false
},
new SettingsCheckbox
})
{
LabelText = GameplaySettingsStrings.BackgroundBlur,
ApplyClassicDefault = () => modSelectTextSearchStartsActive.Current.Value = false,
},
new SettingsItemV2(new FormCheckBox
{
Caption = GameplaySettingsStrings.BackgroundBlur,
Current = config.GetBindable<bool>(OsuSetting.SongSelectBackgroundBlur),
ClassicDefault = false,
}
})
{
ApplyClassicDefault = () => backgroundBlurCheckbox.Current.Value = false,
},
};
}
}