Merge commit
This commit is contained in:
		@@ -60,7 +60,7 @@ public class MdgaApp extends SimpleApplication {
 | 
			
		||||
 | 
			
		||||
    private ServerConnection networkConnection;
 | 
			
		||||
 | 
			
		||||
    private MdgaApp() {
 | 
			
		||||
    public MdgaApp() {
 | 
			
		||||
        networkConnection = new NetworkSupport(this);
 | 
			
		||||
        this.clientGameLogic = new ClientGameLogic(networkConnection);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										33
									
								
								Projekte/mdga/model/src/main/java/pp/mdga/Resources.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								Projekte/mdga/model/src/main/java/pp/mdga/Resources.java
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,33 @@
 | 
			
		||||
package pp.mdga;
 | 
			
		||||
 | 
			
		||||
import java.util.ResourceBundle;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Provides access to the resource bundle of the game.
 | 
			
		||||
 *
 | 
			
		||||
 * @see #BUNDLE
 | 
			
		||||
 */
 | 
			
		||||
public class Resources {
 | 
			
		||||
    /**
 | 
			
		||||
     * The resource bundle for the MDGA game.
 | 
			
		||||
     */
 | 
			
		||||
    public static final ResourceBundle BUNDLE = ResourceBundle.getBundle("mdga"); //NON-NLS
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Gets a string for the given key from the resource bundle in {@linkplain #BUNDLE}.
 | 
			
		||||
     *
 | 
			
		||||
     * @param key the key for the desired string
 | 
			
		||||
     * @return the string for the given key
 | 
			
		||||
     * @throws NullPointerException               if {@code key} is {@code null}
 | 
			
		||||
     * @throws java.util.MissingResourceException if no object for the given key can be found
 | 
			
		||||
     * @throws ClassCastException                 if the object found for the given key is not a string
 | 
			
		||||
     */
 | 
			
		||||
    public static String lookup(String key) {
 | 
			
		||||
        return BUNDLE.getString(key);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Private constructor to prevent instantiation.
 | 
			
		||||
     */
 | 
			
		||||
    private Resources() { /* do not instantiate */ }
 | 
			
		||||
}
 | 
			
		||||
@@ -63,9 +63,9 @@ public void selectUnready(){
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void selectStart(){
 | 
			
		||||
        if(logic.isHost() && logic.getGame().allReady()){
 | 
			
		||||
        if(logic.isHost() && logic.getGame().areAllReady()){
 | 
			
		||||
            logic.send(new StartGameMessage(false));
 | 
			
		||||
        } else if(logic.isHost() && !logic.getGame().allReady()) {
 | 
			
		||||
        } else if(logic.isHost() && !logic.getGame().areAllReady()) {
 | 
			
		||||
            logic.send(new StartGameMessage(true));
 | 
			
		||||
        } else {
 | 
			
		||||
            LOGGER.log(System.Logger.Level.ERROR, "You are not the host");
 | 
			
		||||
 
 | 
			
		||||
@@ -48,9 +48,6 @@ public class Game {
 | 
			
		||||
    // The color of the active player.
 | 
			
		||||
    private Color activeColor;
 | 
			
		||||
 | 
			
		||||
    // A flag indicating whether all players are ready.
 | 
			
		||||
    private boolean allReady = false;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This constructor creates a new Game object.
 | 
			
		||||
     */
 | 
			
		||||
@@ -65,6 +62,7 @@ public Game() {
 | 
			
		||||
            drawPile.add(BonusCard.SHIELD);
 | 
			
		||||
        }
 | 
			
		||||
        board = new Board();
 | 
			
		||||
        die = new Die();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -113,6 +111,21 @@ public boolean isColorTaken(Color color) {
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be used to return the first unused color if possible.
 | 
			
		||||
     *
 | 
			
		||||
     * @return color as a Color enumeration.
 | 
			
		||||
     */
 | 
			
		||||
    public Color getFirstUnusedColor() {
 | 
			
		||||
        for (Color color : Color.values()) {
 | 
			
		||||
            if (!isColorTaken(color)) {
 | 
			
		||||
                return color;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be used to return the player which has the given id parameter.
 | 
			
		||||
     *
 | 
			
		||||
@@ -155,6 +168,22 @@ public int getNumberOfActivePlayers() {
 | 
			
		||||
        return activePlayers;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be used to check if all players are ready.
 | 
			
		||||
     * If yes it will return true, otherwise false.
 | 
			
		||||
     *
 | 
			
		||||
     * @return true or false.
 | 
			
		||||
     */
 | 
			
		||||
    public boolean areAllReady() {
 | 
			
		||||
        for (Map.Entry<Integer, Player> entry : this.players.entrySet()) {
 | 
			
		||||
            if (!entry.getValue().isReady()) {
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be used to return a piece based on the UUID.
 | 
			
		||||
     *
 | 
			
		||||
@@ -350,22 +379,4 @@ public void setDie(Die die) {
 | 
			
		||||
    public void setHost(int host) {
 | 
			
		||||
        this.host = host;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method returns the all ready state.
 | 
			
		||||
     *
 | 
			
		||||
     * @return the already state
 | 
			
		||||
     */
 | 
			
		||||
    public Boolean allReady() {
 | 
			
		||||
        return allReady;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method sets the all ready state.
 | 
			
		||||
     *
 | 
			
		||||
     * @param allReady the new all-ready state
 | 
			
		||||
     */
 | 
			
		||||
    public void setAllReady(Boolean allReady) {
 | 
			
		||||
        this.allReady = allReady;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -145,16 +145,6 @@ public void received(LobbyReadyMessage msg, int from) {
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        this.logic.getGame().setAllReady(true);
 | 
			
		||||
        if (this.logic.getGame().allReady()) {
 | 
			
		||||
            this.logic.getServerSender().broadcast(new StartBriefingMessage(this.logic.getGame().getBoard()));
 | 
			
		||||
            this.initializeGame();
 | 
			
		||||
            for (Map.Entry<Color, PlayerData> entry : logic.getGame().getBoard().getPlayerData().entrySet()) {
 | 
			
		||||
                this.logic.getServerSender().broadcast(new PlayerDataMessage(entry.getValue(), entry.getKey()));
 | 
			
		||||
            }
 | 
			
		||||
            this.logic.getServerSender().broadcast(new ServerStartGameMessage());
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,18 @@
 | 
			
		||||
incorrect.request.0=
 | 
			
		||||
incorrect.request.1=
 | 
			
		||||
incorrect.request.2=
 | 
			
		||||
incorrect.request.3=
 | 
			
		||||
incorrect.request.4=
 | 
			
		||||
incorrect.request.5=
 | 
			
		||||
incorrect.request.6=
 | 
			
		||||
incorrect.request.7=
 | 
			
		||||
incorrect.request.8=
 | 
			
		||||
incorrect.request.9=
 | 
			
		||||
incorrect.request.10=
 | 
			
		||||
incorrect.request.11=
 | 
			
		||||
incorrect.request.12=
 | 
			
		||||
incorrect.request.13=
 | 
			
		||||
incorrect.request.14=
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,14 @@
 | 
			
		||||
incorrect.request.1=Die ausgewählte TSK ist bereits belegt.
 | 
			
		||||
incorrect.request.2=Es gibt keine freie TSK mehr, welche ausgewählt werden kann.
 | 
			
		||||
incorrect.request.3=
 | 
			
		||||
incorrect.request.4=
 | 
			
		||||
incorrect.request.5=
 | 
			
		||||
incorrect.request.6=
 | 
			
		||||
incorrect.request.7=
 | 
			
		||||
incorrect.request.8=
 | 
			
		||||
incorrect.request.9=
 | 
			
		||||
incorrect.request.10=
 | 
			
		||||
incorrect.request.11=
 | 
			
		||||
incorrect.request.12=
 | 
			
		||||
incorrect.request.13=
 | 
			
		||||
incorrect.request.14=
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user