-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Apply generic math-related changes #27965"
- Loading branch information
Showing
13 changed files
with
31 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using System.Numerics; | ||
using System; | ||
using osu.Framework.Allocation; | ||
using osu.Framework.Bindables; | ||
using osu.Framework.Graphics; | ||
|
@@ -10,15 +10,15 @@ | |
using osu.Framework.Localisation; | ||
using osu.Game.Graphics.Containers; | ||
using osu.Game.Graphics.Sprites; | ||
using Vector2 = osuTK.Vector2; | ||
using osuTK; | ||
|
||
namespace osu.Game.Graphics.UserInterface | ||
{ | ||
/// <summary> | ||
/// An <see cref="IExpandable"/> implementation for the UI slider bar control. | ||
/// </summary> | ||
public partial class ExpandableSlider<T, TSlider> : CompositeDrawable, IExpandable, IHasCurrentValue<T> | ||
where T : struct, INumber<T>, IMinMaxValue<T> | ||
where T : struct, IEquatable<T>, IComparable<T>, IConvertible | ||
where TSlider : RoundedSliderBar<T>, new() | ||
{ | ||
private readonly OsuSpriteText label; | ||
|
@@ -129,7 +129,7 @@ protected override void LoadComplete() | |
/// An <see cref="IExpandable"/> implementation for the UI slider bar control. | ||
/// </summary> | ||
public partial class ExpandableSlider<T> : ExpandableSlider<T, RoundedSliderBar<T>> | ||
where T : struct, INumber<T>, IMinMaxValue<T> | ||
where T : struct, IEquatable<T>, IComparable<T>, IConvertible | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using System.Numerics; | ||
using System; | ||
using osu.Framework.Graphics; | ||
using osu.Game.Overlays.Settings; | ||
|
||
namespace osu.Game.Graphics.UserInterfaceV2 | ||
{ | ||
public partial class LabelledSliderBar<TNumber> : LabelledComponent<SettingsSlider<TNumber>, TNumber> | ||
where TNumber : struct, INumber<TNumber>, IMinMaxValue<TNumber> | ||
where TNumber : struct, IEquatable<TNumber>, IComparable<TNumber>, IConvertible | ||
{ | ||
public LabelledSliderBar() | ||
: base(true) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using System.Numerics; | ||
using System; | ||
using System.Globalization; | ||
using osu.Framework.Bindables; | ||
using osu.Framework.Graphics; | ||
|
@@ -10,12 +10,12 @@ | |
using osu.Framework.Localisation; | ||
using osu.Game.Overlays.Settings; | ||
using osu.Game.Utils; | ||
using Vector2 = osuTK.Vector2; | ||
using osuTK; | ||
|
||
namespace osu.Game.Graphics.UserInterfaceV2 | ||
{ | ||
public partial class SliderWithTextBoxInput<T> : CompositeDrawable, IHasCurrentValue<T> | ||
where T : struct, INumber<T>, IMinMaxValue<T> | ||
where T : struct, IEquatable<T>, IComparable<T>, IConvertible | ||
{ | ||
/// <summary> | ||
/// A custom step value for each key press which actuates a change on this control. | ||
|
@@ -138,7 +138,7 @@ private void updateTextBoxFromSlider(ValueChangedEvent<T> _) | |
{ | ||
if (updatingFromTextBox) return; | ||
|
||
decimal decimalValue = decimal.CreateTruncating(slider.Current.Value); | ||
decimal decimalValue = slider.Current.Value.ToDecimal(NumberFormatInfo.InvariantInfo); | ||
textBox.Text = decimalValue.ToString($@"N{FormatUtils.FindPrecision(decimalValue)}"); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using System.Numerics; | ||
using System; | ||
using osu.Framework.Graphics; | ||
using osu.Game.Configuration; | ||
using osu.Game.Graphics.UserInterface; | ||
|
@@ -13,7 +13,7 @@ namespace osu.Game.Overlays.Settings | |
/// Mostly provided for convenience of use with <see cref="SettingSourceAttribute"/>. | ||
/// </summary> | ||
public partial class SettingsPercentageSlider<TValue> : SettingsSlider<TValue> | ||
where TValue : struct, INumber<TValue>, IMinMaxValue<TValue> | ||
where TValue : struct, IEquatable<TValue>, IComparable<TValue>, IConvertible | ||
{ | ||
protected override Drawable CreateControl() => ((RoundedSliderBar<TValue>)base.CreateControl()).With(sliderBar => sliderBar.DisplayAsPercentage = true); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using System.Numerics; | ||
using System; | ||
using osu.Framework.Graphics; | ||
using osu.Framework.Graphics.UserInterface; | ||
using osu.Game.Graphics.UserInterface; | ||
|
||
namespace osu.Game.Overlays.Settings | ||
{ | ||
public partial class SettingsSlider<T> : SettingsSlider<T, RoundedSliderBar<T>> | ||
where T : struct, INumber<T>, IMinMaxValue<T> | ||
where T : struct, IEquatable<T>, IComparable<T>, IConvertible | ||
{ | ||
} | ||
|
||
public partial class SettingsSlider<TValue, TSlider> : SettingsItem<TValue> | ||
where TValue : struct, INumber<TValue>, IMinMaxValue<TValue> | ||
where TValue : struct, IEquatable<TValue>, IComparable<TValue>, IConvertible | ||
where TSlider : RoundedSliderBar<TValue>, new() | ||
{ | ||
protected override Drawable CreateControl() => new TSlider | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using System.Numerics; | ||
using System; | ||
using System.Globalization; | ||
using osu.Framework.Bindables; | ||
using osu.Framework.Graphics; | ||
|
@@ -12,7 +12,7 @@ | |
using osu.Game.Graphics.UserInterfaceV2; | ||
using osu.Game.Overlays.Settings; | ||
using osu.Game.Utils; | ||
using Vector2 = osuTK.Vector2; | ||
using osuTK; | ||
|
||
namespace osu.Game.Screens.Edit.Timing | ||
{ | ||
|
@@ -22,7 +22,7 @@ namespace osu.Game.Screens.Edit.Timing | |
/// by providing an "indeterminate state". | ||
/// </summary> | ||
public partial class IndeterminateSliderWithTextBoxInput<T> : CompositeDrawable, IHasCurrentValue<T?> | ||
where T : struct, INumber<T>, IMinMaxValue<T> | ||
where T : struct, IEquatable<T>, IComparable<T>, IConvertible | ||
{ | ||
/// <summary> | ||
/// A custom step value for each key press which actuates a change on this control. | ||
|
@@ -136,7 +136,7 @@ private void updateState() | |
slider.Current.Value = nonNullValue; | ||
|
||
// use the value from the slider to ensure that any precision/min/max set on it via the initial indeterminate value have been applied correctly. | ||
decimal decimalValue = decimal.CreateTruncating(slider.Current.Value); | ||
decimal decimalValue = slider.Current.Value.ToDecimal(NumberFormatInfo.InvariantInfo); | ||
textBox.Text = decimalValue.ToString($@"N{FormatUtils.FindPrecision(decimalValue)}"); | ||
textBox.PlaceholderText = string.Empty; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using System.Numerics; | ||
using System; | ||
using osu.Framework.Allocation; | ||
using osu.Framework.Graphics; | ||
using osu.Game.Graphics; | ||
|
@@ -11,7 +11,7 @@ | |
namespace osu.Game.Screens.Play.PlayerSettings | ||
{ | ||
public partial class PlayerSliderBar<T> : SettingsSlider<T> | ||
where T : struct, INumber<T>, IMinMaxValue<T> | ||
where T : struct, IEquatable<T>, IComparable<T>, IConvertible | ||
{ | ||
public RoundedSliderBar<T> Bar => (RoundedSliderBar<T>)Control; | ||
|
||
|