mirror of
https://github.com/osukey/osukey.git
synced 2025-08-08 09:03:50 +09:00
Add ability to use Shift
+Number
to set current beat divisor in editor
This commit is contained in:
@ -25,6 +25,26 @@ namespace osu.Game.Screens.Edit
|
|||||||
BindValueChanged(_ => ensureValidDivisor());
|
BindValueChanged(_ => ensureValidDivisor());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Set a divisor, updating the valid divisor range appropriately.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="divisor">The intended divisor.</param>
|
||||||
|
public void SetArbitraryDivisor(int divisor)
|
||||||
|
{
|
||||||
|
// If the current valid divisor range doesn't contain the proposed value, attempt to find one which does.
|
||||||
|
if (!ValidDivisors.Value.Presets.Contains(divisor))
|
||||||
|
{
|
||||||
|
if (BeatDivisorPresetCollection.COMMON.Presets.Contains(divisor))
|
||||||
|
ValidDivisors.Value = BeatDivisorPresetCollection.COMMON;
|
||||||
|
else if (BeatDivisorPresetCollection.TRIPLETS.Presets.Contains(divisor))
|
||||||
|
ValidDivisors.Value = BeatDivisorPresetCollection.TRIPLETS;
|
||||||
|
else
|
||||||
|
ValidDivisors.Value = BeatDivisorPresetCollection.Custom(divisor);
|
||||||
|
}
|
||||||
|
|
||||||
|
Value = divisor;
|
||||||
|
}
|
||||||
|
|
||||||
private void updateBindableProperties()
|
private void updateBindableProperties()
|
||||||
{
|
{
|
||||||
ensureValidDivisor();
|
ensureValidDivisor();
|
||||||
|
@ -209,6 +209,17 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override bool OnKeyDown(KeyDownEvent e)
|
||||||
|
{
|
||||||
|
if (e.ShiftPressed && e.Key >= Key.Number1 && e.Key <= Key.Number9)
|
||||||
|
{
|
||||||
|
beatDivisor.SetArbitraryDivisor(e.Key - Key.Number0);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return base.OnKeyDown(e);
|
||||||
|
}
|
||||||
|
|
||||||
internal class DivisorDisplay : OsuAnimatedButton, IHasPopover
|
internal class DivisorDisplay : OsuAnimatedButton, IHasPopover
|
||||||
{
|
{
|
||||||
public BindableBeatDivisor BeatDivisor { get; } = new BindableBeatDivisor();
|
public BindableBeatDivisor BeatDivisor { get; } = new BindableBeatDivisor();
|
||||||
@ -306,17 +317,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!BeatDivisor.ValidDivisors.Value.Presets.Contains(divisor))
|
BeatDivisor.SetArbitraryDivisor(divisor);
|
||||||
{
|
|
||||||
if (BeatDivisorPresetCollection.COMMON.Presets.Contains(divisor))
|
|
||||||
BeatDivisor.ValidDivisors.Value = BeatDivisorPresetCollection.COMMON;
|
|
||||||
else if (BeatDivisorPresetCollection.TRIPLETS.Presets.Contains(divisor))
|
|
||||||
BeatDivisor.ValidDivisors.Value = BeatDivisorPresetCollection.TRIPLETS;
|
|
||||||
else
|
|
||||||
BeatDivisor.ValidDivisors.Value = BeatDivisorPresetCollection.Custom(divisor);
|
|
||||||
}
|
|
||||||
|
|
||||||
BeatDivisor.Value = divisor;
|
|
||||||
|
|
||||||
this.HidePopover();
|
this.HidePopover();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user