1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 07:22:55 +08:00

Merge pull request #26591 from peppy/offset-awareness

Show offset explanation tooltip on settings offset adjust slider bar
This commit is contained in:
Bartłomiej Dach 2024-01-22 14:59:31 +01:00 committed by GitHub
commit 95435ecd13
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 5 deletions

View File

@ -10,9 +10,9 @@ namespace osu.Game.Localisation
private const string prefix = @"osu.Game.Resources.Localisation.BeatmapOffsetControl"; private const string prefix = @"osu.Game.Resources.Localisation.BeatmapOffsetControl";
/// <summary> /// <summary>
/// "Beatmap offset" /// "Audio offset (this beatmap)"
/// </summary> /// </summary>
public static LocalisableString BeatmapOffset => new TranslatableString(getKey(@"beatmap_offset"), @"Beatmap offset"); public static LocalisableString AudioOffsetThisBeatmap => new TranslatableString(getKey(@"beatmap_offset"), @"Audio offset (this beatmap)");
/// <summary> /// <summary>
/// "Previous play:" /// "Previous play:"

View File

@ -12,12 +12,14 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Framework.Localisation;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Localisation; using osu.Game.Localisation;
using osu.Game.Screens.Play.PlayerSettings;
using osuTK; using osuTK;
namespace osu.Game.Overlays.Settings.Sections.Audio namespace osu.Game.Overlays.Settings.Sections.Audio
@ -67,7 +69,7 @@ namespace osu.Game.Overlays.Settings.Sections.Audio
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
Children = new Drawable[] Children = new Drawable[]
{ {
new TimeSlider new OffsetSliderBar
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Current = { BindTarget = Current }, Current = { BindTarget = Current },
@ -157,6 +159,11 @@ namespace osu.Game.Overlays.Settings.Sections.Audio
: $@"Based on the last {averageHitErrorHistory.Count} play(s), the suggested offset is {SuggestedOffset.Value:N0} ms."; : $@"Based on the last {averageHitErrorHistory.Count} play(s), the suggested offset is {SuggestedOffset.Value:N0} ms.";
applySuggestion.Enabled.Value = SuggestedOffset.Value != null; applySuggestion.Enabled.Value = SuggestedOffset.Value != null;
} }
private partial class OffsetSliderBar : RoundedSliderBar<double>
{
public override LocalisableString TooltipText => BeatmapOffsetControl.GetOffsetExplanatoryText(Current.Value);
}
} }
} }
} }

View File

@ -86,7 +86,7 @@ namespace osu.Game.Screens.Play.PlayerSettings
new OffsetSliderBar new OffsetSliderBar
{ {
KeyboardStep = 5, KeyboardStep = 5,
LabelText = BeatmapOffsetControlStrings.BeatmapOffset, LabelText = BeatmapOffsetControlStrings.AudioOffsetThisBeatmap,
Current = Current, Current = Current,
}, },
referenceScoreContainer = new FillFlowContainer referenceScoreContainer = new FillFlowContainer
@ -307,7 +307,7 @@ namespace osu.Game.Screens.Play.PlayerSettings
} }
} }
public partial class OffsetSliderBar : PlayerSliderBar<double> private partial class OffsetSliderBar : PlayerSliderBar<double>
{ {
protected override Drawable CreateControl() => new CustomSliderBar(); protected override Drawable CreateControl() => new CustomSliderBar();