Fix up new stages, configure stage plates, add bonus boss stage, add levels to configuration files. Change Class selection window to include an online character checkbox to toggle between online and offline saving. Fix online/offline file IDs that were incorrectly loading due to no callbacks for async file retrieval.

This commit is contained in:
2024-01-27 10:34:56 -06:00
parent a06131e6f4
commit 5589740f03
21 changed files with 479 additions and 55 deletions
@@ -44,6 +44,7 @@ All rights reserved.
#include "ClassInfo.h"
#include "SaveFileNameButton.h"
#include "TextEntryLabel.h"
#include "Checkbox.h"
INCLUDE_game
using A=Attribute;
@@ -75,7 +76,12 @@ void Menu::InitializeClassSelectionWindow(){
classSelectionWindow->ADD("Confirm",MenuComponent)(geom2d::rect<float>{{outlineSize.x+4-navigationButtonSize.x-2,outlineSize.y+29-navigationButtonSize.y-2},navigationButtonSize},"Confirm",[](MenuFuncData data){
std::string selectedClass=data.component.lock()->S(A::CLASS_SELECTION);
data.game->ChangePlayerClass(classutils::StringToClass(selectedClass));
GameState::ChangeState(States::OVERWORLD_MAP);
if(SaveFile::IsOnline()){
SaveFile::SetSaveFileID(SaveFile::GetOnlineSaveFileCount());
SaveFile::UpdateSaveGameData([](){GameState::ChangeState(States::OVERWORLD_MAP);});
}else{
SaveFile::SetSaveFileOfflineID_TransitionToOverworldMap();
}
return true;
})END
->disabled=true;
@@ -141,6 +147,20 @@ void Menu::InitializeClassSelectionWindow(){
toggleGroup.push_back(classSprite);
}
#ifdef __EMSCRIPTEN__
classSelectionWindow->ADD("Online Character Checkbox",Checkbox)(geom2d::rect<float>{classSelectionWindow->pos+classSelectionWindow->size-vf2d{84,72},{12,12}},[](ToggleFuncData data){
SaveFile::SetOnlineMode(data.checked);
if(SaveFile::IsOnline()&&SaveFile::GetUserID().length()==0){
//Present the user with the user ID form.
game->TextEntryEnable(true);
Menu::OpenMenu(USER_ID);
}
return true;
},SaveFile::IsOnline())END;
classSelectionWindow->ADD("Online Character Text Label",MenuLabel)(geom2d::rect<float>{classSelectionWindow->pos+classSelectionWindow->size-vf2d{69,70},{54,12}},"Online Character",0.75f,ComponentAttr::SHADOW)END;
#endif
for(std::weak_ptr<IToggleable>item:toggleGroup){
item.lock()->SetToggleGroup(toggleGroup);
}