Commit 56d2f191 authored by Lukas Marik's avatar Lukas Marik

#950 not create TablexiaLabel in enum contructor dof DifficultyOption

parent a84f74e0
......@@ -252,7 +252,6 @@ public class GamePageGroup extends Group {
HARD (GameDifficulty.HARD, GamePageAssets.DIFF_THUMB_HARD, DIFFICULTY_BUTTON_HARD),
BONUS (GameDifficulty.BONUS, GamePageAssets.DIFF_THUMB_BONUS, DIFFICULTY_BUTTON_BONUS);
private TablexiaLabel label;
private float snapPointPosition;
private GameDifficulty gameDifficulty;
private String texturePath;
......@@ -263,8 +262,13 @@ public class GamePageGroup extends Group {
this.texturePath = texturePath;
this.buttonName = buttonName;
label = new TablexiaLabel(gameDifficulty.getTextDescription(), new TablexiaLabel.TablexiaLabelStyle(DIFFICULTY_FONT_STYLE, Color.BLACK));
label.setAlignment(Align.center);
}
public TablexiaLabel createLabel(Color color){
TablexiaLabel tablexiaLabel = new TablexiaLabel(gameDifficulty.getTextDescription(), new TablexiaLabel.TablexiaLabelStyle(DIFFICULTY_FONT_STYLE, color));
tablexiaLabel.setAlignment(Align.center);
return tablexiaLabel;
}
}
......@@ -303,10 +307,13 @@ public class GamePageGroup extends Group {
diffStack = new Stack();
Color color = isBonusDifficultyUnlocked() ? Color.BLACK : Color.DARK_GRAY;
for(DifficultyOption diffOption : DifficultyOption.values()) {
diffOption.snapPointPosition = (barWidth / (DifficultyOption.values().length - 1)) * diffOption.ordinal() + barX - diffThumbWidth / 2;
diffOption.label.setPosition(diffOption.snapPointPosition + (diffThumbWidth / 2) - diffOption.label.getWidth() / 2, barPositionY);
addActor(diffOption.label);
TablexiaLabel tablexiaLabel = diffOption.createLabel(diffOption == DifficultyOption.BONUS ? color : Color.BLACK);
tablexiaLabel.setPosition(diffOption.snapPointPosition + (diffThumbWidth / 2) - tablexiaLabel.getWidth() / 2, barPositionY);
addActor(tablexiaLabel);
Actor diffButton = new Actor();
diffButton.setSize(diffThumbWidth, diffThumbHeight);
......@@ -323,8 +330,6 @@ public class GamePageGroup extends Group {
addActor(diffButton);
diffStack.addActor(new Image(getScreen().getCommonGamePageTextureRegion(diffOption.texturePath)));
}
Color color = isBonusDifficultyUnlocked() ? Color.BLACK : Color.DARK_GRAY;
DifficultyOption.BONUS.label.setTablexiaLabelStyle(new TablexiaLabel.TablexiaLabelStyle(DIFFICULTY_FONT_STYLE, color));
diffStack.setSize(diffThumbWidth, diffThumbHeight);
diffStack.setPosition(DifficultyOption.EASY.snapPointPosition, diffThumbY);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment