mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 07:42:57 +08:00
Get rid of weird cruft and non-standard flow
This commit is contained in:
parent
6f5c468a83
commit
638c8f1adc
@ -2,6 +2,7 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Utils;
|
||||
@ -10,8 +11,13 @@ using osu.Game.Rulesets.Edit;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Edit
|
||||
{
|
||||
public partial class FreehandSliderSettingsProvider : Drawable
|
||||
public partial class FreehandSliderSettingsProvider : EditorToolboxGroup
|
||||
{
|
||||
public FreehandSliderSettingsProvider()
|
||||
: base("slider")
|
||||
{
|
||||
}
|
||||
|
||||
public BindableFloat Tolerance { get; } = new BindableFloat(1.5f)
|
||||
{
|
||||
MinValue = 0.05f,
|
||||
@ -41,6 +47,34 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
private ExpandableSlider<int> toleranceSlider = null!;
|
||||
private ExpandableSlider<int> cornerThresholdSlider = null!;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
toleranceSlider = new ExpandableSlider<int>
|
||||
{
|
||||
Current = sliderTolerance
|
||||
},
|
||||
cornerThresholdSlider = new ExpandableSlider<int>
|
||||
{
|
||||
Current = sliderCornerThreshold
|
||||
}
|
||||
};
|
||||
|
||||
sliderTolerance.BindValueChanged(e =>
|
||||
{
|
||||
toleranceSlider.ContractedLabelText = $"C. P. S.: {e.NewValue:N0}";
|
||||
toleranceSlider.ExpandedLabelText = $"Control Point Spacing: {e.NewValue:N0}";
|
||||
}, true);
|
||||
|
||||
sliderCornerThreshold.BindValueChanged(e =>
|
||||
{
|
||||
cornerThresholdSlider.ContractedLabelText = $"C. T.: {e.NewValue:N0}";
|
||||
cornerThresholdSlider.ExpandedLabelText = $"Corner Threshold: {e.NewValue:N0}";
|
||||
}, true);
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
@ -70,35 +104,5 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
sliderCornerThreshold.Value = newValue;
|
||||
});
|
||||
}
|
||||
|
||||
public void AttachToToolbox(ExpandingToolboxContainer toolboxContainer)
|
||||
{
|
||||
toolboxContainer.Add(new EditorToolboxGroup("slider")
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
toleranceSlider = new ExpandableSlider<int>
|
||||
{
|
||||
Current = sliderTolerance
|
||||
},
|
||||
cornerThresholdSlider = new ExpandableSlider<int>
|
||||
{
|
||||
Current = sliderCornerThreshold
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
sliderTolerance.BindValueChanged(e =>
|
||||
{
|
||||
toleranceSlider.ContractedLabelText = $"C. P. S.: {e.NewValue:N0}";
|
||||
toleranceSlider.ExpandedLabelText = $"Control Point Spacing: {e.NewValue:N0}";
|
||||
}, true);
|
||||
|
||||
sliderCornerThreshold.BindValueChanged(e =>
|
||||
{
|
||||
cornerThresholdSlider.ContractedLabelText = $"C. T.: {e.NewValue:N0}";
|
||||
cornerThresholdSlider.ExpandedLabelText = $"Corner Threshold: {e.NewValue:N0}";
|
||||
}, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
protected readonly OsuDistanceSnapProvider DistanceSnapProvider = new OsuDistanceSnapProvider();
|
||||
|
||||
[Cached]
|
||||
protected readonly FreehandSliderSettingsProvider FreehandSliderSettingsProvider = new FreehandSliderSettingsProvider();
|
||||
protected readonly FreehandSliderSettingsProvider FreehandlSliderToolboxGroup = new FreehandSliderSettingsProvider();
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
@ -102,8 +102,7 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
RotationHandler = BlueprintContainer.SelectionHandler.RotationHandler,
|
||||
});
|
||||
|
||||
AddInternal(FreehandSliderSettingsProvider);
|
||||
FreehandSliderSettingsProvider.AttachToToolbox(RightToolbox);
|
||||
RightToolbox.Add(FreehandlSliderToolboxGroup);
|
||||
}
|
||||
|
||||
protected override ComposeBlueprintContainer CreateBlueprintContainer()
|
||||
|
Loading…
Reference in New Issue
Block a user