Automatic code reformat

This commit is contained in:
Lonami Exo 2018-02-05 10:30:49 +01:00
parent d7db9b8f82
commit ef2fb8fa84
23 changed files with 153 additions and 107 deletions

View file

@ -40,7 +40,12 @@ import io.github.lonamiwebs.klooni.screens.MainMenuScreen;
import io.github.lonamiwebs.klooni.screens.TransitionScreen; import io.github.lonamiwebs.klooni.screens.TransitionScreen;
public class Klooni extends Game { public class Klooni extends Game {
// region Effects
//region Members
// FIXME theme should NOT be static as it might load textures which will expose it to the race condition iff GDX got initialized before or not
public static Theme theme;
public IEffectFactory effect;
// ordered list of effects. index 0 will get default if VanishEffectFactory is removed from list // ordered list of effects. index 0 will get default if VanishEffectFactory is removed from list
public final static IEffectFactory[] EFFECTS = { public final static IEffectFactory[] EFFECTS = {
@ -51,31 +56,7 @@ public class Klooni extends Game {
new ExplodeEffectFactory(), new ExplodeEffectFactory(),
}; };
private Map<String, Sound> effectSounds; private Map<String, Sound> effectSounds;
private void loadEffectSound(final String effectName) {
FileHandle soundFile = Gdx.files.internal("sound/effect_" + effectName + ".mp3");
if (!soundFile.exists())
soundFile = Gdx.files.internal("sound/effect_vanish.mp3");
effectSounds.put(effectName, Gdx.audio.newSound(soundFile));
}
public void playEffectSound() {
effectSounds.get(effect.getName())
.play(MathUtils.random(0.7f, 1f), MathUtils.random(0.8f, 1.2f), 0);
}
// endregion
//region Members
// FIXME theme should NOT be static as it might load textures which will expose it to the race condition iff GDX got initialized before or not
public static Theme theme;
public IEffectFactory effect;
public Skin skin; public Skin skin;
public final ShareChallenge shareChallenge; public final ShareChallenge shareChallenge;
@ -158,6 +139,23 @@ public class Klooni extends Game {
//endregion //endregion
// region Effects
private void loadEffectSound(final String effectName) {
FileHandle soundFile = Gdx.files.internal("sound/effect_" + effectName + ".mp3");
if (!soundFile.exists())
soundFile = Gdx.files.internal("sound/effect_vanish.mp3");
effectSounds.put(effectName, Gdx.audio.newSound(soundFile));
}
public void playEffectSound() {
effectSounds.get(effect.getName())
.play(MathUtils.random(0.7f, 1f), MathUtils.random(0.8f, 1.2f), 0);
}
// endregion
//region Settings //region Settings
private static Preferences prefs; private static Preferences prefs;
@ -283,7 +281,7 @@ public class Klooni extends Game {
} }
public static int getMoney() { public static int getMoney() {
return (int)getRealMoney(); return (int) getRealMoney();
} }
private static float getRealMoney() { private static float getRealMoney() {

View file

@ -39,7 +39,7 @@ public class SkinLoader {
// We cannot use a size which is over the device height, // We cannot use a size which is over the device height,
// so use the closest smaller one // so use the closest smaller one
int i; int i;
float desired = (float)Gdx.graphics.getHeight() / (float)Klooni.GAME_HEIGHT; float desired = (float) Gdx.graphics.getHeight() / (float) Klooni.GAME_HEIGHT;
for (i = multipliers.length - 1; i > 0; --i) { for (i = multipliers.length - 1; i > 0; --i) {
if (multipliers[i] < desired) if (multipliers[i] < desired)
break; break;
@ -57,7 +57,7 @@ public class SkinLoader {
Skin skin = new Skin(Gdx.files.internal("skin/uiskin.json")); Skin skin = new Skin(Gdx.files.internal("skin/uiskin.json"));
// Nine patches // Nine patches
final int border = (int)(28 * bestMultiplier); final int border = (int) (28 * bestMultiplier);
skin.add("button_up", new NinePatch(new Texture( skin.add("button_up", new NinePatch(new Texture(
Gdx.files.internal(folder + "button_up.png")), border, border, border, border)); Gdx.files.internal(folder + "button_up.png")), border, border, border, border));

View file

@ -71,7 +71,7 @@ public class Theme {
//region Static methods //region Static methods
static boolean exists(final String name) { static boolean exists(final String name) {
return Gdx.files.internal("themes/"+name+".theme").exists(); return Gdx.files.internal("themes/" + name + ".theme").exists();
} }
// Gets all the available themes on the available on the internal game storage // Gets all the available themes on the available on the internal game storage
@ -86,7 +86,7 @@ public class Theme {
else { else {
Gdx.app.log( Gdx.app.log(
"Theme/Info", "Non-existing theme '" + themes[i] + "Theme/Info", "Non-existing theme '" + themes[i] +
"' found on theme.list (line " + (i + 1) + ")"); "' found on theme.list (line " + (i + 1) + ")");
} }
} }
@ -121,7 +121,7 @@ public class Theme {
// Updates the theme with all the values from the specified file or name // Updates the theme with all the values from the specified file or name
public Theme update(final String name) { public Theme update(final String name) {
return update(Gdx.files.internal("themes/"+name+".theme")); return update(Gdx.files.internal("themes/" + name + ".theme"));
} }
private Theme update(final FileHandle handle) { private Theme update(final FileHandle handle) {
@ -137,13 +137,13 @@ public class Theme {
JsonValue colors = json.get("colors"); JsonValue colors = json.get("colors");
// Java won't allow unsigned integers, we need to use Long // Java won't allow unsigned integers, we need to use Long
background = new Color((int)Long.parseLong(colors.getString("background"), 16)); background = new Color((int) Long.parseLong(colors.getString("background"), 16));
foreground = new Color((int)Long.parseLong(colors.getString("foreground"), 16)); foreground = new Color((int) Long.parseLong(colors.getString("foreground"), 16));
JsonValue buttonColors = colors.get("buttons"); JsonValue buttonColors = colors.get("buttons");
Color[] buttons = new Color[buttonColors.size]; Color[] buttons = new Color[buttonColors.size];
for (int i = 0; i < buttons.length; ++i) { for (int i = 0; i < buttons.length; ++i) {
buttons[i] = new Color((int)Long.parseLong(buttonColors.getString(i), 16)); buttons[i] = new Color((int) Long.parseLong(buttonColors.getString(i), 16));
if (buttonStyles[i] == null) { if (buttonStyles[i] == null) {
buttonStyles[i] = new ImageButton.ImageButtonStyle(); buttonStyles[i] = new ImageButton.ImageButtonStyle();
} }
@ -153,22 +153,22 @@ public class Theme {
buttonStyles[i].down = skin.newDrawable("button_down", buttons[i]); buttonStyles[i].down = skin.newDrawable("button_down", buttons[i]);
} }
currentScore = new Color((int)Long.parseLong(colors.getString("current_score"), 16)); currentScore = new Color((int) Long.parseLong(colors.getString("current_score"), 16));
highScore = new Color((int)Long.parseLong(colors.getString("high_score"), 16)); highScore = new Color((int) Long.parseLong(colors.getString("high_score"), 16));
bonus = new Color((int)Long.parseLong(colors.getString("bonus"), 16)); bonus = new Color((int) Long.parseLong(colors.getString("bonus"), 16));
bandColor = new Color((int)Long.parseLong(colors.getString("band"), 16)); bandColor = new Color((int) Long.parseLong(colors.getString("band"), 16));
textColor = new Color((int)Long.parseLong(colors.getString("text"), 16)); textColor = new Color((int) Long.parseLong(colors.getString("text"), 16));
emptyCell = new Color((int)Long.parseLong(colors.getString("empty_cell"), 16)); emptyCell = new Color((int) Long.parseLong(colors.getString("empty_cell"), 16));
JsonValue cellColors = colors.get("cells"); JsonValue cellColors = colors.get("cells");
cells = new Color[cellColors.size]; cells = new Color[cellColors.size];
for (int i = 0; i < cells.length; ++i) { for (int i = 0; i < cells.length; ++i) {
cells[i] = new Color((int)Long.parseLong(cellColors.getString(i), 16)); cells[i] = new Color((int) Long.parseLong(cellColors.getString(i), 16));
} }
String cellTextureFile = json.getString("cell_texture"); String cellTextureFile = json.getString("cell_texture");
cellTexture = SkinLoader.loadPng("cells/"+cellTextureFile); cellTexture = SkinLoader.loadPng("cells/" + cellTextureFile);
return this; return this;
} }

View file

@ -123,7 +123,7 @@ public class EffectCard extends ShopCard {
else if (Klooni.isEffectBought(effect)) else if (Klooni.isEffectBought(effect))
priceLabel.setText("bought"); priceLabel.setText("bought");
else else
priceLabel.setText("buy for "+effect.getPrice()); priceLabel.setText("buy for " + effect.getPrice());
} }
@Override @Override

View file

@ -158,8 +158,7 @@ public class MoneyBuyBand extends Table {
if (shownText.length() > infoText.length()) { if (shownText.length() > infoText.length()) {
// The old text was longer than the new one, so shorten it // The old text was longer than the new one, so shorten it
shownText.setLength(shownText.length() - 1); shownText.setLength(shownText.length() - 1);
} } else {
else {
// It can't be equal length or we wouldn't be here, // It can't be equal length or we wouldn't be here,
// so avoid checking shown.length() < info.length(). // so avoid checking shown.length() < info.length().
// We need to append the next character that we want to show // We need to append the next character that we want to show
@ -180,8 +179,7 @@ public class MoneyBuyBand extends Table {
setTempText("cannot buy!"); setTempText("cannot buy!");
confirmButton.setVisible(false); confirmButton.setVisible(false);
cancelButton.setVisible(false); cancelButton.setVisible(false);
} } else {
else {
this.toBuy = toBuy; this.toBuy = toBuy;
setText("confirm?"); setText("confirm?");
confirmButton.setVisible(true); confirmButton.setVisible(true);

View file

@ -73,12 +73,19 @@ public abstract class ShopCard extends Actor {
// Showcases the current effect (the shop will be showcasing them, one by one) // Showcases the current effect (the shop will be showcasing them, one by one)
// This method should be called on the same card as long as it returns true. // This method should be called on the same card as long as it returns true.
// It should return false once it's done so that the next card can be showcased. // It should return false once it's done so that the next card can be showcased.
public boolean showcase(Batch batch, float yDisplacement) { return false; } public boolean showcase(Batch batch, float yDisplacement) {
return false;
}
public abstract void usedItemUpdated(); public abstract void usedItemUpdated();
public abstract void use(); public abstract void use();
public abstract boolean isBought(); public abstract boolean isBought();
public abstract boolean isUsed(); public abstract boolean isUsed();
public abstract float getPrice(); public abstract float getPrice();
public abstract void performBuy(); public abstract void performBuy();
} }

View file

@ -80,7 +80,7 @@ public class ThemeCard extends ShopCard {
else if (Klooni.isThemeBought(theme)) else if (Klooni.isThemeBought(theme))
priceLabel.setText("bought"); priceLabel.setText("bought");
else else
priceLabel.setText("buy for "+theme.getPrice()); priceLabel.setText("buy for " + theme.getPrice());
} }
@Override @Override

View file

@ -36,7 +36,7 @@ public class WaterdropEffectFactory implements IEffectFactory {
private void init() { private void init() {
if(dropTexture == null) if (dropTexture == null)
dropTexture = SkinLoader.loadPng("cells/drop.png"); dropTexture = SkinLoader.loadPng("cells/drop.png");
} }

View file

@ -102,13 +102,19 @@ public abstract class BaseScorer implements BinSerializable {
return currentScore; return currentScore;
} }
public void pause() { } public void pause() {
public void resume() { } }
public void resume() {
}
abstract public boolean isGameOver(); abstract public boolean isGameOver();
abstract protected boolean isNewRecord(); abstract protected boolean isNewRecord();
public String gameOverReason() { return ""; } public String gameOverReason() {
return "";
}
abstract public void saveScore(); abstract public void saveScore();

View file

@ -98,7 +98,7 @@ public class Board implements BinSerializable {
for (int i = 0; i < piece.cellRows; ++i) for (int i = 0; i < piece.cellRows; ++i)
for (int j = 0; j < piece.cellCols; ++j) for (int j = 0; j < piece.cellCols; ++j)
if (!cells[y+i][x+j].isEmpty() && piece.filled(i, j)) if (!cells[y + i][x + j].isEmpty() && piece.filled(i, j))
return false; return false;
return true; return true;
@ -113,7 +113,7 @@ public class Board implements BinSerializable {
for (int i = 0; i < piece.cellRows; ++i) for (int i = 0; i < piece.cellRows; ++i)
for (int j = 0; j < piece.cellCols; ++j) for (int j = 0; j < piece.cellCols; ++j)
if (piece.filled(i, j)) if (piece.filled(i, j))
cells[y+i][x+j].set(piece.colorIndex); cells[y + i][x + j].set(piece.colorIndex);
return true; return true;
} }
@ -129,7 +129,7 @@ public class Board implements BinSerializable {
for (int j = 0; j < cellCount; ++j) for (int j = 0; j < cellCount; ++j)
cells[i][j].draw(batch); cells[i][j].draw(batch);
for (int i = effects.size; i-- != 0;) { for (int i = effects.size; i-- != 0; ) {
effects.get(i).draw(batch); effects.get(i).draw(batch);
if (effects.get(i).isDone()) if (effects.get(i).isDone())
effects.removeIndex(i); effects.removeIndex(i);
@ -248,7 +248,9 @@ public class Board implements BinSerializable {
} }
} }
public boolean effectsDone() { return effects.size == 0; } public boolean effectsDone() {
return effects.size == 0;
}
//endregion //endregion

View file

@ -33,7 +33,7 @@ class BonusParticle {
private final static float SPEED = 1f; private final static float SPEED = 1f;
BonusParticle(final Vector2 pos, final int score, final Label.LabelStyle style) { BonusParticle(final Vector2 pos, final int score, final Label.LabelStyle style) {
label = new Label("+"+score, style); label = new Label("+" + score, style);
label.setBounds(pos.x, pos.y, 0, 0); label.setBounds(pos.x, pos.y, 0, 0);
} }

View file

@ -91,17 +91,17 @@ public class Piece {
for (int j = 0; j < lSize; ++j) for (int j = 0; j < lSize; ++j)
shape[0][j] = true; shape[0][j] = true;
for (int i = 0; i < lSize; ++i) for (int i = 0; i < lSize; ++i)
shape[i][lSize-1] = true; shape[i][lSize - 1] = true;
break; break;
case 2: // case 2: //
for (int j = 0; j < lSize; ++j) for (int j = 0; j < lSize; ++j)
shape[lSize-1][j] = true; shape[lSize - 1][j] = true;
for (int i = 0; i < lSize; ++i) for (int i = 0; i < lSize; ++i)
shape[i][lSize-1] = true; shape[i][lSize - 1] = true;
break; break;
case 3: // case 3: //
for (int j = 0; j < lSize; ++j) for (int j = 0; j < lSize; ++j)
shape[lSize-1][j] = true; shape[lSize - 1][j] = true;
for (int i = 0; i < lSize; ++i) for (int i = 0; i < lSize; ++i)
shape[i][0] = true; shape[i][0] = true;
break; break;
@ -121,19 +121,28 @@ public class Piece {
private static Piece fromIndex(int colorIndex, int rotateCount) { private static Piece fromIndex(int colorIndex, int rotateCount) {
switch (colorIndex) { switch (colorIndex) {
// Squares // Squares
case 0: return new Piece(1, 1, 0, colorIndex); case 0:
case 1: return new Piece(2, 2, 0, colorIndex); return new Piece(1, 1, 0, colorIndex);
case 2: return new Piece(3, 3, 0, colorIndex); case 1:
return new Piece(2, 2, 0, colorIndex);
case 2:
return new Piece(3, 3, 0, colorIndex);
// Lines // Lines
case 3: return new Piece(1, 2, rotateCount, colorIndex); case 3:
case 4: return new Piece(1, 3, rotateCount, colorIndex); return new Piece(1, 2, rotateCount, colorIndex);
case 5: return new Piece(1, 4, rotateCount, colorIndex); case 4:
case 6: return new Piece(1, 5, rotateCount, colorIndex); return new Piece(1, 3, rotateCount, colorIndex);
case 5:
return new Piece(1, 4, rotateCount, colorIndex);
case 6:
return new Piece(1, 5, rotateCount, colorIndex);
// L's // L's
case 7: return new Piece(2, rotateCount, colorIndex); case 7:
case 8: return new Piece(3, rotateCount, colorIndex); return new Piece(2, rotateCount, colorIndex);
case 8:
return new Piece(3, rotateCount, colorIndex);
} }
throw new RuntimeException("Random function is broken."); throw new RuntimeException("Random function is broken.");
} }

View file

@ -83,11 +83,11 @@ public class TimeScorer extends BaseScorer implements BinSerializable {
//region Private methods //region Private methods
private int nanosToSeconds(long nano) { private int nanosToSeconds(long nano) {
return MathUtils.ceil((float)(nano * NANOS_TO_SECONDS)); return MathUtils.ceil((float) (nano * NANOS_TO_SECONDS));
} }
private long scoreToNanos(int score) { private long scoreToNanos(int score) {
return (long)(score * SCORE_TO_NANOS); return (long) (score * SCORE_TO_NANOS);
} }
private int getTimeLeft() { private int getTimeLeft() {
@ -114,7 +114,9 @@ public class TimeScorer extends BaseScorer implements BinSerializable {
} }
@Override @Override
public String gameOverReason() { return "time is up"; } public String gameOverReason() {
return "time is up";
}
@Override @Override
public void saveScore() { public void saveScore() {

View file

@ -7,6 +7,8 @@ import io.github.lonamiwebs.klooni.game.Cell;
public interface IEffect { public interface IEffect {
void setInfo(Cell deadCell, Vector2 culprit); void setInfo(Cell deadCell, Vector2 culprit);
void draw(Batch batch); void draw(Batch batch);
boolean isDone(); boolean isDone();
} }

View file

@ -23,14 +23,17 @@ import io.github.lonamiwebs.klooni.game.Cell;
/** /**
* IEffectEfactory interface has to be implemented for each effect. * IEffectEfactory interface has to be implemented for each effect.
* * <p>
* It tells the name and the price of the effect and will create it, when needed. * It tells the name and the price of the effect and will create it, when needed.
* *
* @see IEffect * @see IEffect
*/ */
public interface IEffectFactory { public interface IEffectFactory {
public String getName(); public String getName();
public String getDisplay(); public String getDisplay();
public int getPrice(); public int getPrice();
public IEffect create(final Cell deadCell, final Vector2 culprit); public IEffect create(final Cell deadCell, final Vector2 culprit);
} }

View file

@ -70,8 +70,8 @@ class CustomizeScreen implements Screen {
//region Static members //region Static members
// As the examples show on the LibGdx wiki // As the examples show on the LibGdx wiki
private static final float MIN_DELTA = 1/30f; private static final float MIN_DELTA = 1 / 30f;
private static final float DRAG_LIMIT_SQ = 20*20; private static final float DRAG_LIMIT_SQ = 20 * 20;
//endregion //endregion
@ -210,7 +210,7 @@ class CustomizeScreen implements Screen {
// Scroll to the currently selected item // Scroll to the currently selected item
table.layout(); table.layout();
for (Actor a : shopGroup.getChildren()) { for (Actor a : shopGroup.getChildren()) {
ShopCard c = (ShopCard)a; ShopCard c = (ShopCard) a;
if (c.isUsed()) { if (c.isUsed()) {
shopScroll.scrollTo( shopScroll.scrollTo(
c.getX(), c.getY() + c.getHeight(), c.getX(), c.getY() + c.getHeight(),
@ -247,7 +247,7 @@ class CustomizeScreen implements Screen {
buyBand.askBuy(card); buyBand.askBuy(card);
for (Actor a : shopGroup.getChildren()) { for (Actor a : shopGroup.getChildren()) {
((ShopCard)a).usedItemUpdated(); ((ShopCard) a).usedItemUpdated();
} }
} }
} }
@ -276,7 +276,7 @@ class CustomizeScreen implements Screen {
// After everything is drawn, showcase the current shop item // After everything is drawn, showcase the current shop item
SnapshotArray<Actor> children = shopGroup.getChildren(); SnapshotArray<Actor> children = shopGroup.getChildren();
if (children.size > 0) { if (children.size > 0) {
final ShopCard card = (ShopCard)children.get(showcaseIndex); final ShopCard card = (ShopCard) children.get(showcaseIndex);
final Batch batch = stage.getBatch(); final Batch batch = stage.getBatch();
batch.begin(); batch.begin();
@ -311,13 +311,16 @@ class CustomizeScreen implements Screen {
//region Empty methods //region Empty methods
@Override @Override
public void pause() { } public void pause() {
}
@Override @Override
public void resume() { } public void resume() {
}
@Override @Override
public void hide() { } public void hide() {
}
//endregion //endregion
} }

View file

@ -106,7 +106,7 @@ class GameScreen implements Screen, InputProcessor, BinSerializable {
scorer = new TimeScorer(game, layout); scorer = new TimeScorer(game, layout);
break; break;
default: default:
throw new RuntimeException("Unknown game mode given: "+gameMode); throw new RuntimeException("Unknown game mode given: " + gameMode);
} }
board = new Board(layout, BOARD_SIZE); board = new Board(layout, BOARD_SIZE);
@ -258,10 +258,12 @@ class GameScreen implements Screen, InputProcessor, BinSerializable {
//region Unused methods //region Unused methods
@Override @Override
public void resize(int width, int height) { } public void resize(int width, int height) {
}
@Override @Override
public void resume() { } public void resume() {
}
@Override @Override
public void hide() { /* Hide can only be called if the menu was shown. Place logic there. */ } public void hide() { /* Hide can only be called if the menu was shown. Place logic there. */ }
@ -341,7 +343,8 @@ class GameScreen implements Screen, InputProcessor, BinSerializable {
// After it's been loaded, delete the save file // After it's been loaded, delete the save file
deleteSave(); deleteSave();
return true; return true;
} catch (IOException ignored) { } } catch (IOException ignored) {
}
} }
return false; return false;
} }

View file

@ -43,7 +43,7 @@ public class MainMenuScreen extends InputListener implements Screen {
//region Static members //region Static members
// As the examples show on the LibGdx wiki // As the examples show on the LibGdx wiki
private static final float minDelta = 1/30f; private static final float minDelta = 1 / 30f;
//endregion //endregion
@ -62,7 +62,7 @@ public class MainMenuScreen extends InputListener implements Screen {
final SoftButton playButton = new SoftButton( final SoftButton playButton = new SoftButton(
0, GameScreen.hasSavedData() ? "play_saved_texture" : "play_texture"); 0, GameScreen.hasSavedData() ? "play_saved_texture" : "play_texture");
playButton.addListener(new ChangeListener() { playButton.addListener(new ChangeListener() {
public void changed (ChangeEvent event, Actor actor) { public void changed(ChangeEvent event, Actor actor) {
MainMenuScreen.this.game.transitionTo( MainMenuScreen.this.game.transitionTo(
new GameScreen(MainMenuScreen.this.game, GameScreen.GAME_MODE_SCORE)); new GameScreen(MainMenuScreen.this.game, GameScreen.GAME_MODE_SCORE));
} }
@ -95,7 +95,7 @@ public class MainMenuScreen extends InputListener implements Screen {
// Palette button (buy colors) // Palette button (buy colors)
final SoftButton paletteButton = new SoftButton(3, "palette_texture"); final SoftButton paletteButton = new SoftButton(3, "palette_texture");
paletteButton.addListener(new ChangeListener() { paletteButton.addListener(new ChangeListener() {
public void changed (ChangeEvent event, Actor actor) { public void changed(ChangeEvent event, Actor actor) {
// Don't dispose because then it needs to take us to the previous screen // Don't dispose because then it needs to take us to the previous screen
MainMenuScreen.this.game.transitionTo(new CustomizeScreen( MainMenuScreen.this.game.transitionTo(new CustomizeScreen(
MainMenuScreen.this.game, MainMenuScreen.this.game.getScreen()), false); MainMenuScreen.this.game, MainMenuScreen.this.game.getScreen()), false);
@ -140,13 +140,16 @@ public class MainMenuScreen extends InputListener implements Screen {
//region Unused methods //region Unused methods
@Override @Override
public void pause() { } public void pause() {
}
@Override @Override
public void resume() { } public void resume() {
}
@Override @Override
public void hide() { } public void hide() {
}
//endregion //endregion
} }

View file

@ -80,7 +80,7 @@ class PauseMenuStage extends Stage {
table.add(homeButton).space(16); table.add(homeButton).space(16);
homeButton.addListener(new ChangeListener() { homeButton.addListener(new ChangeListener() {
public void changed (ChangeEvent event, Actor actor) { public void changed(ChangeEvent event, Actor actor) {
game.transitionTo(new MainMenuScreen(game)); game.transitionTo(new MainMenuScreen(game));
} }
}); });

View file

@ -101,19 +101,24 @@ class ShareScoreScreen implements Screen {
//region Empty methods //region Empty methods
@Override @Override
public void resize(int width, int height) { } public void resize(int width, int height) {
}
@Override @Override
public void dispose() { } public void dispose() {
}
@Override @Override
public void pause() { } public void pause() {
}
@Override @Override
public void resume() { } public void resume() {
}
@Override @Override
public void hide() { } public void hide() {
}
//endregion //endregion
} }

View file

@ -96,8 +96,7 @@ public class TransitionScreen implements Screen {
fadedElapsed = 0; fadedElapsed = 0;
fadingOut = false; fadingOut = false;
} }
} } else {
else {
toScreen.render(delta); toScreen.render(delta);
opacity = Math.min(fadedElapsed * FADE_INVERSE_DELAY, 1); opacity = Math.min(fadedElapsed * FADE_INVERSE_DELAY, 1);
} }
@ -146,13 +145,16 @@ public class TransitionScreen implements Screen {
//region Unused methods //region Unused methods
@Override @Override
public void pause() { } public void pause() {
}
@Override @Override
public void resume() { } public void resume() {
}
@Override @Override
public void hide() { } public void hide() {
}
//endregion //endregion
} }

View file

@ -23,5 +23,6 @@ import java.io.IOException;
public interface BinSerializable { public interface BinSerializable {
void write(final DataOutputStream out) throws IOException; void write(final DataOutputStream out) throws IOException;
void read(final DataInputStream in) throws IOException; void read(final DataInputStream in) throws IOException;
} }

View file

@ -27,7 +27,7 @@ import java.util.Arrays;
public class BinSerializer { public class BinSerializer {
// ascii (klooni) and binary (1010b) // ascii (klooni) and binary (1010b)
private final 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 // MODIFY THIS VALUE EVERY TIME A BinSerializable IMPLEMENTATION CHANGES
// Or unwanted results will happen and corrupt the game in an unknown way. // Or unwanted results will happen and corrupt the game in an unknown way.
@ -43,7 +43,8 @@ public class BinSerializer {
} finally { } finally {
try { try {
out.close(); out.close();
} catch (IOException ignored) { } } catch (IOException ignored) {
}
} }
} }
@ -68,7 +69,8 @@ public class BinSerializer {
} finally { } finally {
try { try {
in.close(); in.close();
} catch (IOException ignored) { } } catch (IOException ignored) {
}
} }
} }
} }