mirror of
https://github.com/ppy/osu
synced 2025-01-19 04:20:59 +00:00
Split activation keybind to separate increase/decrease keybinds
This commit is contained in:
parent
521ec1a225
commit
813d6fed48
@ -79,7 +79,8 @@ namespace osu.Game.Input.Bindings
|
||||
new KeyBinding(new[] { InputKey.F5 }, GlobalAction.EditorTestGameplay),
|
||||
new KeyBinding(new[] { InputKey.Control, InputKey.H }, GlobalAction.EditorFlipHorizontally),
|
||||
new KeyBinding(new[] { InputKey.Control, InputKey.J }, GlobalAction.EditorFlipVertically),
|
||||
new KeyBinding(new[] { InputKey.Control, InputKey.Alt }, GlobalAction.EditorDistanceSpacing),
|
||||
new KeyBinding(new[] { InputKey.Control, InputKey.Alt, InputKey.MouseWheelDown }, GlobalAction.EditorDecreaseDistanceSpacing),
|
||||
new KeyBinding(new[] { InputKey.Control, InputKey.Alt, InputKey.MouseWheelUp }, GlobalAction.EditorIncreaseDistanceSpacing),
|
||||
};
|
||||
|
||||
public IEnumerable<KeyBinding> InGameKeyBindings => new[]
|
||||
@ -303,7 +304,10 @@ namespace osu.Game.Input.Bindings
|
||||
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.EditorFlipVertically))]
|
||||
EditorFlipVertically,
|
||||
|
||||
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.EditorDistanceSpacing))]
|
||||
EditorDistanceSpacing,
|
||||
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.EditorIncreaseDistanceSpacing))]
|
||||
EditorIncreaseDistanceSpacing,
|
||||
|
||||
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.EditorDecreaseDistanceSpacing))]
|
||||
EditorDecreaseDistanceSpacing,
|
||||
}
|
||||
}
|
||||
|
@ -240,9 +240,14 @@ namespace osu.Game.Localisation
|
||||
public static LocalisableString EditorFlipVertically => new TranslatableString(getKey(@"editor_flip_vertically"), @"Flip selection vertically");
|
||||
|
||||
/// <summary>
|
||||
/// "Distance grid spacing (hold)"
|
||||
/// "Increase distance grid spacing"
|
||||
/// </summary>
|
||||
public static LocalisableString EditorDistanceSpacing => new TranslatableString(getKey(@"editor_distance_spacing"), @"Distance grid spacing (hold)");
|
||||
public static LocalisableString EditorIncreaseDistanceSpacing => new TranslatableString(getKey(@"editor_increase_distance_spacing"), @"Increase distance grid spacing");
|
||||
|
||||
/// <summary>
|
||||
/// "Decrease distance grid spacing"
|
||||
/// </summary>
|
||||
public static LocalisableString EditorDecreaseDistanceSpacing => new TranslatableString(getKey(@"editor_decrease_distance_spacing"), @"Decrease distance grid spacing");
|
||||
|
||||
/// <summary>
|
||||
/// "Toggle skin editor"
|
||||
|
@ -20,7 +20,7 @@ namespace osu.Game.Rulesets.Edit
|
||||
/// </summary>
|
||||
/// <typeparam name="TObject">The base type of supported objects.</typeparam>
|
||||
[Cached(typeof(IDistanceSnapProvider))]
|
||||
public abstract class DistancedHitObjectComposer<TObject> : HitObjectComposer<TObject>, IDistanceSnapProvider, IKeyBindingHandler<GlobalAction>
|
||||
public abstract class DistancedHitObjectComposer<TObject> : HitObjectComposer<TObject>, IDistanceSnapProvider, IScrollBindingHandler<GlobalAction>
|
||||
where TObject : HitObject
|
||||
{
|
||||
protected Bindable<double> DistanceSpacingMultiplier { get; } = new BindableDouble(1.0)
|
||||
@ -35,7 +35,6 @@ namespace osu.Game.Rulesets.Edit
|
||||
protected ExpandingToolboxContainer RightSideToolboxContainer { get; private set; }
|
||||
|
||||
private ExpandableSlider<double, SizeSlider<double>> distanceSpacingSlider;
|
||||
private bool distanceSpacingScrollActive;
|
||||
|
||||
protected DistancedHitObjectComposer(Ruleset ruleset)
|
||||
: base(ruleset)
|
||||
@ -79,11 +78,11 @@ namespace osu.Game.Rulesets.Edit
|
||||
|
||||
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
|
||||
{
|
||||
if (!DistanceSpacingMultiplier.Disabled && e.Action == GlobalAction.EditorDistanceSpacing)
|
||||
switch (e.Action)
|
||||
{
|
||||
RightSideToolboxContainer.Expanded.Value = true;
|
||||
distanceSpacingScrollActive = true;
|
||||
return true;
|
||||
case GlobalAction.EditorIncreaseDistanceSpacing:
|
||||
case GlobalAction.EditorDecreaseDistanceSpacing:
|
||||
return adjustDistanceSpacing(e.Action, 0.1f);
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -91,22 +90,31 @@ 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)
|
||||
public bool OnScroll(KeyBindingScrollEvent<GlobalAction> e)
|
||||
{
|
||||
if (distanceSpacingScrollActive)
|
||||
switch (e.Action)
|
||||
{
|
||||
DistanceSpacingMultiplier.Value += e.ScrollDelta.Y * (e.IsPrecise ? 0.01f : 0.1f);
|
||||
return true;
|
||||
case GlobalAction.EditorIncreaseDistanceSpacing:
|
||||
case GlobalAction.EditorDecreaseDistanceSpacing:
|
||||
return adjustDistanceSpacing(e.Action, e.IsPrecise ? 0.01f : 0.1f);
|
||||
}
|
||||
|
||||
return base.OnScroll(e);
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool adjustDistanceSpacing(GlobalAction action, float amount)
|
||||
{
|
||||
if (DistanceSpacingMultiplier.Disabled)
|
||||
return false;
|
||||
|
||||
if (action == GlobalAction.EditorIncreaseDistanceSpacing)
|
||||
DistanceSpacingMultiplier.Value += amount;
|
||||
else if (action == GlobalAction.EditorDecreaseDistanceSpacing)
|
||||
DistanceSpacingMultiplier.Value -= amount;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual float GetBeatSnapDistanceAt(HitObject referenceObject)
|
||||
|
Loading…
Reference in New Issue
Block a user