1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 08:32:57 +08:00

Revert "Convert data type of DistanceSpacing to float"

This reverts commit 7aaa88cac2.
This commit is contained in:
Salman Ahmed 2022-04-29 08:02:07 +03:00
parent b6d2ca7709
commit fef94d49f4
13 changed files with 24 additions and 21 deletions

View File

@ -187,7 +187,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
public SnapResult SnapScreenSpacePositionToValidTime(Vector2 screenSpacePosition) => new SnapResult(screenSpacePosition, 0);
public IBindable<float> DistanceSpacingMultiplier { get; } = new BindableFloat(1);
public IBindable<double> DistanceSpacingMultiplier { get; } = new BindableDouble(1);
public float GetBeatSnapDistanceAt(HitObject referenceObject) => (float)beat_length;

View File

@ -222,7 +222,7 @@ namespace osu.Game.Tests.Editing
{
public new EditorBeatmap EditorBeatmap => base.EditorBeatmap;
public new Bindable<float> DistanceSpacingMultiplier => base.DistanceSpacingMultiplier;
public new Bindable<double> DistanceSpacingMultiplier => base.DistanceSpacingMultiplier;
public TestHitObjectComposer()
: base(new OsuRuleset())

View File

@ -167,7 +167,7 @@ namespace osu.Game.Tests.Visual.Editing
public SnapResult SnapScreenSpacePositionToValidTime(Vector2 screenSpacePosition) => new SnapResult(screenSpacePosition, 0);
public IBindable<float> DistanceSpacingMultiplier { get; } = new BindableFloat(1);
public IBindable<double> DistanceSpacingMultiplier { get; } = new BindableDouble(1);
public float GetBeatSnapDistanceAt(HitObject referenceObject) => 10;

View File

@ -17,7 +17,7 @@ namespace osu.Game.Tests.Visual.UserInterface
private TestExpandingContainer container;
private SettingsToolboxGroup toolboxGroup;
private ExpandableSlider<float, SizeSlider> slider1;
private ExpandableSlider<float, SizeSlider<float>> slider1;
private ExpandableSlider<double> slider2;
[SetUp]
@ -34,7 +34,7 @@ namespace osu.Game.Tests.Visual.UserInterface
Width = 1,
Children = new Drawable[]
{
slider1 = new ExpandableSlider<float, SizeSlider>
slider1 = new ExpandableSlider<float, SizeSlider<float>>
{
Current = new BindableFloat
{

View File

@ -109,7 +109,7 @@ namespace osu.Game.Beatmaps
public bool SamplesMatchPlaybackRate { get; set; } = true;
public float DistanceSpacing { get; set; } = 1.0f;
public double DistanceSpacing { get; set; } = 1.0;
public int BeatDivisor { get; set; }

View File

@ -107,7 +107,7 @@ namespace osu.Game.Beatmaps
[NotMapped]
public int[] Bookmarks { get; set; } = Array.Empty<int>();
public float DistanceSpacing { get; set; }
public double DistanceSpacing { get; set; }
public int BeatDivisor { get; set; }
public int GridSize { get; set; }
public double TimelineZoom { get; set; }

View File

@ -240,7 +240,7 @@ namespace osu.Game.Beatmaps.Formats
break;
case @"DistanceSpacing":
beatmap.BeatmapInfo.DistanceSpacing = Math.Max(0, Parsing.ParseFloat(pair.Value));
beatmap.BeatmapInfo.DistanceSpacing = Math.Max(0, Parsing.ParseDouble(pair.Value));
break;
case @"BeatDivisor":

View File

@ -19,7 +19,7 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay
{
Children = new Drawable[]
{
new SettingsSlider<float, SizeSlider>
new SettingsSlider<float, SizeSlider<float>>
{
LabelText = SkinSettingsStrings.GameplayCursorSize,
Current = config.GetBindable<float>(OsuSetting.GameplayCursorSize),

View File

@ -1,6 +1,8 @@
// 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.
using System;
using System.Globalization;
using osu.Framework.Localisation;
using osu.Game.Graphics.UserInterface;
@ -9,8 +11,9 @@ namespace osu.Game.Overlays.Settings.Sections
/// <summary>
/// A slider intended to show a "size" multiplier number, where 1x is 1.0.
/// </summary>
internal class SizeSlider : OsuSliderBar<float>
public class SizeSlider<T> : OsuSliderBar<T>
where T : struct, IEquatable<T>, IComparable<T>, IConvertible, IFormattable
{
public override LocalisableString TooltipText => Current.Value.ToString(@"0.##x");
public override LocalisableString TooltipText => Current.Value.ToString(@"0.##x", NumberFormatInfo.CurrentInfo);
}
}

View File

@ -24,7 +24,7 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface
LabelText = UserInterfaceStrings.CursorRotation,
Current = config.GetBindable<bool>(OsuSetting.CursorRotation)
},
new SettingsSlider<float, SizeSlider>
new SettingsSlider<float, SizeSlider<float>>
{
LabelText = UserInterfaceStrings.MenuCursorSize,
Current = config.GetBindable<float>(OsuSetting.MenuCursorSize),

View File

@ -21,18 +21,18 @@ namespace osu.Game.Rulesets.Edit
public abstract class DistancedHitObjectComposer<TObject> : HitObjectComposer<TObject>, IDistanceSnapProvider
where TObject : HitObject
{
protected Bindable<float> DistanceSpacingMultiplier { get; } = new BindableFloat(1.0f)
protected Bindable<double> DistanceSpacingMultiplier { get; } = new BindableDouble(1.0)
{
MinValue = 0.1f,
MaxValue = 6.0f,
Precision = 0.01f,
MinValue = 0.1,
MaxValue = 6.0,
Precision = 0.01,
};
IBindable<float> IDistanceSnapProvider.DistanceSpacingMultiplier => DistanceSpacingMultiplier;
IBindable<double> IDistanceSnapProvider.DistanceSpacingMultiplier => DistanceSpacingMultiplier;
protected ExpandingToolboxContainer RightSideToolboxContainer { get; private set; }
private ExpandableSlider<float, SizeSlider> distanceSpacingSlider;
private ExpandableSlider<double, SizeSlider<double>> distanceSpacingSlider;
private bool distanceSpacingScrollActive;
protected DistancedHitObjectComposer(Ruleset ruleset)
@ -50,7 +50,7 @@ namespace osu.Game.Rulesets.Edit
Origin = Anchor.TopRight,
Child = new EditorToolboxGroup("snapping")
{
Child = distanceSpacingSlider = new ExpandableSlider<float, SizeSlider>
Child = distanceSpacingSlider = new ExpandableSlider<double, SizeSlider<double>>
{
Current = { BindTarget = DistanceSpacingMultiplier },
KeyboardStep = 0.1f,

View File

@ -13,7 +13,7 @@ namespace osu.Game.Rulesets.Edit
/// The spacing multiplier applied to beat snap distances.
/// </summary>
/// <seealso cref="BeatmapInfo.DistanceSpacing"/>
IBindable<float> DistanceSpacingMultiplier { get; }
IBindable<double> DistanceSpacingMultiplier { get; }
/// <summary>
/// Retrieves the distance between two points within a timing point that are one beat length apart.

View File

@ -53,7 +53,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
[Resolved]
private BindableBeatDivisor beatDivisor { get; set; }
private IBindable<float> distanceSpacingMultiplier;
private IBindable<double> distanceSpacingMultiplier;
private readonly LayoutValue gridCache = new LayoutValue(Invalidation.RequiredParentSizeToFit);
private readonly double? endTime;