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/ui | |
| parent | d1ee70ccb99cc23cbd3d20bb5daf70cd9aa54205 (diff) | |
upd: code cleanup
Diffstat (limited to 'core/src/kz/ilotterytea/maxon/ui')
4 files changed, 9 insertions, 30 deletions
diff --git a/core/src/kz/ilotterytea/maxon/ui/AnimatedImage.java b/core/src/kz/ilotterytea/maxon/ui/AnimatedImage.java index d1f5b90..97cd354 100644 --- a/core/src/kz/ilotterytea/maxon/ui/AnimatedImage.java +++ b/core/src/kz/ilotterytea/maxon/ui/AnimatedImage.java @@ -2,7 +2,6 @@ package kz.ilotterytea.maxon.ui; import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.scenes.scene2d.ui.Image; -import com.badlogic.gdx.scenes.scene2d.utils.Drawable; import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable; import com.badlogic.gdx.utils.Disposable; @@ -13,13 +12,7 @@ public class AnimatedImage extends Image implements Disposable { private final int fps; private int index = 0, seconds = 0; - private boolean stopAnim = false; - - public AnimatedImage(ArrayList<TextureRegion> regions) { - super(regions.get(0)); - this.regions = regions; - this.fps = 0; - } + private final boolean stopAnim = false; public AnimatedImage(ArrayList<TextureRegion> regions, int fps) { super(regions.get(0)); @@ -48,23 +41,6 @@ public class AnimatedImage extends Image implements Disposable { } public TextureRegion getFrame(int index) { return regions.get(index); } - public int getIndex() { return index; } - public Drawable getDrawable() { return super.getDrawable(); } - - public void nextFrame() { - index++; - - if (index > regions.size() - 1 || regions.get(index) == null) { - index = 0; - } - - super.setDrawable(new TextureRegionDrawable(regions.get(index))); - } - - public void disableAnim() { stopAnim = true; } - public void enableAnim() { stopAnim = false; } - - public boolean isAnimationStopped() { return stopAnim; } @Override public void dispose() { for (TextureRegion reg : regions) { diff --git a/core/src/kz/ilotterytea/maxon/ui/LeafParticle.java b/core/src/kz/ilotterytea/maxon/ui/LeafParticle.java index 82879cf..e6a8cf2 100644 --- a/core/src/kz/ilotterytea/maxon/ui/LeafParticle.java +++ b/core/src/kz/ilotterytea/maxon/ui/LeafParticle.java @@ -6,7 +6,11 @@ import com.badlogic.gdx.graphics.g2d.Sprite; import com.badlogic.gdx.graphics.g2d.TextureRegion; public class LeafParticle extends Sprite { - private float angle, x, y, vertAngle, rotation, time; + private final float angle; + private float x; + private float y; + private final float vertAngle; + private final float rotation; public LeafParticle(TextureRegion region, float x, float y, float angle, float vertAngle, float rotation) { super(region); @@ -19,7 +23,7 @@ public class LeafParticle extends Sprite { @Override public void draw(Batch batch) { - this.time = Gdx.graphics.getDeltaTime(); + float time = Gdx.graphics.getDeltaTime(); this.x -= (float) Math.sin(time) * this.angle; this.y -= (float) Math.sin(time) * this.vertAngle; diff --git a/core/src/kz/ilotterytea/maxon/ui/MovingChessBackground.java b/core/src/kz/ilotterytea/maxon/ui/MovingChessBackground.java index a585d0b..3ae73c6 100644 --- a/core/src/kz/ilotterytea/maxon/ui/MovingChessBackground.java +++ b/core/src/kz/ilotterytea/maxon/ui/MovingChessBackground.java @@ -69,14 +69,14 @@ public class MovingChessBackground { totalDWidth = totalDWidth / drawables.size(); totalDHeight = totalDHeight / drawables.size(); - log.info(String.format("Total size of %s drawables: %sx%s", drawables.size(), totalDWidth, totalDHeight)); + log.info("Total size of {} drawables: {}x{}", drawables.size(), totalDWidth, totalDHeight); int DIndex = 0; log.info("Starting to generating tiles..."); for (int h = 0; h < height / totalDHeight + 3; h++) { - tiles.add(h, new ArrayList<Image>()); + tiles.add(h, new ArrayList<>()); for (int w = -1; w < width / totalDWidth; w++) { if (DIndex + 1 > drawables.size()) DIndex = 0; diff --git a/core/src/kz/ilotterytea/maxon/ui/game/QuickActionsTable.kt b/core/src/kz/ilotterytea/maxon/ui/game/QuickActionsTable.kt index 7c66513..72ab8c5 100644 --- a/core/src/kz/ilotterytea/maxon/ui/game/QuickActionsTable.kt +++ b/core/src/kz/ilotterytea/maxon/ui/game/QuickActionsTable.kt @@ -9,7 +9,6 @@ import com.badlogic.gdx.scenes.scene2d.ui.Table import com.badlogic.gdx.scenes.scene2d.utils.ClickListener import com.badlogic.gdx.utils.Align import kz.ilotterytea.maxon.MaxonGame -import kz.ilotterytea.maxon.player.Savegame import kz.ilotterytea.maxon.screens.MenuScreen import kz.ilotterytea.maxon.screens.SlotsMinigameScreen import kz.ilotterytea.maxon.ui.ShakingImageButton |
