summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2022-12-24 18:17:04 +0600
committerilotterytea <iltsu@alright.party>2022-12-24 18:17:04 +0600
commitc6d944bc8d3c86695a25b0a19cb4ab9baf0ec694 (patch)
tree43ecf7d5c589c99bff6560a04bf74c2413e776d9 /core
parentdd82481dd42f71ef4886f1a63eacf9456883c5d2 (diff)
Removed 'android' module because it was moved to maxoning/pocket repository.
Diffstat (limited to 'core')
-rw-r--r--core/src/com/ilotterytea/maxoning/screens/MobileMenuScreen.java252
-rw-r--r--core/src/com/ilotterytea/maxoning/screens/SplashScreen.java7
2 files changed, 1 insertions, 258 deletions
diff --git a/core/src/com/ilotterytea/maxoning/screens/MobileMenuScreen.java b/core/src/com/ilotterytea/maxoning/screens/MobileMenuScreen.java
deleted file mode 100644
index 4c8450c..0000000
--- a/core/src/com/ilotterytea/maxoning/screens/MobileMenuScreen.java
+++ /dev/null
@@ -1,252 +0,0 @@
-package com.ilotterytea.maxoning.screens;
-
-import com.badlogic.gdx.Gdx;
-import com.badlogic.gdx.Screen;
-import com.badlogic.gdx.audio.Music;
-import com.badlogic.gdx.files.FileHandle;
-import com.badlogic.gdx.graphics.GL20;
-import com.badlogic.gdx.graphics.Texture;
-import com.badlogic.gdx.graphics.g2d.TextureAtlas;
-import com.badlogic.gdx.math.Interpolation;
-import com.badlogic.gdx.scenes.scene2d.InputEvent;
-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.utils.ClickListener;
-import com.badlogic.gdx.utils.Align;
-import com.badlogic.gdx.utils.viewport.FillViewport;
-import com.ilotterytea.maxoning.MaxonConstants;
-import com.ilotterytea.maxoning.MaxonGame;
-import com.ilotterytea.maxoning.anim.SpriteUtils;
-import com.ilotterytea.maxoning.player.MaxonSavegame;
-import com.ilotterytea.maxoning.ui.AnimatedImage;
-import com.ilotterytea.maxoning.ui.MovingChessBackground;
-import com.ilotterytea.maxoning.utils.I18N;
-import com.ilotterytea.maxoning.utils.serialization.GameDataSystem;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Locale;
-
-/**
- * Menu screen for mobile devices.
- * @since 1.3
- * @author ilotterytea
- */
-public class MobileMenuScreen implements Screen {
- private final MaxonGame game;
- private Stage stage;
-
- private Skin skin;
-
- private MovingChessBackground bg;
-
- private MaxonSavegame sav;
- private Music menuMusic;
-
- public MobileMenuScreen(MaxonGame game) {
- this.game = game;
- }
-
- @Override
- public void show() {
- stage = new Stage(new FillViewport(Gdx.graphics.getWidth() / game.prefs.getFloat("scale", 2f), Gdx.graphics.getHeight() / game.prefs.getFloat("scale", 2f)));
- skin = game.assetManager.get("MainSpritesheet.skin", Skin.class);
-
- TextureAtlas brandAtlas = game.assetManager.get("sprites/gui/brand.atlas", TextureAtlas.class);
-
- sav = GameDataSystem.load("latest.sav");
- menuMusic = game.assetManager.get("mus/menu/mus_menu_loop.ogg", Music.class);
- menuMusic.setLooping(true);
- menuMusic.play();
-
- // Background:
- bg = new MovingChessBackground(
- 1,
- 1,
- stage.getWidth(),
- stage.getHeight(),
- skin.getDrawable("tile_01"),
- skin.getDrawable("tile_02")
- );
-
- // Cat:
- AnimatedImage cat = new AnimatedImage(
- SpriteUtils.splitToTextureRegions(game.assetManager.get("sprites/sheet/loadingCircle.png", Texture.class),
- 112, 112, 10, 5
- )
- );
- cat.setOrigin(
- cat.getWidth() / 2f,
- cat.getHeight() / 2f
- );
- cat.setPosition(
- (stage.getWidth() / 2f) - (cat.getWidth() / 2f),
- (stage.getHeight() / 2f) - (cat.getHeight() / 2f) + 128f
- );
- cat.addAction(
- Actions.repeat(
- RepeatAction.FOREVER,
- Actions.sequence(
- Actions.rotateTo(-5, 5f, Interpolation.smoother),
- Actions.rotateTo(5, 5f, Interpolation.smoother)
- )
- )
- );
-
- stage.addActor(cat);
-
- // - - - - - - L O G O - - - - - - :
- Image logoImage = new Image(brandAtlas.findRegion("brand"));
- logoImage.setScale(0.5f);
- logoImage.setPosition(
- (stage.getWidth() / 2f) - (logoImage.getWidth() / 2f),
- (stage.getHeight() / 2f) - (logoImage.getHeight() / 2f) + 128f
- );
- logoImage.setOrigin(
- logoImage.getWidth() / 2f,
- logoImage.getHeight() / 2f
- );
- logoImage.addAction(
- Actions.repeat(
- RepeatAction.FOREVER,
- Actions.sequence(
- Actions.parallel(
- Actions.rotateTo(-5, 5f, Interpolation.smoother),
- Actions.scaleTo(0.45f, 0.45f, 5f, Interpolation.smoother)
- ),
- Actions.parallel(
- Actions.rotateTo(5, 5f, Interpolation.smoother),
- Actions.scaleTo(0.5f, 0.5f, 5f, Interpolation.smoother)
- )
- )
- )
- );
-
-
- stage.addActor(logoImage);
-
- // - - - - - - M E N U - - - - - - :
- Table menuTable = new Table();
- menuTable.setSize(stage.getWidth(), stage.getHeight());
- menuTable.setPosition(0, 0);
- menuTable.align(Align.bottom | Align.center);
- menuTable.pad(20f);
-
- stage.addActor(menuTable);
-
- // Play button:
- final TextButton startBtn = new TextButton(
- (sav == null) ?
- game.locale.TranslatableText("menu.playGame") :
- game.locale.TranslatableText("menu.continue"),
- skin
- );
-
- startBtn.addListener(new ClickListener() {
- @Override
- public void clicked(InputEvent event, float x, float y) {
- try {
- game.setScreen(new GameScreen(
- game,
- (sav == null) ? new MaxonSavegame() : sav,
- 0
- ));
- } catch (IOException | ClassNotFoundException e) {
- throw new RuntimeException(e);
- }
- }
- });
-
- menuTable.add(startBtn).width(256f).pad(6f).row();
-
- // Table for lang and reset buttons:
- Table langResetTable = new Table();
- menuTable.add(langResetTable).width(256f).row();
-
- // Language button:
- String[] fh4Locale = game.locale.getFileHandle().nameWithoutExtension().split("_");
- Locale locale = new Locale(fh4Locale[0], fh4Locale[1]);
- final TextButton langBtn = new TextButton(locale.getDisplayLanguage(), skin);
-
- langBtn.addListener(new ClickListener() {
- @Override
- public void clicked(InputEvent event, float x, float y) {
- int index = 0;
- ArrayList<FileHandle> fhArray = new ArrayList<>();
- fhArray.add(MaxonConstants.FILE_RU_RU);
- fhArray.add(MaxonConstants.FILE_EN_US);
-
- if (fhArray.indexOf(game.locale.getFileHandle()) + 1 < fhArray.size()) {
- index = fhArray.indexOf(game.locale.getFileHandle()) + 1;
- }
-
- FileHandle fhNext = fhArray.get(index);
-
- game.locale = new I18N(fhNext);
- game.prefs.putString("lang", fhNext.nameWithoutExtension());
- game.prefs.flush();
-
- String[] fh4Locale = fhNext.nameWithoutExtension().split("_");
- Locale locale = new Locale(fh4Locale[0], fh4Locale[1]);
-
- langBtn.setText(locale.getDisplayLanguage());
- game.setScreen(new SplashScreen(game));
- }
- });
-
- langResetTable.add(langBtn).width(256f);//.padRight(6f);
-
- // Reset save button:
- //TextButton resetBtn = new TextButton("Reset", widgetSkin);
- //langResetTable.add(resetBtn).width(125f);
-
- Gdx.input.setInputProcessor(stage);
-
- render(Gdx.graphics.getDeltaTime());
- }
-
- @Override
- public void render(float delta) {
- Gdx.gl.glClearColor(0, 0, 0, 1f);
- Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
-
- game.batch.begin();
-
- bg.draw(game.batch);
-
- game.batch.end();
-
- stage.draw();
- stage.act(delta);
- }
-
- @Override
- public void resize(int width, int height) {
- stage.getViewport().update(width, height, true);
-
- bg.update(width, height);
- }
-
- @Override
- public void pause() {
-
- }
-
- @Override
- public void resume() {
-
- }
-
- @Override
- public void hide() {
- menuMusic.stop();
- dispose();
- }
-
- @Override
- public void dispose() {
- stage.dispose();
- }
-}
diff --git a/core/src/com/ilotterytea/maxoning/screens/SplashScreen.java b/core/src/com/ilotterytea/maxoning/screens/SplashScreen.java
index a25a6bf..5170f46 100644
--- a/core/src/com/ilotterytea/maxoning/screens/SplashScreen.java
+++ b/core/src/com/ilotterytea/maxoning/screens/SplashScreen.java
@@ -12,7 +12,6 @@ import com.badlogic.gdx.utils.Align;
import com.badlogic.gdx.utils.viewport.FillViewport;
import com.ilotterytea.maxoning.MaxonGame;
import com.ilotterytea.maxoning.utils.AssetLoading;
-import com.ilotterytea.maxoning.utils.OsUtils;
public class SplashScreen implements Screen {
final MaxonGame game;
@@ -59,11 +58,7 @@ public class SplashScreen implements Screen {
private void update() {
if (game.assetManager.update()) {
AssetLoading.registerItems(game.assetManager, game.locale);
- if (OsUtils.isAndroid || OsUtils.isIos) {
- game.setScreen(new MobileMenuScreen(game));
- } else {
- game.setScreen(new MenuScreen(game));
- }
+ game.setScreen(new MenuScreen(game));
dispose();
}
}