diff options
| author | ilotterytea <iltsu@alright.party> | 2024-10-26 00:52:53 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2024-10-26 00:52:53 +0500 |
| commit | 4c205aaaf26b65ed6f5ada09b894345f131d5be7 (patch) | |
| tree | 0feeb0aa6cd7057f1ce4ec344a9d86c9bf67cee0 /core/src/kz/ilotterytea/maxon/screens | |
| parent | d1ee70ccb99cc23cbd3d20bb5daf70cd9aa54205 (diff) | |
upd: code cleanup
Diffstat (limited to 'core/src/kz/ilotterytea/maxon/screens')
5 files changed, 19 insertions, 74 deletions
diff --git a/core/src/kz/ilotterytea/maxon/screens/MenuScreen.java b/core/src/kz/ilotterytea/maxon/screens/MenuScreen.java index de84cd7..11bd67f 100644 --- a/core/src/kz/ilotterytea/maxon/screens/MenuScreen.java +++ b/core/src/kz/ilotterytea/maxon/screens/MenuScreen.java @@ -14,7 +14,6 @@ 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.Image; import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import com.badlogic.gdx.utils.Align; import com.badlogic.gdx.utils.Timer; @@ -39,10 +38,10 @@ import net.mgsx.gltf.scene3d.utils.IBLBuilder; import java.util.ArrayList; public class MenuScreen implements Screen { - private final MaxonGame game; + private MaxonGame game; - private final Stage stage; - private final Music menuMusic; + private Stage stage; + private Music menuMusic; private final Savegame savegame = Savegame.getInstance(); @@ -52,7 +51,7 @@ public class MenuScreen implements Screen { private final ArrayList<Timer.Task> tasks = new ArrayList<>(); private Sound clickSound; - public MenuScreen() { + @Override public void show() { this.game = MaxonGame.getInstance(); game.getDiscordActivityClient().runThread(); @@ -63,9 +62,6 @@ public class MenuScreen implements Screen { Skin uiSkin = game.assetManager.get("sprites/gui/ui.skin", Skin.class); Skin widgetSkin = game.assetManager.get("sprites/gui/widgets.skin", Skin.class); TextureAtlas brandAtlas = game.assetManager.get("sprites/gui/brand.atlas", TextureAtlas.class); - TextureAtlas widgetAtlas = game.assetManager.get("sprites/gui/widgets.atlas", TextureAtlas.class); - - Skin friendsSkin = game.assetManager.get("sprites/gui/friends.skin", Skin.class); // Main Menu music: this.menuMusic = game.assetManager.get("mus/menu/mus_menu_loop.mp3", Music.class); @@ -333,13 +329,8 @@ public class MenuScreen implements Screen { create3D(); Gdx.input.setInputProcessor(stage); - } - @Override public void show() { if (game.prefs.getBoolean("music", true)) menuMusic.play(); - - // Start to render: - render(Gdx.graphics.getDeltaTime()); } @Override diff --git a/core/src/kz/ilotterytea/maxon/screens/SlotsMinigameScreen.kt b/core/src/kz/ilotterytea/maxon/screens/SlotsMinigameScreen.kt index bd164c3..4f489ac 100644 --- a/core/src/kz/ilotterytea/maxon/screens/SlotsMinigameScreen.kt +++ b/core/src/kz/ilotterytea/maxon/screens/SlotsMinigameScreen.kt @@ -1,3 +1,7 @@ +@file:Suppress("unused", "unused", "unused", "unused", "unused", "unused", "unused", "unused", "unused", "unused", + "unused", "unused", "unused", "unused", "unused", "unused", "unused", "unused" +) + package kz.ilotterytea.maxon.screens import com.badlogic.gdx.Gdx @@ -40,6 +44,9 @@ private enum class Slot(val multiplier: Int) { private class SlotImage(slot: Slot, assetManager: AssetManager) : Image(assetManager.get("sprites/minigames/slots/${slot.name.lowercase()}.png", Texture::class.java)) +@Suppress("unused", "unused", "unused", "unused", "unused", "unused", "unused", "unused", "unused", "unused", "unused", + "unused", "unused", "unused", "unused", "unused", "unused", "unused" +) class SlotsMinigameScreen : Screen { private val savegame = Savegame.getInstance() @@ -60,7 +67,6 @@ class SlotsMinigameScreen : Screen { private var loseStreak = 0 private var maxLoseStreak = Random.nextInt(20, 50) - private var finished = false private var disabled = false private var lockedColumns = -1 private val columnSlots = arrayListOf<Slot>() @@ -250,7 +256,6 @@ class SlotsMinigameScreen : Screen { private fun finish() { if (audioLoop.isPlaying) audioLoop.stop() - finished = true stakeField?.isDisabled = false exitButton?.isDisabled = false spinButton?.isDisabled = false @@ -277,7 +282,6 @@ class SlotsMinigameScreen : Screen { stakeField?.isDisabled = true loseSlot = Slot.values()[Random.nextInt(0,3)] - finished = false lockedColumns = -1 loseStreak = 0 prize = 0.0 diff --git a/core/src/kz/ilotterytea/maxon/screens/game/GameScreen.java b/core/src/kz/ilotterytea/maxon/screens/game/GameScreen.java index 5cf0a5a..be6f840 100644 --- a/core/src/kz/ilotterytea/maxon/screens/game/GameScreen.java +++ b/core/src/kz/ilotterytea/maxon/screens/game/GameScreen.java @@ -9,18 +9,12 @@ import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.graphics.g3d.decals.CameraGroupStrategy; import com.badlogic.gdx.graphics.g3d.decals.Decal; import com.badlogic.gdx.graphics.g3d.decals.DecalBatch; -import com.badlogic.gdx.math.Interpolation; import com.badlogic.gdx.math.MathUtils; import com.badlogic.gdx.math.Vector3; -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.ui.*; -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 kz.ilotterytea.maxon.MaxonConstants; import kz.ilotterytea.maxon.MaxonGame; import kz.ilotterytea.maxon.anim.SpriteUtils; import kz.ilotterytea.maxon.audio.Playlist; @@ -28,16 +22,12 @@ import kz.ilotterytea.maxon.inputprocessors.CrossProcessor; import kz.ilotterytea.maxon.pets.Pet; import kz.ilotterytea.maxon.pets.PetManager; import kz.ilotterytea.maxon.player.DecalPlayer; -import kz.ilotterytea.maxon.player.MaxonItem; -import kz.ilotterytea.maxon.player.MaxonItemRegister; import kz.ilotterytea.maxon.player.Savegame; import kz.ilotterytea.maxon.screens.MenuScreen; import kz.ilotterytea.maxon.screens.game.shop.ShopUI; import kz.ilotterytea.maxon.ui.*; import kz.ilotterytea.maxon.ui.game.QuickActionsTable; import kz.ilotterytea.maxon.utils.OsUtils; -import kz.ilotterytea.maxon.utils.math.Math; -import com.rafaskoberg.gdx.typinglabel.TypingLabel; import net.mgsx.gltf.scene3d.attributes.PBRCubemapAttribute; import net.mgsx.gltf.scene3d.attributes.PBRTextureAttribute; import net.mgsx.gltf.scene3d.lights.DirectionalShadowLight; @@ -50,33 +40,17 @@ import net.mgsx.gltf.scene3d.utils.EnvironmentUtil; import net.mgsx.gltf.scene3d.utils.IBLBuilder; import java.util.ArrayList; -import java.util.Map; public class GameScreen implements Screen, InputProcessor { - final MaxonGame game; - final long playTimestamp; - boolean isShopping = false, isInventoryEnabled = false; - - private Savegame savegame = Savegame.getInstance(); + private MaxonGame game; + private long playTimestamp; private final Savegame savegame = Savegame.getInstance(); private Stage stage; private Skin uiSkin; - Label pointsLabel, multiplierLabel; - AnimatedImage cat; - AnimatedImageButton maxon; - - Table boardTable, quickTable; - - Dialog notEnoughPointsDialog; - - ArrayList<MaxonItem> items; - Map<Integer, Integer> invItems; - - MovingChessBackground bg; - Playlist playlist; + private Playlist playlist; private ShopUI shopUI; @@ -93,7 +67,8 @@ public class GameScreen implements Screen, InputProcessor { private final ArrayList<Timer.Task> tasks = new ArrayList<>(); - public GameScreen() { + @Override + public void show() { this.game = MaxonGame.getInstance(); this.playTimestamp = System.currentTimeMillis(); if (savegame.isNewlyCreated()) savegame.setNewlyCreated(false); @@ -103,7 +78,7 @@ public class GameScreen implements Screen, InputProcessor { decalBatch = new DecalBatch(new CameraGroupStrategy(camera)); decals = new ArrayList<>(); - ArrayList<TextureRegion> playerTextureRegions = SpriteUtils.splitToTextureRegions(game.assetManager.get("sprites/sheet/loadingCircle.png", Texture.class), 112, 112, 10, 5); + ArrayList<TextureRegion> playerTextureRegions = SpriteUtils.splitToTextureRegions(game.assetManager.get("sprites/sheet/loadingCircle.png", Texture.class), 112, 112); decalPlayer = new DecalPlayer(savegame, playerTextureRegions); decals.add(decalPlayer.getDecal()); @@ -116,17 +91,12 @@ public class GameScreen implements Screen, InputProcessor { playlist.setShuffleMode(true); if (game.prefs.getBoolean("music", true)) playlist.next(); - items = new ArrayList<>(); - createStageUI(); giftbox = new Giftbox(stage, uiSkin, game.assetManager, sceneManager); Gdx.input.setInputProcessor(new InputMultiplexer(this, new CrossProcessor(), stage)); - } - @Override - public void show() { tasks.add(Timer.schedule(new Timer.Task() { @Override public void run() { @@ -171,23 +141,6 @@ public class GameScreen implements Screen, InputProcessor { playlist.next(); } - // i've temporarily commented it all out while i set up 3d - //game.batch.begin(); - - //bg.draw(game.batch); - - //game.batch.end(); - - // Update the points label: - //pointsLabel.setText(game.locale.FormattedText("game.points", - // MaxonConstants.DECIMAL_FORMAT.format(player.points) - //)); - - // Update the multiplier label: - //multiplierLabel.setText(game.locale.FormattedText("game.multiplier", - // MaxonConstants.DECIMAL_FORMAT.format(player.multiplier) - //)); - // Render 3D sceneManager.update(Gdx.graphics.getDeltaTime()); sceneManager.render(); @@ -284,10 +237,8 @@ public class GameScreen implements Screen, InputProcessor { public boolean keyDown(int keycode) { if (Gdx.input.isKeyPressed(Input.Keys.ESCAPE)) { game.setScreen(new MenuScreen()); + return true; } - //if (Gdx.input.isKeyPressed(Input.Keys.SPACE) || Gdx.input.isKeyPressed(Input.Keys.UP)) { - // displayPointIncrease(); - //} return false; } diff --git a/core/src/kz/ilotterytea/maxon/screens/game/Giftbox.java b/core/src/kz/ilotterytea/maxon/screens/game/Giftbox.java index 752d7a1..bb3a185 100644 --- a/core/src/kz/ilotterytea/maxon/screens/game/Giftbox.java +++ b/core/src/kz/ilotterytea/maxon/screens/game/Giftbox.java @@ -73,7 +73,7 @@ public class Giftbox implements Disposable { this.boxImage = new AnimatedImage( SpriteUtils.splitToTextureRegions( assetManager.get("sprites/giftbox/gift.png"), - 256, 256, 2, 1 + 256, 256 ), 10 ); diff --git a/core/src/kz/ilotterytea/maxon/screens/game/shop/ShopUI.java b/core/src/kz/ilotterytea/maxon/screens/game/shop/ShopUI.java index 50ab62e..567dff7 100644 --- a/core/src/kz/ilotterytea/maxon/screens/game/shop/ShopUI.java +++ b/core/src/kz/ilotterytea/maxon/screens/game/shop/ShopUI.java @@ -39,7 +39,6 @@ public class ShopUI { private final Sound clickSound, notEnoughMoneySound, purchaseSound, sellSound; private final String styleName = OsUtils.isMobile ? "defaultMobile" : "default"; - private final float iconSize = OsUtils.isMobile ? 64f : 32f; public ShopUI(final Savegame savegame, Stage stage, Skin skin, TextureAtlas atlas) { this.savegame = savegame; |
