Commit 06db4035 authored by Aneta Steimarova's avatar Aneta Steimarova

#847 Refactoring constants in VisualizationDialog class

parent 59843b87
......@@ -48,10 +48,16 @@ public class VisualizationDialog {
private static final int VISUALIZATION_OK_HEIGHT = 50;
private static final String VISUALIZATION_OK_TEXT = "OK";
private final float BUTTON_Y_POSITION_RATIO = 0.15f;
private final float VIZUALIZATION_PAPER_WIDTH = 0.95f;
private final float VIZUALIZATION_PAPER_HEIGHT = 0.4f;
private final int VIZUALIZATION_PAPER_LEFT_BORDER = 5;
private static final float BUTTON_Y_POSITION_RATIO = 0.15f;
private static final float VIZUALIZATION_PAPER_WIDTH = 0.95f;
private static final float VIZUALIZATION_PAPER_HEIGHT = 0.4f;
private static final int VIZUALIZATION_PAPER_LEFT_BORDER = 5;
private static float CHARACTER_SPACE = 40;
private static float ONE_IMAGE_WITH_SPACE = 40;
private static float ONE_IMAGE_WIDTH_AND_HEIGHT = 30;
private static float IMAGE_SPACE = 10;
private static Color CHARACTER_COLOR = Color.BLACK;
SafeGame safeGame;
......@@ -114,25 +120,22 @@ public class VisualizationDialog {
private void addImagesToSounds(Group vizualizationGroup, Image paper, List<Actor> listOfChars) {
Group soundImageGroup = new Group();
float oneImageWithSpace = 40;
float oneImageWidthanHeight = 30;
float imageSpace = 10;
int space = VIZUALIZATION_PAPER_LEFT_BORDER;
for(SafeSounds safeSound: safeGame.getSafeSequence().getGeneratedSoundSequence()){
if(safeSound.equals(SafeSounds.SILENCE)){
space += oneImageWithSpace;
space += ONE_IMAGE_WITH_SPACE;
}
else space = createAndAddImage(safeSound, soundImageGroup, space, oneImageWidthanHeight, imageSpace, listOfChars);
else space = createAndAddImage(safeSound, soundImageGroup, space, ONE_IMAGE_WIDTH_AND_HEIGHT, IMAGE_SPACE, listOfChars);
}
for (int i=0; i<safeGame.getSafeSequence().getPlayAgainFirstXSounds(); i++){
SafeSounds safeSound = safeGame.getSafeSequence().getGeneratedSoundSequence()[i];
if(safeSound.equals(SafeSounds.SILENCE)){
space += oneImageWithSpace;
space += ONE_IMAGE_WITH_SPACE;
}
else space = createAndAddImage(safeSound, soundImageGroup, space, oneImageWidthanHeight, imageSpace, listOfChars);
else space = createAndAddImage(safeSound, soundImageGroup, space, ONE_IMAGE_WIDTH_AND_HEIGHT, IMAGE_SPACE, listOfChars);
}
makePositioning(soundImageGroup, paper, space, imageSpace);
makePositioning(soundImageGroup, paper, space, IMAGE_SPACE);
vizualizationGroup.addActor(soundImageGroup);
}
......@@ -147,7 +150,7 @@ public class VisualizationDialog {
return space;
}
Image soundImage = new Image(safeGame.getScreenTextureRegion(VisualizationObject.getImageForID(imageID)));
soundImage.setColor(Color.BLACK);
soundImage.setColor(CHARACTER_COLOR);
soundImage.setWidth(oneImageWidthanHeight);
soundImage.setHeight(oneImageWidthanHeight);
soundImage.setPosition(space + soundImage.getWidth()/2, 0);
......@@ -159,17 +162,16 @@ public class VisualizationDialog {
private void addCharactersToSounds(Group vizualizationGroup, Image paper, List<Actor> listOfChars) {
Group soundImageGroup = new Group();
float imageSpace = 40;
int space = VIZUALIZATION_PAPER_LEFT_BORDER;
for(SafeSounds safeSound: safeGame.getSafeSequence().getGeneratedSoundSequence()){
TablexiaLabel textLabel = new TablexiaLabel(safeSound.getSoundName(), new TablexiaLabel.TablexiaLabelStyle(ApplicationFontManager.FontType.REGULAR_35, Color.WHITE), false);
textLabel.setColor(Color.BLACK);
textLabel.setColor(CHARACTER_COLOR);
textLabel.setPosition(space + textLabel.getWidth()/2, 0);
space += textLabel.getWidth() + imageSpace;
space += textLabel.getWidth() + CHARACTER_SPACE;
soundImageGroup.addActor(textLabel);
listOfChars.add(textLabel);
}
makePositioning(soundImageGroup, paper, space, imageSpace);
makePositioning(soundImageGroup, paper, space, CHARACTER_SPACE);
vizualizationGroup.addActor(soundImageGroup);
}
......
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