mirror of
https://github.com/ppy/osu.git
synced 2025-01-07 20:42:54 +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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
@ -10,8 +11,13 @@ using osu.Game.Rulesets.Edit;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.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)
|
public BindableFloat Tolerance { get; } = new BindableFloat(1.5f)
|
||||||
{
|
{
|
||||||
MinValue = 0.05f,
|
MinValue = 0.05f,
|
||||||
@ -41,6 +47,34 @@ namespace osu.Game.Rulesets.Osu.Edit
|
|||||||
private ExpandableSlider<int> toleranceSlider = null!;
|
private ExpandableSlider<int> toleranceSlider = null!;
|
||||||
private ExpandableSlider<int> cornerThresholdSlider = 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()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
@ -70,35 +104,5 @@ namespace osu.Game.Rulesets.Osu.Edit
|
|||||||
sliderCornerThreshold.Value = newValue;
|
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();
|
protected readonly OsuDistanceSnapProvider DistanceSnapProvider = new OsuDistanceSnapProvider();
|
||||||
|
|
||||||
[Cached]
|
[Cached]
|
||||||
protected readonly FreehandSliderSettingsProvider FreehandSliderSettingsProvider = new FreehandSliderSettingsProvider();
|
protected readonly FreehandSliderSettingsProvider FreehandlSliderToolboxGroup = new FreehandSliderSettingsProvider();
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
@ -102,8 +102,7 @@ namespace osu.Game.Rulesets.Osu.Edit
|
|||||||
RotationHandler = BlueprintContainer.SelectionHandler.RotationHandler,
|
RotationHandler = BlueprintContainer.SelectionHandler.RotationHandler,
|
||||||
});
|
});
|
||||||
|
|
||||||
AddInternal(FreehandSliderSettingsProvider);
|
RightToolbox.Add(FreehandlSliderToolboxGroup);
|
||||||
FreehandSliderSettingsProvider.AttachToToolbox(RightToolbox);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override ComposeBlueprintContainer CreateBlueprintContainer()
|
protected override ComposeBlueprintContainer CreateBlueprintContainer()
|
||||||
|
Loading…
Reference in New Issue
Block a user