mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 01:43:20 +08:00
Allow external use of offset text explanation
This commit is contained in:
parent
27a9dcc5a1
commit
7e9522a722
@ -233,12 +233,10 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
||||
{
|
||||
case GlobalAction.IncreaseOffset:
|
||||
Current.Value += amount;
|
||||
|
||||
return true;
|
||||
|
||||
case GlobalAction.DecreaseOffset:
|
||||
Current.Value -= amount;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -249,18 +247,13 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
||||
{
|
||||
}
|
||||
|
||||
public partial class OffsetSliderBar : PlayerSliderBar<double>
|
||||
public static LocalisableString GetOffsetExplanatoryText(double offset)
|
||||
{
|
||||
protected override Drawable CreateControl() => new CustomSliderBar();
|
||||
return offset == 0
|
||||
? LocalisableString.Interpolate($@"{offset:0.0} ms")
|
||||
: LocalisableString.Interpolate($@"{offset:0.0} ms {getEarlyLateText(offset)}");
|
||||
|
||||
protected partial class CustomSliderBar : SliderBar
|
||||
{
|
||||
public override LocalisableString TooltipText =>
|
||||
Current.Value == 0
|
||||
? LocalisableString.Interpolate($@"{base.TooltipText} ms")
|
||||
: LocalisableString.Interpolate($@"{base.TooltipText} ms {getEarlyLateText(Current.Value)}");
|
||||
|
||||
private LocalisableString getEarlyLateText(double value)
|
||||
LocalisableString getEarlyLateText(double value)
|
||||
{
|
||||
Debug.Assert(value != 0);
|
||||
|
||||
@ -269,6 +262,15 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
||||
: BeatmapOffsetControlStrings.HitObjectsAppearLater;
|
||||
}
|
||||
}
|
||||
|
||||
public partial class OffsetSliderBar : PlayerSliderBar<double>
|
||||
{
|
||||
protected override Drawable CreateControl() => new CustomSliderBar();
|
||||
|
||||
protected partial class CustomSliderBar : SliderBar
|
||||
{
|
||||
public override LocalisableString TooltipText => GetOffsetExplanatoryText(Current.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user