mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 01:43:20 +08:00
Merge branch 'master' into distance-spacing-osd
This commit is contained in:
commit
3d2072498e
@ -79,7 +79,8 @@ namespace osu.Game.Input.Bindings
|
|||||||
new KeyBinding(new[] { InputKey.F5 }, GlobalAction.EditorTestGameplay),
|
new KeyBinding(new[] { InputKey.F5 }, GlobalAction.EditorTestGameplay),
|
||||||
new KeyBinding(new[] { InputKey.Control, InputKey.H }, GlobalAction.EditorFlipHorizontally),
|
new KeyBinding(new[] { InputKey.Control, InputKey.H }, GlobalAction.EditorFlipHorizontally),
|
||||||
new KeyBinding(new[] { InputKey.Control, InputKey.J }, GlobalAction.EditorFlipVertically),
|
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[]
|
public IEnumerable<KeyBinding> InGameKeyBindings => new[]
|
||||||
@ -303,7 +304,10 @@ namespace osu.Game.Input.Bindings
|
|||||||
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.EditorFlipVertically))]
|
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.EditorFlipVertically))]
|
||||||
EditorFlipVertically,
|
EditorFlipVertically,
|
||||||
|
|
||||||
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.EditorDistanceSpacing))]
|
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.EditorIncreaseDistanceSpacing))]
|
||||||
EditorDistanceSpacing,
|
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");
|
public static LocalisableString EditorFlipVertically => new TranslatableString(getKey(@"editor_flip_vertically"), @"Flip selection vertically");
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// "Distance grid spacing (hold)"
|
/// "Increase distance spacing"
|
||||||
/// </summary>
|
/// </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 spacing");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "Decrease distance spacing"
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString EditorDecreaseDistanceSpacing => new TranslatableString(getKey(@"editor_decrease_distance_spacing"), @"Decrease distance spacing");
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// "Toggle skin editor"
|
/// "Toggle skin editor"
|
||||||
|
@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="TObject">The base type of supported objects.</typeparam>
|
/// <typeparam name="TObject">The base type of supported objects.</typeparam>
|
||||||
[Cached(typeof(IDistanceSnapProvider))]
|
[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
|
where TObject : HitObject
|
||||||
{
|
{
|
||||||
protected Bindable<double> DistanceSpacingMultiplier { get; } = new BindableDouble(1.0)
|
protected Bindable<double> DistanceSpacingMultiplier { get; } = new BindableDouble(1.0)
|
||||||
@ -39,7 +39,6 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
protected ExpandingToolboxContainer RightSideToolboxContainer { get; private set; }
|
protected ExpandingToolboxContainer RightSideToolboxContainer { get; private set; }
|
||||||
|
|
||||||
private ExpandableSlider<double, SizeSlider<double>> distanceSpacingSlider;
|
private ExpandableSlider<double, SizeSlider<double>> distanceSpacingSlider;
|
||||||
private bool distanceSpacingScrollActive;
|
|
||||||
|
|
||||||
[Resolved(canBeNull: true)]
|
[Resolved(canBeNull: true)]
|
||||||
private OnScreenDisplay onScreenDisplay { get; set; }
|
private OnScreenDisplay onScreenDisplay { get; set; }
|
||||||
@ -90,10 +89,11 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
|
|
||||||
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
|
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
|
||||||
{
|
{
|
||||||
if (!DistanceSpacingMultiplier.Disabled && e.Action == GlobalAction.EditorDistanceSpacing)
|
switch (e.Action)
|
||||||
{
|
{
|
||||||
distanceSpacingScrollActive = true;
|
case GlobalAction.EditorIncreaseDistanceSpacing:
|
||||||
return true;
|
case GlobalAction.EditorDecreaseDistanceSpacing:
|
||||||
|
return adjustDistanceSpacing(e.Action, 0.1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -101,19 +101,31 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
|
|
||||||
public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
|
public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
|
||||||
{
|
{
|
||||||
if (!DistanceSpacingMultiplier.Disabled && e.Action == GlobalAction.EditorDistanceSpacing)
|
|
||||||
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);
|
case GlobalAction.EditorIncreaseDistanceSpacing:
|
||||||
return true;
|
case GlobalAction.EditorDecreaseDistanceSpacing:
|
||||||
|
return adjustDistanceSpacing(e.Action, e.ScrollAmount * (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)
|
public virtual float GetBeatSnapDistanceAt(HitObject referenceObject)
|
||||||
|
Loading…
Reference in New Issue
Block a user