mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 09:17:51 +08:00
Merge pull request #26689 from myQwil/divisor_cycle
Prevent custom divisor ranges from halting divisor preset cycling
This commit is contained in:
commit
baaf33d995
@ -210,6 +210,13 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
switchPresets(-1);
|
switchPresets(-1);
|
||||||
assertPreset(BeatDivisorType.Custom, 15);
|
assertPreset(BeatDivisorType.Custom, 15);
|
||||||
assertBeatSnap(15);
|
assertBeatSnap(15);
|
||||||
|
|
||||||
|
setDivisorViaInput(24);
|
||||||
|
assertPreset(BeatDivisorType.Custom, 24);
|
||||||
|
switchPresets(1);
|
||||||
|
assertPreset(BeatDivisorType.Common);
|
||||||
|
switchPresets(-2);
|
||||||
|
assertPreset(BeatDivisorType.Triplets);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void switchBeatSnap(int direction) => AddRepeatStep($"move snap {(direction > 0 ? "forward" : "backward")}", () =>
|
private void switchBeatSnap(int direction) => AddRepeatStep($"move snap {(direction > 0 ? "forward" : "backward")}", () =>
|
||||||
|
@ -29,10 +29,11 @@ namespace osu.Game.Screens.Edit
|
|||||||
/// Set a divisor, updating the valid divisor range appropriately.
|
/// Set a divisor, updating the valid divisor range appropriately.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="divisor">The intended divisor.</param>
|
/// <param name="divisor">The intended divisor.</param>
|
||||||
public void SetArbitraryDivisor(int divisor)
|
/// <param name="preferKnownPresets">Forces changing the valid divisors to a known preset.</param>
|
||||||
|
public void SetArbitraryDivisor(int divisor, bool preferKnownPresets = false)
|
||||||
{
|
{
|
||||||
// If the current valid divisor range doesn't contain the proposed value, attempt to find one which does.
|
// 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 (preferKnownPresets || !ValidDivisors.Value.Presets.Contains(divisor))
|
||||||
{
|
{
|
||||||
if (BeatDivisorPresetCollection.COMMON.Presets.Contains(divisor))
|
if (BeatDivisorPresetCollection.COMMON.Presets.Contains(divisor))
|
||||||
ValidDivisors.Value = BeatDivisorPresetCollection.COMMON;
|
ValidDivisors.Value = BeatDivisorPresetCollection.COMMON;
|
||||||
|
@ -208,11 +208,11 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
switch (currentType)
|
switch (currentType)
|
||||||
{
|
{
|
||||||
case BeatDivisorType.Common:
|
case BeatDivisorType.Common:
|
||||||
beatDivisor.SetArbitraryDivisor(4);
|
beatDivisor.SetArbitraryDivisor(4, true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BeatDivisorType.Triplets:
|
case BeatDivisorType.Triplets:
|
||||||
beatDivisor.SetArbitraryDivisor(6);
|
beatDivisor.SetArbitraryDivisor(6, true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BeatDivisorType.Custom:
|
case BeatDivisorType.Custom:
|
||||||
|
Loading…
Reference in New Issue
Block a user