Implemented offline / online character tabs for the load game window. Release Build 6459.

pull/35/head
sigonasr2 10 months ago
parent 5589740f03
commit 2640477f89
  1. 2
      Adventures in Lestoria/ClassSelectionWindow.cpp
  2. 39
      Adventures in Lestoria/LoadGameWindow.cpp
  3. 6
      Adventures in Lestoria/UserIDMenu.cpp
  4. 2
      Adventures in Lestoria/Version.h
  5. BIN
      x64/Release/Adventures in Lestoria.exe

@ -73,6 +73,8 @@ 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("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));

@ -41,14 +41,43 @@ 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<float>{{-8,-12},{112,12}},"Load Game",1.0f,ComponentAttr::SHADOW|ComponentAttr::OUTLINE|ComponentAttr::BACKGROUND)END;
loadGameWindow->ADD("Game Files List",ScrollableWindowComponent)(geom2d::rect<float>{{-8,4},{112,116}})END
loadGameWindow->ADD("Game Files Label",MenuLabel)(geom2d::rect<float>{{-8,-12},{208,12}},"Load Game",1.0f,ComponentAttr::SHADOW|ComponentAttr::OUTLINE|ComponentAttr::BACKGROUND)END;
loadGameWindow->ADD("Game Files List",ScrollableWindowComponent)(geom2d::rect<float>{{40,24},{112,116}})END
->Enable(true);
loadGameWindow->ADD("Online Game Files List",ScrollableWindowComponent)(geom2d::rect<float>{{-8,4},{112,116}})END
loadGameWindow->ADD("Online Game Files List",ScrollableWindowComponent)(geom2d::rect<float>{{40,24},{112,116}})END
->Enable(false);
loadGameWindow->ADD("Go Back Button",MenuComponent)(geom2d::rect<float>{{24,124},{48,12}},"Back",[](MenuFuncData menu){Menu::CloseMenu();return true;})END;
loadGameWindow->ADD("Go Back Button",MenuComponent)(geom2d::rect<float>{{72,148},{48,12}},"Back",[](MenuFuncData menu){Menu::CloseMenu();return true;})END;
#ifdef __EMSCRIPTEN__
auto offlineCharacterTab = loadGameWindow->ADD("Offline Character Tab",MenuComponent)(geom2d::rect<float>{{-8,4},{102,16}},"Offline Characters",[](MenuFuncData data){
Component<ScrollableWindowComponent>(data.menu.GetType(),"Game Files List")->Enable(true);
Component<ScrollableWindowComponent>(data.menu.GetType(),"Online Game Files List")->Enable(false);
Component<MenuComponent>(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<float>{{96,4},{102,16}},"Online Characters",[](MenuFuncData data){
Component<ScrollableWindowComponent>(data.menu.GetType(),"Game Files List")->Enable(false);
Component<ScrollableWindowComponent>(data.menu.GetType(),"Online Game Files List")->Enable(true);
Component<MenuComponent>(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) \

@ -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<float>{{18,110},{48,12}},"Back",[](MenuFuncData data){
SaveFile::SetOnlineMode(false); //We declined the online saving, so don't allow it.
if(Component<Checkbox>(CLASS_SELECTION,"Online Character Checkbox")->IsChecked()){
Component<Checkbox>(CLASS_SELECTION,"Online Character Checkbox")->Click(); //Since the checkbox is currently checked, we have to click it to toggle it.
}
#ifdef __EMSCRIPTEN__
Component<MenuComponent>(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<float>{{102,110},{48,12}},"Submit",[](MenuFuncData data){
SaveFile::SetUserID(Component<TextEntryLabel>(USER_ID,"User ID Input")->GetLabel());
SaveFile::UpdateSaveGameData([](){});
Menu::CloseMenu();
return true;
})END

@ -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

Loading…
Cancel
Save