mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 17:07:38 +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.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Extensions.LocalisationExtensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Input.Bindings;
|
using osu.Game.Input.Bindings;
|
||||||
|
using osu.Game.Overlays;
|
||||||
|
using osu.Game.Overlays.OSD;
|
||||||
using osu.Game.Overlays.Settings.Sections;
|
using osu.Game.Overlays.Settings.Sections;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -37,6 +41,9 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
private ExpandableSlider<double, SizeSlider<double>> distanceSpacingSlider;
|
private ExpandableSlider<double, SizeSlider<double>> distanceSpacingSlider;
|
||||||
private bool distanceSpacingScrollActive;
|
private bool distanceSpacingScrollActive;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private OnScreenDisplay onScreenDisplay { get; set; }
|
||||||
|
|
||||||
protected DistancedHitObjectComposer(Ruleset ruleset)
|
protected DistancedHitObjectComposer(Ruleset ruleset)
|
||||||
: base(ruleset)
|
: base(ruleset)
|
||||||
{
|
{
|
||||||
@ -72,6 +79,10 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
{
|
{
|
||||||
distanceSpacingSlider.ContractedLabelText = $"D. S. ({v.NewValue:0.##x})";
|
distanceSpacingSlider.ContractedLabelText = $"D. S. ({v.NewValue:0.##x})";
|
||||||
distanceSpacingSlider.ExpandedLabelText = $"Distance Spacing ({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;
|
EditorBeatmap.BeatmapInfo.DistanceSpacing = v.NewValue;
|
||||||
}, true);
|
}, true);
|
||||||
}
|
}
|
||||||
@ -81,7 +92,6 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
{
|
{
|
||||||
if (!DistanceSpacingMultiplier.Disabled && e.Action == GlobalAction.EditorDistanceSpacing)
|
if (!DistanceSpacingMultiplier.Disabled && e.Action == GlobalAction.EditorDistanceSpacing)
|
||||||
{
|
{
|
||||||
RightSideToolboxContainer.Expanded.Value = true;
|
|
||||||
distanceSpacingScrollActive = true;
|
distanceSpacingScrollActive = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -92,10 +102,7 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
|
public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
|
||||||
{
|
{
|
||||||
if (!DistanceSpacingMultiplier.Disabled && e.Action == GlobalAction.EditorDistanceSpacing)
|
if (!DistanceSpacingMultiplier.Disabled && e.Action == GlobalAction.EditorDistanceSpacing)
|
||||||
{
|
|
||||||
RightSideToolboxContainer.Expanded.Value = false;
|
|
||||||
distanceSpacingScrollActive = false;
|
distanceSpacingScrollActive = false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnScroll(ScrollEvent e)
|
protected override bool OnScroll(ScrollEvent e)
|
||||||
@ -160,5 +167,13 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
FillFlow.Spacing = new Vector2(10);
|
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