Fixed issues with one input bleeding into multiple inputs. Removed old redundant system where we can specify a menu to navigate to. Implemented controller compatibility for UserID menu. Release Build 7326.

This commit is contained in:
2024-02-18 18:46:45 -06:00
parent 7434079e0d
commit a39a841166
25 changed files with 91 additions and 77 deletions
+4 -12
View File
@@ -125,7 +125,7 @@ Menu*Menu::CreateMenu(MenuType type,vf2d pos,vf2d size){
}
void Menu::CheckClickAndPerformMenuSelect(AiL*game){
if(game->KEY_CONFIRM.Released()&&(MOUSE_NAVIGATION||(!MOUSE_NAVIGATION&&!game->GetMouse(Mouse::LEFT).bReleased&&!game->GetMouse(Mouse::RIGHT).bReleased&&!game->GetMouse(Mouse::MIDDLE).bReleased))){
if(game->KEY_CONFIRM.Released()&&!Menu::alreadyClicked&&(MOUSE_NAVIGATION||(!MOUSE_NAVIGATION&&!game->GetMouse(Mouse::LEFT).bReleased&&!game->GetMouse(Mouse::RIGHT).bReleased&&!game->GetMouse(Mouse::MIDDLE).bReleased))){
if(!GetSelection().expired()){ //If we are on controller/gamepad it's possible we haven't highlighted a button yet, so don't click this button right away.
MenuSelect(game);
Menu::alreadyClicked=true;
@@ -150,17 +150,7 @@ void Menu::HoverMenuSelect(AiL*game){
void Menu::MenuSelect(AiL*game){
if(!game->IsFocused()||selection.expired()||selection.lock()->disable||selection.lock()->disableOutsideWindow||selection.lock()->grayedOut)return;
bool buttonStillValid=selection.lock()->onClick(MenuFuncData{*this,game,selection,dynamic_pointer_cast<ScrollableWindowComponent>(selection.lock()->parentComponent.lock())});
if(buttonStillValid){
if(selection.lock()->menuDest!=MenuType::ENUM_END){
if(stack.size()<MAX_MENUS){
SoundEffect::PlaySFX("Menu Select",SoundEffect::CENTERED);
Menu::OpenMenu(selection.lock()->menuDest); //Navigate to the next menu.
}else{
ERR("WARNING! Exceeded menu stack size limit!")
}
}
}
selection.lock()->onClick(MenuFuncData{*this,game,selection,dynamic_pointer_cast<ScrollableWindowComponent>(selection.lock()->parentComponent.lock())});
}
void Menu::Update(AiL*game){
@@ -327,6 +317,7 @@ void Menu::KeyboardButtonNavigation(AiL*game,vf2d menuPos){
}
for(auto&[input,data]:inputGroups){
if(Menu::alreadyClicked)break;
bool activated=false;
switch(input.GetEngageType()){
case Released:{
@@ -621,6 +612,7 @@ vf2d Menu::center(){
}
void Menu::CloseMenu(){
Menu::alreadyClicked=true;
game->TextEntryEnable(false);
if(stack.size()>0){
stack.pop_back();