mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 04:02:59 +08:00
Display toast notification on editor distance spacing change
This commit is contained in:
parent
521ec1a225
commit
b8287f3687
@ -3,12 +3,16 @@
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.LocalisationExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Input.Bindings;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Input.Bindings;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Overlays.OSD;
|
||||
using osu.Game.Overlays.Settings.Sections;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osuTK;
|
||||
@ -37,6 +41,9 @@ namespace osu.Game.Rulesets.Edit
|
||||
private ExpandableSlider<double, SizeSlider<double>> distanceSpacingSlider;
|
||||
private bool distanceSpacingScrollActive;
|
||||
|
||||
[Resolved]
|
||||
private OnScreenDisplay onScreenDisplay { get; set; }
|
||||
|
||||
protected DistancedHitObjectComposer(Ruleset ruleset)
|
||||
: base(ruleset)
|
||||
{
|
||||
@ -72,6 +79,10 @@ namespace osu.Game.Rulesets.Edit
|
||||
{
|
||||
distanceSpacingSlider.ContractedLabelText = $"D. S. ({v.NewValue:0.##x})";
|
||||
distanceSpacingSlider.ExpandedLabelText = $"Distance Spacing ({v.NewValue:0.##x})";
|
||||
|
||||
if (v.NewValue != v.OldValue)
|
||||
onScreenDisplay.Display(new DistanceSpacingToast(v.NewValue.ToLocalisableString(@"0.##x")));
|
||||
|
||||
EditorBeatmap.BeatmapInfo.DistanceSpacing = v.NewValue;
|
||||
}, true);
|
||||
}
|
||||
@ -81,7 +92,6 @@ namespace osu.Game.Rulesets.Edit
|
||||
{
|
||||
if (!DistanceSpacingMultiplier.Disabled && e.Action == GlobalAction.EditorDistanceSpacing)
|
||||
{
|
||||
RightSideToolboxContainer.Expanded.Value = true;
|
||||
distanceSpacingScrollActive = true;
|
||||
return true;
|
||||
}
|
||||
@ -92,10 +102,7 @@ namespace osu.Game.Rulesets.Edit
|
||||
public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
|
||||
{
|
||||
if (!DistanceSpacingMultiplier.Disabled && e.Action == GlobalAction.EditorDistanceSpacing)
|
||||
{
|
||||
RightSideToolboxContainer.Expanded.Value = false;
|
||||
distanceSpacingScrollActive = false;
|
||||
}
|
||||
}
|
||||
|
||||
protected override bool OnScroll(ScrollEvent e)
|
||||
@ -160,5 +167,13 @@ namespace osu.Game.Rulesets.Edit
|
||||
FillFlow.Spacing = new Vector2(10);
|
||||
}
|
||||
}
|
||||
|
||||
private class DistanceSpacingToast : Toast
|
||||
{
|
||||
public DistanceSpacingToast(LocalisableString value)
|
||||
: base("Distance Spacing", value, string.Empty)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user