Commit 8aa1e8e6 authored by Vitaliy Vashchenko's avatar Vitaliy Vashchenko

Merge branch 'feature-gamepagegroup-language-defect' into 'V3.7'

#950 not create TablexiaLabel in enum contructor dof DifficultyOption

See merge request !743
parents a84f74e0 56d2f191
...@@ -252,7 +252,6 @@ public class GamePageGroup extends Group { ...@@ -252,7 +252,6 @@ public class GamePageGroup extends Group {
HARD (GameDifficulty.HARD, GamePageAssets.DIFF_THUMB_HARD, DIFFICULTY_BUTTON_HARD), HARD (GameDifficulty.HARD, GamePageAssets.DIFF_THUMB_HARD, DIFFICULTY_BUTTON_HARD),
BONUS (GameDifficulty.BONUS, GamePageAssets.DIFF_THUMB_BONUS, DIFFICULTY_BUTTON_BONUS); BONUS (GameDifficulty.BONUS, GamePageAssets.DIFF_THUMB_BONUS, DIFFICULTY_BUTTON_BONUS);
private TablexiaLabel label;
private float snapPointPosition; private float snapPointPosition;
private GameDifficulty gameDifficulty; private GameDifficulty gameDifficulty;
private String texturePath; private String texturePath;
...@@ -263,8 +262,13 @@ public class GamePageGroup extends Group { ...@@ -263,8 +262,13 @@ public class GamePageGroup extends Group {
this.texturePath = texturePath; this.texturePath = texturePath;
this.buttonName = buttonName; 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 { ...@@ -303,10 +307,13 @@ public class GamePageGroup extends Group {
diffStack = new Stack(); diffStack = new Stack();
Color color = isBonusDifficultyUnlocked() ? Color.BLACK : Color.DARK_GRAY;
for(DifficultyOption diffOption : DifficultyOption.values()) { for(DifficultyOption diffOption : DifficultyOption.values()) {
diffOption.snapPointPosition = (barWidth / (DifficultyOption.values().length - 1)) * diffOption.ordinal() + barX - diffThumbWidth / 2; diffOption.snapPointPosition = (barWidth / (DifficultyOption.values().length - 1)) * diffOption.ordinal() + barX - diffThumbWidth / 2;
diffOption.label.setPosition(diffOption.snapPointPosition + (diffThumbWidth / 2) - diffOption.label.getWidth() / 2, barPositionY); TablexiaLabel tablexiaLabel = diffOption.createLabel(diffOption == DifficultyOption.BONUS ? color : Color.BLACK);
addActor(diffOption.label); tablexiaLabel.setPosition(diffOption.snapPointPosition + (diffThumbWidth / 2) - tablexiaLabel.getWidth() / 2, barPositionY);
addActor(tablexiaLabel);
Actor diffButton = new Actor(); Actor diffButton = new Actor();
diffButton.setSize(diffThumbWidth, diffThumbHeight); diffButton.setSize(diffThumbWidth, diffThumbHeight);
...@@ -323,8 +330,6 @@ public class GamePageGroup extends Group { ...@@ -323,8 +330,6 @@ public class GamePageGroup extends Group {
addActor(diffButton); addActor(diffButton);
diffStack.addActor(new Image(getScreen().getCommonGamePageTextureRegion(diffOption.texturePath))); 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.setSize(diffThumbWidth, diffThumbHeight);
diffStack.setPosition(DifficultyOption.EASY.snapPointPosition, diffThumbY); 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