diff --git a/Adventures in Lestoria/InventoryWindow.cpp b/Adventures in Lestoria/InventoryWindow.cpp index b41ee02e..0e3c7ed8 100644 --- a/Adventures in Lestoria/InventoryWindow.cpp +++ b/Adventures in Lestoria/InventoryWindow.cpp @@ -89,7 +89,11 @@ void Menu::InitializeInventoryWindow(){ Component(data.menu.GetType(),"Inventory Display - "+data.component.lock()->S(A::CATEGORY_NAME))->Enable(); Component(data.menu.GetType(),data.component.lock()->S(A::CATEGORY_NAME)+" Inventory Tab")->SetSelected(true); data.menu.S(A::LAST_INVENTORY_TYPE_OPENED)=data.component.lock()->S(A::CATEGORY_NAME); - data.menu.I(A::ITEM_SLOT)=Component(data.menu.GetType(),"Inventory Display - "+data.component.lock()->S(A::CATEGORY_NAME))->GetComponents().size()-1; + if(Component(data.menu.GetType(),"Inventory Display - "+data.component.lock()->S(A::CATEGORY_NAME))->GetComponents().size()>0){ + data.menu.I(A::ITEM_SLOT)=0; + }else{ + data.menu.I(A::ITEM_SLOT)=-1; + } if(data.menu.I(A::ITEM_SLOT)>=0){ data.menu.SetSelection(Component(data.menu.GetType(),"Inventory Display - "+data.component.lock()->S(A::CATEGORY_NAME))->GetComponents()[0],true); } @@ -198,20 +202,42 @@ void Menu::InitializeInventoryWindow(){ {game->KEY_CONFIRM,{"Select",[](MenuType type){}}}, } ,{ //Button Navigation Rules + {"Back Button",{ + .up=[](MenuType type,Data&returnData){ + auto inventoryDisplay=Component(type,std::format("Inventory Display - {}",Menu::menus[type]->S(A::LAST_INVENTORY_TYPE_OPENED))); + if(inventoryDisplay->GetComponents().size()>0){ + returnData=inventoryDisplay->GetComponents()[inventoryDisplay->GetComponents().size()-1]; + }else{ + returnData="Back Button"; + } + }, + .down=[](MenuType type,Data&returnData){ + auto inventoryDisplay=Component(type,std::format("Inventory Display - {}",Menu::menus[type]->S(A::LAST_INVENTORY_TYPE_OPENED))); + if(inventoryDisplay->GetComponents().size()>0){ + returnData=inventoryDisplay->GetComponents()[0]; + }else{ + returnData="Back Button"; + } + }, + .left=[](MenuType type,Data&returnData){ + returnData=std::format("{} Inventory Tab",Menu::menus[type]->S(A::LAST_INVENTORY_TYPE_OPENED)); + }, + .right=[](MenuType type,Data&returnData){ + returnData=std::format("{} Inventory Tab",Menu::menus[type]->S(A::LAST_INVENTORY_TYPE_OPENED)); + }, + }}, {"Inventory Display - Consumables",{ .up=[](MenuType type,Data&returnData){ Menu::menus[type]->I(A::ITEM_SLOT)--; if(Menu::menus[type]->I(A::ITEM_SLOT)<0){ - Menu::menus[type]->I(A::ITEM_SLOT)=Component(type,"Inventory Display - Consumables")->GetComponents().size()-1; - } - returnData=Component(type,"Inventory Display - Consumables")->GetComponents()[Menu::menus[type]->I(A::ITEM_SLOT)]; + returnData="Back Button"; + }else returnData=Component(type,"Inventory Display - Consumables")->GetComponents()[Menu::menus[type]->I(A::ITEM_SLOT)]; }, .down=[](MenuType type,Data&returnData){ Menu::menus[type]->I(A::ITEM_SLOT)++; if(Menu::menus[type]->I(A::ITEM_SLOT)>=Component(type,"Inventory Display - Consumables")->GetComponents().size()){ - Menu::menus[type]->I(A::ITEM_SLOT)-=Component(type,"Inventory Display - Consumables")->GetComponents().size(); - } - returnData=Component(type,"Inventory Display - Consumables")->GetComponents()[Menu::menus[type]->I(A::ITEM_SLOT)]; + returnData="Back Button"; + }else returnData=Component(type,"Inventory Display - Consumables")->GetComponents()[Menu::menus[type]->I(A::ITEM_SLOT)]; }, .left=[](MenuType type,Data&returnData){ returnData=std::format("{} Inventory Tab",Menu::menus[type]->S(A::LAST_INVENTORY_TYPE_OPENED)); @@ -224,16 +250,14 @@ void Menu::InitializeInventoryWindow(){ .up=[](MenuType type,Data&returnData){ Menu::menus[type]->I(A::ITEM_SLOT)--; if(Menu::menus[type]->I(A::ITEM_SLOT)<0){ - Menu::menus[type]->I(A::ITEM_SLOT)=Component(type,"Inventory Display - Equipment")->GetComponents().size()-1; - } - returnData=Component(type,"Inventory Display - Equipment")->GetComponents()[Menu::menus[type]->I(A::ITEM_SLOT)]; + returnData="Back Button"; + }else returnData=Component(type,"Inventory Display - Equipment")->GetComponents()[Menu::menus[type]->I(A::ITEM_SLOT)]; }, .down=[](MenuType type,Data&returnData){ Menu::menus[type]->I(A::ITEM_SLOT)++; if(Menu::menus[type]->I(A::ITEM_SLOT)>=Component(type,"Inventory Display - Equipment")->GetComponents().size()){ - Menu::menus[type]->I(A::ITEM_SLOT)-=Component(type,"Inventory Display - Equipment")->GetComponents().size(); - } - returnData=Component(type,"Inventory Display - Equipment")->GetComponents()[Menu::menus[type]->I(A::ITEM_SLOT)]; + returnData="Back Button"; + }else returnData=Component(type,"Inventory Display - Equipment")->GetComponents()[Menu::menus[type]->I(A::ITEM_SLOT)]; }, .left=[](MenuType type,Data&returnData){ returnData=std::format("{} Inventory Tab",Menu::menus[type]->S(A::LAST_INVENTORY_TYPE_OPENED)); @@ -246,16 +270,14 @@ void Menu::InitializeInventoryWindow(){ .up=[](MenuType type,Data&returnData){ Menu::menus[type]->I(A::ITEM_SLOT)--; if(Menu::menus[type]->I(A::ITEM_SLOT)<0){ - Menu::menus[type]->I(A::ITEM_SLOT)=Component(type,"Inventory Display - Accessories")->GetComponents().size()-1; - } - returnData=Component(type,"Inventory Display - Accessories")->GetComponents()[Menu::menus[type]->I(A::ITEM_SLOT)]; + returnData="Back Button"; + }else returnData=Component(type,"Inventory Display - Accessories")->GetComponents()[Menu::menus[type]->I(A::ITEM_SLOT)]; }, .down=[](MenuType type,Data&returnData){ Menu::menus[type]->I(A::ITEM_SLOT)++; if(Menu::menus[type]->I(A::ITEM_SLOT)>=Component(type,"Inventory Display - Accessories")->GetComponents().size()){ - Menu::menus[type]->I(A::ITEM_SLOT)-=Component(type,"Inventory Display - Accessories")->GetComponents().size(); - } - returnData=Component(type,"Inventory Display - Accessories")->GetComponents()[Menu::menus[type]->I(A::ITEM_SLOT)]; + returnData="Back Button"; + }else returnData=Component(type,"Inventory Display - Accessories")->GetComponents()[Menu::menus[type]->I(A::ITEM_SLOT)]; }, .left=[](MenuType type,Data&returnData){ returnData=std::format("{} Inventory Tab",Menu::menus[type]->S(A::LAST_INVENTORY_TYPE_OPENED)); @@ -268,16 +290,14 @@ void Menu::InitializeInventoryWindow(){ .up=[](MenuType type,Data&returnData){ Menu::menus[type]->I(A::ITEM_SLOT)--; if(Menu::menus[type]->I(A::ITEM_SLOT)<0){ - Menu::menus[type]->I(A::ITEM_SLOT)=Component(type,"Inventory Display - Materials")->GetComponents().size()-1; - } - returnData=Component(type,"Inventory Display - Materials")->GetComponents()[Menu::menus[type]->I(A::ITEM_SLOT)]; + returnData="Back Button"; + }else returnData=Component(type,"Inventory Display - Materials")->GetComponents()[Menu::menus[type]->I(A::ITEM_SLOT)]; }, .down=[](MenuType type,Data&returnData){ Menu::menus[type]->I(A::ITEM_SLOT)++; if(Menu::menus[type]->I(A::ITEM_SLOT)>=Component(type,"Inventory Display - Materials")->GetComponents().size()){ - Menu::menus[type]->I(A::ITEM_SLOT)-=Component(type,"Inventory Display - Materials")->GetComponents().size(); - } - returnData=Component(type,"Inventory Display - Materials")->GetComponents()[Menu::menus[type]->I(A::ITEM_SLOT)]; + returnData="Back Button"; + }else returnData=Component(type,"Inventory Display - Materials")->GetComponents()[Menu::menus[type]->I(A::ITEM_SLOT)]; }, .left=[](MenuType type,Data&returnData){ returnData=std::format("{} Inventory Tab",Menu::menus[type]->S(A::LAST_INVENTORY_TYPE_OPENED)); diff --git a/Adventures in Lestoria/MerchantWindow.cpp b/Adventures in Lestoria/MerchantWindow.cpp index 25fd6d78..d4aded90 100644 --- a/Adventures in Lestoria/MerchantWindow.cpp +++ b/Adventures in Lestoria/MerchantWindow.cpp @@ -223,4 +223,28 @@ void Menu::InitializeMerchantWindow(){ },vf2d{2,2})END; buyTab->onClick(MenuFuncData{*merchantWindow,game,buyTab}); + + /*merchantWindow->SetupKeyboardNavigation( + [](MenuType type,Data&returnData){ //On Open + if(SaveFile::GetSaveFileCount()>0){ + returnData="Load Game Button"; + }else{ + returnData="New Game Button"; + } + }, + { //Button Key + {game->KEY_BACK,{"Back",[](MenuType type){}}}, + {game->KEY_CONFIRM,{"Select",[](MenuType type){}}}, + } + ,{ //Button Navigation Rules + {"New Game Button",{ + .up="Quit Game Button", + .down="Load Game Button",}}, + {"Load Game Button",{ + .up="New Game Button", + .down="Quit Game Button",}}, + {"Quit Game Button",{ + .up="Load Game Button", + .down="New Game Button",}}, + });*/ } \ No newline at end of file diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index f713e37c..308d8ccb 100644 --- a/Adventures in Lestoria/Version.h +++ b/Adventures in Lestoria/Version.h @@ -39,7 +39,7 @@ All rights reserved. #define VERSION_MAJOR 0 #define VERSION_MINOR 3 #define VERSION_PATCH 0 -#define VERSION_BUILD 7202 +#define VERSION_BUILD 7204 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index a631ec4f..cf9d3da5 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ