Arreglado el login online
This commit is contained in:
@@ -730,15 +730,13 @@ void Director::initOnline()
|
||||
|
||||
if (options->online.jailerID == "")
|
||||
{ // Jailer ID no definido
|
||||
|
||||
options->online.enabled = false;
|
||||
}
|
||||
else
|
||||
{ // Jailer ID iniciado
|
||||
|
||||
options->online.enabled = options->online.sessionEnabled = true;
|
||||
// Establece el servidor y el puerto
|
||||
jscore::init(options->online.server, options->online.port);
|
||||
|
||||
#ifdef DEBUG
|
||||
const std::string caption = options->online.jailerID + " IS LOGGED IN (DEBUG)";
|
||||
#else
|
||||
@@ -749,9 +747,38 @@ void Director::initOnline()
|
||||
{
|
||||
std::cout << caption << std::endl;
|
||||
}
|
||||
|
||||
// Obtiene la información de puntuaciones online
|
||||
if (!jscore::initOnlineScore(options->online.gameID))
|
||||
{
|
||||
screen->showNotification("Fallo al conectar a " + options->online.server);
|
||||
if (options->console)
|
||||
{
|
||||
std::cout << "Fallo al conectar a " << options->online.server << std::endl;
|
||||
}
|
||||
|
||||
options->online.enabled = false;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Obten la puntuación online para el jailerID
|
||||
const int points = jscore::getUserPoints(options->online.gameID, options->online.jailerID);
|
||||
if (points == 0)
|
||||
{ // Fallo de conexión o no hay registros
|
||||
screen->showNotification("No se ha podido obtener la puntuacion online");
|
||||
if (options->console)
|
||||
{
|
||||
std::cout << "No se ha podido obtener la puntuacion online" << std::endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
options->online.score = points;
|
||||
}
|
||||
}
|
||||
|
||||
// OLD
|
||||
/* OLD
|
||||
|
||||
if (!options->online.enabled)
|
||||
{
|
||||
@@ -810,6 +837,7 @@ void Director::initOnline()
|
||||
options->online.score = points;
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
// Asigna variables a partir de dos cadenas
|
||||
@@ -818,6 +846,7 @@ bool Director::setOptions(options_t *options, std::string var, std::string value
|
||||
// Indicador de éxito en la asignación
|
||||
bool success = true;
|
||||
|
||||
// Opciones de video
|
||||
if (var == "videoMode")
|
||||
{
|
||||
if (value == "SDL_WINDOW_FULLSCREEN_DESKTOP")
|
||||
@@ -885,6 +914,7 @@ bool Director::setOptions(options_t *options, std::string var, std::string value
|
||||
options->borderHeight = std::stoi(value);
|
||||
}
|
||||
|
||||
// Opciones varias
|
||||
else if (var == "language")
|
||||
{
|
||||
options->language = std::stoi(value);
|
||||
@@ -905,6 +935,7 @@ bool Director::setOptions(options_t *options, std::string var, std::string value
|
||||
options->input[1].deviceType = std::stoi(value);
|
||||
}
|
||||
|
||||
// Opciones onlince
|
||||
else if (var == "enabled")
|
||||
{
|
||||
options->online.enabled = stringToBool(value);
|
||||
@@ -929,6 +960,7 @@ bool Director::setOptions(options_t *options, std::string var, std::string value
|
||||
options->online.jailerID = value;
|
||||
}
|
||||
|
||||
// Opciones de notificaciones
|
||||
else if (var == "notifications.posH")
|
||||
{
|
||||
if (value == "pos_left")
|
||||
@@ -962,6 +994,7 @@ bool Director::setOptions(options_t *options, std::string var, std::string value
|
||||
options->notifications.sound = stringToBool(value);
|
||||
}
|
||||
|
||||
// Lineas vacias o que empiezan por comentario
|
||||
else if (var == "" || var.substr(0, 1) == "#")
|
||||
{
|
||||
}
|
||||
|
||||
@@ -777,7 +777,7 @@ bool Game::sendOnlineScore()
|
||||
return true;
|
||||
}
|
||||
|
||||
if (jscore::updateUserPoints("coffee_crisis", options->online.jailerID, score))
|
||||
if (jscore::updateUserPoints(options->online.gameID, options->online.jailerID, score))
|
||||
{
|
||||
options->online.score = score;
|
||||
screen->showNotification("PUNTUACION ENVIADA: " + std::to_string(score) + " PUNTOS");
|
||||
@@ -1732,8 +1732,15 @@ void Game::renderScoreBoard()
|
||||
textScoreBoard->writeCentered(PLAY_AREA_CENTER_X, offset3, lang->getText(56));
|
||||
if (options->online.enabled)
|
||||
{
|
||||
const std::string txt = jscore::getUserName(0) + " - " + updateScoreText((Uint32)jscore::getPoints(0));
|
||||
textScoreBoard->writeCentered(PLAY_AREA_CENTER_X, offset4, txt);
|
||||
if (jscore::getNumUsers() > 0)
|
||||
{
|
||||
const std::string txt = jscore::getUserName(0) + " - " + updateScoreText((Uint32)jscore::getPoints(0));
|
||||
textScoreBoard->writeCentered(PLAY_AREA_CENTER_X, offset4, txt);
|
||||
}
|
||||
else
|
||||
{
|
||||
textScoreBoard->writeCentered(PLAY_AREA_CENTER_X, offset4, "Bacteriol - 0000010");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -117,9 +117,6 @@ void Logo::update()
|
||||
// Actualiza el contador
|
||||
counter++;
|
||||
|
||||
if (counter == 1)
|
||||
screen->showNotification("hola");
|
||||
|
||||
// Comprueba si ha terminado el logo
|
||||
checkLogoEnd();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user