Made lint happier

This commit is contained in:
Lonami Exo 2017-07-26 11:16:14 +02:00
parent e51f27d091
commit 1b1eb678db
23 changed files with 35 additions and 67 deletions

View file

@ -37,7 +37,7 @@ public class Klooni extends Game {
public Skin skin;
public ShareChallenge shareChallenge;
public final ShareChallenge shareChallenge;
public static boolean onDesktop;

View file

@ -24,14 +24,14 @@ import com.badlogic.gdx.graphics.g2d.NinePatch;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
public class SkinLoader {
private static float[] multipliers = {0.75f, 1.0f, 1.25f, 1.5f, 2.0f, 4.0f};
private static String[] ids = {
private final static float[] multipliers = {0.75f, 1.0f, 1.25f, 1.5f, 2.0f, 4.0f};
private final static String[] ids = {
"play", "play_saved", "star", "stopwatch", "palette", "home", "replay",
"share", "sound_on", "sound_off", "snap_on", "snap_off", "issues", "credits",
"web", "back", "ok", "cancel", "power_off", "effects"
};
private static float bestMultiplier;
private final static float bestMultiplier;
static {
// Use the height to determine the best match

View file

@ -22,8 +22,6 @@ import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Pixmap;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.NinePatch;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.utils.Array;
@ -58,7 +56,7 @@ public class Theme {
public Texture cellTexture;
// Save the button styles so the changes here get reflected
private ImageButton.ImageButtonStyle[] buttonStyles;
private final ImageButton.ImageButtonStyle[] buttonStyles;
//endregion
@ -199,13 +197,6 @@ public class Theme {
return colorIndex < 0 ? emptyCell : cells[colorIndex];
}
public Color getRandomCellColor() {
if (cells.length == 0)
return emptyCell;
else
return cells[MathUtils.random(cells.length - 1)];
}
public void glClearBackground() {
Gdx.gl.glClearColor(background.r, background.g, background.b, background.a);
}
@ -234,7 +225,7 @@ public class Theme {
//region Disposal
void dispose() {
cellTexture.dispose();
}
//endregion

View file

@ -33,7 +33,7 @@ public class EffectCard extends ShopCard {
//region Members
public final Effect effect;
private final Effect effect;
private final Board board;
// We want to create an effect from the beginning
@ -139,7 +139,7 @@ public class EffectCard extends ShopCard {
@Override
public boolean isUsed() {
return game.effect.equals(effect.name);
return game.effect.name.equals(effect.name);
}
@Override

View file

@ -46,7 +46,7 @@ public class MoneyBuyBand extends Table {
private ShopCard toBuy;
// Used to interpolate between strings
private StringBuilder shownText;
private final StringBuilder shownText;
// When the next text update will take place
private long nextTextUpdate;

View file

@ -31,7 +31,7 @@ public abstract class ShopCard extends Actor {
final Klooni game;
final Label nameLabel;
private final Label nameLabel;
final Label priceLabel;
public final Rectangle nameBounds;
@ -39,8 +39,8 @@ public abstract class ShopCard extends Actor {
public float cellSize;
public ShopCard(final Klooni game, final GameLayout layout,
final String itemName, final Color backgroundColor) {
ShopCard(final Klooni game, final GameLayout layout,
final String itemName, final Color backgroundColor) {
this.game = game;
Label.LabelStyle labelStyle = new Label.LabelStyle();
labelStyle.font = game.skin.getFont("font_small");

View file

@ -17,7 +17,6 @@
*/
package io.github.lonamiwebs.klooni.actors;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton;
import com.badlogic.gdx.scenes.scene2d.utils.Drawable;
@ -30,7 +29,7 @@ public class SoftButton extends ImageButton {
//region Members
private int styleIndex;
private final int styleIndex;
public Drawable image;
//endregion

View file

@ -30,7 +30,7 @@ public class ThemeCard extends ShopCard {
//region Members
public final Theme theme;
private final Theme theme;
private final Texture background;
private final static int colorsUsed[][] = {

View file

@ -25,7 +25,7 @@ public class WaterdropEffect implements IEffect {
private static final float FALL_VARIATION = 50.0f;
private static final float COLOR_SPEED = 7.5f;
private static Texture dropTexture;
private final static Texture dropTexture;
static {
dropTexture = SkinLoader.loadPng("cells/drop.png");

View file

@ -17,7 +17,6 @@
*/
package io.github.lonamiwebs.klooni.game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
@ -88,9 +87,8 @@ public abstract class BaseScorer implements BinSerializable {
//region Public methods
// Adds the score a given piece would give
public int addPieceScore(int areaPut) {
public void addPieceScore(final int areaPut) {
currentScore += areaPut;
return areaPut;
}
// Adds the score given by the board, this is, the count of cleared strips

View file

@ -235,21 +235,17 @@ public class Board implements BinSerializable {
return clearCount;
}
public int clearAll(final int clearFromX, final int clearFromY, final Effect effect) {
int clearCount = 0;
public void clearAll(final int clearFromX, final int clearFromY, final Effect effect) {
final Vector2 culprit = cells[clearFromY][clearFromX].pos;
for (int i = 0; i < cellCount; ++i) {
for (int j = 0; j < cellCount; ++j) {
if (!cells[i][j].isEmpty()) {
clearCount++;
effects.add(effect.create(cells[i][j], culprit));
cells[i][j].set(-1);
}
}
}
return clearCount;
}
public boolean effectsDone() { return effects.size == 0; }

View file

@ -27,7 +27,7 @@ import io.github.lonamiwebs.klooni.Klooni;
class BonusParticle {
private Label label;
private final Label label;
private float lifetime;
private final static float SPEED = 1f;

View file

@ -131,6 +131,7 @@ public class GameLayout {
band.infoBounds.set(area.x, area.y + area.height * 0.10f, area.width, area.height * 0.35f);
}
@SuppressWarnings("SuspiciousNameCombination")
public void update(ShopCard card) {
card.setSize(availableWidth - marginWidth, shopCardHeight);
card.cellSize = shopCardHeight * 0.2f;

View file

@ -41,7 +41,7 @@ public class Piece {
private final int rotation;
public final int cellCols, cellRows;
private boolean shape[][];
private final boolean shape[][];
// Default arbitrary value
float cellSize = 10f;

View file

@ -66,7 +66,7 @@ public class PieceHolder implements BinSerializable {
//region Static members
public static final float DRAG_SPEED = 0.5f; // Interpolation value ((pos -> new) / frame)
private static final float DRAG_SPEED = 0.5f; // Interpolation value ((pos -> new) / frame)
//endregion
@ -188,11 +188,11 @@ public class PieceHolder implements BinSerializable {
}
// If no piece is currently being held, the area will be 0
public int calculateHeldPieceArea() {
private int calculateHeldPieceArea() {
return heldPiece > -1 ? pieces[heldPiece].calculateArea() : 0;
}
public Vector2 calculateHeldPieceCenter() {
private Vector2 calculateHeldPieceCenter() {
return heldPiece > -1 ? pieces[heldPiece].calculateGravityCenter() : null;
}

View file

@ -49,8 +49,8 @@ class CustomizeScreen implements Screen {
//region Members
private Klooni game;
private Stage stage;
private final Klooni game;
private final Stage stage;
private final Screen lastScreen;
@ -58,7 +58,7 @@ class CustomizeScreen implements Screen {
private final SoftButton toggleShopButton;
private final VerticalGroup shopGroup; // Showing available themes or effects
private final ScrollPane shopScroll;
final MoneyBuyBand buyBand;
private final MoneyBuyBand buyBand;
private boolean showingEffectsShop;
private int showcaseIndex;

View file

@ -25,7 +25,6 @@ import com.badlogic.gdx.audio.Sound;
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.math.MathUtils;
import java.io.DataInputStream;
import java.io.DataOutputStream;

View file

@ -19,37 +19,20 @@ package io.github.lonamiwebs.klooni.screens;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.InputListener;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.HorizontalGroup;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.VerticalGroup;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
import com.badlogic.gdx.utils.Align;
import io.github.lonamiwebs.klooni.Klooni;
import io.github.lonamiwebs.klooni.Theme;
import io.github.lonamiwebs.klooni.actors.MoneyBuyBand;
import io.github.lonamiwebs.klooni.actors.SoftButton;
import io.github.lonamiwebs.klooni.actors.ThemeCard;
import io.github.lonamiwebs.klooni.game.GameLayout;
// Screen where the user can customize the look and feel of the game
class ShareScoreScreen implements Screen {
//region Members
private Klooni game;
private final Klooni game;
private final Label infoLabel;
private final SpriteBatch spriteBatch;

View file

@ -27,11 +27,11 @@ import java.util.Arrays;
public class BinSerializer {
// ascii (klooni) and binary (1010b)
private static byte[] HEADER = { 0x6B, 0x6C, 0x6F, 0x6F, 0x6E, 0x69, 0xa };
private final static byte[] HEADER = { 0x6B, 0x6C, 0x6F, 0x6F, 0x6E, 0x69, 0xa };
// MODIFY THIS VALUE EVERY TIME A BinSerializable IMPLEMENTATION CHANGES
// Or unwanted results will happen and corrupt the game in an unknown way.
private static int VERSION = 2;
private final static int VERSION = 2;
public static void serialize(final BinSerializable serializable, final OutputStream output)
throws IOException {

View file

@ -37,7 +37,8 @@ eclipse {
task afterEclipseImport(description: "Post processing after project generation", group: "IDE") {
doLast {
def classpath = new XmlParser().parse(file(".classpath"))
new Node(classpath, "classpathentry", [ kind: 'src', path: 'assets' ]);
// Result of "new" was being ignored
// new Node(classpath, "classpathentry", [ kind: 'src', path: 'assets' ]);
def writer = new FileWriter(file(".classpath"))
def printer = new XmlNodePrinter(new PrintWriter(writer))
printer.setPreserveWhitespace(true)

View file

@ -22,7 +22,7 @@ import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
import io.github.lonamiwebs.klooni.Klooni;
public class DesktopLauncher {
class DesktopLauncher {
public static void main (String[] arg) {
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
config.title = "Klooni 1010!";

View file

@ -24,7 +24,7 @@ import com.badlogic.gdx.backends.iosrobovm.IOSApplication;
import com.badlogic.gdx.backends.iosrobovm.IOSApplicationConfiguration;
import io.github.lonamiwebs.klooni.Klooni;
public class IOSLauncher extends IOSApplication.Delegate {
class IOSLauncher extends IOSApplication.Delegate {
@Override
protected IOSApplication createApplication() {
IOSApplicationConfiguration config = new IOSApplicationConfiguration();

View file

@ -46,9 +46,9 @@ code {
<td style="width:100%;">
<h1>Theme properties</h1>
<p><i>Change the theme name, price, shape and elements' color.</i></p>
<label for="themeName" autocomplete="off">Theme name:</label>
<label for="themeName">Theme name:</label>
<input id="themeName" type="text" placeholder="Name..."
onchange="updateJson()">
onchange="updateJson()" autocomplete="off">
<br />
<label for="themePrice">Theme name:</label>
<input id="themePrice" type="number" min="0" max="1000"