Added controller compatibility for the consumable item crafting menu. Fixed bug for selecting buttons that would become disabled causing infinite menu loop. Added checkes fo auto-resolve default button and immediately close out the loop. Release Build 7299.
This commit is contained in:
@@ -368,6 +368,18 @@ void Menu::KeyboardButtonNavigation(AiL*game,vf2d menuPos){
|
||||
}
|
||||
if(navigationGroups.count(selectionButtonName)){
|
||||
Navigation nav=navigationGroups[selectionButtonName];
|
||||
|
||||
if(selection.lock()->IsGreyedOut()||selection.lock()->IsDisabled()){
|
||||
// If the button is greyed out or disabled, this is an invalid selection. We will try to reset to a default, but we need to break out of this loop.
|
||||
if(onOpenFunc){
|
||||
Data returnData;
|
||||
onOpenFunc(GetType(),returnData);
|
||||
defaultButton=returnData;
|
||||
if(std::holds_alternative<ButtonName>(returnData)&&std::get<ButtonName>(returnData).length()>0||std::holds_alternative<std::weak_ptr<MenuComponent>>(returnData))SetSelection(returnData,true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if(game->KEY_UP.PressedDAS()||game->KEY_SCROLLUP.AnalogDAS(0.5f)<-0.5f){
|
||||
SoundEffect::PlaySFX("Menu Navigate",SoundEffect::CENTERED);
|
||||
SetMouseNavigation(false);
|
||||
@@ -414,7 +426,12 @@ void Menu::KeyboardButtonNavigation(AiL*game,vf2d menuPos){
|
||||
}
|
||||
}else
|
||||
if(!Menu::UsingMouseNavigation()){
|
||||
if(std::holds_alternative<ButtonName>(defaultButton)&&std::get<ButtonName>(defaultButton).length()>0||std::holds_alternative<std::weak_ptr<MenuComponent>>(defaultButton))SetSelection(defaultButton,true);
|
||||
if(onOpenFunc){
|
||||
Data returnData;
|
||||
onOpenFunc(GetType(),returnData);
|
||||
defaultButton=returnData;
|
||||
if(std::holds_alternative<ButtonName>(returnData)&&std::get<ButtonName>(returnData).length()>0||std::holds_alternative<std::weak_ptr<MenuComponent>>(returnData))SetSelection(returnData,true);
|
||||
}
|
||||
}else{
|
||||
break; //There's no reason to be doing anything here if we navigate with the mouse.
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user