diff options
| -rw-r--r-- | core/src/kz/ilotterytea/maxon/MaxonGame.java | 10 | ||||
| -rw-r--r-- | core/src/kz/ilotterytea/maxon/screens/MenuScreen.java | 6 | ||||
| -rw-r--r-- | core/src/kz/ilotterytea/maxon/session/IdentityClient.java (renamed from core/src/kz/ilotterytea/maxon/session/SessionClient.java) | 20 |
3 files changed, 18 insertions, 18 deletions
diff --git a/core/src/kz/ilotterytea/maxon/MaxonGame.java b/core/src/kz/ilotterytea/maxon/MaxonGame.java index b53c510..8986de9 100644 --- a/core/src/kz/ilotterytea/maxon/MaxonGame.java +++ b/core/src/kz/ilotterytea/maxon/MaxonGame.java @@ -8,7 +8,7 @@ import com.badlogic.gdx.graphics.g2d.SpriteBatch; import kz.ilotterytea.maxon.localization.LocalizationManager; import kz.ilotterytea.maxon.pets.PetManager; import kz.ilotterytea.maxon.screens.SplashScreen; -import kz.ilotterytea.maxon.session.SessionClient; +import kz.ilotterytea.maxon.session.IdentityClient; import kz.ilotterytea.maxon.utils.GameUpdater; public class MaxonGame extends Game { @@ -20,7 +20,7 @@ public class MaxonGame extends Game { private PetManager petManager; private DiscordActivityClient discordActivityClient; - private SessionClient sessionClient; + private IdentityClient identityClient; private static MaxonGame instance; @@ -39,8 +39,8 @@ public class MaxonGame extends Game { return discordActivityClient; } - public SessionClient getSessionClient() { - return sessionClient; + public IdentityClient getIdentityClient() { + return identityClient; } public LocalizationManager getLocale() { @@ -56,7 +56,7 @@ public class MaxonGame extends Game { // Check the latest version new GameUpdater().checkLatestUpdate(); - sessionClient = new SessionClient(Gdx.app.getPreferences("kz.ilotterytea.SigninSession")); + identityClient = new IdentityClient(Gdx.app.getPreferences("kz.ilotterytea.SigninIdentity")); batch = new SpriteBatch(); prefs = Gdx.app.getPreferences(MaxonConstants.GAME_APP_PACKAGE); locale = new LocalizationManager(Gdx.files.internal("i18n/" + prefs.getString("lang", "en_us") + ".json")); diff --git a/core/src/kz/ilotterytea/maxon/screens/MenuScreen.java b/core/src/kz/ilotterytea/maxon/screens/MenuScreen.java index ec60b33..0cf096d 100644 --- a/core/src/kz/ilotterytea/maxon/screens/MenuScreen.java +++ b/core/src/kz/ilotterytea/maxon/screens/MenuScreen.java @@ -28,7 +28,7 @@ import kz.ilotterytea.maxon.constants.SettingsConstants; import kz.ilotterytea.maxon.localization.LineId; import kz.ilotterytea.maxon.localization.LocalizationManager; import kz.ilotterytea.maxon.player.Savegame; -import kz.ilotterytea.maxon.session.SessionClient; +import kz.ilotterytea.maxon.session.IdentityClient; import kz.ilotterytea.maxon.ui.DebugWidget; import kz.ilotterytea.maxon.ui.SavegameWidget; import kz.ilotterytea.maxon.ui.ShakingImageButton; @@ -407,7 +407,7 @@ public class MenuScreen implements Screen { stage.draw(); // Login button logic - SessionClient session = game.getSessionClient(); + IdentityClient session = game.getIdentityClient(); if (!session.isProcessing() && !session.isAuthorised() && !loginButton.getText().equals(game.getLocale().getLine(LineId.LoginButton))) { loginButton.setText(game.getLocale().getLine(LineId.LoginButton)); loginButton.clearListeners(); @@ -850,7 +850,7 @@ public class MenuScreen implements Screen { @Override public void clicked(InputEvent event, float x, float y) { super.clicked(event, x, y); - MaxonGame.getInstance().getSessionClient().authorize(usernameField.getText(), passwords[0]); + MaxonGame.getInstance().getIdentityClient().authorize(usernameField.getText(), passwords[0]); loginButton.setText(game.getLocale().getLine(LineId.LoginProcessing)); loginButton.setDisabled(true); // maybe we could somehow fire the close button instead of cv pasting diff --git a/core/src/kz/ilotterytea/maxon/session/SessionClient.java b/core/src/kz/ilotterytea/maxon/session/IdentityClient.java index 31edd6e..570b16b 100644 --- a/core/src/kz/ilotterytea/maxon/session/SessionClient.java +++ b/core/src/kz/ilotterytea/maxon/session/IdentityClient.java @@ -14,7 +14,7 @@ import kz.ilotterytea.maxon.utils.RandomUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class SessionClient { +public class IdentityClient { private final Logger log; private final Preferences sessionPreferences; @@ -23,9 +23,9 @@ public class SessionClient { private String userId, username, password; private boolean isProcessing, isAuthorised; - public SessionClient(Preferences sessionPreferences) { + public IdentityClient(Preferences sessionPreferences) { startValidationThread(); - this.log = LoggerFactory.getLogger(SessionClient.class); + this.log = LoggerFactory.getLogger(IdentityClient.class); this.clientToken = RandomUtils.generateRandomString(); this.sessionPreferences = sessionPreferences; @@ -67,7 +67,7 @@ public class SessionClient { Gdx.net.sendHttpRequest(request, new Net.HttpResponseListener() { @Override public void handleHttpResponse(Net.HttpResponse httpResponse) { - SessionClient.this.isProcessing = false; + IdentityClient.this.isProcessing = false; try { JsonValue json = new JsonReader().parse(httpResponse.getResultAsString()); @@ -84,12 +84,12 @@ public class SessionClient { return; } - SessionClient.this.username = username; - SessionClient.this.password = password; - SessionClient.this.accessToken = json.get("data").getString("accessToken"); - SessionClient.this.userId = String.valueOf(json.get("data").get("user").getInt("id")); - SessionClient.this.isAuthorised = true; - log.info("Successfully authorised! Welcome back, {}!", SessionClient.this.username); + IdentityClient.this.username = username; + IdentityClient.this.password = password; + IdentityClient.this.accessToken = json.get("data").getString("accessToken"); + IdentityClient.this.userId = String.valueOf(json.get("data").get("user").getInt("id")); + IdentityClient.this.isAuthorised = true; + log.info("Successfully authorised! Welcome back, {}!", IdentityClient.this.username); } catch (Exception e) { log.error("An exception was thrown while authorising", e); } |
