Add missing colors to the themes
This commit is contained in:
parent
6fde0e7b00
commit
9d74c813e5
6 changed files with 34 additions and 13 deletions
|
@ -9,11 +9,14 @@
|
||||||
"c23a20ff",
|
"c23a20ff",
|
||||||
"956fd6ff"
|
"956fd6ff"
|
||||||
],
|
],
|
||||||
|
"empty_cell": "292929ff",
|
||||||
"cells": [
|
"cells": [
|
||||||
"7931bfff", "4c87aeff", "3aa853ff",
|
"7931bfff", "4c87aeff", "3aa853ff",
|
||||||
"1e984dff", "2e749bff", "db5500ff", "d88109ff",
|
"1e984dff", "2e749bff", "db5500ff", "d88109ff",
|
||||||
"d9294dff", "ac342bff"
|
"d9294dff", "ac342bff"
|
||||||
]
|
],
|
||||||
|
"current_score": "c83737ff",
|
||||||
|
"high_score": "d400aaff"
|
||||||
},
|
},
|
||||||
"cell_texture": "basic.png"
|
"cell_texture": "basic.png"
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,11 +9,14 @@
|
||||||
"2389fcff",
|
"2389fcff",
|
||||||
"d94848ff"
|
"d94848ff"
|
||||||
],
|
],
|
||||||
|
"empty_cell": "ffffffff",
|
||||||
"cells": [
|
"cells": [
|
||||||
"7988bfff", "98dc53ff", "4cd4aeff",
|
"7988bfff", "98dc53ff", "4cd4aeff",
|
||||||
"fec63dff", "ec9548ff", "e66a82ff", "da6554ff",
|
"fec63dff", "ec9548ff", "e66a82ff", "da6554ff",
|
||||||
"57cb84ff", "5abee2ff"
|
"57cb84ff", "5abee2ff"
|
||||||
]
|
],
|
||||||
|
"current_score": "ffcc00ff",
|
||||||
|
"high_score": "65d681ff"
|
||||||
},
|
},
|
||||||
"cell_texture": "basic.png"
|
"cell_texture": "basic.png"
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,13 @@ public class Theme {
|
||||||
private String displayName;
|
private String displayName;
|
||||||
private String name;
|
private String name;
|
||||||
private int price;
|
private int price;
|
||||||
|
|
||||||
public Color background;
|
public Color background;
|
||||||
|
public Color emptyCell;
|
||||||
|
|
||||||
|
public Color currentScore;
|
||||||
|
public Color highScore;
|
||||||
|
|
||||||
private Color[] cells;
|
private Color[] cells;
|
||||||
private Color[] buttons;
|
private Color[] buttons;
|
||||||
|
|
||||||
|
@ -99,6 +105,11 @@ 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));
|
||||||
|
highScore = new Color((int)Long.parseLong(colors.getString("high_score"), 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++) {
|
||||||
|
|
|
@ -35,7 +35,6 @@ public class Cell {
|
||||||
size = cellSize;
|
size = cellSize;
|
||||||
|
|
||||||
empty = true;
|
empty = true;
|
||||||
color = Color.WHITE;
|
|
||||||
vanishElapsed = Float.POSITIVE_INFINITY;
|
vanishElapsed = Float.POSITIVE_INFINITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +49,8 @@ public class Cell {
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw(SpriteBatch batch) {
|
void draw(SpriteBatch batch) {
|
||||||
draw(color, batch, pos.x, pos.y, size);
|
// Always query the color to the theme, because it might have changed
|
||||||
|
draw(empty ? Klooni.theme.emptyCell : color, batch, pos.x, pos.y, size);
|
||||||
|
|
||||||
// Draw the previous vanishing cell
|
// Draw the previous vanishing cell
|
||||||
if (vanishElapsed <= vanishLifetime) {
|
if (vanishElapsed <= vanishLifetime) {
|
||||||
|
@ -89,8 +89,6 @@ public class Cell {
|
||||||
|
|
||||||
// Negative time = delay, + 0.4*lifetime because elastic interpolation has that delay
|
// Negative time = delay, + 0.4*lifetime because elastic interpolation has that delay
|
||||||
vanishElapsed = vanishLifetime * 0.4f - vanishDist;
|
vanishElapsed = vanishLifetime * 0.4f - vanishDist;
|
||||||
|
|
||||||
color = Color.WHITE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isEmpty() {
|
boolean isEmpty() {
|
||||||
|
|
|
@ -70,7 +70,7 @@ public class GameLayout {
|
||||||
area.x, area.y,
|
area.x, area.y,
|
||||||
area.width * 0.5f - cupSize * 0.5f, area.height);
|
area.width * 0.5f - cupSize * 0.5f, area.height);
|
||||||
|
|
||||||
scorer.maxScoreLabel.setBounds(
|
scorer.highScoreLabel.setBounds(
|
||||||
area.x + area.width * 0.5f + cupSize * 0.5f, area.y,
|
area.x + area.width * 0.5f + cupSize * 0.5f, area.y,
|
||||||
area.width * 0.5f - cupSize * 0.5f, area.height);
|
area.width * 0.5f - cupSize * 0.5f, area.height);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,11 +22,13 @@ public class Scorer {
|
||||||
private int currentScore, maxScore;
|
private int currentScore, maxScore;
|
||||||
|
|
||||||
final Label currentScoreLabel;
|
final Label currentScoreLabel;
|
||||||
final Label maxScoreLabel;
|
final Label highScoreLabel;
|
||||||
|
|
||||||
final Texture cupTexture;
|
final Texture cupTexture;
|
||||||
final Rectangle cupArea;
|
final Rectangle cupArea;
|
||||||
|
|
||||||
|
private final Color cupColor;
|
||||||
|
|
||||||
// If the currentScore beat the maxScore, then we have a new record
|
// If the currentScore beat the maxScore, then we have a new record
|
||||||
private boolean newRecord;
|
private boolean newRecord;
|
||||||
|
|
||||||
|
@ -43,17 +45,18 @@ public class Scorer {
|
||||||
maxScore = Klooni.getMaxScore();
|
maxScore = Klooni.getMaxScore();
|
||||||
|
|
||||||
cupTexture = new Texture(Gdx.files.internal("ui/cup.png"));
|
cupTexture = new Texture(Gdx.files.internal("ui/cup.png"));
|
||||||
|
cupColor = Klooni.theme.currentScore.cpy();
|
||||||
cupArea = new Rectangle();
|
cupArea = new Rectangle();
|
||||||
|
|
||||||
Label.LabelStyle labelStyle = new Label.LabelStyle();
|
Label.LabelStyle labelStyle = new Label.LabelStyle();
|
||||||
labelStyle.font = game.skin.getFont("font");
|
labelStyle.font = game.skin.getFont("font");
|
||||||
|
|
||||||
currentScoreLabel = new Label("0", labelStyle);
|
currentScoreLabel = new Label("0", labelStyle);
|
||||||
currentScoreLabel.setColor(Color.GOLD);
|
currentScoreLabel.setColor(Klooni.theme.currentScore);
|
||||||
currentScoreLabel.setAlignment(Align.right);
|
currentScoreLabel.setAlignment(Align.right);
|
||||||
|
|
||||||
maxScoreLabel = new Label(Integer.toString(maxScore), labelStyle);
|
highScoreLabel = new Label(Integer.toString(maxScore), labelStyle);
|
||||||
maxScoreLabel.setColor(new Color(0x65D681FF));
|
highScoreLabel.setColor(Klooni.theme.highScore);
|
||||||
|
|
||||||
layout.update(this);
|
layout.update(this);
|
||||||
}
|
}
|
||||||
|
@ -108,10 +111,13 @@ public class Scorer {
|
||||||
currentScoreLabel.setText(Integer.toString(MathUtils.round(shownScore)));
|
currentScoreLabel.setText(Integer.toString(MathUtils.round(shownScore)));
|
||||||
}
|
}
|
||||||
|
|
||||||
batch.setColor(Color.GOLD);
|
// If we beat a new record, the cup color will linear interpolate to the high score color
|
||||||
|
cupColor.lerp(newRecord ? Klooni.theme.highScore : Klooni.theme.currentScore, 0.05f);
|
||||||
|
batch.setColor(cupColor);
|
||||||
batch.draw(cupTexture, cupArea.x, cupArea.y, cupArea.width, cupArea.height);
|
batch.draw(cupTexture, cupArea.x, cupArea.y, cupArea.width, cupArea.height);
|
||||||
|
|
||||||
currentScoreLabel.draw(batch, 1f);
|
currentScoreLabel.draw(batch, 1f);
|
||||||
maxScoreLabel.draw(batch, 1f);
|
highScoreLabel.draw(batch, 1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
//endregion
|
//endregion
|
||||||
|
|
Loading…
Reference in a new issue