|
|
|
@ -343,7 +343,7 @@ void Menu::InitializeCharacterMenuWindow(){
|
|
|
|
|
auto abilityDescriptionLabel{characterMenuWindow->ADD("Ability Description Text",MenuLabel)(geom2d::rect<float>{{125,30+16},{116,windowSize.y-39-16}},"",1.f,ComponentAttr::LEFT_ALIGN|ComponentAttr::SHADOW)END};
|
|
|
|
|
|
|
|
|
|
#pragma region Skill Selection Boxes
|
|
|
|
|
std::array abilityBoxes{
|
|
|
|
|
const std::array abilityBoxes{
|
|
|
|
|
std::pair<std::reference_wrapper<Ability>,AbilitySlot>{game->GetPlayer()->GetAbility1(),AbilitySlot::ABILITY1},
|
|
|
|
|
std::pair<std::reference_wrapper<Ability>,AbilitySlot>{game->GetPlayer()->GetAbility2(),AbilitySlot::ABILITY2},
|
|
|
|
|
std::pair<std::reference_wrapper<Ability>,AbilitySlot>{game->GetPlayer()->GetAbility3(),AbilitySlot::ABILITY3},
|
|
|
|
@ -357,11 +357,13 @@ void Menu::InitializeCharacterMenuWindow(){
|
|
|
|
|
float labelY=24+i*28+36;
|
|
|
|
|
auto skillBox{characterMenuWindow->ADD(std::format("Skill Icon Label {}",i),MenuIconButton)(geom2d::rect<float>{{x,y+28},{24,24}},GFX[ability.get().icon].Decal(),DO_NOTHING)END};
|
|
|
|
|
auto skillNameLabel{characterMenuWindow->ADD(std::format("Skill Name Label {}",i),MenuLabel)(geom2d::rect<float>{{labelX,labelY},{96,24}},ability.get().GetNameWithPlayerModifiers())END};
|
|
|
|
|
skillBox->SetHoverFunc([&abilityNameLabel,&abilityDescriptionLabel,&ability](MenuFuncData data){
|
|
|
|
|
abilityNameLabel->SetLabel(ability.get().GetNameWithPlayerModifiers());
|
|
|
|
|
abilityDescriptionLabel->SetLabel(ability.get().GetDescriptionWithPlayerModifiers());
|
|
|
|
|
skillBox->SetHoverFunc([slot](MenuFuncData data){
|
|
|
|
|
const auto&ability{game->GetPlayer()->GetAbility(slot)};
|
|
|
|
|
Component<MenuLabel>(data.menu.GetType(),"Ability Name Text")->SetLabel(ability.GetNameWithPlayerModifiers());
|
|
|
|
|
Component<MenuLabel>(data.menu.GetType(),"Ability Description Text")->SetLabel(ability.GetDescriptionWithPlayerModifiers());
|
|
|
|
|
return true;
|
|
|
|
|
});
|
|
|
|
|
skillBox->Disable(); //Hide these by default.
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
#pragma endregion
|
|
|
|
@ -372,17 +374,29 @@ void Menu::InitializeCharacterMenuWindow(){
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//Used in conjunction with the onClick events of MenuComponents tab.
|
|
|
|
|
auto OnTabClick=[&abilityBoxes,&abilityNameLabel,&abilityDescriptionLabel](const ClickedTab tabClicked,const MenuFuncData&data){
|
|
|
|
|
auto OnTabClick=[](const ClickedTab tabClicked,const MenuFuncData&data){
|
|
|
|
|
using enum ClickedTab;
|
|
|
|
|
auto abilityNameLabel{Component<MenuLabel>(data.menu.GetType(),"Ability Name Text")};
|
|
|
|
|
auto abilityDescriptionLabel{Component<MenuLabel>(data.menu.GetType(),"Ability Description Text")};
|
|
|
|
|
for(int i=0;i<8;i++){
|
|
|
|
|
auto slot{Component<EquipSlotButton>(data.menu.GetType(),CharacterMenuWindow::slotNames[i])};
|
|
|
|
|
auto slot{Component<EquipSlotButton>(data.menu.GetType(),std::format("Equip Slot {}",CharacterMenuWindow::slotNames[i]))};
|
|
|
|
|
if(tabClicked==EQUIPMENT)slot->Enable();
|
|
|
|
|
else slot->Disable();
|
|
|
|
|
}
|
|
|
|
|
const std::array abilityBoxes{
|
|
|
|
|
std::pair<std::reference_wrapper<Ability>,AbilitySlot>{game->GetPlayer()->GetAbility1(),AbilitySlot::ABILITY1},
|
|
|
|
|
std::pair<std::reference_wrapper<Ability>,AbilitySlot>{game->GetPlayer()->GetAbility2(),AbilitySlot::ABILITY2},
|
|
|
|
|
std::pair<std::reference_wrapper<Ability>,AbilitySlot>{game->GetPlayer()->GetAbility3(),AbilitySlot::ABILITY3},
|
|
|
|
|
std::pair<std::reference_wrapper<Ability>,AbilitySlot>{game->GetPlayer()->GetAbility4(),AbilitySlot::ABILITY4},
|
|
|
|
|
std::pair<std::reference_wrapper<Ability>,AbilitySlot>{game->GetPlayer()->GetRightClickAbility(),AbilitySlot::DEFENSIVE},
|
|
|
|
|
};
|
|
|
|
|
for(int i=0;i<abilityBoxes.size();i++){
|
|
|
|
|
auto slot{Component<MenuComponent>(data.menu.GetType(),std::format("Skill Icon Label {}",i))};
|
|
|
|
|
if(tabClicked==SKILLS)slot->Enable();
|
|
|
|
|
else slot->Disable();
|
|
|
|
|
auto&[ability,slot]{abilityBoxes[i]};
|
|
|
|
|
Component<MenuIconButton>(data.menu.GetType(),std::format("Skill Icon Label {}",i))->SetIcon(GFX[ability.get().icon].Decal());
|
|
|
|
|
Component<MenuLabel>(data.menu.GetType(),std::format("Skill Name Label {}",i))->SetLabel(ability.get().GetNameWithPlayerModifiers());
|
|
|
|
|
auto abilityLabel{Component<MenuComponent>(data.menu.GetType(),std::format("Skill Icon Label {}",i))};
|
|
|
|
|
if(tabClicked==SKILLS)abilityLabel->Enable();
|
|
|
|
|
else abilityLabel->Disable();
|
|
|
|
|
}
|
|
|
|
|
Component<MenuComponent>(data.menu.GetType(),"Equipment Tab")->SetSelected(tabClicked==EQUIPMENT);
|
|
|
|
|
Component<MenuComponent>(data.menu.GetType(),"Skills Tab")->SetSelected(tabClicked==SKILLS);
|
|
|
|
|