Merge remote-tracking branch 'origin/master'
@ -3,3 +3,5 @@ serai
|
|||||||
serai
|
serai
|
||||||
Jonas of Istanbul
|
Jonas of Istanbul
|
||||||
serai
|
serai
|
||||||
|
serai
|
||||||
|
serai
|
||||||
|
|||||||
@ -19,7 +19,7 @@ public class BudaLogConfig {
|
|||||||
LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
|
LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
|
||||||
Configuration config = ctx.getConfiguration();
|
Configuration config = ctx.getConfiguration();
|
||||||
LoggerConfig loggerConfig = config.getLoggerConfig(LogManager.ROOT_LOGGER_NAME);
|
LoggerConfig loggerConfig = config.getLoggerConfig(LogManager.ROOT_LOGGER_NAME);
|
||||||
loggerConfig.setLevel(Level.DEBUG); // change level here
|
loggerConfig.setLevel(Level.ERROR); // change level here
|
||||||
ctx.updateLoggers(); // This causes all Loggers to refetch information from their LoggerConfig.
|
ctx.updateLoggers(); // This causes all Loggers to refetch information from their LoggerConfig.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import ch.unibas.dmi.dbis.cs108.multiplayer.client.gui.ClientModel;
|
|||||||
import ch.unibas.dmi.dbis.cs108.multiplayer.client.gui.GUI;
|
import ch.unibas.dmi.dbis.cs108.multiplayer.client.gui.GUI;
|
||||||
import ch.unibas.dmi.dbis.cs108.multiplayer.client.gui.GameStateModel;
|
import ch.unibas.dmi.dbis.cs108.multiplayer.client.gui.GameStateModel;
|
||||||
import ch.unibas.dmi.dbis.cs108.multiplayer.client.gui.ChatApp;
|
import ch.unibas.dmi.dbis.cs108.multiplayer.client.gui.ChatApp;
|
||||||
|
import ch.unibas.dmi.dbis.cs108.multiplayer.client.gui.Sprites;
|
||||||
import ch.unibas.dmi.dbis.cs108.multiplayer.client.gui.chat.ChatController;
|
import ch.unibas.dmi.dbis.cs108.multiplayer.client.gui.chat.ChatController;
|
||||||
import ch.unibas.dmi.dbis.cs108.multiplayer.client.gui.game.GameController;
|
import ch.unibas.dmi.dbis.cs108.multiplayer.client.gui.game.GameController;
|
||||||
import ch.unibas.dmi.dbis.cs108.multiplayer.client.gui.lounge.LoungeApp;
|
import ch.unibas.dmi.dbis.cs108.multiplayer.client.gui.lounge.LoungeApp;
|
||||||
@ -350,12 +351,16 @@ public class Client {
|
|||||||
case GuiParameters.night: //ClientGameInfoHandler;
|
case GuiParameters.night: //ClientGameInfoHandler;
|
||||||
gameStateModel.setDayClone(false);
|
gameStateModel.setDayClone(false);
|
||||||
LOGGER.debug("----------------Night, Your role is:" + gameStateModel.getYourRole() + gameStateModel);
|
LOGGER.debug("----------------Night, Your role is:" + gameStateModel.getYourRole() + gameStateModel);
|
||||||
|
Sprites.setNightSprites(gameStateModel.getPassengerTrainClone()[1], GameController.getGameStateModel().getKickedOff());
|
||||||
|
chatApp.getGameController().updateGameSprites();
|
||||||
chatApp.getGameController().setNoiseButtonInvisible();
|
chatApp.getGameController().setNoiseButtonInvisible();
|
||||||
chatApp.getGameController().setVoteButtonVisibilityNight(gameStateModel);
|
chatApp.getGameController().setVoteButtonVisibilityNight(gameStateModel);
|
||||||
break;
|
break;
|
||||||
case GuiParameters.day: //ClientGameInfoHandler
|
case GuiParameters.day: //ClientGameInfoHandler
|
||||||
gameStateModel.setDayClone(true);
|
gameStateModel.setDayClone(true);
|
||||||
LOGGER.debug("----------------Day, Your role is:" + gameStateModel.getYourRole()+ gameStateModel);
|
LOGGER.debug("----------------Day, Your role is:" + gameStateModel.getYourRole()+ gameStateModel);
|
||||||
|
Sprites.setDaySprites(gameStateModel.getPassengerTrainClone()[1], GameController.getGameStateModel().getKickedOff());
|
||||||
|
chatApp.getGameController().updateGameSprites();
|
||||||
chatApp.getGameController().setNoiseButtonVisible();
|
chatApp.getGameController().setNoiseButtonVisible();
|
||||||
chatApp.getGameController().setVoteButtonVisibilityDay(gameStateModel);
|
chatApp.getGameController().setVoteButtonVisibilityDay(gameStateModel);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -9,7 +9,6 @@ import javafx.util.Duration;
|
|||||||
|
|
||||||
public class BGAnimation extends Transition {
|
public class BGAnimation extends Transition {
|
||||||
ImageView imageView;
|
ImageView imageView;
|
||||||
private static final Image bgFull = new Image("ch/unibas/dmi/dbis/cs108/multiplayer/client/gui/game/Day/BG_small.jpg");
|
|
||||||
int index;
|
int index;
|
||||||
int lastIndex;
|
int lastIndex;
|
||||||
|
|
||||||
@ -19,7 +18,7 @@ public class BGAnimation extends Transition {
|
|||||||
this.imageView = imageView;
|
this.imageView = imageView;
|
||||||
imageView.setFitHeight(1950);
|
imageView.setFitHeight(1950);
|
||||||
imageView.setFitWidth(6667.968);
|
imageView.setFitWidth(6667.968);
|
||||||
imageView.setImage(bgFull);
|
imageView.setImage(Sprites.getBg());
|
||||||
setCycleDuration(duration);
|
setCycleDuration(duration);
|
||||||
setInterpolator(Interpolator.DISCRETE);
|
setInterpolator(Interpolator.DISCRETE);
|
||||||
|
|
||||||
@ -27,6 +26,7 @@ public class BGAnimation extends Transition {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void interpolate(double frac) {
|
protected void interpolate(double frac) {
|
||||||
|
imageView.setImage(Sprites.getBg());
|
||||||
if(index == lastIndex) {
|
if(index == lastIndex) {
|
||||||
index = 0;
|
index = 0;
|
||||||
imageView.setX(0);
|
imageView.setX(0);
|
||||||
|
|||||||
@ -157,6 +157,9 @@ public class ChatApp extends Application {
|
|||||||
this.setGameC(gameController);
|
this.setGameC(gameController);
|
||||||
gameC.setClient(cModel);
|
gameC.setClient(cModel);
|
||||||
gameC.setGameStateModel(GameController.getGameStateModel());
|
gameC.setGameStateModel(GameController.getGameStateModel());
|
||||||
|
Sprites.setDaySprites(GameController.getGameStateModel().getPassengerTrainClone()[1], GameController.getGameStateModel().getKickedOff());
|
||||||
|
SpritesDay.setBells();
|
||||||
|
SpritesDay.setWheels();
|
||||||
try {
|
try {
|
||||||
URL chatResource = ChatApp.class.getResource("chat/ChatView.fxml");
|
URL chatResource = ChatApp.class.getResource("chat/ChatView.fxml");
|
||||||
URL gameResource = ChatApp.class.getResource("game/GameDayAll.fxml");
|
URL gameResource = ChatApp.class.getResource("game/GameDayAll.fxml");
|
||||||
|
|||||||
@ -68,10 +68,14 @@ public class GameStateModel {
|
|||||||
* @param yourRole the role to set this role to
|
* @param yourRole the role to set this role to
|
||||||
*/
|
*/
|
||||||
public void setYourRole(String yourRole) {
|
public void setYourRole(String yourRole) {
|
||||||
if(yourRole.equals("h") || yourRole.equals("g") || yourRole.equals("s")) {
|
try {
|
||||||
this.yourRole = yourRole;
|
if (yourRole.equals("h") || yourRole.equals("g") || yourRole.equals("s")) {
|
||||||
} else {
|
this.yourRole = yourRole;
|
||||||
this.yourRole = "h";
|
} else {
|
||||||
|
this.yourRole = "h";
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOGGER.warn("YourRole:" + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,215 @@
|
|||||||
|
package ch.unibas.dmi.dbis.cs108.multiplayer.client.gui;
|
||||||
|
|
||||||
|
import java.net.URL;
|
||||||
|
import javafx.scene.image.Image;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class contains all Sprites as images to be accessed by other classes, this way the loading only happens once and the handling
|
||||||
|
* of day to night sprites changes can be simplified
|
||||||
|
*/
|
||||||
|
public class Sprites {
|
||||||
|
|
||||||
|
private static Image bg;
|
||||||
|
private static Image shadow;
|
||||||
|
private static Image secondWagon;
|
||||||
|
private static Image emptyWagon;
|
||||||
|
private static Image[] rooms = new Image[6];
|
||||||
|
private static Image emptyWagonWall;
|
||||||
|
private static Image fullWagon;
|
||||||
|
private static Image loki;
|
||||||
|
private static Image[] wheels = new Image[26];
|
||||||
|
private static Image[] bells = new Image[17];
|
||||||
|
private static Image fg;
|
||||||
|
|
||||||
|
public static Image getBg() {
|
||||||
|
return bg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Image getShadow() {
|
||||||
|
return shadow;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Image getSecondWagon() {
|
||||||
|
return secondWagon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Image getEmptyWagon() {
|
||||||
|
return emptyWagon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Image[] getRooms() {
|
||||||
|
return rooms;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Image getARoom(int position) {
|
||||||
|
return rooms[position];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Image getEmptyWagonWall() {
|
||||||
|
return emptyWagonWall;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Image getFullWagon() {
|
||||||
|
return fullWagon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Image getLoki() {
|
||||||
|
return loki;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Image[] getWheels() {
|
||||||
|
return wheels;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Image[] getBells() {
|
||||||
|
return bells;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Image getFg() {
|
||||||
|
return fg;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets all Images of this class to the Day Version
|
||||||
|
*/
|
||||||
|
public static void setDaySprites(String[] roles, boolean[] kickedOff) {
|
||||||
|
try {
|
||||||
|
bg = SpritesDay.bg;
|
||||||
|
shadow = SpritesDay.shadow;
|
||||||
|
secondWagon = SpritesDay.secondWagon;
|
||||||
|
emptyWagon = SpritesDay.emptyWagon;
|
||||||
|
for (int i = 0; i < roles.length; i++) {
|
||||||
|
rooms[i] = getRoomDay(i, roles[i], kickedOff);
|
||||||
|
}
|
||||||
|
emptyWagonWall = SpritesDay.emptyWagonWall;
|
||||||
|
fullWagon = SpritesDay.fullWagon;
|
||||||
|
loki = SpritesDay.loki;
|
||||||
|
wheels = SpritesDay.wheels;
|
||||||
|
bells = SpritesDay.bells;
|
||||||
|
fg = SpritesDay.fg;
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println(e.getMessage());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets all Images of this class to the Night version, takes into account which room is a ghost
|
||||||
|
* Room and which isn't
|
||||||
|
*
|
||||||
|
* @param roles a String containing the roles of the Passengers (g/h/s) from left to
|
||||||
|
*/
|
||||||
|
public static void setNightSprites(String[] roles, boolean[] kickedOff) {
|
||||||
|
bg = SpritesNight.bg;
|
||||||
|
shadow = SpritesNight.shadow;
|
||||||
|
secondWagon = SpritesNight.secondWagon;
|
||||||
|
emptyWagon = SpritesNight.emptyWagon;
|
||||||
|
for (int i = 0; i < roles.length; i++) {
|
||||||
|
rooms[i] = getRoomNight(i, roles[i], kickedOff);
|
||||||
|
}
|
||||||
|
emptyWagonWall = SpritesNight.emptyWagonWall;
|
||||||
|
fullWagon = SpritesNight.fullWagon;
|
||||||
|
loki = SpritesNight.loki;
|
||||||
|
wheels = SpritesNight.wheels;
|
||||||
|
bells = SpritesNight.bells;
|
||||||
|
fg = SpritesNight.fg;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a room Image from SpritesDay, corresponding to the position and the role of the passenger in that room
|
||||||
|
* @param position the position of the room integer 0-5
|
||||||
|
* @param suffix the role of the passenger eiter (h/s)
|
||||||
|
* @return the Image if parameters are passable otherwise null (ie position = 6)
|
||||||
|
*/
|
||||||
|
public static Image getRoomDay(int position, String suffix, boolean[] kickedOff) {
|
||||||
|
switch (position) {
|
||||||
|
case 0:
|
||||||
|
if (kickedOff[0]) {
|
||||||
|
return SpritesDay.room0Spectator;
|
||||||
|
}
|
||||||
|
return SpritesDay.room0;
|
||||||
|
case 1:
|
||||||
|
if (kickedOff[1]) {
|
||||||
|
return SpritesDay.room1Spectator;
|
||||||
|
}
|
||||||
|
return SpritesDay.room1;
|
||||||
|
case 2:
|
||||||
|
if (kickedOff[2]) {
|
||||||
|
return SpritesDay.room2Spectator;
|
||||||
|
}
|
||||||
|
return SpritesDay.room2;
|
||||||
|
case 3:
|
||||||
|
if (kickedOff[3]) {
|
||||||
|
return SpritesDay.room3Spectator;
|
||||||
|
}
|
||||||
|
return SpritesDay.room3;
|
||||||
|
case 4:
|
||||||
|
if (kickedOff[4]) {
|
||||||
|
return SpritesDay.room4Spectator;
|
||||||
|
}
|
||||||
|
return SpritesDay.room4;
|
||||||
|
case 5:
|
||||||
|
if (kickedOff[5]) {
|
||||||
|
return SpritesDay.room5Spectator;
|
||||||
|
}
|
||||||
|
return SpritesDay.room5;
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a room Image from SpritesNight, corresponding to the position and the role of the passenger in that room
|
||||||
|
* @param position the position of the room integer 0-5
|
||||||
|
* @param suffix the role of the passenger eiter (h/s/g)
|
||||||
|
* @return the Image if parameters are passable otherwise null (ie position = 6)
|
||||||
|
*/
|
||||||
|
public static Image getRoomNight(int position, String suffix, boolean[] kickedOff) {
|
||||||
|
switch (position) {
|
||||||
|
case 0:
|
||||||
|
if (kickedOff[0]) {
|
||||||
|
return SpritesNight.room0Spectator;
|
||||||
|
} else if ("g".equals(suffix)) {
|
||||||
|
return SpritesNight.room0LightsOn;
|
||||||
|
}
|
||||||
|
return SpritesNight.room0;
|
||||||
|
case 1:
|
||||||
|
if (kickedOff[1]) {
|
||||||
|
return SpritesNight.room1Spectator;
|
||||||
|
} else if ("g".equals(suffix)) {
|
||||||
|
return SpritesNight.room1LightsOn;
|
||||||
|
}
|
||||||
|
return SpritesNight.room1;
|
||||||
|
case 2:
|
||||||
|
if (kickedOff[2]) {
|
||||||
|
return SpritesNight.room2Spectator;
|
||||||
|
} else if ("g".equals(suffix)) {
|
||||||
|
return SpritesNight.room2LightsOn;
|
||||||
|
}
|
||||||
|
return SpritesNight.room2;
|
||||||
|
case 3:
|
||||||
|
if (kickedOff[3]) {
|
||||||
|
return SpritesNight.room3Spectator;
|
||||||
|
} else if ("g".equals(suffix)) {
|
||||||
|
return SpritesNight.room3LightsOn;
|
||||||
|
}
|
||||||
|
return SpritesNight.room3;
|
||||||
|
case 4:
|
||||||
|
if (kickedOff[4]) {
|
||||||
|
return SpritesNight.room4Spectator;
|
||||||
|
} else if ("g".equals(suffix)) {
|
||||||
|
return SpritesNight.room4LightsOn;
|
||||||
|
}
|
||||||
|
return SpritesNight.room4;
|
||||||
|
case 5:
|
||||||
|
if (kickedOff[5]) {
|
||||||
|
return SpritesNight.room5Spectator;
|
||||||
|
} else if ("g".equals(suffix)) {
|
||||||
|
return SpritesNight.room5LightsOn;
|
||||||
|
}
|
||||||
|
return SpritesNight.room5;
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,65 @@
|
|||||||
|
package ch.unibas.dmi.dbis.cs108.multiplayer.client.gui;
|
||||||
|
|
||||||
|
import javafx.scene.image.Image;
|
||||||
|
|
||||||
|
public class SpritesDay {
|
||||||
|
private static final String path = "ch/unibas/dmi/dbis/cs108/multiplayer/client/gui/game/Day/";
|
||||||
|
|
||||||
|
public static final Image bg = new Image(path + "BG_small.jpg");
|
||||||
|
public static final Image shadow = new Image(path + "Shadow_Below_Train.png");
|
||||||
|
public static final Image secondWagon = new Image(path + "Second_Wagon.png");
|
||||||
|
public static final Image emptyWagon = new Image(path + "Empty_Wagon.png");
|
||||||
|
public static final Image room0 = new Image(path + "Room1.png");
|
||||||
|
public static final Image room1 = new Image(path + "Room2.png");
|
||||||
|
public static final Image room2 = new Image(path + "Room3.png");
|
||||||
|
public static final Image room3 = new Image(path + "Room4.png");
|
||||||
|
public static final Image room4 = new Image(path + "Room5.png");
|
||||||
|
public static final Image room5 = new Image(path + "Room6.png");
|
||||||
|
public static final Image room0Spectator = new Image(path + "Room1_Spectator.png");
|
||||||
|
public static final Image room1Spectator = new Image(path + "Room2_Spectator.png");
|
||||||
|
public static final Image room2Spectator = new Image(path + "Room3_Spectator.png");
|
||||||
|
public static final Image room3Spectator = new Image(path + "Room4_Spectator.png");
|
||||||
|
public static final Image room4Spectator = new Image(path + "Room5_Spectator.png");
|
||||||
|
public static final Image room5Spectator = new Image(path + "Room6_Spectator.png");
|
||||||
|
public static final Image emptyWagonWall = new Image(path + "Empty_Wagon_Wall.png");
|
||||||
|
public static final Image fullWagon = new Image(path + "Full_Wagon.png");
|
||||||
|
public static final Image loki = new Image(path + "Loki.png");
|
||||||
|
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 void setWheels() {
|
||||||
|
try {
|
||||||
|
for (int i = 1; i <= 26; i++) {
|
||||||
|
String url;
|
||||||
|
if (i < 10) {
|
||||||
|
url =
|
||||||
|
path + "Wheels/Image000" + i + ".png";
|
||||||
|
} else {
|
||||||
|
url = path + "Wheels/Image00" + i + ".png";
|
||||||
|
}
|
||||||
|
wheels[i-1] = new Image(url);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setBells() {
|
||||||
|
try {
|
||||||
|
for (int i = 1; i <= 17; i++) {
|
||||||
|
String url;
|
||||||
|
if (i < 10) {
|
||||||
|
url =
|
||||||
|
path + "Bell/Image000" + i + ".png";
|
||||||
|
} else {
|
||||||
|
url = path + "Bell/Image00" + i + ".png";
|
||||||
|
}
|
||||||
|
bells[i-1] = new Image(url);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,38 @@
|
|||||||
|
package ch.unibas.dmi.dbis.cs108.multiplayer.client.gui;
|
||||||
|
|
||||||
|
import javafx.scene.image.Image;
|
||||||
|
|
||||||
|
public class SpritesNight {
|
||||||
|
private static final String path = "ch/unibas/dmi/dbis/cs108/multiplayer/client/gui/game/Night/";
|
||||||
|
|
||||||
|
public static final Image bg = new Image(path + "BG_small.jpg");
|
||||||
|
public static final Image shadow = new Image(path + "Shadow_Below_Train.png");
|
||||||
|
public static final Image secondWagon = new Image(path + "Second_Wagon.png");
|
||||||
|
public static final Image emptyWagon = new Image(path + "Empty_Wagon.png");
|
||||||
|
public static final Image room0 = new Image(path + "Room1_Lights_Off.png");
|
||||||
|
public static final Image room1 = new Image(path + "Room2_Lights_Off.png");
|
||||||
|
public static final Image room2 = new Image(path + "Room3_Lights_Off.png");
|
||||||
|
public static final Image room3 = new Image(path + "Room4_Lights_Off.png");
|
||||||
|
public static final Image room4 = new Image(path + "Room5_Lights_Off.png");
|
||||||
|
public static final Image room5 = new Image(path + "Room6_Lights_Off.png");
|
||||||
|
public static final Image room0LightsOn = new Image(path + "Room1_Lights_On.png");
|
||||||
|
public static final Image room1LightsOn = new Image(path + "Room2_Lights_On.png");
|
||||||
|
public static final Image room2LightsOn = new Image(path + "Room3_Lights_On.png");
|
||||||
|
public static final Image room3LightsOn = new Image(path + "Room4_Lights_On.png");
|
||||||
|
public static final Image room4LightsOn = new Image(path + "Room5_Lights_On.png");
|
||||||
|
public static final Image room5LightsOn = new Image(path + "Room6_Lights_On.png");
|
||||||
|
public static final Image room0Spectator = new Image(path + "Room1_Spectator.png");
|
||||||
|
public static final Image room1Spectator = new Image(path + "Room2_Spectator.png");
|
||||||
|
public static final Image room2Spectator = new Image(path + "Room3_Spectator.png");
|
||||||
|
public static final Image room3Spectator = new Image(path + "Room4_Spectator.png");
|
||||||
|
public static final Image room4Spectator = new Image(path + "Room5_Spectator.png");
|
||||||
|
public static final Image room5Spectator = new Image(path + "Room6_Spectator.png");
|
||||||
|
public static final Image emptyWagonWall = new Image(path + "Empty_Wagon_Wall.png");
|
||||||
|
public static final Image fullWagon = new Image(path + "Full_Wagon.png");
|
||||||
|
public static final Image loki = new Image(path + "Loki.png");
|
||||||
|
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");
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -4,6 +4,7 @@ import static javafx.scene.AccessibleRole.PARENT;
|
|||||||
|
|
||||||
import ch.unibas.dmi.dbis.cs108.multiplayer.client.gui.ChatApp;
|
import ch.unibas.dmi.dbis.cs108.multiplayer.client.gui.ChatApp;
|
||||||
import ch.unibas.dmi.dbis.cs108.multiplayer.client.gui.GameStateModel;
|
import ch.unibas.dmi.dbis.cs108.multiplayer.client.gui.GameStateModel;
|
||||||
|
import ch.unibas.dmi.dbis.cs108.multiplayer.client.gui.Sprites;
|
||||||
import ch.unibas.dmi.dbis.cs108.multiplayer.helpers.GuiParameters;
|
import ch.unibas.dmi.dbis.cs108.multiplayer.helpers.GuiParameters;
|
||||||
import ch.unibas.dmi.dbis.cs108.BudaLogConfig;
|
import ch.unibas.dmi.dbis.cs108.BudaLogConfig;
|
||||||
import ch.unibas.dmi.dbis.cs108.multiplayer.client.gui.ClientModel;
|
import ch.unibas.dmi.dbis.cs108.multiplayer.client.gui.ClientModel;
|
||||||
@ -37,24 +38,10 @@ public class GameController implements Initializable {
|
|||||||
|
|
||||||
private static GameStateModel gameStateModel;
|
private static GameStateModel gameStateModel;
|
||||||
|
|
||||||
Image[] bells = new Image[17];
|
Image[] bells = Sprites.getBells();
|
||||||
|
|
||||||
public GameController() {
|
public GameController() {
|
||||||
super();
|
super();
|
||||||
try {
|
|
||||||
for (int i = 1; i <= 17; i++) {
|
|
||||||
String url;
|
|
||||||
if (i < 10) {
|
|
||||||
url =
|
|
||||||
"ch/unibas/dmi/dbis/cs108/multiplayer/client/gui/game/Day/Bell/Image000" + i + ".png";
|
|
||||||
} else {
|
|
||||||
url = "ch/unibas/dmi/dbis/cs108/multiplayer/client/gui/game/Day/Bell/Image00" + i + ".png";
|
|
||||||
}
|
|
||||||
bells[i-1] = new Image(url);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO(Seraina, Sebi): Same issue as ChatController? do with setters?
|
//TODO(Seraina, Sebi): Same issue as ChatController? do with setters?
|
||||||
@ -139,6 +126,23 @@ public class GameController implements Initializable {
|
|||||||
@FXML
|
@FXML
|
||||||
private AnchorPane chatAreaGame;
|
private AnchorPane chatAreaGame;
|
||||||
|
|
||||||
|
public void updateGameSprites(){
|
||||||
|
Platform.runLater(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try{
|
||||||
|
room0ImageView.setImage(Sprites.getARoom(0));
|
||||||
|
room1ImageView.setImage(Sprites.getARoom(1));
|
||||||
|
room2ImageView.setImage(Sprites.getARoom(2));
|
||||||
|
room3ImageView.setImage(Sprites.getARoom(3));
|
||||||
|
room4ImageView.setImage(Sprites.getARoom(4));
|
||||||
|
room5ImageView.setImage(Sprites.getARoom(5));
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOGGER.info(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public void addToChatArea(Node n) {
|
public void addToChatArea(Node n) {
|
||||||
chatAreaGame.getChildren().add(n);
|
chatAreaGame.getChildren().add(n);
|
||||||
@ -538,15 +542,6 @@ public class GameController implements Initializable {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* loads the notification Bell from resource
|
|
||||||
* @return the Image node containing the BellImage
|
|
||||||
*/
|
|
||||||
public Image loadBellImage() {
|
|
||||||
Image bell = new Image("ch/unibas/dmi/dbis/cs108/multiplayer/client/gui/game/DayOpen/bell.png");
|
|
||||||
return bell;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds an image of a bell on top of button0
|
* Adds an image of a bell on top of button0
|
||||||
*/
|
*/
|
||||||
@ -561,7 +556,7 @@ public class GameController implements Initializable {
|
|||||||
bell.play();
|
bell.play();
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.debug(e.getMessage());
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -582,7 +577,7 @@ public class GameController implements Initializable {
|
|||||||
bell.play();
|
bell.play();
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.debug(e.getMessage());
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -602,8 +597,7 @@ public class GameController implements Initializable {
|
|||||||
bell.play();
|
bell.play();
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.debug(e.getMessage());
|
e.printStackTrace();
|
||||||
;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -623,7 +617,7 @@ public class GameController implements Initializable {
|
|||||||
bell.play();
|
bell.play();
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.debug(e.getMessage());
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -643,7 +637,7 @@ public class GameController implements Initializable {
|
|||||||
bell.play();
|
bell.play();
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.debug(e.getMessage());
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -663,7 +657,7 @@ public class GameController implements Initializable {
|
|||||||
bell.play();
|
bell.play();
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.debug(e.getMessage());
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
|
After Width: | Height: | Size: 42 KiB |
|
After Width: | Height: | Size: 41 KiB |
|
After Width: | Height: | Size: 41 KiB |
|
After Width: | Height: | Size: 42 KiB |
|
After Width: | Height: | Size: 41 KiB |
|
After Width: | Height: | Size: 42 KiB |
|
After Width: | Height: | Size: 42 KiB |
|
After Width: | Height: | Size: 41 KiB |
|
After Width: | Height: | Size: 41 KiB |
|
After Width: | Height: | Size: 42 KiB |
|
After Width: | Height: | Size: 41 KiB |
|
After Width: | Height: | Size: 42 KiB |