remove some redundant getControls() in FreeplayState, just access controls directly

This commit is contained in:
Cameron Taylor
2025-12-12 08:16:37 -05:00
committed by Hundrec
parent dbf0776dbf
commit ca7891e5cb
2 changed files with 9 additions and 13 deletions
@@ -46,8 +46,11 @@ class CapsuleOptionsMenu extends FlxSpriteGroup
currentInstrumental.setFormat('VCR OSD Mono', 40, FlxTextAlign.CENTER, true);
final PAD = 4;
leftArrow = new InstrumentalSelector(parent, PAD, 30, false, parent.getControls());
rightArrow = new InstrumentalSelector(parent, capsuleMenuBG.width - leftArrow.width - PAD, 30, true, parent.getControls());
@:privateAccess
leftArrow = new InstrumentalSelector(parent, PAD, 30, false, parent.controls);
@:privateAccess
rightArrow = new InstrumentalSelector(parent, capsuleMenuBG.width - leftArrow.width - PAD, 30, true, parent.controls);
var label:FlxText = new FlxText(0, 5, capsuleMenuBG.width, 'INSTRUMENTAL');
label.setFormat('VCR OSD Mono', 24, FlxTextAlign.CENTER, true);
@@ -74,28 +77,26 @@ class CapsuleOptionsMenu extends FlxSpriteGroup
return;
}
var changedInst:Bool = false;
@:privateAccess
if (!busy)
{
@:privateAccess
if (parent.controls.BACK_P #if mobile || TouchUtil.pressAction(parent.backButton) #end)
{
close();
return;
}
if (parent.getControls().UI_LEFT_P #if mobile || TouchUtil.pressAction(leftArrow) #end)
if (parent.controls.UI_LEFT_P #if mobile || TouchUtil.pressAction(leftArrow) #end)
{
currentInstrumentalIndex = (currentInstrumentalIndex + 1) % instrumentalIds.length;
changedInst = true;
}
if (parent.getControls().UI_RIGHT_P #if mobile || TouchUtil.pressAction(rightArrow) #end)
if (parent.controls.UI_RIGHT_P #if mobile || TouchUtil.pressAction(rightArrow) #end)
{
currentInstrumentalIndex = (currentInstrumentalIndex - 1 + instrumentalIds.length) % instrumentalIds.length;
changedInst = true;
}
if (parent.getControls()
.ACCEPT_P #if mobile
if (parent.controls.ACCEPT_P #if mobile
|| ((TouchUtil.pressAction(currentInstrumental))
&& !(TouchUtil.overlapsComplex(leftArrow) || TouchUtil.overlapsComplex(rightArrow))) #end)
{
@@ -2673,11 +2673,6 @@ class FreeplayState extends MusicBeatSubState
capsuleOnConfirmDefault(cap);
}
public function getControls():Controls
{
return controls;
}
function openInstrumentalList(cap:SongMenuItem, instrumentalIds:Array<String>):Void
{
uiStateMachine.transition(Interacting);