Arreglado el login online
This commit is contained in:
@@ -730,15 +730,13 @@ void Director::initOnline()
|
|||||||
|
|
||||||
if (options->online.jailerID == "")
|
if (options->online.jailerID == "")
|
||||||
{ // Jailer ID no definido
|
{ // Jailer ID no definido
|
||||||
|
|
||||||
options->online.enabled = false;
|
options->online.enabled = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // Jailer ID iniciado
|
{ // Jailer ID iniciado
|
||||||
|
|
||||||
options->online.enabled = options->online.sessionEnabled = true;
|
options->online.enabled = options->online.sessionEnabled = true;
|
||||||
|
// Establece el servidor y el puerto
|
||||||
jscore::init(options->online.server, options->online.port);
|
jscore::init(options->online.server, options->online.port);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
const std::string caption = options->online.jailerID + " IS LOGGED IN (DEBUG)";
|
const std::string caption = options->online.jailerID + " IS LOGGED IN (DEBUG)";
|
||||||
#else
|
#else
|
||||||
@@ -749,9 +747,38 @@ void Director::initOnline()
|
|||||||
{
|
{
|
||||||
std::cout << caption << std::endl;
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
// OLD
|
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
|
||||||
|
|
||||||
if (!options->online.enabled)
|
if (!options->online.enabled)
|
||||||
{
|
{
|
||||||
@@ -810,6 +837,7 @@ void Director::initOnline()
|
|||||||
options->online.score = points;
|
options->online.score = points;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
// Asigna variables a partir de dos cadenas
|
// 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
|
// Indicador de éxito en la asignación
|
||||||
bool success = true;
|
bool success = true;
|
||||||
|
|
||||||
|
// Opciones de video
|
||||||
if (var == "videoMode")
|
if (var == "videoMode")
|
||||||
{
|
{
|
||||||
if (value == "SDL_WINDOW_FULLSCREEN_DESKTOP")
|
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);
|
options->borderHeight = std::stoi(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Opciones varias
|
||||||
else if (var == "language")
|
else if (var == "language")
|
||||||
{
|
{
|
||||||
options->language = std::stoi(value);
|
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);
|
options->input[1].deviceType = std::stoi(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Opciones onlince
|
||||||
else if (var == "enabled")
|
else if (var == "enabled")
|
||||||
{
|
{
|
||||||
options->online.enabled = stringToBool(value);
|
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;
|
options->online.jailerID = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Opciones de notificaciones
|
||||||
else if (var == "notifications.posH")
|
else if (var == "notifications.posH")
|
||||||
{
|
{
|
||||||
if (value == "pos_left")
|
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);
|
options->notifications.sound = stringToBool(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Lineas vacias o que empiezan por comentario
|
||||||
else if (var == "" || var.substr(0, 1) == "#")
|
else if (var == "" || var.substr(0, 1) == "#")
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -777,7 +777,7 @@ bool Game::sendOnlineScore()
|
|||||||
return true;
|
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;
|
options->online.score = score;
|
||||||
screen->showNotification("PUNTUACION ENVIADA: " + std::to_string(score) + " PUNTOS");
|
screen->showNotification("PUNTUACION ENVIADA: " + std::to_string(score) + " PUNTOS");
|
||||||
@@ -1731,11 +1731,18 @@ void Game::renderScoreBoard()
|
|||||||
// HI-SCORE
|
// HI-SCORE
|
||||||
textScoreBoard->writeCentered(PLAY_AREA_CENTER_X, offset3, lang->getText(56));
|
textScoreBoard->writeCentered(PLAY_AREA_CENTER_X, offset3, lang->getText(56));
|
||||||
if (options->online.enabled)
|
if (options->online.enabled)
|
||||||
|
{
|
||||||
|
if (jscore::getNumUsers() > 0)
|
||||||
{
|
{
|
||||||
const std::string txt = jscore::getUserName(0) + " - " + updateScoreText((Uint32)jscore::getPoints(0));
|
const std::string txt = jscore::getUserName(0) + " - " + updateScoreText((Uint32)jscore::getPoints(0));
|
||||||
textScoreBoard->writeCentered(PLAY_AREA_CENTER_X, offset4, txt);
|
textScoreBoard->writeCentered(PLAY_AREA_CENTER_X, offset4, txt);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
textScoreBoard->writeCentered(PLAY_AREA_CENTER_X, offset4, "Bacteriol - 0000010");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
textScoreBoard->writeCentered(PLAY_AREA_CENTER_X, offset4, updateScoreText(hiScore));
|
textScoreBoard->writeCentered(PLAY_AREA_CENTER_X, offset4, updateScoreText(hiScore));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,9 +117,6 @@ void Logo::update()
|
|||||||
// Actualiza el contador
|
// Actualiza el contador
|
||||||
counter++;
|
counter++;
|
||||||
|
|
||||||
if (counter == 1)
|
|
||||||
screen->showNotification("hola");
|
|
||||||
|
|
||||||
// Comprueba si ha terminado el logo
|
// Comprueba si ha terminado el logo
|
||||||
checkLogoEnd();
|
checkLogoEnd();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user