From 5f7fe3ba5d607de0ca0589f37db0574837858dd5 Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Sun, 13 Oct 2024 02:11:57 +0500 Subject: upd: game updater now checks from assets url --- .../kz/ilotterytea/maxon/screens/MenuScreen.java | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'core/src/kz/ilotterytea/maxon/screens') 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 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))); -- cgit v1.2.3