Merge remote-tracking branch 'origin/master'

This commit is contained in:
Jonas 2022-05-15 21:06:01 +02:00
commit 977f126073
8 changed files with 22 additions and 4 deletions

View File

@ -9,20 +9,25 @@ import javafx.util.Duration;
public class BGAnimation extends Transition { public class BGAnimation extends Transition {
private ImageView bgView; private ImageView bgView;
private ImageView fgView; private ImageView fgView;
private ImageView crop;
private int index; private int index;
private int lastIndex; private int lastIndex;
public BGAnimation(Duration duration, ImageView bgView, ImageView fgView) { public BGAnimation(Duration duration, ImageView bgView, ImageView fgView, ImageView imageCrop) {
index = 0; index = 0;
lastIndex = 1034; lastIndex = 1034;
this.bgView = bgView; this.bgView = bgView;
this.fgView = fgView; this.fgView = fgView;
this.crop = imageCrop;
bgView.setFitHeight(1950); bgView.setFitHeight(1950);
bgView.setFitWidth(6667.968); bgView.setFitWidth(6667.968);
bgView.setImage(Sprites.getBg()); bgView.setImage(Sprites.getBg());
fgView.setFitHeight(1950); fgView.setFitHeight(1950);
fgView.setFitWidth(6667.968); fgView.setFitWidth(6667.968);
fgView.setImage(Sprites.getFg()); fgView.setImage(Sprites.getFg());
imageCrop.setFitHeight(1950);
imageCrop.setFitWidth(6667.968);
imageCrop.setImage(Sprites.getCrop());
setCycleDuration(duration); setCycleDuration(duration);
setInterpolator(Interpolator.DISCRETE); setInterpolator(Interpolator.DISCRETE);

View File

@ -30,7 +30,7 @@ public class DayNightChangeListener implements Runnable {
@Override @Override
public void run() { public void run() {
try{ try{
Thread.sleep(1000); //TODO(Seraina): test! gameStateModel.setDayClone(false);
while(!gameStateModel.isGameOver()) { while(!gameStateModel.isGameOver()) {
if(gameStateModel.getDayClone()) { //its Day if(gameStateModel.getDayClone()) { //its Day
LoungeSceneViewController.getTrainAnimationDayController().dontShowFullWagon(); LoungeSceneViewController.getTrainAnimationDayController().dontShowFullWagon();
@ -46,6 +46,8 @@ public class DayNightChangeListener implements Runnable {
try { try {
if (gameStateModel.getYourRoleFromPosition(position).equals("")) { if (gameStateModel.getYourRoleFromPosition(position).equals("")) {
LoungeSceneViewController.getTrainAnimationDayController().showFullWagon(); LoungeSceneViewController.getTrainAnimationDayController().showFullWagon();
} else if (gameStateModel.getYourRoleFromPosition(position).equals("g")) {
LoungeSceneViewController.getTrainAnimationDayController().dontShowFullWagon();
} }
} catch (Exception e) { } catch (Exception e) {
e.getMessage(); e.getMessage();

View File

@ -20,6 +20,7 @@ public class Sprites {
private static Image[] wheels = new Image[26]; private static Image[] wheels = new Image[26];
private static Image[] bells = new Image[17]; private static Image[] bells = new Image[17];
private static Image fg; private static Image fg;
private static Image crop;
public static Image getBg() { public static Image getBg() {
return bg; return bg;
@ -69,6 +70,10 @@ public class Sprites {
return fg; return fg;
} }
public static Image getCrop() {
return crop;
}
/** /**
* Sets all Images of this class to the Day Version * Sets all Images of this class to the Day Version
*/ */
@ -85,6 +90,7 @@ public class Sprites {
wheels = SpritesDay.wheels; wheels = SpritesDay.wheels;
bells = SpritesDay.bells; bells = SpritesDay.bells;
fg = SpritesDay.fg; fg = SpritesDay.fg;
crop = SpritesDay.crop;
} catch (Exception e) { } catch (Exception e) {
System.out.println(e.getMessage()); System.out.println(e.getMessage());
e.printStackTrace(); e.printStackTrace();
@ -114,6 +120,7 @@ public class Sprites {
wheels = SpritesNight.wheels; wheels = SpritesNight.wheels;
bells = SpritesNight.bells; bells = SpritesNight.bells;
fg = SpritesNight.fg; fg = SpritesNight.fg;
crop = SpritesNight.crop;
} }
public static void updateNightRoomSprites(String[] roles, boolean[] kickedOff) { public static void updateNightRoomSprites(String[] roles, boolean[] kickedOff) {

View File

@ -27,6 +27,7 @@ public class SpritesDay {
public static final Image[] wheels = new Image[26]; public static final Image[] wheels = new Image[26];
public static final Image[] bells = new Image[17]; public static final Image[] bells = new Image[17];
public static final Image fg = new Image(path + "Foreground_small.png"); 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() { public static void setWheels() {
try { try {

View File

@ -33,6 +33,6 @@ public class SpritesNight {
public static final Image[] wheels = SpritesDay.wheels; public static final Image[] wheels = SpritesDay.wheels;
public static final Image[] bells = SpritesDay.bells; public static final Image[] bells = SpritesDay.bells;
public static final Image fg = new Image(path + "Foreground_small.png"); public static final Image fg = new Image(path + "Foreground_small.png");
public static final Image crop = SpritesDay.crop;
} }

View File

@ -20,6 +20,8 @@ public class TrainAnimationDayController implements Initializable {
public static final Logger LOGGER = LogManager.getLogger(TrainAnimationDayController.class); public static final Logger LOGGER = LogManager.getLogger(TrainAnimationDayController.class);
public static final BudaLogConfig l = new BudaLogConfig(LOGGER); public static final BudaLogConfig l = new BudaLogConfig(LOGGER);
@FXML
private ImageView backgroundCropView;
@FXML @FXML
private ImageView wagonWallImageView; private ImageView wagonWallImageView;
@FXML @FXML
@ -256,7 +258,7 @@ public class TrainAnimationDayController implements Initializable {
Animation wheels = new WheelsAnimation(Duration.millis(866.666), wheelsImageView); Animation wheels = new WheelsAnimation(Duration.millis(866.666), wheelsImageView);
wheels.setCycleCount(Animation.INDEFINITE); wheels.setCycleCount(Animation.INDEFINITE);
wheels.play(); 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.setCycleCount(Animation.INDEFINITE);
backGround.play(); backGround.play();
} }

View File

@ -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"> <AnchorPane layoutX="10.0" layoutY="10.0" pickOnBounds="false" prefHeight="200.0" prefWidth="200.0" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="0.0">
<children> <children>
<ImageView fx:id="foreGroundAnimationImageView1" fitHeight="843.75" fitWidth="1500.0" preserveRatio="true" /> <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> </children>
</AnchorPane> </AnchorPane>
</children> </children>

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB