Ya se puede cambiar el jailerID desde el menu de opciones
This commit is contained in:
@@ -32,6 +32,7 @@ EnterID::EnterID(SDL_Renderer *renderer, Screen *screen, Asset *asset, Lang *lan
|
||||
SDL_SetTextureBlendMode(textTexture, SDL_BLENDMODE_BLEND);
|
||||
|
||||
// Inicializa variables
|
||||
oldJailerID = options->online.jailerID;
|
||||
loopRunning = true;
|
||||
counter = 0;
|
||||
ticks = 0;
|
||||
@@ -75,8 +76,8 @@ void EnterID::checkEvents()
|
||||
break;
|
||||
}
|
||||
|
||||
// El ENTER solo se comprueba cuando se suelta, para no saltarse la siguiente sección
|
||||
if ((eventHandler->type == SDL_KEYUP && eventHandler->key.repeat == 0) || (eventHandler->type == SDL_JOYBUTTONUP))
|
||||
// Comprueba las teclas que se han pulsado
|
||||
if ((eventHandler->type == SDL_KEYDOWN && eventHandler->key.repeat == 0) || (eventHandler->type == SDL_JOYBUTTONDOWN))
|
||||
{
|
||||
if (eventHandler->key.keysym.scancode == SDL_SCANCODE_RETURN)
|
||||
{
|
||||
@@ -84,11 +85,7 @@ void EnterID::checkEvents()
|
||||
endSection();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Comprueba las teclas que se han pulsado
|
||||
if ((eventHandler->type == SDL_KEYDOWN && eventHandler->key.repeat == 0) || (eventHandler->type == SDL_JOYBUTTONDOWN))
|
||||
{
|
||||
if (eventHandler->key.keysym.scancode >= SDL_SCANCODE_A && eventHandler->key.keysym.scancode <= SDL_SCANCODE_Z)
|
||||
{ // Si pulsa una letra
|
||||
if (pos < maxLenght)
|
||||
@@ -256,60 +253,65 @@ void EnterID::fillTexture()
|
||||
// Inicializa los servicios online
|
||||
void EnterID::initOnline()
|
||||
{
|
||||
// Si ya ha iniciado la sesión y no ha cambiado el jailerID, que no continue
|
||||
if (options->online.sessionEnabled)
|
||||
{ // Si ya ha iniciado la sesión, que no continue
|
||||
return;
|
||||
}
|
||||
{
|
||||
if (oldJailerID == options->online.jailerID)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
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 + " (DEBUG)";
|
||||
const std::string caption = options->online.jailerID + " (DEBUG)";
|
||||
#else
|
||||
const std::string caption = options->online.jailerID;
|
||||
const std::string caption = options->online.jailerID;
|
||||
#endif
|
||||
screen->showNotification(caption, lang->getText(85), 12);
|
||||
if (options->console)
|
||||
{
|
||||
std::cout << caption << std::endl;
|
||||
}
|
||||
//screen->showNotification(caption, lang->getText(85), 12);
|
||||
screen->showNotification(caption, lang->getText(85));
|
||||
if (options->console)
|
||||
{
|
||||
std::cout << caption << std::endl;
|
||||
}
|
||||
|
||||
// Obtiene la información de puntuaciones online
|
||||
if (!jscore::initOnlineScore(options->online.gameID))
|
||||
{
|
||||
screen->showNotification(lang->getText(80), options->online.server);
|
||||
if (options->console)
|
||||
{
|
||||
std::cout << "Can't connect to " << options->online.server << std::endl;
|
||||
}
|
||||
// Obtiene la información de puntuaciones online
|
||||
if (!jscore::initOnlineScore(options->online.gameID))
|
||||
{
|
||||
screen->showNotification(lang->getText(80), options->online.server);
|
||||
if (options->console)
|
||||
{
|
||||
std::cout << "Can't connect to " << options->online.server << std::endl;
|
||||
}
|
||||
|
||||
options->online.enabled = false;
|
||||
options->online.enabled = false;
|
||||
|
||||
return;
|
||||
}
|
||||
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(lang->getText(81), lang->getText(82));
|
||||
if (options->console)
|
||||
{
|
||||
std::cout << "Can't get online scores" << std::endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
options->online.score = points;
|
||||
}
|
||||
}
|
||||
// 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(lang->getText(81), lang->getText(82));
|
||||
if (options->console)
|
||||
{
|
||||
std::cout << "Can't get online scores" << std::endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
options->online.score = points;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Termina la sección
|
||||
|
||||
Reference in New Issue
Block a user