diff --git a/source/funkin/ui/freeplay/CapsuleOptionsMenu.hx b/source/funkin/ui/freeplay/CapsuleOptionsMenu.hx index cb0fa7b289..8d6b3605c8 100644 --- a/source/funkin/ui/freeplay/CapsuleOptionsMenu.hx +++ b/source/funkin/ui/freeplay/CapsuleOptionsMenu.hx @@ -22,6 +22,8 @@ class CapsuleOptionsMenu extends FlxSpriteGroup var currentInstrumental:FlxText; + var busy:Bool = false; + public function new(parent:FreeplayState, x:Float = 0, y:Float = 0, instIds:Array):Void { super(x, y); @@ -66,24 +68,34 @@ class CapsuleOptionsMenu extends FlxSpriteGroup destroy(); return; } - @:privateAccess - if (parent.controls.BACK) - { - close(); - return; - } - var changedInst = false; - if (parent.getControls().UI_LEFT_P) - { - currentInstrumentalIndex = (currentInstrumentalIndex + 1) % instrumentalIds.length; - changedInst = true; - } - if (parent.getControls().UI_RIGHT_P) + + if (!busy) { - currentInstrumentalIndex = (currentInstrumentalIndex - 1 + instrumentalIds.length) % instrumentalIds.length; - changedInst = true; + @:privateAccess + if (parent.controls.BACK) + { + close(); + return; + } + + if (parent.getControls().UI_LEFT_P) + { + currentInstrumentalIndex = (currentInstrumentalIndex + 1) % instrumentalIds.length; + changedInst = true; + } + if (parent.getControls().UI_RIGHT_P) + { + currentInstrumentalIndex = (currentInstrumentalIndex - 1 + instrumentalIds.length) % instrumentalIds.length; + changedInst = true; + } + if (parent.getControls().ACCEPT) + { + busy = true; + onConfirm(instrumentalIds[currentInstrumentalIndex] ?? ''); + } } + if (!changedInst && currentInstrumental.text == '') changedInst = true; if (changedInst) @@ -91,11 +103,6 @@ class CapsuleOptionsMenu extends FlxSpriteGroup currentInstrumental.text = instrumentalIds[currentInstrumentalIndex].toTitleCase() ?? ''; if (currentInstrumental.text == '') currentInstrumental.text = 'Default'; } - - if (parent.getControls().ACCEPT) - { - onConfirm(instrumentalIds[currentInstrumentalIndex] ?? ''); - } } public function close():Void