|
|
|
@ -43,6 +43,7 @@ All rights reserved. |
|
|
|
|
#include "MenuComponent.h" |
|
|
|
|
#include "PlayerMoneyLabel.h" |
|
|
|
|
#include "ItemMenuLabel.h" |
|
|
|
|
#include "SoundEffect.h" |
|
|
|
|
|
|
|
|
|
INCLUDE_game |
|
|
|
|
INCLUDE_ITEM_CATEGORIES |
|
|
|
@ -54,12 +55,17 @@ void Menu::InitializeMerchantWindow(){ |
|
|
|
|
|
|
|
|
|
static std::string lastInventoryTypeOpened=""; |
|
|
|
|
|
|
|
|
|
std::vector<std::pair<std::string,int>>categories; |
|
|
|
|
for(auto&[category,items]:ITEM_CATEGORIES){ |
|
|
|
|
if(DATA["ItemCategory"][category].GetString(0)=="!HIDE")continue; //This category is meant to be hidden!
|
|
|
|
|
categories.push_back({category,DATA["ItemCategory"][category].GetInt(0)}); //We assume the first value becomes the sort order we wish to use.
|
|
|
|
|
} |
|
|
|
|
std::sort(categories.begin(),categories.end(),[](std::pair<std::string,int>&cat1,std::pair<std::string,int>&cat2){return cat1.second<cat2.second;}); |
|
|
|
|
auto GetSortedCategories=[](){ |
|
|
|
|
std::vector<std::pair<std::string,int>>categories; |
|
|
|
|
for(auto&[category,items]:ITEM_CATEGORIES){ |
|
|
|
|
if(DATA["ItemCategory"][category].GetString(0)=="!HIDE")continue; //This category is meant to be hidden!
|
|
|
|
|
categories.push_back({category,DATA["ItemCategory"][category].GetInt(0)}); //We assume the first value becomes the sort order we wish to use.
|
|
|
|
|
} |
|
|
|
|
std::sort(categories.begin(),categories.end(),[](std::pair<std::string,int>&cat1,std::pair<std::string,int>&cat2){return cat1.second<cat2.second;}); |
|
|
|
|
return categories; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
std::vector<std::pair<std::string,int>>categories=GetSortedCategories(); |
|
|
|
|
|
|
|
|
|
auto buyTab=merchantWindow->ADD("Buy Tab",MenuComponent)(geom2d::rect<float>{{2,0},{merchantWindow->size.x/2-4,24}},"Buy",[](MenuFuncData data){ |
|
|
|
|
Component<RowInventoryScrollableWindowComponent>(MERCHANT,"Merchant Inventory Display")->Enable(); |
|
|
|
@ -72,6 +78,7 @@ void Menu::InitializeMerchantWindow(){ |
|
|
|
|
Component<RowInventoryScrollableWindowComponent>(data.menu.GetType(),"Inventory Display - "+data.menu.S(A::LAST_INVENTORY_TYPE_OPENED))->Disable(); |
|
|
|
|
Component<MenuComponent>(data.menu.GetType(),data.menu.S(A::LAST_INVENTORY_TYPE_OPENED)+" Inventory Tab")->Disable(); |
|
|
|
|
data.component.lock()->selected=true; |
|
|
|
|
SoundEffect::PlaySFX("Button Click",SoundEffect::CENTERED); |
|
|
|
|
return true; |
|
|
|
|
})END; |
|
|
|
|
buyTab->selected=true; |
|
|
|
@ -88,10 +95,13 @@ void Menu::InitializeMerchantWindow(){ |
|
|
|
|
Component<RowInventoryScrollableWindowComponent>(data.menu.GetType(),"Inventory Display - "+data.menu.S(A::LAST_INVENTORY_TYPE_OPENED))->Enable(); |
|
|
|
|
Component<MenuComponent>(data.menu.GetType(),data.menu.S(A::LAST_INVENTORY_TYPE_OPENED)+" Inventory Tab")->Enable(); |
|
|
|
|
data.component.lock()->selected=true; |
|
|
|
|
SoundEffect::PlaySFX("Button Click",SoundEffect::CENTERED); |
|
|
|
|
return true; |
|
|
|
|
})END; |
|
|
|
|
sellTab->selectionType=SelectionType::HIGHLIGHT; |
|
|
|
|
|
|
|
|
|
merchantWindow->I(A::ITEM_SLOT)=0; |
|
|
|
|
|
|
|
|
|
auto inventoryDisplay=merchantWindow->ADD("Merchant Inventory Display",RowInventoryScrollableWindowComponent)(geom2d::rect<float>{{2,28},{220,merchantWindow->size.y-44}},"Item Name Label","Item Description Label", |
|
|
|
|
[](MenuFuncData data){ |
|
|
|
|
std::weak_ptr<RowItemDisplay>item=DYNAMIC_POINTER_CAST<RowItemDisplay>(data.component.lock()); |
|
|
|
@ -112,6 +122,7 @@ void Menu::InitializeMerchantWindow(){ |
|
|
|
|
}, |
|
|
|
|
[](MenuFuncData data){ |
|
|
|
|
Component<MenuItemItemButton>(data.menu.GetType(),"Item Icon")->SetItem(DYNAMIC_POINTER_CAST<RowItemDisplay>(data.component.lock())->GetItem()); |
|
|
|
|
data.menu.I(A::MERCHANT_ITEM_SLOT)=data.parentComponent.lock()->GetComponentIndex(data.component); |
|
|
|
|
return true; |
|
|
|
|
}, |
|
|
|
|
[](MenuFuncData data){ |
|
|
|
@ -128,8 +139,6 @@ void Menu::InitializeMerchantWindow(){ |
|
|
|
|
|
|
|
|
|
merchantWindow->ADD("Inventory Tabs Outline",MenuComponent)(geom2d::rect<float>{{0,28},{72,merchantWindow->size.y-44}},"",DO_NOTHING,ButtonAttr::UNSELECTABLE)END; |
|
|
|
|
|
|
|
|
|
std::sort(categories.begin(),categories.end(),[](std::pair<std::string,int>&cat1,std::pair<std::string,int>&cat2){return cat1.second<cat2.second;}); |
|
|
|
|
|
|
|
|
|
#pragma region Inventory Tabs |
|
|
|
|
bool first=true; |
|
|
|
|
for(float yOffset=0;auto&[category,sortOrder]:categories){ |
|
|
|
@ -145,6 +154,15 @@ void Menu::InitializeMerchantWindow(){ |
|
|
|
|
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); |
|
|
|
|
data.menu.S(A::LAST_INVENTORY_TYPE_OPENED)=data.component.lock()->S(A::CATEGORY_NAME); |
|
|
|
|
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){ |
|
|
|
|
data.menu.SetSelection(Component<RowInventoryScrollableWindowComponent>(data.menu.GetType(),"Inventory Display - "+data.component.lock()->S(A::CATEGORY_NAME))->GetComponents()[0],true); |
|
|
|
|
} |
|
|
|
|
SoundEffect::PlaySFX("Button Click",SoundEffect::CENTERED); |
|
|
|
|
return true; |
|
|
|
|
},vf2d{textScaling,1.f})END; |
|
|
|
|
button->SetSelectionType(HIGHLIGHT); |
|
|
|
@ -172,6 +190,7 @@ void Menu::InitializeMerchantWindow(){ |
|
|
|
|
}, |
|
|
|
|
[](MenuFuncData data){ |
|
|
|
|
Component<MenuItemItemButton>(data.menu.GetType(),"Item Icon")->SetItem(DYNAMIC_POINTER_CAST<RowItemDisplay>(data.component.lock())->GetItem()); |
|
|
|
|
data.menu.I(A::ITEM_SLOT)=data.parentComponent.lock()->GetComponentIndex(data.component); |
|
|
|
|
return true; |
|
|
|
|
}, |
|
|
|
|
[](MenuFuncData data){ |
|
|
|
@ -224,27 +243,570 @@ void Menu::InitializeMerchantWindow(){ |
|
|
|
|
|
|
|
|
|
buyTab->onClick(MenuFuncData{*merchantWindow,game,buyTab}); |
|
|
|
|
|
|
|
|
|
/*merchantWindow->SetupKeyboardNavigation(
|
|
|
|
|
merchantWindow->SetupKeyboardNavigation( |
|
|
|
|
[](MenuType type,Data&returnData){ //On Open
|
|
|
|
|
if(SaveFile::GetSaveFileCount()>0){ |
|
|
|
|
returnData="Load Game Button"; |
|
|
|
|
}else{ |
|
|
|
|
returnData="New Game Button"; |
|
|
|
|
} |
|
|
|
|
returnData=Component<RowInventoryScrollableWindowComponent>(type,"Merchant Inventory Display")->GetComponents()[0]; |
|
|
|
|
}, |
|
|
|
|
{ //Button Key
|
|
|
|
|
{game->KEY_BACK,{"Back",[](MenuType type){}}}, |
|
|
|
|
{game->KEY_BACK,{"Leave",[](MenuType type){ |
|
|
|
|
Menu::CloseMenu(); |
|
|
|
|
}}}, |
|
|
|
|
{game->KEY_FACELEFT,{[](MenuFuncData data){ |
|
|
|
|
if(Component<MenuComponent>(MERCHANT,"Buy Tab")->selected){ |
|
|
|
|
return "Sell Page"; |
|
|
|
|
}else{ |
|
|
|
|
return "Buy Page"; |
|
|
|
|
} |
|
|
|
|
},[](MenuType type){ |
|
|
|
|
if(Component<MenuComponent>(MERCHANT,"Buy Tab")->selected){ |
|
|
|
|
Component<MenuComponent>(MERCHANT,"Sell Tab")->Click(); |
|
|
|
|
|
|
|
|
|
}else{ |
|
|
|
|
Component<MenuComponent>(MERCHANT,"Buy Tab")->Click(); |
|
|
|
|
} |
|
|
|
|
if(Component<MenuComponent>(MERCHANT,"Buy Tab")->selected){ |
|
|
|
|
auto merchantList=Component<RowInventoryScrollableWindowComponent>(type,"Merchant Inventory Display"); |
|
|
|
|
Menu::menus[type]->SetSelection(merchantList->GetComponents()[merchantList->GetComponents().size()-1]); |
|
|
|
|
}else{ |
|
|
|
|
auto inventory=Component<RowInventoryScrollableWindowComponent>(type,std::format("Inventory Display - {}",Menu::menus[type]->S(A::LAST_INVENTORY_TYPE_OPENED))); |
|
|
|
|
if(inventory->GetComponents().size()>0){ |
|
|
|
|
Menu::menus[type]->SetSelection(inventory->GetComponents()[0]); |
|
|
|
|
}else{ |
|
|
|
|
Menu::menus[type]->SetSelection(std::weak_ptr<MenuComponent>{Component<MenuComponent>(type,std::format("{} Inventory Tab",Menu::menus[type]->S(A::LAST_INVENTORY_TYPE_OPENED)))}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}}}, |
|
|
|
|
{{game->KEY_SHOULDER,Pressed},{"Scroll Up/Down",[](MenuType type){}}}, |
|
|
|
|
{{game->KEY_FACEUP,Pressed},{[](MenuFuncData data){ |
|
|
|
|
if(Component<MenuComponent>(MERCHANT,"Buy Tab")->selected){ |
|
|
|
|
return ""; |
|
|
|
|
}else{ |
|
|
|
|
return "Change Category"; |
|
|
|
|
} |
|
|
|
|
},[&](MenuType type){ |
|
|
|
|
auto categories=GetSortedCategories(); |
|
|
|
|
size_t index=0; |
|
|
|
|
for(auto&[category,item]:categories){ |
|
|
|
|
if(category==Menu::menus[type]->S(A::LAST_INVENTORY_TYPE_OPENED))break; |
|
|
|
|
index++; |
|
|
|
|
} |
|
|
|
|
if(index<categories.size()){ |
|
|
|
|
index++; |
|
|
|
|
if(index>=categories.size()){ |
|
|
|
|
index-=categories.size(); |
|
|
|
|
} |
|
|
|
|
Component<MenuComponent>(type,std::format("{} Inventory Tab",categories[index].first))->Click(); |
|
|
|
|
}else ERR("WARNING! Could not find current category! THIS SHOULD NOT BE HAPPENING!"); |
|
|
|
|
}}}, |
|
|
|
|
{{game->KEY_FASTSCROLLDOWN,PressedDAS},{"",[&](MenuType type){ |
|
|
|
|
if(!Menu::menus[type]->GetSelection().expired()&& |
|
|
|
|
!Menu::menus[type]->GetSelection().lock()->parentComponent.expired()){ |
|
|
|
|
Menu::menus[type]->GetSelection().lock()->parentComponent.lock()->IncreaseSelectionIndex(3.f); |
|
|
|
|
} |
|
|
|
|
}}}, |
|
|
|
|
{{game->KEY_FASTSCROLLUP,PressedDAS},{"",[&](MenuType type){ |
|
|
|
|
if(!Menu::menus[type]->GetSelection().expired()&& |
|
|
|
|
!Menu::menus[type]->GetSelection().lock()->parentComponent.expired()){ |
|
|
|
|
Menu::menus[type]->GetSelection().lock()->parentComponent.lock()->IncreaseSelectionIndex(-3.f); |
|
|
|
|
} |
|
|
|
|
}}}, |
|
|
|
|
{{game->KEY_SCROLL,Pressed},{"Navigate",[](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",}}, |
|
|
|
|
});*/ |
|
|
|
|
{"Leave Button",{ |
|
|
|
|
.up=[](MenuType type,Data&returnData){ |
|
|
|
|
if(Component<MenuComponent>(MERCHANT,"Buy Tab")->selected){ |
|
|
|
|
auto merchantList=Component<RowInventoryScrollableWindowComponent>(type,"Merchant Inventory Display"); |
|
|
|
|
returnData=merchantList->GetComponents()[merchantList->GetComponents().size()-1]; |
|
|
|
|
}else{ |
|
|
|
|
auto inventory=Component<RowInventoryScrollableWindowComponent>(type,std::format("Inventory Display - {}",Menu::menus[type]->S(A::LAST_INVENTORY_TYPE_OPENED))); |
|
|
|
|
if(inventory->GetComponents().size()>0){ |
|
|
|
|
returnData=inventory->GetComponents()[inventory->GetComponents().size()-1]; |
|
|
|
|
}else{ |
|
|
|
|
returnData=Component<MenuComponent>(type,std::format("{} Inventory Tab",Menu::menus[type]->S(A::LAST_INVENTORY_TYPE_OPENED))); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
.down=[](MenuType type,Data&returnData){ |
|
|
|
|
if(Component<MenuComponent>(MERCHANT,"Buy Tab")->selected){ |
|
|
|
|
auto merchantList=Component<RowInventoryScrollableWindowComponent>(type,"Merchant Inventory Display"); |
|
|
|
|
returnData=merchantList->GetComponents()[0]; |
|
|
|
|
}else{ |
|
|
|
|
auto inventory=Component<RowInventoryScrollableWindowComponent>(type,std::format("Inventory Display - {}",Menu::menus[type]->S(A::LAST_INVENTORY_TYPE_OPENED))); |
|
|
|
|
if(inventory->GetComponents().size()>0){ |
|
|
|
|
returnData=inventory->GetComponents()[0]; |
|
|
|
|
}else{ |
|
|
|
|
returnData=Component<MenuComponent>(type,std::format("{} Inventory Tab",Menu::menus[type]->S(A::LAST_INVENTORY_TYPE_OPENED))); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
.left=[](MenuType type,Data&returnData){ |
|
|
|
|
if(Component<MenuComponent>(MERCHANT,"Buy Tab")->selected){ |
|
|
|
|
Component<MenuComponent>(MERCHANT,"Sell Tab")->Click(); |
|
|
|
|
}else{ |
|
|
|
|
Component<MenuComponent>(MERCHANT,"Buy Tab")->Click(); |
|
|
|
|
} |
|
|
|
|
if(Component<MenuComponent>(MERCHANT,"Buy Tab")->selected){ |
|
|
|
|
auto merchantList=Component<RowInventoryScrollableWindowComponent>(type,"Merchant Inventory Display"); |
|
|
|
|
returnData=merchantList->GetComponents()[0]; |
|
|
|
|
}else{ |
|
|
|
|
auto inventory=Component<RowInventoryScrollableWindowComponent>(type,std::format("Inventory Display - {}",Menu::menus[type]->S(A::LAST_INVENTORY_TYPE_OPENED))); |
|
|
|
|
if(inventory->GetComponents().size()>0){ |
|
|
|
|
returnData=inventory->GetComponents()[0]; |
|
|
|
|
}else{ |
|
|
|
|
returnData=Component<MenuComponent>(type,std::format("{} Inventory Tab",Menu::menus[type]->S(A::LAST_INVENTORY_TYPE_OPENED))); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
.right=[](MenuType type,Data&returnData){ |
|
|
|
|
if(Component<MenuComponent>(MERCHANT,"Buy Tab")->selected){ |
|
|
|
|
Component<MenuComponent>(MERCHANT,"Sell Tab")->Click(); |
|
|
|
|
}else{ |
|
|
|
|
Component<MenuComponent>(MERCHANT,"Buy Tab")->Click(); |
|
|
|
|
} |
|
|
|
|
if(Component<MenuComponent>(MERCHANT,"Buy Tab")->selected){ |
|
|
|
|
auto merchantList=Component<RowInventoryScrollableWindowComponent>(type,"Merchant Inventory Display"); |
|
|
|
|
returnData=merchantList->GetComponents()[0]; |
|
|
|
|
}else{ |
|
|
|
|
auto inventory=Component<RowInventoryScrollableWindowComponent>(type,std::format("Inventory Display - {}",Menu::menus[type]->S(A::LAST_INVENTORY_TYPE_OPENED))); |
|
|
|
|
if(inventory->GetComponents().size()>0){ |
|
|
|
|
returnData=inventory->GetComponents()[0]; |
|
|
|
|
}else{ |
|
|
|
|
returnData=Component<MenuComponent>(type,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){ |
|
|
|
|
returnData="Leave Button"; |
|
|
|
|
}else returnData=Component<RowInventoryScrollableWindowComponent>(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<RowInventoryScrollableWindowComponent>(type,"Inventory Display - Consumables")->GetComponents().size()){ |
|
|
|
|
returnData="Leave Button"; |
|
|
|
|
}else returnData=Component<RowInventoryScrollableWindowComponent>(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)); |
|
|
|
|
}, |
|
|
|
|
.right=[](MenuType type,Data&returnData){ |
|
|
|
|
if(Component<MenuComponent>(MERCHANT,"Buy Tab")->selected){ |
|
|
|
|
Component<MenuComponent>(MERCHANT,"Sell Tab")->Click(); |
|
|
|
|
}else{ |
|
|
|
|
Component<MenuComponent>(MERCHANT,"Buy Tab")->Click(); |
|
|
|
|
} |
|
|
|
|
if(Component<MenuComponent>(MERCHANT,"Buy Tab")->selected){ |
|
|
|
|
auto merchantList=Component<RowInventoryScrollableWindowComponent>(type,"Merchant Inventory Display"); |
|
|
|
|
returnData=merchantList->GetComponents()[0]; |
|
|
|
|
}else{ |
|
|
|
|
auto inventory=Component<RowInventoryScrollableWindowComponent>(type,std::format("Inventory Display - {}",Menu::menus[type]->S(A::LAST_INVENTORY_TYPE_OPENED))); |
|
|
|
|
if(inventory->GetComponents().size()>0){ |
|
|
|
|
returnData=inventory->GetComponents()[0]; |
|
|
|
|
}else{ |
|
|
|
|
returnData=Component<MenuComponent>(type,std::format("{} Inventory Tab",Menu::menus[type]->S(A::LAST_INVENTORY_TYPE_OPENED))); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}}, |
|
|
|
|
{"Inventory Display - Equipment",{ |
|
|
|
|
.up=[](MenuType type,Data&returnData){ |
|
|
|
|
Menu::menus[type]->I(A::ITEM_SLOT)--; |
|
|
|
|
if(Menu::menus[type]->I(A::ITEM_SLOT)<0){ |
|
|
|
|
returnData="Leave Button"; |
|
|
|
|
}else returnData=Component<RowInventoryScrollableWindowComponent>(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<RowInventoryScrollableWindowComponent>(type,"Inventory Display - Equipment")->GetComponents().size()){ |
|
|
|
|
returnData="Leave Button"; |
|
|
|
|
}else returnData=Component<RowInventoryScrollableWindowComponent>(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)); |
|
|
|
|
}, |
|
|
|
|
.right=[](MenuType type,Data&returnData){ |
|
|
|
|
if(Component<MenuComponent>(MERCHANT,"Buy Tab")->selected){ |
|
|
|
|
Component<MenuComponent>(MERCHANT,"Sell Tab")->Click(); |
|
|
|
|
}else{ |
|
|
|
|
Component<MenuComponent>(MERCHANT,"Buy Tab")->Click(); |
|
|
|
|
} |
|
|
|
|
if(Component<MenuComponent>(MERCHANT,"Buy Tab")->selected){ |
|
|
|
|
auto merchantList=Component<RowInventoryScrollableWindowComponent>(type,"Merchant Inventory Display"); |
|
|
|
|
returnData=merchantList->GetComponents()[0]; |
|
|
|
|
}else{ |
|
|
|
|
auto inventory=Component<RowInventoryScrollableWindowComponent>(type,std::format("Inventory Display - {}",Menu::menus[type]->S(A::LAST_INVENTORY_TYPE_OPENED))); |
|
|
|
|
if(inventory->GetComponents().size()>0){ |
|
|
|
|
returnData=inventory->GetComponents()[0]; |
|
|
|
|
}else{ |
|
|
|
|
returnData=Component<MenuComponent>(type,std::format("{} Inventory Tab",Menu::menus[type]->S(A::LAST_INVENTORY_TYPE_OPENED))); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}}, |
|
|
|
|
{"Inventory Display - Accessories",{ |
|
|
|
|
.up=[](MenuType type,Data&returnData){ |
|
|
|
|
Menu::menus[type]->I(A::ITEM_SLOT)--; |
|
|
|
|
if(Menu::menus[type]->I(A::ITEM_SLOT)<0){ |
|
|
|
|
returnData="Leave Button"; |
|
|
|
|
}else returnData=Component<RowInventoryScrollableWindowComponent>(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<RowInventoryScrollableWindowComponent>(type,"Inventory Display - Accessories")->GetComponents().size()){ |
|
|
|
|
returnData="Leave Button"; |
|
|
|
|
}else returnData=Component<RowInventoryScrollableWindowComponent>(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)); |
|
|
|
|
}, |
|
|
|
|
.right=[](MenuType type,Data&returnData){ |
|
|
|
|
if(Component<MenuComponent>(MERCHANT,"Buy Tab")->selected){ |
|
|
|
|
Component<MenuComponent>(MERCHANT,"Sell Tab")->Click(); |
|
|
|
|
}else{ |
|
|
|
|
Component<MenuComponent>(MERCHANT,"Buy Tab")->Click(); |
|
|
|
|
} |
|
|
|
|
if(Component<MenuComponent>(MERCHANT,"Buy Tab")->selected){ |
|
|
|
|
auto merchantList=Component<RowInventoryScrollableWindowComponent>(type,"Merchant Inventory Display"); |
|
|
|
|
returnData=merchantList->GetComponents()[0]; |
|
|
|
|
}else{ |
|
|
|
|
auto inventory=Component<RowInventoryScrollableWindowComponent>(type,std::format("Inventory Display - {}",Menu::menus[type]->S(A::LAST_INVENTORY_TYPE_OPENED))); |
|
|
|
|
if(inventory->GetComponents().size()>0){ |
|
|
|
|
returnData=inventory->GetComponents()[0]; |
|
|
|
|
}else{ |
|
|
|
|
returnData=Component<MenuComponent>(type,std::format("{} Inventory Tab",Menu::menus[type]->S(A::LAST_INVENTORY_TYPE_OPENED))); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}}, |
|
|
|
|
{"Inventory Display - Materials",{ |
|
|
|
|
.up=[](MenuType type,Data&returnData){ |
|
|
|
|
Menu::menus[type]->I(A::ITEM_SLOT)--; |
|
|
|
|
if(Menu::menus[type]->I(A::ITEM_SLOT)<0){ |
|
|
|
|
returnData="Leave Button"; |
|
|
|
|
}else returnData=Component<RowInventoryScrollableWindowComponent>(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<RowInventoryScrollableWindowComponent>(type,"Inventory Display - Materials")->GetComponents().size()){ |
|
|
|
|
returnData="Leave Button"; |
|
|
|
|
}else returnData=Component<RowInventoryScrollableWindowComponent>(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)); |
|
|
|
|
}, |
|
|
|
|
.right=[](MenuType type,Data&returnData){ |
|
|
|
|
if(Component<MenuComponent>(MERCHANT,"Buy Tab")->selected){ |
|
|
|
|
Component<MenuComponent>(MERCHANT,"Sell Tab")->Click(); |
|
|
|
|
}else{ |
|
|
|
|
Component<MenuComponent>(MERCHANT,"Buy Tab")->Click(); |
|
|
|
|
} |
|
|
|
|
if(Component<MenuComponent>(MERCHANT,"Buy Tab")->selected){ |
|
|
|
|
auto merchantList=Component<RowInventoryScrollableWindowComponent>(type,"Merchant Inventory Display"); |
|
|
|
|
returnData=merchantList->GetComponents()[0]; |
|
|
|
|
}else{ |
|
|
|
|
auto inventory=Component<RowInventoryScrollableWindowComponent>(type,std::format("Inventory Display - {}",Menu::menus[type]->S(A::LAST_INVENTORY_TYPE_OPENED))); |
|
|
|
|
if(inventory->GetComponents().size()>0){ |
|
|
|
|
returnData=inventory->GetComponents()[0]; |
|
|
|
|
}else{ |
|
|
|
|
returnData=Component<MenuComponent>(type,std::format("{} Inventory Tab",Menu::menus[type]->S(A::LAST_INVENTORY_TYPE_OPENED))); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}}, |
|
|
|
|
{"Merchant Inventory Display",{ |
|
|
|
|
.up=[](MenuType type,Data&returnData){ |
|
|
|
|
Menu::menus[type]->I(A::MERCHANT_ITEM_SLOT)--; |
|
|
|
|
if(Menu::menus[type]->I(A::MERCHANT_ITEM_SLOT)<0){ |
|
|
|
|
returnData="Leave Button"; |
|
|
|
|
}else{ |
|
|
|
|
returnData=Component<RowInventoryScrollableWindowComponent>(type,"Merchant Inventory Display")->GetComponents()[Menu::menus[type]->I(A::MERCHANT_ITEM_SLOT)]; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
.down=[](MenuType type,Data&returnData){ |
|
|
|
|
Menu::menus[type]->I(A::MERCHANT_ITEM_SLOT)++; |
|
|
|
|
if(Menu::menus[type]->I(A::MERCHANT_ITEM_SLOT)>=Component<RowInventoryScrollableWindowComponent>(type,"Merchant Inventory Display")->GetComponents().size()){ |
|
|
|
|
returnData="Leave Button"; |
|
|
|
|
}else{ |
|
|
|
|
returnData=Component<RowInventoryScrollableWindowComponent>(type,"Merchant Inventory Display")->GetComponents()[Menu::menus[type]->I(A::MERCHANT_ITEM_SLOT)]; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
.left=[](MenuType type,Data&returnData){ |
|
|
|
|
if(Component<MenuComponent>(MERCHANT,"Buy Tab")->selected){ |
|
|
|
|
Component<MenuComponent>(MERCHANT,"Sell Tab")->Click(); |
|
|
|
|
}else{ |
|
|
|
|
Component<MenuComponent>(MERCHANT,"Buy Tab")->Click(); |
|
|
|
|
} |
|
|
|
|
if(Component<MenuComponent>(MERCHANT,"Buy Tab")->selected){ |
|
|
|
|
auto merchantList=Component<RowInventoryScrollableWindowComponent>(type,"Merchant Inventory Display"); |
|
|
|
|
returnData=merchantList->GetComponents()[0]; |
|
|
|
|
}else{ |
|
|
|
|
auto inventory=Component<RowInventoryScrollableWindowComponent>(type,std::format("Inventory Display - {}",Menu::menus[type]->S(A::LAST_INVENTORY_TYPE_OPENED))); |
|
|
|
|
if(inventory->GetComponents().size()>0){ |
|
|
|
|
returnData=inventory->GetComponents()[0]; |
|
|
|
|
}else{ |
|
|
|
|
returnData=Component<MenuComponent>(type,std::format("{} Inventory Tab",Menu::menus[type]->S(A::LAST_INVENTORY_TYPE_OPENED))); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
.right=[](MenuType type,Data&returnData){ |
|
|
|
|
if(Component<MenuComponent>(MERCHANT,"Buy Tab")->selected){ |
|
|
|
|
Component<MenuComponent>(MERCHANT,"Sell Tab")->Click(); |
|
|
|
|
}else{ |
|
|
|
|
Component<MenuComponent>(MERCHANT,"Buy Tab")->Click(); |
|
|
|
|
} |
|
|
|
|
if(Component<MenuComponent>(MERCHANT,"Buy Tab")->selected){ |
|
|
|
|
auto merchantList=Component<RowInventoryScrollableWindowComponent>(type,"Merchant Inventory Display"); |
|
|
|
|
returnData=merchantList->GetComponents()[0]; |
|
|
|
|
}else{ |
|
|
|
|
auto inventory=Component<RowInventoryScrollableWindowComponent>(type,std::format("Inventory Display - {}",Menu::menus[type]->S(A::LAST_INVENTORY_TYPE_OPENED))); |
|
|
|
|
if(inventory->GetComponents().size()>0){ |
|
|
|
|
returnData=inventory->GetComponents()[0]; |
|
|
|
|
}else{ |
|
|
|
|
returnData=Component<MenuComponent>(type,std::format("{} Inventory Tab",Menu::menus[type]->S(A::LAST_INVENTORY_TYPE_OPENED))); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
}}, |
|
|
|
|
{"Consumables Inventory Tab",{ |
|
|
|
|
.up=[&](MenuType type,Data&returnData){ |
|
|
|
|
auto categories=GetSortedCategories(); |
|
|
|
|
size_t index=0; |
|
|
|
|
for(auto&[category,item]:categories){ |
|
|
|
|
if(category=="Consumables")break; |
|
|
|
|
index++; |
|
|
|
|
} |
|
|
|
|
if(index<categories.size()){ |
|
|
|
|
index--; |
|
|
|
|
if(index>=categories.size()){ |
|
|
|
|
index=categories.size()-1; |
|
|
|
|
} |
|
|
|
|
Component<MenuComponent>(type,std::format("{} Inventory Tab",categories[index].first))->Click(); |
|
|
|
|
returnData=std::format("{} Inventory Tab",categories[index].first); |
|
|
|
|
}else ERR("WARNING! Could not find current category! THIS SHOULD NOT BE HAPPENING!"); |
|
|
|
|
}, |
|
|
|
|
.down=[&](MenuType type,Data&returnData){ |
|
|
|
|
auto categories=GetSortedCategories(); |
|
|
|
|
size_t index=0; |
|
|
|
|
for(auto&[category,item]:categories){ |
|
|
|
|
if(category=="Consumables")break; |
|
|
|
|
index++; |
|
|
|
|
} |
|
|
|
|
if(index<categories.size()){ |
|
|
|
|
index++; |
|
|
|
|
if(index>=categories.size()){ |
|
|
|
|
index-=categories.size(); |
|
|
|
|
} |
|
|
|
|
Component<MenuComponent>(type,std::format("{} Inventory Tab",categories[index].first))->Click(); |
|
|
|
|
returnData=std::format("{} Inventory Tab",categories[index].first); |
|
|
|
|
}else ERR("WARNING! Could not find current category! THIS SHOULD NOT BE HAPPENING!"); |
|
|
|
|
}, |
|
|
|
|
.left=[&](MenuType type,Data&returnData){ |
|
|
|
|
if(Component<MenuComponent>(MERCHANT,"Buy Tab")->selected){ |
|
|
|
|
Component<MenuComponent>(MERCHANT,"Sell Tab")->Click(); |
|
|
|
|
}else{ |
|
|
|
|
Component<MenuComponent>(MERCHANT,"Buy Tab")->Click(); |
|
|
|
|
} |
|
|
|
|
if(Component<MenuComponent>(MERCHANT,"Buy Tab")->selected){ |
|
|
|
|
auto merchantList=Component<RowInventoryScrollableWindowComponent>(type,"Merchant Inventory Display"); |
|
|
|
|
returnData=merchantList->GetComponents()[0]; |
|
|
|
|
}else{ |
|
|
|
|
auto inventory=Component<RowInventoryScrollableWindowComponent>(type,std::format("Inventory Display - {}",Menu::menus[type]->S(A::LAST_INVENTORY_TYPE_OPENED))); |
|
|
|
|
if(inventory->GetComponents().size()>0){ |
|
|
|
|
returnData=inventory->GetComponents()[0]; |
|
|
|
|
}else{ |
|
|
|
|
returnData=Component<MenuComponent>(type,std::format("{} Inventory Tab",Menu::menus[type]->S(A::LAST_INVENTORY_TYPE_OPENED))); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
.right=[&](MenuType type,Data&returnData){ |
|
|
|
|
if(Menu::menus[type]->I(A::ITEM_SLOT)>=0){ |
|
|
|
|
returnData=Component<RowInventoryScrollableWindowComponent>(type,"Inventory Display - Consumables")->GetComponents()[Menu::menus[type]->I(A::ITEM_SLOT)]; |
|
|
|
|
}else{ |
|
|
|
|
returnData="Consumables Inventory Tab"; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
}}, |
|
|
|
|
{"Equipment Inventory Tab",{ |
|
|
|
|
.up=[&](MenuType type,Data&returnData){ |
|
|
|
|
auto categories=GetSortedCategories(); |
|
|
|
|
size_t index=0; |
|
|
|
|
for(auto&[category,item]:categories){ |
|
|
|
|
if(category=="Equipment")break; |
|
|
|
|
index++; |
|
|
|
|
} |
|
|
|
|
if(index<categories.size()){ |
|
|
|
|
index--; |
|
|
|
|
if(index>=categories.size()){ |
|
|
|
|
index=categories.size()-1; |
|
|
|
|
} |
|
|
|
|
Component<MenuComponent>(type,std::format("{} Inventory Tab",categories[index].first))->Click(); |
|
|
|
|
returnData=std::format("{} Inventory Tab",categories[index].first); |
|
|
|
|
}else ERR("WARNING! Could not find current category! THIS SHOULD NOT BE HAPPENING!"); |
|
|
|
|
}, |
|
|
|
|
.down=[&](MenuType type,Data&returnData){ |
|
|
|
|
auto categories=GetSortedCategories(); |
|
|
|
|
size_t index=0; |
|
|
|
|
for(auto&[category,item]:categories){ |
|
|
|
|
if(category=="Equipment")break; |
|
|
|
|
index++; |
|
|
|
|
} |
|
|
|
|
if(index<categories.size()){ |
|
|
|
|
index++; |
|
|
|
|
if(index>=categories.size()){ |
|
|
|
|
index-=categories.size(); |
|
|
|
|
} |
|
|
|
|
Component<MenuComponent>(type,std::format("{} Inventory Tab",categories[index].first))->Click(); |
|
|
|
|
returnData=std::format("{} Inventory Tab",categories[index].first); |
|
|
|
|
}else ERR("WARNING! Could not find current category! THIS SHOULD NOT BE HAPPENING!"); |
|
|
|
|
}, |
|
|
|
|
.left=[&](MenuType type,Data&returnData){ |
|
|
|
|
if(Component<MenuComponent>(MERCHANT,"Buy Tab")->selected){ |
|
|
|
|
Component<MenuComponent>(MERCHANT,"Sell Tab")->Click(); |
|
|
|
|
}else{ |
|
|
|
|
Component<MenuComponent>(MERCHANT,"Buy Tab")->Click(); |
|
|
|
|
} |
|
|
|
|
if(Component<MenuComponent>(MERCHANT,"Buy Tab")->selected){ |
|
|
|
|
auto merchantList=Component<RowInventoryScrollableWindowComponent>(type,"Merchant Inventory Display"); |
|
|
|
|
returnData=merchantList->GetComponents()[0]; |
|
|
|
|
}else{ |
|
|
|
|
auto inventory=Component<RowInventoryScrollableWindowComponent>(type,std::format("Inventory Display - {}",Menu::menus[type]->S(A::LAST_INVENTORY_TYPE_OPENED))); |
|
|
|
|
if(inventory->GetComponents().size()>0){ |
|
|
|
|
returnData=inventory->GetComponents()[0]; |
|
|
|
|
}else{ |
|
|
|
|
returnData=Component<MenuComponent>(type,std::format("{} Inventory Tab",Menu::menus[type]->S(A::LAST_INVENTORY_TYPE_OPENED))); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
.right=[&](MenuType type,Data&returnData){ |
|
|
|
|
if(Menu::menus[type]->I(A::ITEM_SLOT)>=0){ |
|
|
|
|
returnData=Component<RowInventoryScrollableWindowComponent>(type,"Inventory Display - Equipment")->GetComponents()[Menu::menus[type]->I(A::ITEM_SLOT)]; |
|
|
|
|
}else{ |
|
|
|
|
returnData="Equipment Inventory Tab"; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
}}, |
|
|
|
|
{"Accessories Inventory Tab",{ |
|
|
|
|
.up=[&](MenuType type,Data&returnData){ |
|
|
|
|
auto categories=GetSortedCategories(); |
|
|
|
|
size_t index=0; |
|
|
|
|
for(auto&[category,item]:categories){ |
|
|
|
|
if(category=="Accessories")break; |
|
|
|
|
index++; |
|
|
|
|
} |
|
|
|
|
if(index<categories.size()){ |
|
|
|
|
index--; |
|
|
|
|
if(index>=categories.size()){ |
|
|
|
|
index=categories.size()-1; |
|
|
|
|
} |
|
|
|
|
Component<MenuComponent>(type,std::format("{} Inventory Tab",categories[index].first))->Click(); |
|
|
|
|
returnData=std::format("{} Inventory Tab",categories[index].first); |
|
|
|
|
}else ERR("WARNING! Could not find current category! THIS SHOULD NOT BE HAPPENING!"); |
|
|
|
|
}, |
|
|
|
|
.down=[&](MenuType type,Data&returnData){ |
|
|
|
|
auto categories=GetSortedCategories(); |
|
|
|
|
size_t index=0; |
|
|
|
|
for(auto&[category,item]:categories){ |
|
|
|
|
if(category=="Accessories")break; |
|
|
|
|
index++; |
|
|
|
|
} |
|
|
|
|
if(index<categories.size()){ |
|
|
|
|
index++; |
|
|
|
|
if(index>=categories.size()){ |
|
|
|
|
index-=categories.size(); |
|
|
|
|
} |
|
|
|
|
Component<MenuComponent>(type,std::format("{} Inventory Tab",categories[index].first))->Click(); |
|
|
|
|
returnData=std::format("{} Inventory Tab",categories[index].first); |
|
|
|
|
}else ERR("WARNING! Could not find current category! THIS SHOULD NOT BE HAPPENING!"); |
|
|
|
|
}, |
|
|
|
|
.left=[&](MenuType type,Data&returnData){ |
|
|
|
|
if(Component<MenuComponent>(MERCHANT,"Buy Tab")->selected){ |
|
|
|
|
Component<MenuComponent>(MERCHANT,"Sell Tab")->Click(); |
|
|
|
|
}else{ |
|
|
|
|
Component<MenuComponent>(MERCHANT,"Buy Tab")->Click(); |
|
|
|
|
} |
|
|
|
|
if(Component<MenuComponent>(MERCHANT,"Buy Tab")->selected){ |
|
|
|
|
auto merchantList=Component<RowInventoryScrollableWindowComponent>(type,"Merchant Inventory Display"); |
|
|
|
|
returnData=merchantList->GetComponents()[0]; |
|
|
|
|
}else{ |
|
|
|
|
auto inventory=Component<RowInventoryScrollableWindowComponent>(type,std::format("Inventory Display - {}",Menu::menus[type]->S(A::LAST_INVENTORY_TYPE_OPENED))); |
|
|
|
|
if(inventory->GetComponents().size()>0){ |
|
|
|
|
returnData=inventory->GetComponents()[0]; |
|
|
|
|
}else{ |
|
|
|
|
returnData=Component<MenuComponent>(type,std::format("{} Inventory Tab",Menu::menus[type]->S(A::LAST_INVENTORY_TYPE_OPENED))); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
.right=[&](MenuType type,Data&returnData){ |
|
|
|
|
if(Menu::menus[type]->I(A::ITEM_SLOT)>=0){ |
|
|
|
|
returnData=Component<RowInventoryScrollableWindowComponent>(type,"Inventory Display - Accessories")->GetComponents()[Menu::menus[type]->I(A::ITEM_SLOT)]; |
|
|
|
|
}else{ |
|
|
|
|
returnData="Accessories Inventory Tab"; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
}}, |
|
|
|
|
{"Materials Inventory Tab",{ |
|
|
|
|
.up=[&](MenuType type,Data&returnData){ |
|
|
|
|
auto categories=GetSortedCategories(); |
|
|
|
|
size_t index=0; |
|
|
|
|
for(auto&[category,item]:categories){ |
|
|
|
|
if(category=="Materials")break; |
|
|
|
|
index++; |
|
|
|
|
} |
|
|
|
|
if(index<categories.size()){ |
|
|
|
|
index--; |
|
|
|
|
if(index>=categories.size()){ |
|
|
|
|
index=categories.size()-1; |
|
|
|
|
} |
|
|
|
|
Component<MenuComponent>(type,std::format("{} Inventory Tab",categories[index].first))->Click(); |
|
|
|
|
returnData=std::format("{} Inventory Tab",categories[index].first); |
|
|
|
|
}else ERR("WARNING! Could not find current category! THIS SHOULD NOT BE HAPPENING!"); |
|
|
|
|
}, |
|
|
|
|
.down=[&](MenuType type,Data&returnData){ |
|
|
|
|
auto categories=GetSortedCategories(); |
|
|
|
|
size_t index=0; |
|
|
|
|
for(auto&[category,item]:categories){ |
|
|
|
|
if(category=="Materials")break; |
|
|
|
|
index++; |
|
|
|
|
} |
|
|
|
|
if(index<categories.size()){ |
|
|
|
|
index++; |
|
|
|
|
if(index>=categories.size()){ |
|
|
|
|
index-=categories.size(); |
|
|
|
|
} |
|
|
|
|
Component<MenuComponent>(type,std::format("{} Inventory Tab",categories[index].first))->Click(); |
|
|
|
|
returnData=std::format("{} Inventory Tab",categories[index].first); |
|
|
|
|
}else ERR("WARNING! Could not find current category! THIS SHOULD NOT BE HAPPENING!"); |
|
|
|
|
}, |
|
|
|
|
.left=[&](MenuType type,Data&returnData){ |
|
|
|
|
if(Component<MenuComponent>(MERCHANT,"Buy Tab")->selected){ |
|
|
|
|
Component<MenuComponent>(MERCHANT,"Sell Tab")->Click(); |
|
|
|
|
}else{ |
|
|
|
|
Component<MenuComponent>(MERCHANT,"Buy Tab")->Click(); |
|
|
|
|
} |
|
|
|
|
if(Component<MenuComponent>(MERCHANT,"Buy Tab")->selected){ |
|
|
|
|
auto merchantList=Component<RowInventoryScrollableWindowComponent>(type,"Merchant Inventory Display"); |
|
|
|
|
returnData=merchantList->GetComponents()[0]; |
|
|
|
|
}else{ |
|
|
|
|
auto inventory=Component<RowInventoryScrollableWindowComponent>(type,std::format("Inventory Display - {}",Menu::menus[type]->S(A::LAST_INVENTORY_TYPE_OPENED))); |
|
|
|
|
if(inventory->GetComponents().size()>0){ |
|
|
|
|
returnData=inventory->GetComponents()[0]; |
|
|
|
|
}else{ |
|
|
|
|
returnData=Component<MenuComponent>(type,std::format("{} Inventory Tab",Menu::menus[type]->S(A::LAST_INVENTORY_TYPE_OPENED))); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
.right=[&](MenuType type,Data&returnData){ |
|
|
|
|
if(Menu::menus[type]->I(A::ITEM_SLOT)>=0){ |
|
|
|
|
returnData=Component<RowInventoryScrollableWindowComponent>(type,"Inventory Display - Materials")->GetComponents()[Menu::menus[type]->I(A::ITEM_SLOT)]; |
|
|
|
|
}else{ |
|
|
|
|
returnData="Materials Inventory Tab"; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
}}, |
|
|
|
|
}); |
|
|
|
|
} |