Setup Sell Layout for merchant screen.
This commit is contained in:
@@ -56,8 +56,6 @@ using ButtonAttr::UNSELECTABLE;
|
||||
using ButtonAttr::UNSELECTABLE_VIA_KEYBOARD;
|
||||
|
||||
void Menu::InitializeInventoryWindow(){
|
||||
static std::string lastInventoryTypeOpened="";
|
||||
|
||||
Menu*inventoryWindow=CreateMenu(INVENTORY,CENTERED,game->GetScreenSize()-vi2d{52,52});
|
||||
|
||||
inventoryWindow->ADD("Inventory Label",MenuLabel)({{0,0},{inventoryWindow->size.x-1,24}},"Inventory",2,SHADOW|OUTLINE|BACKGROUND)END;
|
||||
@@ -80,11 +78,11 @@ void Menu::InitializeInventoryWindow(){
|
||||
auto button=inventoryWindow->ADD(category+" Inventory Tab",MenuComponent)({{2,30+yOffset},{68,16}},category,MenuType::ENUM_END,
|
||||
[&](MenuFuncData data){
|
||||
//Close the old inventory window and show the proper one.
|
||||
Component<RowInventoryScrollableWindowComponent>(data.menu.GetType(),"Inventory Display - "+lastInventoryTypeOpened)->Enable(false);
|
||||
Component<MenuComponent>(data.menu.GetType(),lastInventoryTypeOpened+" Inventory Tab")->SetSelected(false);
|
||||
Component<RowInventoryScrollableWindowComponent>(data.menu.GetType(),"Inventory Display - "+data.menu.S(A::LAST_INVENTORY_TYPE_OPENED))->Enable(false);
|
||||
Component<MenuComponent>(data.menu.GetType(),data.menu.S(A::LAST_INVENTORY_TYPE_OPENED)+" Inventory Tab")->SetSelected(false);
|
||||
Component<RowInventoryScrollableWindowComponent>(data.menu.GetType(),"Inventory Display - "+data.component->S(A::CATEGORY_NAME))->Enable(true);
|
||||
Component<MenuComponent>(data.menu.GetType(),data.component->S(A::CATEGORY_NAME)+" Inventory Tab")->SetSelected(true);
|
||||
lastInventoryTypeOpened=data.component->S(A::CATEGORY_NAME);
|
||||
data.menu.S(A::LAST_INVENTORY_TYPE_OPENED)=data.component->S(A::CATEGORY_NAME);
|
||||
return true;
|
||||
},{textScaling,1.f})END;
|
||||
button->SetSelectionType(HIGHLIGHT);
|
||||
@@ -103,7 +101,7 @@ void Menu::InitializeInventoryWindow(){
|
||||
},{.padding=1,.size={137,28}})END;
|
||||
|
||||
if(first){
|
||||
lastInventoryTypeOpened=category;
|
||||
inventoryWindow->S(A::LAST_INVENTORY_TYPE_OPENED)=category;
|
||||
button->onClick(MenuFuncData{*inventoryWindow,game,button}); //Simulate a click of this button if it's the top one for an initial inventory display.
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user