Moved settings related to the game itself into its own settings save file. Emscripten build also saves a separate system settings file in indexeddb. Added checks to prevent menu sounds from playing when the menu is not currently open, but adjusted in a different location in the game. Implemented different button icon sets and a setting to toggle between them. Removed the double button display (caused more confusion and took up more room). Fixed a bug with iterating through navigation groups when a button was removed/disabled from the list. Removed iconscaling dependency based on MenuIconButton sizes.

This commit is contained in:
2024-02-20 03:47:12 -06:00
parent 0d295021b6
commit 66b0648a59
45 changed files with 459 additions and 155 deletions
+17 -12
View File
@@ -374,17 +374,6 @@ 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);
@@ -441,7 +430,18 @@ void Menu::KeyboardButtonNavigation(AiL*game,vf2d menuPos){
break; //There's no reason to be doing anything here if we navigate with the mouse.
}
iterationCount++;
if(iterationCount==MAX_ITERATIONS)ERR("WARNING! We've entered the max iteration count of automatic Menu navigation! THIS LIKELY MEANS WE'VE DONE SOMETHING TERRIBLY WRONG!");
if(iterationCount==MAX_ITERATIONS){
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;
}
}
}while(iterationCount<MAX_ITERATIONS&&(selection.lock()->grayedOut||selection.lock()->disable));
}
@@ -770,4 +770,9 @@ void Menu::SetSelection(Data button,const bool reset){
void Menu::IgnoreNextMouseNavigationAttempt(){
nextMouseNavigationIsIgnored=true;
}
bool Menu::IsCurrentlyActive(MenuType type){
if(Menu::stack.size()==0)return false;
return Menu::stack.back()->GetType()==type;
}