Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
977f126073
@ -9,20 +9,25 @@ import javafx.util.Duration;
|
||||
public class BGAnimation extends Transition {
|
||||
private ImageView bgView;
|
||||
private ImageView fgView;
|
||||
private ImageView crop;
|
||||
private int index;
|
||||
private int lastIndex;
|
||||
|
||||
public BGAnimation(Duration duration, ImageView bgView, ImageView fgView) {
|
||||
public BGAnimation(Duration duration, ImageView bgView, ImageView fgView, ImageView imageCrop) {
|
||||
index = 0;
|
||||
lastIndex = 1034;
|
||||
this.bgView = bgView;
|
||||
this.fgView = fgView;
|
||||
this.crop = imageCrop;
|
||||
bgView.setFitHeight(1950);
|
||||
bgView.setFitWidth(6667.968);
|
||||
bgView.setImage(Sprites.getBg());
|
||||
fgView.setFitHeight(1950);
|
||||
fgView.setFitWidth(6667.968);
|
||||
fgView.setImage(Sprites.getFg());
|
||||
imageCrop.setFitHeight(1950);
|
||||
imageCrop.setFitWidth(6667.968);
|
||||
imageCrop.setImage(Sprites.getCrop());
|
||||
|
||||
setCycleDuration(duration);
|
||||
setInterpolator(Interpolator.DISCRETE);
|
||||
|
||||
@ -30,7 +30,7 @@ public class DayNightChangeListener implements Runnable {
|
||||
@Override
|
||||
public void run() {
|
||||
try{
|
||||
Thread.sleep(1000); //TODO(Seraina): test!
|
||||
gameStateModel.setDayClone(false);
|
||||
while(!gameStateModel.isGameOver()) {
|
||||
if(gameStateModel.getDayClone()) { //its Day
|
||||
LoungeSceneViewController.getTrainAnimationDayController().dontShowFullWagon();
|
||||
@ -46,6 +46,8 @@ public class DayNightChangeListener implements Runnable {
|
||||
try {
|
||||
if (gameStateModel.getYourRoleFromPosition(position).equals("")) {
|
||||
LoungeSceneViewController.getTrainAnimationDayController().showFullWagon();
|
||||
} else if (gameStateModel.getYourRoleFromPosition(position).equals("g")) {
|
||||
LoungeSceneViewController.getTrainAnimationDayController().dontShowFullWagon();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.getMessage();
|
||||
|
||||
@ -20,6 +20,7 @@ public class Sprites {
|
||||
private static Image[] wheels = new Image[26];
|
||||
private static Image[] bells = new Image[17];
|
||||
private static Image fg;
|
||||
private static Image crop;
|
||||
|
||||
public static Image getBg() {
|
||||
return bg;
|
||||
@ -69,6 +70,10 @@ public class Sprites {
|
||||
return fg;
|
||||
}
|
||||
|
||||
public static Image getCrop() {
|
||||
return crop;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets all Images of this class to the Day Version
|
||||
*/
|
||||
@ -85,6 +90,7 @@ public class Sprites {
|
||||
wheels = SpritesDay.wheels;
|
||||
bells = SpritesDay.bells;
|
||||
fg = SpritesDay.fg;
|
||||
crop = SpritesDay.crop;
|
||||
} catch (Exception e) {
|
||||
System.out.println(e.getMessage());
|
||||
e.printStackTrace();
|
||||
@ -114,6 +120,7 @@ public class Sprites {
|
||||
wheels = SpritesNight.wheels;
|
||||
bells = SpritesNight.bells;
|
||||
fg = SpritesNight.fg;
|
||||
crop = SpritesNight.crop;
|
||||
}
|
||||
|
||||
public static void updateNightRoomSprites(String[] roles, boolean[] kickedOff) {
|
||||
|
||||
@ -27,6 +27,7 @@ public class SpritesDay {
|
||||
public static final Image[] wheels = new Image[26];
|
||||
public static final Image[] bells = new Image[17];
|
||||
public static final Image fg = new Image(path + "Foreground_small.png");
|
||||
public static final Image crop = new Image("ch/unibas/dmi/dbis/cs108/multiplayer/client/gui/game/background_crop.png");
|
||||
|
||||
public static void setWheels() {
|
||||
try {
|
||||
|
||||
@ -33,6 +33,6 @@ public class SpritesNight {
|
||||
public static final Image[] wheels = SpritesDay.wheels;
|
||||
public static final Image[] bells = SpritesDay.bells;
|
||||
public static final Image fg = new Image(path + "Foreground_small.png");
|
||||
|
||||
public static final Image crop = SpritesDay.crop;
|
||||
|
||||
}
|
||||
|
||||
@ -20,6 +20,8 @@ public class TrainAnimationDayController implements Initializable {
|
||||
public static final Logger LOGGER = LogManager.getLogger(TrainAnimationDayController.class);
|
||||
public static final BudaLogConfig l = new BudaLogConfig(LOGGER);
|
||||
|
||||
@FXML
|
||||
private ImageView backgroundCropView;
|
||||
@FXML
|
||||
private ImageView wagonWallImageView;
|
||||
@FXML
|
||||
@ -256,7 +258,7 @@ public class TrainAnimationDayController implements Initializable {
|
||||
Animation wheels = new WheelsAnimation(Duration.millis(866.666), wheelsImageView);
|
||||
wheels.setCycleCount(Animation.INDEFINITE);
|
||||
wheels.play();
|
||||
Animation backGround = new BGAnimation(Duration.millis(17), backGroundAnimationImageView, foreGroundAnimationImageView1);
|
||||
Animation backGround = new BGAnimation(Duration.millis(17), backGroundAnimationImageView, foreGroundAnimationImageView1, backgroundCropView);
|
||||
backGround.setCycleCount(Animation.INDEFINITE);
|
||||
backGround.play();
|
||||
}
|
||||
|
||||
@ -80,6 +80,7 @@
|
||||
<AnchorPane layoutX="10.0" layoutY="10.0" pickOnBounds="false" prefHeight="200.0" prefWidth="200.0" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<children>
|
||||
<ImageView fx:id="foreGroundAnimationImageView1" fitHeight="843.75" fitWidth="1500.0" preserveRatio="true" />
|
||||
<ImageView fx:id="backgroundCropView" fitHeight="843.75" fitWidth="1500.0" layoutX="10.0" layoutY="10.0" preserveRatio="true" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="0.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</children>
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 59 KiB |
Reference in New Issue
Block a user