|
|
|
@ -5,6 +5,7 @@ |
|
|
|
|
#include "MenuLabel.h" |
|
|
|
|
#include "MenuAnimatedIconToggleButton.h" |
|
|
|
|
#include "GameState.h" |
|
|
|
|
#include "ClassInfo.h" |
|
|
|
|
|
|
|
|
|
INCLUDE_game |
|
|
|
|
typedef Attribute A; |
|
|
|
@ -29,12 +30,7 @@ void Menu::InitializeClassSelectionWindow(){ |
|
|
|
|
classSelectionWindow->AddComponent("Back Button",backButton); |
|
|
|
|
MenuComponent*confirmButton=new MenuComponent(CLASS_SELECTION,{{outlineSize.x+4-navigationButtonSize.x-2,outlineSize.y+4-navigationButtonSize.y-2},navigationButtonSize},"Confirm",[](MenuFuncData data){ |
|
|
|
|
std::string selectedClass=data.component->S(A::CLASS_SELECTION); |
|
|
|
|
INCLUDE_DATA |
|
|
|
|
std::vector<std::string>classList=DATA["class_list"].GetValues(); |
|
|
|
|
auto it=std::find(classList.begin(),classList.end(),selectedClass); |
|
|
|
|
int element=std::distance(classList.begin(),it); |
|
|
|
|
Class cl=Class(1<<element); |
|
|
|
|
data.game->ChangePlayerClass(cl); |
|
|
|
|
data.game->ChangePlayerClass(classutils::StringToClass(selectedClass)); |
|
|
|
|
GameState::ChangeState(States::GAME_RUN); |
|
|
|
|
}); |
|
|
|
|
confirmButton->disabled=true; |
|
|
|
|