|
|
|
@ -73,9 +73,9 @@ void Menu::InitializeClassSelectionWindow(){ |
|
|
|
|
|
|
|
|
|
vf2d navigationButtonSize={24*2.5f,16}; |
|
|
|
|
|
|
|
|
|
classSelectionWindow->ADD("Back",MenuComponent)(geom2d::rect<float>{{6,outlineSize.y+29-navigationButtonSize.y-2},navigationButtonSize},"Back",[](MenuFuncData){Menu::CloseMenu();return true;})END; |
|
|
|
|
classSelectionWindow->ADD("Back",MenuComponent)(geom2d::rect<float>{{6,outlineSize.y+29-navigationButtonSize.y-14},navigationButtonSize},"Back",[](MenuFuncData){Menu::CloseMenu();return true;})END; |
|
|
|
|
|
|
|
|
|
classSelectionWindow->ADD("Confirm",MenuComponent)(geom2d::rect<float>{{outlineSize.x+4-navigationButtonSize.x-2,outlineSize.y+29-navigationButtonSize.y-2},navigationButtonSize},"Confirm",[](MenuFuncData data){ |
|
|
|
|
classSelectionWindow->ADD("Confirm",MenuComponent)(geom2d::rect<float>{{outlineSize.x+4-navigationButtonSize.x-2,outlineSize.y+29-navigationButtonSize.y-14},navigationButtonSize},"Confirm",[](MenuFuncData data){ |
|
|
|
|
std::string selectedClass=data.component.lock()->S(A::CLASS_SELECTION); |
|
|
|
|
data.game->ChangePlayerClass(classutils::StringToClass(selectedClass)); |
|
|
|
|
#ifdef __EMSCRIPTEN__ |
|
|
|
@ -134,15 +134,16 @@ void Menu::InitializeClassSelectionWindow(){ |
|
|
|
|
vf2d backgroundSize={floor(outlineSize.y/3-buttonPadding.y*3),outlineSize.y/3-buttonPadding.y*3}; //The floor is for fixing a small pixel rounding bug.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
classSelectionWindow->ADD(className+" Background",MenuLabel)(geom2d::rect<float>{backgroundOffsetPos,backgroundSize},"",1,ComponentAttr::OUTLINE|ComponentAttr::BACKGROUND)END; |
|
|
|
|
classSelectionWindow->ADD(className+" Button",MenuComponent)(geom2d::rect<float>{offsetPos,buttonSize},"Info",CLASS_INFO, |
|
|
|
|
auto classLabel=classSelectionWindow->ADD(className+" Background",MenuLabel)(geom2d::rect<float>{backgroundOffsetPos,backgroundSize},"",1,ComponentAttr::OUTLINE|ComponentAttr::BACKGROUND)END; |
|
|
|
|
auto classButton=classSelectionWindow->ADD(className+" Button",MenuComponent)(geom2d::rect<float>{offsetPos,buttonSize},"Info",CLASS_INFO, |
|
|
|
|
[](MenuFuncData data){ |
|
|
|
|
data.menu.S(A::CLASS_SELECTION)=data.component.lock()->S(A::CLASS_SELECTION); |
|
|
|
|
delete Menu::menus[CLASS_INFO]; |
|
|
|
|
Menu::InitializeClassInfoWindow(); |
|
|
|
|
return true; |
|
|
|
|
})END |
|
|
|
|
->S(A::CLASS_SELECTION)=className; |
|
|
|
|
})END; |
|
|
|
|
classButton->S(A::CLASS_SELECTION)=className; |
|
|
|
|
|
|
|
|
|
classSelectionWindow->ADD(className+" Label",MenuLabel)(geom2d::rect<float>{backgroundOffsetPos,buttonSize},className,1,ComponentAttr::SHADOW)END; |
|
|
|
|
auto classSprite=classSelectionWindow->ADD(className+" Icon",MenuAnimatedIconToggleButton)(geom2d::rect<float>{backgroundOffsetPos+vf2d{0,12},backgroundSize+vf2d{0,-buttonSize.y-12}},classAnimationName,[](MenuFuncData data){ |
|
|
|
|
data.menu.components["Confirm"]->Enable(true); |
|
|
|
@ -150,6 +151,12 @@ void Menu::InitializeClassSelectionWindow(){ |
|
|
|
|
return true; |
|
|
|
|
})END; |
|
|
|
|
|
|
|
|
|
if(i>=3){ |
|
|
|
|
classLabel->SetGrayedOut(true); |
|
|
|
|
classButton->SetGrayedOut(true); |
|
|
|
|
classSprite->SetGrayedOut(true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
classSprite->S(A::CLASS_SELECTION)=className; |
|
|
|
|
|
|
|
|
|
toggleGroup.push_back(classSprite); |
|
|
|
@ -172,4 +179,111 @@ void Menu::InitializeClassSelectionWindow(){ |
|
|
|
|
for(std::weak_ptr<IToggleable>item:toggleGroup){ |
|
|
|
|
item.lock()->SetToggleGroup(toggleGroup); |
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
classSelectionWindow->SetupKeyboardNavigation( |
|
|
|
|
[](MenuType type,Data&returnData){ //On Open
|
|
|
|
|
returnData=Warrior::name+" Button"; |
|
|
|
|
}, |
|
|
|
|
{ //Button Key
|
|
|
|
|
{game->KEY_BACK,{"Back",[](MenuType type){ |
|
|
|
|
Component<MenuComponent>(type,"Back")->Click(); |
|
|
|
|
}}}, |
|
|
|
|
{game->KEY_START,{"Confirm",[](MenuType type){ |
|
|
|
|
Component<MenuComponent>(type,"Confirm")->Click(); |
|
|
|
|
}}}, |
|
|
|
|
{game->KEY_FACEUP,{"Change Player Name",[](MenuType type){ |
|
|
|
|
Component<SaveFileNameButton>(type,"Character Name Box")->Click(); |
|
|
|
|
}}}, |
|
|
|
|
} |
|
|
|
|
,{ //Button Navigation Rules
|
|
|
|
|
{Warrior::name+" Button",{ |
|
|
|
|
.up=Warrior::name+" Icon", |
|
|
|
|
.down=Thief::name+" Icon", |
|
|
|
|
.left="Back", |
|
|
|
|
.right=Ranger::name+" Button", |
|
|
|
|
}}, |
|
|
|
|
{Warrior::name+" Icon",{ |
|
|
|
|
.up="Character Name Box", |
|
|
|
|
.down=Warrior::name+" Button", |
|
|
|
|
.left="Back", |
|
|
|
|
.right=Ranger::name+" Icon", |
|
|
|
|
}}, |
|
|
|
|
{Ranger::name+" Button",{ |
|
|
|
|
.up=Ranger::name+" Icon", |
|
|
|
|
.down=Trapper::name+" Icon", |
|
|
|
|
.left=Warrior::name+" Button", |
|
|
|
|
.right=Wizard::name+" Button", |
|
|
|
|
}}, |
|
|
|
|
{Ranger::name+" Icon",{ |
|
|
|
|
.up="Character Name Box", |
|
|
|
|
.down=Ranger::name+" Button", |
|
|
|
|
.left=Warrior::name+" Icon", |
|
|
|
|
.right=Wizard::name+" Icon", |
|
|
|
|
}}, |
|
|
|
|
{Wizard::name+" Button",{ |
|
|
|
|
.up=Wizard::name+" Icon", |
|
|
|
|
.down=Witch::name+" Icon", |
|
|
|
|
.left=Ranger::name+" Button", |
|
|
|
|
.right="Confirm", |
|
|
|
|
}}, |
|
|
|
|
{Wizard::name+" Icon",{ |
|
|
|
|
.up="Character Name Box", |
|
|
|
|
.down=Wizard::name+" Button", |
|
|
|
|
.left=Ranger::name+" Icon", |
|
|
|
|
.right="Confirm", |
|
|
|
|
}}, |
|
|
|
|
{Thief::name+" Button",{ |
|
|
|
|
.up=Thief::name+" Icon", |
|
|
|
|
.down="Character Name Box", |
|
|
|
|
.left="Back", |
|
|
|
|
.right=Trapper::name+" Button", |
|
|
|
|
}}, |
|
|
|
|
{Thief::name+" Icon",{ |
|
|
|
|
.up=Warrior::name+" Button", |
|
|
|
|
.down=Thief::name+" Button", |
|
|
|
|
.left="Back", |
|
|
|
|
.right=Trapper::name+" Icon", |
|
|
|
|
}}, |
|
|
|
|
{Trapper::name+" Button",{ |
|
|
|
|
.up=Trapper::name+" Icon", |
|
|
|
|
.down="Character Name Box", |
|
|
|
|
.left=Thief::name+" Button", |
|
|
|
|
.right=Witch::name+" Button", |
|
|
|
|
}}, |
|
|
|
|
{Trapper::name+" Icon",{ |
|
|
|
|
.up=Ranger::name+" Button", |
|
|
|
|
.down=Trapper::name+" Button", |
|
|
|
|
.left=Thief::name+" Icon", |
|
|
|
|
.right=Witch::name+" Icon", |
|
|
|
|
}}, |
|
|
|
|
{Witch::name+" Button",{ |
|
|
|
|
.up=Witch::name+" Icon", |
|
|
|
|
.down="Character Name Box", |
|
|
|
|
.left=Trapper::name+" Button", |
|
|
|
|
.right="Confirm", |
|
|
|
|
}}, |
|
|
|
|
{Witch::name+" Icon",{ |
|
|
|
|
.up=Wizard::name+" Button", |
|
|
|
|
.down=Witch::name+" Button", |
|
|
|
|
.left=Trapper::name+" Icon", |
|
|
|
|
.right="Confirm", |
|
|
|
|
}}, |
|
|
|
|
{"Character Name Box",{ |
|
|
|
|
.up=Witch::name+" Button", |
|
|
|
|
.down=Wizard::name+" Icon", |
|
|
|
|
}}, |
|
|
|
|
{"Confirm",{ |
|
|
|
|
.up=Wizard::name+" Button", |
|
|
|
|
.down=Wizard::name+" Button", |
|
|
|
|
.left=Wizard::name+" Button", |
|
|
|
|
.right="Back", |
|
|
|
|
}}, |
|
|
|
|
{"Back",{ |
|
|
|
|
.up=Warrior::name+" Button", |
|
|
|
|
.down=Warrior::name+" Button", |
|
|
|
|
.left="Confirm", |
|
|
|
|
.right=Warrior::name+" Button", |
|
|
|
|
}}, |
|
|
|
|
}); |
|
|
|
|
} |