summaryrefslogtreecommitdiff
path: root/core/src/kz/ilotterytea/maxon/screens
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2024-10-13 02:11:57 +0500
committerilotterytea <iltsu@alright.party>2024-10-13 02:11:57 +0500
commit5f7fe3ba5d607de0ca0589f37db0574837858dd5 (patch)
tree7d0b20efc0a988e832288a9e5cc8792dc2866d3c /core/src/kz/ilotterytea/maxon/screens
parentc5ee68a647871ca7bc8044a96759e7c00f9188db (diff)
upd: game updater now checks from assets url
Diffstat (limited to 'core/src/kz/ilotterytea/maxon/screens')
-rw-r--r--core/src/kz/ilotterytea/maxon/screens/MenuScreen.java24
1 files changed, 24 insertions, 0 deletions
diff --git a/core/src/kz/ilotterytea/maxon/screens/MenuScreen.java b/core/src/kz/ilotterytea/maxon/screens/MenuScreen.java
index 3158d67..1e15032 100644
--- a/core/src/kz/ilotterytea/maxon/screens/MenuScreen.java
+++ b/core/src/kz/ilotterytea/maxon/screens/MenuScreen.java
@@ -20,10 +20,12 @@ import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.utils.Align;
import com.badlogic.gdx.utils.Timer;
import com.badlogic.gdx.utils.viewport.ScreenViewport;
+import de.tomgrill.gdxdialogs.core.dialogs.GDXButtonDialog;
import kz.ilotterytea.maxon.MaxonConstants;
import kz.ilotterytea.maxon.MaxonGame;
import kz.ilotterytea.maxon.player.Savegame;
import kz.ilotterytea.maxon.ui.*;
+import kz.ilotterytea.maxon.utils.GameUpdater;
import kz.ilotterytea.maxon.utils.I18N;
import kz.ilotterytea.maxon.utils.OsUtils;
import net.mgsx.gltf.scene3d.attributes.PBRCubemapAttribute;
@@ -51,9 +53,31 @@ public class MenuScreen implements Screen {
private final ArrayList<Timer.Task> tasks = new ArrayList<>();
private Sound clickSound;
+ private static boolean suggestedUpdate = false;
+
public MenuScreen() {
this.game = MaxonGame.getInstance();
+ // Suggest an update
+ if (!GameUpdater.CLIENT_IS_ON_LATEST_VERSION && !suggestedUpdate) {
+ GDXButtonDialog bDialog = game.getDialogWindows().newDialog(GDXButtonDialog.class);
+
+ bDialog.setTitle(game.locale.TranslatableText("updater.title"));
+ bDialog.setMessage(game.locale.TranslatableText("updater.message"));
+
+ bDialog.setClickListener(button -> {
+ if (button == 1) {
+ Gdx.net.openURI(MaxonConstants.GAME_APP_URL);
+ }
+ });
+
+ bDialog.addButton(game.locale.TranslatableText("updater.no"));
+ bDialog.addButton(game.locale.TranslatableText("updater.yes"));
+
+ bDialog.build().show();
+ suggestedUpdate = true;
+ }
+
// Stage and skin:
this.stage = new Stage(new ScreenViewport());
this.stage.addAction(Actions.sequence(Actions.alpha(0.0f), Actions.alpha(1.0f, 1f)));