summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2024-10-19 16:54:37 +0500
committerilotterytea <iltsu@alright.party>2024-10-19 16:54:37 +0500
commit3ad154dee870dc38baeeec17094d9aa77c4639ac (patch)
tree4202c47c198a0b7b22b5bbe95c3a134f70e7e2e0 /core
parent1251b9d2f18f04a55a702cb96f10a0aeccbda6f7 (diff)
fix: GDX dialogs dont work well on macos, so i replaced it with my implementation of it
Diffstat (limited to 'core')
-rw-r--r--core/src/kz/ilotterytea/maxon/MaxonGame.java7
-rw-r--r--core/src/kz/ilotterytea/maxon/screens/MenuScreen.java41
2 files changed, 17 insertions, 31 deletions
diff --git a/core/src/kz/ilotterytea/maxon/MaxonGame.java b/core/src/kz/ilotterytea/maxon/MaxonGame.java
index 67b4a0e..a220163 100644
--- a/core/src/kz/ilotterytea/maxon/MaxonGame.java
+++ b/core/src/kz/ilotterytea/maxon/MaxonGame.java
@@ -22,8 +22,6 @@ public class MaxonGame extends Game {
private PetManager petManager;
- private GDXDialogs dialogWindows;
-
private static MaxonGame instance;
public static MaxonGame getInstance() {
@@ -37,10 +35,6 @@ public class MaxonGame extends Game {
return petManager;
}
- public GDXDialogs getDialogWindows() {
- return dialogWindows;
- }
-
@Override
public void create () {
// Check the latest version
@@ -60,7 +54,6 @@ public class MaxonGame extends Game {
assetManager = new AssetManager();
petManager = new PetManager(assetManager);
- dialogWindows = GDXDialogsSystem.install();
this.setScreen(new SplashScreen());
}
diff --git a/core/src/kz/ilotterytea/maxon/screens/MenuScreen.java b/core/src/kz/ilotterytea/maxon/screens/MenuScreen.java
index 1e15032..1154b25 100644
--- a/core/src/kz/ilotterytea/maxon/screens/MenuScreen.java
+++ b/core/src/kz/ilotterytea/maxon/screens/MenuScreen.java
@@ -14,13 +14,11 @@ import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.actions.Actions;
import com.badlogic.gdx.scenes.scene2d.actions.RepeatAction;
import com.badlogic.gdx.scenes.scene2d.ui.*;
-import com.badlogic.gdx.scenes.scene2d.ui.Button;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
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;
@@ -53,31 +51,9 @@ 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)));
@@ -354,6 +330,23 @@ public class MenuScreen implements Screen {
savegameTable.add(info).minSize(640f, 240f);
}
+ // Suggest an update
+ if (!GameUpdater.CLIENT_IS_ON_LATEST_VERSION && OsUtils.isPC) {
+ TextButton updateButton = new TextButton(game.locale.TranslatableText("updater.info"), uiSkin, "link");
+
+ updateButton.setPosition(8f, stage.getHeight() - 32f);
+
+ updateButton.addListener(new ClickListener() {
+ @Override
+ public void clicked(InputEvent event, float x, float y) {
+ super.clicked(event, x, y);
+ Gdx.net.openURI(MaxonConstants.GAME_APP_URL);
+ }
+ });
+
+ menuTable.add(updateButton).pad(6f).left().row();
+ }
+
// Adding tables into the main UI table
menuTable.add(brandTable).grow().row();
menuTable.add(savegameTable).grow().row();