@ -41,6 +41,10 @@ All rights reserved.
# include "CharacterRotatingDisplay.h"
# include "CharacterRotatingDisplay.h"
# include "Crawler.h"
# include "Crawler.h"
# include "ClassInfo.h"
# include "ClassInfo.h"
# include "MenuItemItemButton.h"
# include "Item.h"
# include "PopupMenuLabel.h"
# include "ScrollableWindowComponent.h"
INCLUDE_game
INCLUDE_game
INCLUDE_GFX
INCLUDE_GFX
@ -57,4 +61,72 @@ void Menu::InitializeCharacterMenuWindow(){
characterMenuWindow - > AddComponent ( " Character Label " , characterLabel ) ;
characterMenuWindow - > AddComponent ( " Character Label " , characterLabel ) ;
characterMenuWindow - > AddComponent ( " Equip Slot Outline " , equipSlotOutline ) ;
characterMenuWindow - > AddComponent ( " Equip Slot Outline " , equipSlotOutline ) ;
characterMenuWindow - > AddComponent ( " Character Rotating Display " , charDisplay ) ;
characterMenuWindow - > AddComponent ( " Character Rotating Display " , charDisplay ) ;
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 } } ) ;
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 ) ;
equipSelectionOutline - > Enable ( false ) ;
equipmentList - > Enable ( false ) ;
equipSelectionBottomOutline - > Enable ( false ) ;
equipSelectionSelectButton - > Enable ( false ) ;
characterMenuWindow - > AddComponent ( " Equip Selection Outline " , equipSelectionOutline ) ;
characterMenuWindow - > AddComponent ( " Equip List " , equipmentList ) ;
characterMenuWindow - > AddComponent ( " Equip Selection Bottom Outline " , equipSelectionBottomOutline ) ;
characterMenuWindow - > AddComponent ( " Equip Selection Select Button " , equipSelectionSelectButton ) ;
int equipSlot = 1 ;
for ( int i = 0 ; i < 8 ; i + + ) {
float x = 31 + ( i % 2 ) * 33 ;
float y = 24 + ( i / 2 ) * 28 ;
float labelX = 2 + ( i % 2 ) * 90 ;
float labelY = 24 + ( i / 2 ) * 28 + 36 ;
if ( i < 6 ) {
y - = 8 ;
labelY - = 8 ;
}
const std : : array < std : : string , 8 > slotNames { " Helmet " , " Weapon " , " Armor " , " Gloves " , " Pants " , " Shoes " , " Ring 1 " , " Ring 2 " } ;
EquipSlot slot = EquipSlot ( equipSlot ) ;
MenuItemItemButton * equipmentSlot = NEW MenuItemItemButton ( CHARACTER_MENU , { { x , y + 36 } , { 24 , 24 } } , Item : : BLANK , MenuType : : ENUM_END ,
[ ] ( MenuFuncData data ) {
Component < MenuComponent > ( data . component - > parentMenu , " Equip Selection Outline " ) - > Enable ( true ) ;
Component < ScrollableWindowComponent > ( data . component - > parentMenu , " Equip List " ) - > 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 < CharacterRotatingDisplay > ( data . component - > parentMenu , " Character Rotating Display " ) - > Enable ( false ) ;
return true ;
} , MenuType : : ENUM_END , " " , " " ) ;
PopupMenuLabel * equipmentLabel = NEW PopupMenuLabel ( CHARACTER_MENU , { { labelX , labelY } , { 29 , 24 } } , slotNames [ i ] , { 0.5 , 1 } , ComponentAttr : : SHADOW ) ;
equipSlot < < = 1 ;
characterMenuWindow - > AddComponent ( " Equip Slot " + slotNames [ i ] , equipmentSlot ) ;
characterMenuWindow - > AddComponent ( " Equip Label " + slotNames [ i ] , equipmentLabel ) ;
}
MenuComponent * statDisplayOutline = NEW MenuComponent ( CHARACTER_MENU , { { 245 , 36 } , { 62 , windowSize . y - 37 } } , " " , DO_NOTHING , ButtonAttr : : UNSELECTABLE ) ;
const std : : array < ItemAttribute , 7 > displayAttrs {
ItemAttribute : : health ,
ItemAttribute : : attack ,
ItemAttribute : : defense ,
ItemAttribute : : moveSpdPct ,
ItemAttribute : : cdrPct ,
ItemAttribute : : critPct ,
ItemAttribute : : critDmgPct ,
} ;
characterMenuWindow - > AddComponent ( " Stat Display Outline " , statDisplayOutline ) ;
int yOffset = 0 ;
for ( ItemAttribute attribute : displayAttrs ) {
AttributeData data = ItemAttributable : : GetDisplayInfo ( attribute ) ;
std : : string attrStr = data . name + " : \n " ;
attrStr + = std : : to_string ( game - > GetPlayer ( ) - > A ( attribute ) ) ;
if ( data . displayAsPercent ) {
attrStr + = " % " ;
}
MenuLabel * attrLabel = NEW MenuLabel ( CHARACTER_MENU , { { 245 , 36 + 2 + float ( yOffset ) } , { 62 , 18 } } , attrStr , 1 , ComponentAttr : : SHADOW | ComponentAttr : : LEFT_ALIGN ) ;
yOffset + = 20 ;
characterMenuWindow - > AddComponent ( " Attribute " + data . name + " Label " , attrLabel ) ;
}
}
}