Trabajando en la sección EnterID

This commit is contained in:
2022-11-23 09:54:08 +01:00
parent c955543d31
commit c71adfbac4
12 changed files with 332 additions and 21 deletions

View File

@@ -84,16 +84,22 @@ Director::~Director()
// Inicializa los servicios online
void Director::initOnline()
{
if (!options->online.enabled)
{
return;
}
//if (!options->online.enabled)
//{
// return;
//}
options->online.enabled = true;
// Obten el Jailer ID
if (options->online.jailerID == "")
{ // Jailer ID no definido
screen->showText("No ha especificado ningun Jailer ID");
std::cout << "No ha especificado ningun Jailer ID" << std::endl;
if (options->console)
{
std::cout << "No ha especificado ningun Jailer ID" << std::endl;
}
options->online.enabled = false;
}
else
{ // Jailer ID iniciado
@@ -105,12 +111,18 @@ void Director::initOnline()
if (jscore::initOnlineScore(options->online.gameID))
{
screen->showText(options->online.jailerID + " ha iniciado sesion");
std::cout << options->online.jailerID << " ha iniciado sesion" << std::endl;
if (options->console)
{
std::cout << options->online.jailerID << " ha iniciado sesion" << std::endl;
}
}
else
{
screen->showText("Fallo al conectar a " + options->online.server);
std::cout << "Fallo al conectar a " << options->online.server << std::endl;
if (options->console)
{
std::cout << "Fallo al conectar a " << options->online.server << std::endl;
}
options->online.enabled = false;
@@ -358,9 +370,9 @@ void Director::createSystemFolder()
#endif
#ifdef _WIN32
systemFolder = std::string(getenv("APPDATA")) + "/" + folderName;
systemFolder = std::string(getenv("APPDATA")) + "/" + folderName;
#elif __APPLE__
struct passwd *pw = getpwuid(getuid());
struct passwd *pw = getpwuid(getuid());
const char *homedir = pw->pw_dir;
systemFolder = std::string(homedir) + "/Library/Application Support/" + folderName;
#elif __linux__
@@ -386,15 +398,15 @@ void Director::createSystemFolder()
case EACCES:
printf("the parent directory does not allow write");
exit(EXIT_FAILURE);
case EEXIST:
printf("pathname already exists");
exit(EXIT_FAILURE);
case ENAMETOOLONG:
printf("pathname is too long");
exit(EXIT_FAILURE);
default:
perror("mkdir");
exit(EXIT_FAILURE);
@@ -1647,6 +1659,20 @@ void Director::runDemo()
resource->free();
}
// Ejecuta la seccion en la que se solicita al usuario su ID online
void Director::runEnterID()
{
if (options->console)
{
std::cout << "\n* SECTION: ENTER_ID" << std::endl;
}
// loadResources(section);
enterID = new EnterID(renderer, screen, asset, options);
setSection(enterID->run());
delete enterID;
resource->free();
}
// Ejecuta la seccion del final del juego
void Director::runEnding()
{
@@ -1731,6 +1757,10 @@ void Director::run()
runDemo();
break;
case SECTION_PROG_ENTER_ID:
runEnterID();
break;
case SECTION_PROG_GAME:
runGame();
break;