Added controller compatibility for online mode Load game screen / class selection menu. Release Build 7300.

pull/35/head
sigonasr2 10 months ago
parent a723ac50fc
commit 2b9f770d36
  1. 41
      Adventures in Lestoria/ClassSelectionWindow.cpp
  2. 269
      Adventures in Lestoria/LoadGameWindow.cpp
  3. 4
      Adventures in Lestoria/MenuType.h
  4. 2
      Adventures in Lestoria/Version.h
  5. BIN
      x64/Release/Adventures in Lestoria.exe

@ -195,6 +195,11 @@ void Menu::InitializeClassSelectionWindow(){
{game->KEY_FACEUP,{"Change Player Name",[](MenuType type){
Component<SaveFileNameButton>(type,"Character Name Box")->Click();
}}},
#ifdef __EMSCRIPTEN__
{game->KEY_FACELEFT,{"Toggle Online Character",[](MenuType type){
Component<Checkbox>(type,"Online Character Checkbox")->Click();
}}},
#endif
}
,{ //Button Navigation Rules
{Warrior::name+" Button",{
@ -225,13 +230,21 @@ void Menu::InitializeClassSelectionWindow(){
.up=Wizard::name+" Icon",
.down=Witch::name+" Icon",
.left=Ranger::name+" Button",
.right="Confirm",
#ifdef __EMSCRIPTEN__
.right="Online Character Checkbox",
#else
.right="Confirm",
#endif
}},
{Wizard::name+" Icon",{
.up="Character Name Box",
.down=Wizard::name+" Button",
.left=Ranger::name+" Icon",
.right="Confirm",
#ifdef __EMSCRIPTEN__
.right="Online Character Checkbox",
#else
.right="Confirm",
#endif
}},
{Thief::name+" Button",{
.up=Thief::name+" Icon",
@ -261,24 +274,42 @@ void Menu::InitializeClassSelectionWindow(){
.up=Witch::name+" Icon",
.down="Character Name Box",
.left=Trapper::name+" Button",
.right="Confirm",
#ifdef __EMSCRIPTEN__
.right="Online Character Checkbox",
#else
.right="Confirm",
#endif
}},
{Witch::name+" Icon",{
.up=Wizard::name+" Button",
.down=Witch::name+" Button",
.left=Trapper::name+" Icon",
.right="Confirm",
#ifdef __EMSCRIPTEN__
.right="Online Character Checkbox",
#else
.right="Confirm",
#endif
}},
{"Character Name Box",{
.up=Witch::name+" Button",
.down=Wizard::name+" Icon",
}},
{"Confirm",{
.up=Wizard::name+" Button",
#ifdef __EMSCRIPTEN__
.up="Online Character Checkbox",
#else
.up=Wizard::name+" Button",
#endif
.down=Wizard::name+" Button",
.left=Wizard::name+" Button",
.right="Back",
}},
{"Online Character Checkbox",{
.up="Confirm",
.down="Confirm",
.left=Wizard::name+" Button",
.right=Warrior::name+" Button",
}},
{"Back",{
.up=Warrior::name+" Button",
.down=Warrior::name+" Button",

@ -50,35 +50,44 @@ void Menu::InitializeLoadGameWindow(){
loadGameWindow->ADD("Online Game Files List",ScrollableWindowComponent)(geom2d::rect<float>{{40,24},{112,116}})END
->Disable();
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();
Component<ScrollableWindowComponent>(data.menu.GetType(),"Online Game Files List")->Disable();
Component<MenuComponent>(data.menu.GetType(),"Online Character Tab")->SetSelected(false);
data.component.lock()->SetSelected(true);
SoundEffect::PlaySFX("Button Click",SoundEffect::CENTERED);
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")->Disable();
Component<ScrollableWindowComponent>(data.menu.GetType(),"Online Game Files List")->Enable();
Component<MenuComponent>(data.menu.GetType(),"Offline Character Tab")->SetSelected(false);
SoundEffect::PlaySFX("Button Click",SoundEffect::CENTERED);
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);
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();
Component<ScrollableWindowComponent>(data.menu.GetType(),"Online Game Files List")->Disable();
Component<MenuComponent>(data.menu.GetType(),"Online Character Tab")->SetSelected(false);
data.component.lock()->SetSelected(true);
SoundEffect::PlaySFX("Button Click",SoundEffect::CENTERED);
SaveFile::SetOnlineMode(false);
if(Component<ScrollableWindowComponent>(data.menu.GetType(),"Game Files List")->GetComponents().size()>0){
data.menu.SetSelection(Component<ScrollableWindowComponent>(data.menu.GetType(),"Game Files List")->GetComponents()[0],true);
}
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")->Disable();
Component<ScrollableWindowComponent>(data.menu.GetType(),"Online Game Files List")->Enable();
Component<MenuComponent>(data.menu.GetType(),"Offline Character Tab")->SetSelected(false);
SoundEffect::PlaySFX("Button Click",SoundEffect::CENTERED);
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);
}
return true;
},ButtonAttr::FIT_TO_LABEL)END;
onlineCharacterTab->SetSelectionType(HIGHLIGHT);
SaveFile::SetOnlineMode(true);
}
if(Component<ScrollableWindowComponent>(data.menu.GetType(),"Online Game Files List")->GetComponents().size()>0){
data.menu.SetSelection(Component<ScrollableWindowComponent>(data.menu.GetType(),"Online Game Files List")->GetComponents()[0],true);
}
return true;
},ButtonAttr::FIT_TO_LABEL)END;
onlineCharacterTab->SetSelectionType(HIGHLIGHT);
#ifndef __EMSCRIPTEN__
offlineCharacterTab->Disable();
onlineCharacterTab->Disable();
#endif
#pragma region Keyboard Navigation Rules
@ -86,9 +95,19 @@ void Menu::InitializeLoadGameWindow(){
[](MenuType type,Data&returnData){ //On Open
if(SaveFile::GetSaveFileCount()>0||SaveFile::GetOnlineSaveFileCount()>0){
if(SaveFile::IsOnline()){
returnData=Component<ScrollableWindowComponent>(type,"Online Game Files List")->GetComponents()[0];
if(Component<ScrollableWindowComponent>(type,"Online Game Files List")->GetComponents().size()>0){
Menu::menus[type]->SetSelection(Component<ScrollableWindowComponent>(type,"Online Game Files List")->GetComponents()[0],true);
returnData=Menu::menus[type]->GetSelection();
}else{
returnData="Go Back Button";
}
}else{
returnData=Component<ScrollableWindowComponent>(type,"Game Files List")->GetComponents()[0];
if(Component<ScrollableWindowComponent>(type,"Game Files List")->GetComponents().size()>0){
Menu::menus[type]->SetSelection(Component<ScrollableWindowComponent>(type,"Game Files List")->GetComponents()[0],true);
returnData=Menu::menus[type]->GetSelection();
}else{
returnData="Go Back Button";
}
}
}else{
returnData="Go Back Button";
@ -98,6 +117,21 @@ void Menu::InitializeLoadGameWindow(){
{{game->KEY_BACK},{"Back to Title Screen",[](MenuType type){
Component<MenuComponent>(type,"Go Back Button")->Click();
}}},
#ifdef __EMSCRIPTEN__
{{game->KEY_FACELEFT},{[](MenuFuncData data){
if(Component<MenuComponent>(data.menu.GetType(),"Offline Character Tab")->selected){
return "Online Characters";
}else{
return "Offline Characters";
}
},[](MenuType type){
if(Component<MenuComponent>(type,"Offline Character Tab")->selected){
Component<MenuComponent>(type,"Online Character Tab")->Click();
}else{
Component<MenuComponent>(type,"Offline Character Tab")->Click();
}
}}},
#endif
{{game->KEY_CONFIRM},{"Load",[](MenuType type){}}},
{{game->KEY_SCROLLVERT,Analog},{"Scroll",[](MenuType type){}}},
{{game->KEY_SHOULDER,Pressed},{"Scroll",[](MenuType type){}}},
@ -131,26 +165,187 @@ void Menu::InitializeLoadGameWindow(){
}else{
returnData=*(++component);
}
},}},
},
#ifdef __EMSCRIPTEN__
.left=[](MenuType type,Data&returnData){
Component<MenuComponent>(type,"Online Character Tab")->Click();
if(Menu::menus[type]->GetSelection().expired()){
returnData="Go Back Button";
}else{
returnData=Menu::menus[type]->GetSelection();
}
},
.right=[](MenuType type,Data&returnData){
Component<MenuComponent>(type,"Online Character Tab")->Click();
if(Menu::menus[type]->GetSelection().expired()){
returnData="Go Back Button";
}else{
returnData=Menu::menus[type]->GetSelection();
}
},
#endif
}},
{"Online Game Files List",{
.up=[](MenuType type,Data&returnData){
auto&selection=Menu::menus[type]->GetSelection();
auto&gameFilesList=Component<ScrollableWindowComponent>(type,"Online Game Files List")->GetComponents();
auto component=std::find_if(gameFilesList.begin(),gameFilesList.end(),[&](auto&comp){return comp.lock()==selection.lock();});
if(component==gameFilesList.begin()){
returnData="Go Back Button";
}else{
returnData=*(--component);
}
},
.down=[](MenuType type,Data&returnData){
auto&selection=Menu::menus[type]->GetSelection();
auto&gameFilesList=Component<ScrollableWindowComponent>(type,"Online Game Files List")->GetComponents();
auto component=std::find_if(gameFilesList.begin(),gameFilesList.end(),[&](auto&comp){return comp.lock()==selection.lock();});
if(component==gameFilesList.end()-1){
returnData="Go Back Button";
}else{
returnData=*(++component);
}
},
#ifdef __EMSCRIPTEN__
.left=[](MenuType type,Data&returnData){
Component<MenuComponent>(type,"Offline Character Tab")->Click();
if(Menu::menus[type]->GetSelection().expired()){
returnData="Go Back Button";
}else{
returnData=Menu::menus[type]->GetSelection();
}
},
.right=[](MenuType type,Data&returnData){
Component<MenuComponent>(type,"Offline Character Tab")->Click();
if(Menu::menus[type]->GetSelection().expired()){
returnData="Go Back Button";
}else{
returnData=Menu::menus[type]->GetSelection();
}
},
#endif
}},
{"Go Back Button",{
.up=[](MenuType type,Data&returnData){
auto&selection=Menu::menus[type]->GetSelection();
auto&gameFilesList=Component<ScrollableWindowComponent>(type,"Game Files List")->GetComponents();
if(gameFilesList.size()==0){
std::vector<std::weak_ptr<MenuComponent>>*gameFilesList=&Component<ScrollableWindowComponent>(type,"Game Files List")->GetComponents();
if(!Component<MenuComponent>(type,"Offline Character Tab")->selected){
gameFilesList=&Component<ScrollableWindowComponent>(type,"Online Game Files List")->GetComponents();
}
if(gameFilesList->size()==0){
returnData="Go Back Button";
return;
}
returnData=*(gameFilesList.end()-1);
returnData=*(gameFilesList->end()-1);
},
.down=[](MenuType type,Data&returnData){
auto&selection=Menu::menus[type]->GetSelection();
auto&gameFilesList=Component<ScrollableWindowComponent>(type,"Game Files List")->GetComponents();
if(gameFilesList.size()==0){
std::vector<std::weak_ptr<MenuComponent>>*gameFilesList=&Component<ScrollableWindowComponent>(type,"Game Files List")->GetComponents();
if(!Component<MenuComponent>(type,"Offline Character Tab")->selected){
gameFilesList=&Component<ScrollableWindowComponent>(type,"Online Game Files List")->GetComponents();
}
if(gameFilesList->size()==0){
returnData="Go Back Button";
return;
}
returnData=*(gameFilesList->begin());
},
#ifdef __EMSCRIPTEN__
.left=[](MenuType type,Data&returnData){
if(!Component<MenuComponent>(type,"Offline Character Tab")->selected){
Component<MenuComponent>(type,"Offline Character Tab")->Click();
}else{
Component<MenuComponent>(type,"Online Character Tab")->Click();
}
if(Menu::menus[type]->GetSelection().expired()){
returnData="Go Back Button";
}else{
returnData=Menu::menus[type]->GetSelection();
}
},
.right=[](MenuType type,Data&returnData){
if(!Component<MenuComponent>(type,"Offline Character Tab")->selected){
Component<MenuComponent>(type,"Offline Character Tab")->Click();
}else{
Component<MenuComponent>(type,"Online Character Tab")->Click();
}
if(Menu::menus[type]->GetSelection().expired()){
returnData="Go Back Button";
}else{
returnData=Menu::menus[type]->GetSelection();
}
},
#endif
}},
{"Offline Character Tab",{
.up=[](MenuType type,Data&returnData){
returnData="Go Back Button";
},
.down=[](MenuType type,Data&returnData){
auto&selection=Menu::menus[type]->GetSelection();
std::vector<std::weak_ptr<MenuComponent>>*gameFilesList=&Component<ScrollableWindowComponent>(type,"Game Files List")->GetComponents();
if(!Component<MenuComponent>(type,"Offline Character Tab")->selected){
gameFilesList=&Component<ScrollableWindowComponent>(type,"Online Game Files List")->GetComponents();
}
if(gameFilesList->size()==0){
returnData="Go Back Button";
return;
}
returnData=*(gameFilesList.begin());
returnData=*(gameFilesList->begin());
},
#ifdef __EMSCRIPTEN__
.left=[](MenuType type,Data&returnData){
Component<MenuComponent>(type,"Online Character Tab")->Click();
if(Menu::menus[type]->GetSelection().expired()){
returnData="Go Back Button";
}else{
returnData=Menu::menus[type]->GetSelection();
}
},
.right=[](MenuType type,Data&returnData){
Component<MenuComponent>(type,"Online Character Tab")->Click();
if(Menu::menus[type]->GetSelection().expired()){
returnData="Go Back Button";
}else{
returnData=Menu::menus[type]->GetSelection();
}
},
#endif
}},
{"Online Character Tab",{
.up=[](MenuType type,Data&returnData){
returnData="Go Back Button";
},
.down=[](MenuType type,Data&returnData){
auto&selection=Menu::menus[type]->GetSelection();
std::vector<std::weak_ptr<MenuComponent>>*gameFilesList=&Component<ScrollableWindowComponent>(type,"Game Files List")->GetComponents();
if(!Component<MenuComponent>(type,"Offline Character Tab")->selected){
gameFilesList=&Component<ScrollableWindowComponent>(type,"Online Game Files List")->GetComponents();
}
if(gameFilesList->size()==0){
returnData="Go Back Button";
return;
}
returnData=*(gameFilesList->begin());
},
#ifdef __EMSCRIPTEN__
.left=[](MenuType type,Data&returnData){
Component<MenuComponent>(type,"Offline Character Tab")->Click();
if(Menu::menus[type]->GetSelection().expired()){
returnData="Go Back Button";
}else{
returnData=Menu::menus[type]->GetSelection();
}
},
.right=[](MenuType type,Data&returnData){
Component<MenuComponent>(type,"Offline Character Tab")->Click();
if(Menu::menus[type]->GetSelection().expired()){
returnData="Go Back Button";
}else{
returnData=Menu::menus[type]->GetSelection();
}
},
#endif
}},
});
#pragma endregion

@ -41,7 +41,7 @@ enum MenuType{
///////////////////////////////////////////////////////////
/*DO NOT REMOVE!!*/ENUM_START,///////////////////////////////
///////////////////////////////////////////////////////////
// 64% Controller Compatibility. (100 total items, 4 items per menu * 25 menus)
// 69% Controller Compatibility. (100 total items, 4 items per menu * 25 menus)
INVENTORY_CONSUMABLES, //100% Controller Compatibility
CLASS_INFO, //100% Controller Compatibility
CLASS_SELECTION, //100% Controller Compatibility
@ -60,7 +60,7 @@ enum MenuType{
CRAFT_CONSUMABLE, //100% Controller Compatibility
CONSUMABLE_CRAFT_ITEM, //100% Controller Compatibility
SAVE_FILE_NAME, //100% Controller Compatibility
LOAD_GAME, //75% Controller Compatibility - Online Mode Tab switching
LOAD_GAME, //100% Controller Compatibility - Online Mode Tab switching
USER_ID, //0% Controller Compatibility
SETTINGS, //0% Controller Compatibility
SHERMAN, //0% Controller Compatibility

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 0
#define VERSION_MINOR 3
#define VERSION_PATCH 0
#define VERSION_BUILD 7299
#define VERSION_BUILD 7300
#define stringify(a) stringify_(a)
#define stringify_(a) #a

Loading…
Cancel
Save