diff --git a/Adventures in Lestoria/ClassSelectionWindow.cpp b/Adventures in Lestoria/ClassSelectionWindow.cpp index dd5b6137..2ae8c87d 100644 --- a/Adventures in Lestoria/ClassSelectionWindow.cpp +++ b/Adventures in Lestoria/ClassSelectionWindow.cpp @@ -73,6 +73,8 @@ void Menu::InitializeClassSelectionWindow(){ vf2d navigationButtonSize={24*2.5f,16}; + classSelectionWindow->ADD("Back",MenuComponent)(geom2d::rect{{6,outlineSize.y+29-navigationButtonSize.y-2},navigationButtonSize},"Back",[](MenuFuncData){Menu::CloseMenu();return true;})END; + classSelectionWindow->ADD("Confirm",MenuComponent)(geom2d::rect{{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)); diff --git a/Adventures in Lestoria/LoadGameWindow.cpp b/Adventures in Lestoria/LoadGameWindow.cpp index 4bcf44b6..014672b7 100644 --- a/Adventures in Lestoria/LoadGameWindow.cpp +++ b/Adventures in Lestoria/LoadGameWindow.cpp @@ -41,15 +41,44 @@ All rights reserved. #include "SaveFile.h" void Menu::InitializeLoadGameWindow(){ - Menu*loadGameWindow=CreateMenu(LOAD_GAME,CENTERED,vi2d{96,120}); + Menu*loadGameWindow=CreateMenu(LOAD_GAME,CENTERED,vi2d{192,144}); - loadGameWindow->ADD("Game Files Label",MenuLabel)(geom2d::rect{{-8,-12},{112,12}},"Load Game",1.0f,ComponentAttr::SHADOW|ComponentAttr::OUTLINE|ComponentAttr::BACKGROUND)END; - loadGameWindow->ADD("Game Files List",ScrollableWindowComponent)(geom2d::rect{{-8,4},{112,116}})END + loadGameWindow->ADD("Game Files Label",MenuLabel)(geom2d::rect{{-8,-12},{208,12}},"Load Game",1.0f,ComponentAttr::SHADOW|ComponentAttr::OUTLINE|ComponentAttr::BACKGROUND)END; + loadGameWindow->ADD("Game Files List",ScrollableWindowComponent)(geom2d::rect{{40,24},{112,116}})END ->Enable(true); - loadGameWindow->ADD("Online Game Files List",ScrollableWindowComponent)(geom2d::rect{{-8,4},{112,116}})END + loadGameWindow->ADD("Online Game Files List",ScrollableWindowComponent)(geom2d::rect{{40,24},{112,116}})END ->Enable(false); - loadGameWindow->ADD("Go Back Button",MenuComponent)(geom2d::rect{{24,124},{48,12}},"Back",[](MenuFuncData menu){Menu::CloseMenu();return true;})END; + loadGameWindow->ADD("Go Back Button",MenuComponent)(geom2d::rect{{72,148},{48,12}},"Back",[](MenuFuncData menu){Menu::CloseMenu();return true;})END; + #ifdef __EMSCRIPTEN__ + auto offlineCharacterTab = loadGameWindow->ADD("Offline Character Tab",MenuComponent)(geom2d::rect{{-8,4},{102,16}},"Offline Characters",[](MenuFuncData data){ + Component(data.menu.GetType(),"Game Files List")->Enable(true); + Component(data.menu.GetType(),"Online Game Files List")->Enable(false); + Component(data.menu.GetType(),"Online Character Tab")->SetSelected(false); + data.component.lock()->SetSelected(true); + SaveFile::SetOnlineMode(false); + return true; + },ButtonAttr::FIT_TO_LABEL)END; + offlineCharacterTab->SetSelectionType(HIGHLIGHT); + offlineCharacterTab->SetSelected(true); + auto onlineCharacterTab = loadGameWindow->ADD("Online Character Tab",MenuComponent)(geom2d::rect{{96,4},{102,16}},"Online Characters",[](MenuFuncData data){ + Component(data.menu.GetType(),"Game Files List")->Enable(false); + Component(data.menu.GetType(),"Online Game Files List")->Enable(true); + Component(data.menu.GetType(),"Offline Character Tab")->SetSelected(false); + data.component.lock()->SetSelected(true); + if(!SaveFile::IsOnline()){ + if(SaveFile::GetUserID().length()==0){ + //Present the user with the user ID form. + game->TextEntryEnable(true); + Menu::OpenMenu(USER_ID); + } + SaveFile::SetOnlineMode(true); + } + return true; + },ButtonAttr::FIT_TO_LABEL)END; + onlineCharacterTab->SetSelectionType(HIGHLIGHT); + #endif + #pragma region ScrollWindow macro lambda #define ScrollWindow(amount) \ [](MenuType type){ \ diff --git a/Adventures in Lestoria/UserIDMenu.cpp b/Adventures in Lestoria/UserIDMenu.cpp index cb2404c3..b5172cbf 100644 --- a/Adventures in Lestoria/UserIDMenu.cpp +++ b/Adventures in Lestoria/UserIDMenu.cpp @@ -53,12 +53,18 @@ void Menu::InitializeUserIDWindow(){ },true,24U,1.f,ComponentAttr::BACKGROUND|ComponentAttr::FIT_TO_LABEL|ComponentAttr::OUTLINE|ComponentAttr::SHADOW)END; userIDWindow->ADD("Back Button",MenuComponent)(geom2d::rect{{18,110},{48,12}},"Back",[](MenuFuncData data){ SaveFile::SetOnlineMode(false); //We declined the online saving, so don't allow it. - Component(CLASS_SELECTION,"Online Character Checkbox")->Click(); //Since the checkbox is currently checked, we have to click it to toggle it. + if(Component(CLASS_SELECTION,"Online Character Checkbox")->IsChecked()){ + Component(CLASS_SELECTION,"Online Character Checkbox")->Click(); //Since the checkbox is currently checked, we have to click it to toggle it. + } + #ifdef __EMSCRIPTEN__ + Component(LOAD_GAME,"Offline Character Tab")->Click(); //Reset the load file screen tab to the offline mode. + #endif Menu::CloseMenu(); return true; })END; userIDWindow->ADD("Submit Button",MenuComponent)(geom2d::rect{{102,110},{48,12}},"Submit",[](MenuFuncData data){ SaveFile::SetUserID(Component(USER_ID,"User ID Input")->GetLabel()); + SaveFile::UpdateSaveGameData([](){}); Menu::CloseMenu(); return true; })END diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index fdacb33b..8dabc740 100644 --- a/Adventures in Lestoria/Version.h +++ b/Adventures in Lestoria/Version.h @@ -39,7 +39,7 @@ All rights reserved. #define VERSION_MAJOR 0 #define VERSION_MINOR 3 #define VERSION_PATCH 0 -#define VERSION_BUILD 6455 +#define VERSION_BUILD 6459 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index 24756aba..4c8b5e0b 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ