@ -65,7 +65,14 @@ void Menu::InitializeCharacterMenuWindow(){
MenuComponent * equipSelectionOutline = NEW MenuComponent ( CHARACTER_MENU , { { 123 , 36 } , { 120 , windowSize . y - 37 } } , " " , DO_NOTHING , ButtonAttr : : UNSELECTABLE ) ;
MenuComponent * equipSelectionOutline = NEW MenuComponent ( CHARACTER_MENU , { { 123 , 36 } , { 120 , windowSize . y - 37 } } , " " , DO_NOTHING , ButtonAttr : : UNSELECTABLE ) ;
ScrollableWindowComponent * equipmentList = NEW ScrollableWindowComponent ( CHARACTER_MENU , { { 123 , 36 } , { 120 , windowSize . y - 37 - 24 } } ) ;
ScrollableWindowComponent * equipmentList = NEW ScrollableWindowComponent ( CHARACTER_MENU , { { 123 , 36 } , { 120 , windowSize . y - 37 - 24 } } ) ;
MenuComponent * equipSelectionBottomOutline = NEW MenuComponent ( CHARACTER_MENU , { { 123 , 36 + ( windowSize . y - 37 - 24 ) } , { 120 , 24 } } , " " , DO_NOTHING , ButtonAttr : : UNSELECTABLE ) ;
MenuComponent * equipSelectionBottomOutline = NEW MenuComponent ( CHARACTER_MENU , { { 123 , 36 + ( windowSize . y - 37 - 24 ) } , { 120 , 24 } } , " " , DO_NOTHING , ButtonAttr : : UNSELECTABLE ) ;
MenuComponent * equipSelectionSelectButton = NEW MenuComponent ( CHARACTER_MENU , { { 123 + 12 , 36 + ( windowSize . y - 37 - 24 ) + 6 } , { 96 , 12 } } , " Select " , DO_NOTHING ) ;
MenuComponent * equipSelectionSelectButton = NEW MenuComponent ( CHARACTER_MENU , { { 123 + 12 , 36 + ( windowSize . y - 37 - 24 ) + 6 } , { 96 , 12 } } , " Select " , [ ] ( MenuFuncData data ) {
Component < MenuComponent > ( data . component - > parentMenu , " Equip Selection Outline " ) - > Enable ( false ) ;
Component < ScrollableWindowComponent > ( data . component - > parentMenu , " Equip List " ) - > Enable ( false ) ;
Component < MenuComponent > ( data . component - > parentMenu , " Equip Selection Bottom Outline " ) - > Enable ( false ) ;
Component < MenuComponent > ( data . component - > parentMenu , " Equip Selection Select Button " ) - > Enable ( false ) ;
Component < CharacterRotatingDisplay > ( data . component - > parentMenu , " Character Rotating Display " ) - > Enable ( true ) ;
return true ;
} ) ;
equipSelectionOutline - > Enable ( false ) ;
equipSelectionOutline - > Enable ( false ) ;
equipmentList - > Enable ( false ) ;
equipmentList - > Enable ( false ) ;
@ -89,16 +96,43 @@ void Menu::InitializeCharacterMenuWindow(){
}
}
const std : : array < std : : string , 8 > slotNames { " Helmet " , " Weapon " , " Armor " , " Gloves " , " Pants " , " Shoes " , " Ring 1 " , " Ring 2 " } ;
const std : : array < std : : string , 8 > slotNames { " Helmet " , " Weapon " , " Armor " , " Gloves " , " Pants " , " Shoes " , " Ring 1 " , " Ring 2 " } ;
EquipSlot slot = EquipSlot ( equipSlot ) ;
EquipSlot slot = EquipSlot ( equipSlot ) ;
MenuItemItemButton * equipmentSlot = NEW MenuItemItemButton ( CHARACTER_MENU , { { x , y + 36 } , { 24 , 24 } } , Item : : BLANK , MenuType : : ENUM_END ,
MenuItemItemButton * equipmentSlot = NEW MenuItemItemButton ( CHARACTER_MENU , { { x , y + 36 } , { 24 , 24 } } , Item : : BLANK , MenuType : : ENUM_END ,
[ ] ( MenuFuncData data ) {
[ ] ( MenuFuncData data ) {
EquipSlot slot = EquipSlot ( data . component - > I ( Attribute : : EQUIP_TYPE ) ) ;
std : : vector < Item > & equips = Inventory : : get ( " Equipment " ) ;
std : : vector < Item > & accessories = Inventory : : get ( " Accessories " ) ;
std : : vector < Item > availableEquipment ;
std : : copy_if ( equips . begin ( ) , equips . end ( ) , std : : back_inserter ( availableEquipment ) , [ & ] ( Item & it ) {
return it . GetEquipSlot ( ) & slot ;
} ) ;
ScrollableWindowComponent * equipList = Component < ScrollableWindowComponent > ( data . component - > parentMenu , " Equip List " ) ;
equipList - > RemoveAllComponents ( ) ;
int counter = 0 ;
for ( Item & it : availableEquipment ) {
float xOffset = ( counter % 3 ) * 26 ;
Item & itemInvRef = Inventory : : GetItem ( it . Name ( ) ) ;
MenuItemItemButton * equip = NEW MenuItemItemButton ( CHARACTER_MENU , { { 2 + xOffset , 2 } , { 24 , 24 } } , itemInvRef , MenuType : : ENUM_END , [ ] ( MenuFuncData data ) {
MenuItemItemButton * comp = ( MenuItemItemButton * ) data . component ;
Inventory : : EquipItem ( comp - > GetItem ( ) , EquipSlot ( comp - > I ( Attribute : : EQUIP_TYPE ) ) ) ;
return true ;
} , MenuType : : ENUM_END , " " , " " ) ;
equip - > I ( Attribute : : EQUIP_TYPE ) = int ( slot ) ;
equipList - > AddComponent ( Menu : : menus [ CHARACTER_MENU ] , " Equip Item " + std : : to_string ( counter ) , equip ) ;
counter + + ;
}
Component < MenuComponent > ( data . component - > parentMenu , " Equip Selection Outline " ) - > Enable ( true ) ;
Component < MenuComponent > ( data . component - > parentMenu , " Equip Selection Outline " ) - > Enable ( true ) ;
Component < ScrollableWindowComponent > ( data . component - > parentMenu , " Equip List " ) - > Enable ( true ) ;
equipList - > Enable ( true ) ;
Component < MenuComponent > ( data . component - > parentMenu , " Equip Selection Bottom Outline " ) - > Enable ( true ) ;
Component < MenuComponent > ( data . component - > parentMenu , " Equip Selection Bottom Outline " ) - > Enable ( true ) ;
Component < MenuComponent > ( data . component - > parentMenu , " Equip Selection Select Button " ) - > Enable ( true ) ;
Component < MenuComponent > ( data . component - > parentMenu , " Equip Selection Select Button " ) - > Enable ( true ) ;
Component < CharacterRotatingDisplay > ( data . component - > parentMenu , " Character Rotating Display " ) - > Enable ( false ) ;
Component < CharacterRotatingDisplay > ( data . component - > parentMenu , " Character Rotating Display " ) - > Enable ( false ) ;
return true ;
return true ;
} , MenuType : : ENUM_END , " " , " " ) ;
} , MenuType : : ENUM_END , " " , " " ) ;
PopupMenuLabel * equipmentLabel = NEW PopupMenuLabel ( CHARACTER_MENU , { { labelX , labelY } , { 29 , 24 } } , slotNames [ i ] , { 0.5 , 1 } , ComponentAttr : : SHADOW ) ;
PopupMenuLabel * equipmentLabel = NEW PopupMenuLabel ( CHARACTER_MENU , { { labelX , labelY } , { 29 , 24 } } , slotNames [ i ] , { 0.5 , 1 } , ComponentAttr : : SHADOW ) ;
equipmentSlot - > I ( Attribute : : EQUIP_TYPE ) = int ( slot ) ;
equipSlot < < = 1 ;
equipSlot < < = 1 ;
characterMenuWindow - > AddComponent ( " Equip Slot " + slotNames [ i ] , equipmentSlot ) ;
characterMenuWindow - > AddComponent ( " Equip Slot " + slotNames [ i ] , equipmentSlot ) ;
characterMenuWindow - > AddComponent ( " Equip Label " + slotNames [ i ] , equipmentLabel ) ;
characterMenuWindow - > AddComponent ( " Equip Label " + slotNames [ i ] , equipmentLabel ) ;