Add back button navigation for character inventory menu. Fix scrolling to bottom of inventory display when switching item categories. Release Build 7204.
This commit is contained in:
parent
fe648f8fbf
commit
0124d44a5c
@ -89,7 +89,11 @@ void Menu::InitializeInventoryWindow(){
|
|||||||
Component<RowInventoryScrollableWindowComponent>(data.menu.GetType(),"Inventory Display - "+data.component.lock()->S(A::CATEGORY_NAME))->Enable();
|
Component<RowInventoryScrollableWindowComponent>(data.menu.GetType(),"Inventory Display - "+data.component.lock()->S(A::CATEGORY_NAME))->Enable();
|
||||||
Component<MenuComponent>(data.menu.GetType(),data.component.lock()->S(A::CATEGORY_NAME)+" Inventory Tab")->SetSelected(true);
|
Component<MenuComponent>(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.S(A::LAST_INVENTORY_TYPE_OPENED)=data.component.lock()->S(A::CATEGORY_NAME);
|
||||||
data.menu.I(A::ITEM_SLOT)=Component<RowInventoryScrollableWindowComponent>(data.menu.GetType(),"Inventory Display - "+data.component.lock()->S(A::CATEGORY_NAME))->GetComponents().size()-1;
|
if(Component<RowInventoryScrollableWindowComponent>(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){
|
if(data.menu.I(A::ITEM_SLOT)>=0){
|
||||||
data.menu.SetSelection(Component<RowInventoryScrollableWindowComponent>(data.menu.GetType(),"Inventory Display - "+data.component.lock()->S(A::CATEGORY_NAME))->GetComponents()[0],true);
|
data.menu.SetSelection(Component<RowInventoryScrollableWindowComponent>(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){}}},
|
{game->KEY_CONFIRM,{"Select",[](MenuType type){}}},
|
||||||
}
|
}
|
||||||
,{ //Button Navigation Rules
|
,{ //Button Navigation Rules
|
||||||
|
{"Back Button",{
|
||||||
|
.up=[](MenuType type,Data&returnData){
|
||||||
|
auto inventoryDisplay=Component<RowInventoryScrollableWindowComponent>(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<RowInventoryScrollableWindowComponent>(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",{
|
{"Inventory Display - Consumables",{
|
||||||
.up=[](MenuType type,Data&returnData){
|
.up=[](MenuType type,Data&returnData){
|
||||||
Menu::menus[type]->I(A::ITEM_SLOT)--;
|
Menu::menus[type]->I(A::ITEM_SLOT)--;
|
||||||
if(Menu::menus[type]->I(A::ITEM_SLOT)<0){
|
if(Menu::menus[type]->I(A::ITEM_SLOT)<0){
|
||||||
Menu::menus[type]->I(A::ITEM_SLOT)=Component<RowInventoryScrollableWindowComponent>(type,"Inventory Display - Consumables")->GetComponents().size()-1;
|
returnData="Back Button";
|
||||||
}
|
}else returnData=Component<RowInventoryScrollableWindowComponent>(type,"Inventory Display - Consumables")->GetComponents()[Menu::menus[type]->I(A::ITEM_SLOT)];
|
||||||
returnData=Component<RowInventoryScrollableWindowComponent>(type,"Inventory Display - Consumables")->GetComponents()[Menu::menus[type]->I(A::ITEM_SLOT)];
|
|
||||||
},
|
},
|
||||||
.down=[](MenuType type,Data&returnData){
|
.down=[](MenuType type,Data&returnData){
|
||||||
Menu::menus[type]->I(A::ITEM_SLOT)++;
|
Menu::menus[type]->I(A::ITEM_SLOT)++;
|
||||||
if(Menu::menus[type]->I(A::ITEM_SLOT)>=Component<RowInventoryScrollableWindowComponent>(type,"Inventory Display - Consumables")->GetComponents().size()){
|
if(Menu::menus[type]->I(A::ITEM_SLOT)>=Component<RowInventoryScrollableWindowComponent>(type,"Inventory Display - Consumables")->GetComponents().size()){
|
||||||
Menu::menus[type]->I(A::ITEM_SLOT)-=Component<RowInventoryScrollableWindowComponent>(type,"Inventory Display - Consumables")->GetComponents().size();
|
returnData="Back Button";
|
||||||
}
|
}else returnData=Component<RowInventoryScrollableWindowComponent>(type,"Inventory Display - Consumables")->GetComponents()[Menu::menus[type]->I(A::ITEM_SLOT)];
|
||||||
returnData=Component<RowInventoryScrollableWindowComponent>(type,"Inventory Display - Consumables")->GetComponents()[Menu::menus[type]->I(A::ITEM_SLOT)];
|
|
||||||
},
|
},
|
||||||
.left=[](MenuType type,Data&returnData){
|
.left=[](MenuType type,Data&returnData){
|
||||||
returnData=std::format("{} Inventory Tab",Menu::menus[type]->S(A::LAST_INVENTORY_TYPE_OPENED));
|
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){
|
.up=[](MenuType type,Data&returnData){
|
||||||
Menu::menus[type]->I(A::ITEM_SLOT)--;
|
Menu::menus[type]->I(A::ITEM_SLOT)--;
|
||||||
if(Menu::menus[type]->I(A::ITEM_SLOT)<0){
|
if(Menu::menus[type]->I(A::ITEM_SLOT)<0){
|
||||||
Menu::menus[type]->I(A::ITEM_SLOT)=Component<RowInventoryScrollableWindowComponent>(type,"Inventory Display - Equipment")->GetComponents().size()-1;
|
returnData="Back Button";
|
||||||
}
|
}else returnData=Component<RowInventoryScrollableWindowComponent>(type,"Inventory Display - Equipment")->GetComponents()[Menu::menus[type]->I(A::ITEM_SLOT)];
|
||||||
returnData=Component<RowInventoryScrollableWindowComponent>(type,"Inventory Display - Equipment")->GetComponents()[Menu::menus[type]->I(A::ITEM_SLOT)];
|
|
||||||
},
|
},
|
||||||
.down=[](MenuType type,Data&returnData){
|
.down=[](MenuType type,Data&returnData){
|
||||||
Menu::menus[type]->I(A::ITEM_SLOT)++;
|
Menu::menus[type]->I(A::ITEM_SLOT)++;
|
||||||
if(Menu::menus[type]->I(A::ITEM_SLOT)>=Component<RowInventoryScrollableWindowComponent>(type,"Inventory Display - Equipment")->GetComponents().size()){
|
if(Menu::menus[type]->I(A::ITEM_SLOT)>=Component<RowInventoryScrollableWindowComponent>(type,"Inventory Display - Equipment")->GetComponents().size()){
|
||||||
Menu::menus[type]->I(A::ITEM_SLOT)-=Component<RowInventoryScrollableWindowComponent>(type,"Inventory Display - Equipment")->GetComponents().size();
|
returnData="Back Button";
|
||||||
}
|
}else returnData=Component<RowInventoryScrollableWindowComponent>(type,"Inventory Display - Equipment")->GetComponents()[Menu::menus[type]->I(A::ITEM_SLOT)];
|
||||||
returnData=Component<RowInventoryScrollableWindowComponent>(type,"Inventory Display - Equipment")->GetComponents()[Menu::menus[type]->I(A::ITEM_SLOT)];
|
|
||||||
},
|
},
|
||||||
.left=[](MenuType type,Data&returnData){
|
.left=[](MenuType type,Data&returnData){
|
||||||
returnData=std::format("{} Inventory Tab",Menu::menus[type]->S(A::LAST_INVENTORY_TYPE_OPENED));
|
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){
|
.up=[](MenuType type,Data&returnData){
|
||||||
Menu::menus[type]->I(A::ITEM_SLOT)--;
|
Menu::menus[type]->I(A::ITEM_SLOT)--;
|
||||||
if(Menu::menus[type]->I(A::ITEM_SLOT)<0){
|
if(Menu::menus[type]->I(A::ITEM_SLOT)<0){
|
||||||
Menu::menus[type]->I(A::ITEM_SLOT)=Component<RowInventoryScrollableWindowComponent>(type,"Inventory Display - Accessories")->GetComponents().size()-1;
|
returnData="Back Button";
|
||||||
}
|
}else returnData=Component<RowInventoryScrollableWindowComponent>(type,"Inventory Display - Accessories")->GetComponents()[Menu::menus[type]->I(A::ITEM_SLOT)];
|
||||||
returnData=Component<RowInventoryScrollableWindowComponent>(type,"Inventory Display - Accessories")->GetComponents()[Menu::menus[type]->I(A::ITEM_SLOT)];
|
|
||||||
},
|
},
|
||||||
.down=[](MenuType type,Data&returnData){
|
.down=[](MenuType type,Data&returnData){
|
||||||
Menu::menus[type]->I(A::ITEM_SLOT)++;
|
Menu::menus[type]->I(A::ITEM_SLOT)++;
|
||||||
if(Menu::menus[type]->I(A::ITEM_SLOT)>=Component<RowInventoryScrollableWindowComponent>(type,"Inventory Display - Accessories")->GetComponents().size()){
|
if(Menu::menus[type]->I(A::ITEM_SLOT)>=Component<RowInventoryScrollableWindowComponent>(type,"Inventory Display - Accessories")->GetComponents().size()){
|
||||||
Menu::menus[type]->I(A::ITEM_SLOT)-=Component<RowInventoryScrollableWindowComponent>(type,"Inventory Display - Accessories")->GetComponents().size();
|
returnData="Back Button";
|
||||||
}
|
}else returnData=Component<RowInventoryScrollableWindowComponent>(type,"Inventory Display - Accessories")->GetComponents()[Menu::menus[type]->I(A::ITEM_SLOT)];
|
||||||
returnData=Component<RowInventoryScrollableWindowComponent>(type,"Inventory Display - Accessories")->GetComponents()[Menu::menus[type]->I(A::ITEM_SLOT)];
|
|
||||||
},
|
},
|
||||||
.left=[](MenuType type,Data&returnData){
|
.left=[](MenuType type,Data&returnData){
|
||||||
returnData=std::format("{} Inventory Tab",Menu::menus[type]->S(A::LAST_INVENTORY_TYPE_OPENED));
|
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){
|
.up=[](MenuType type,Data&returnData){
|
||||||
Menu::menus[type]->I(A::ITEM_SLOT)--;
|
Menu::menus[type]->I(A::ITEM_SLOT)--;
|
||||||
if(Menu::menus[type]->I(A::ITEM_SLOT)<0){
|
if(Menu::menus[type]->I(A::ITEM_SLOT)<0){
|
||||||
Menu::menus[type]->I(A::ITEM_SLOT)=Component<RowInventoryScrollableWindowComponent>(type,"Inventory Display - Materials")->GetComponents().size()-1;
|
returnData="Back Button";
|
||||||
}
|
}else returnData=Component<RowInventoryScrollableWindowComponent>(type,"Inventory Display - Materials")->GetComponents()[Menu::menus[type]->I(A::ITEM_SLOT)];
|
||||||
returnData=Component<RowInventoryScrollableWindowComponent>(type,"Inventory Display - Materials")->GetComponents()[Menu::menus[type]->I(A::ITEM_SLOT)];
|
|
||||||
},
|
},
|
||||||
.down=[](MenuType type,Data&returnData){
|
.down=[](MenuType type,Data&returnData){
|
||||||
Menu::menus[type]->I(A::ITEM_SLOT)++;
|
Menu::menus[type]->I(A::ITEM_SLOT)++;
|
||||||
if(Menu::menus[type]->I(A::ITEM_SLOT)>=Component<RowInventoryScrollableWindowComponent>(type,"Inventory Display - Materials")->GetComponents().size()){
|
if(Menu::menus[type]->I(A::ITEM_SLOT)>=Component<RowInventoryScrollableWindowComponent>(type,"Inventory Display - Materials")->GetComponents().size()){
|
||||||
Menu::menus[type]->I(A::ITEM_SLOT)-=Component<RowInventoryScrollableWindowComponent>(type,"Inventory Display - Materials")->GetComponents().size();
|
returnData="Back Button";
|
||||||
}
|
}else returnData=Component<RowInventoryScrollableWindowComponent>(type,"Inventory Display - Materials")->GetComponents()[Menu::menus[type]->I(A::ITEM_SLOT)];
|
||||||
returnData=Component<RowInventoryScrollableWindowComponent>(type,"Inventory Display - Materials")->GetComponents()[Menu::menus[type]->I(A::ITEM_SLOT)];
|
|
||||||
},
|
},
|
||||||
.left=[](MenuType type,Data&returnData){
|
.left=[](MenuType type,Data&returnData){
|
||||||
returnData=std::format("{} Inventory Tab",Menu::menus[type]->S(A::LAST_INVENTORY_TYPE_OPENED));
|
returnData=std::format("{} Inventory Tab",Menu::menus[type]->S(A::LAST_INVENTORY_TYPE_OPENED));
|
||||||
|
@ -223,4 +223,28 @@ void Menu::InitializeMerchantWindow(){
|
|||||||
},vf2d{2,2})END;
|
},vf2d{2,2})END;
|
||||||
|
|
||||||
buyTab->onClick(MenuFuncData{*merchantWindow,game,buyTab});
|
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",}},
|
||||||
|
});*/
|
||||||
}
|
}
|
@ -39,7 +39,7 @@ All rights reserved.
|
|||||||
#define VERSION_MAJOR 0
|
#define VERSION_MAJOR 0
|
||||||
#define VERSION_MINOR 3
|
#define VERSION_MINOR 3
|
||||||
#define VERSION_PATCH 0
|
#define VERSION_PATCH 0
|
||||||
#define VERSION_BUILD 7202
|
#define VERSION_BUILD 7204
|
||||||
|
|
||||||
#define stringify(a) stringify_(a)
|
#define stringify(a) stringify_(a)
|
||||||
#define stringify_(a) #a
|
#define stringify_(a) #a
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user