Develope game branch #33
			
				
			
		
		
		
	| 
						 | 
				
			
			@ -62,8 +62,8 @@ public class Factory {
 | 
			
		|||
            FXMLLoader loader = new FXMLLoader(getClass().getResource("gameScheduleView/Game.fxml"));
 | 
			
		||||
            box.getChildren().add(loader.load());
 | 
			
		||||
            GameController controller = loader.getController();
 | 
			
		||||
            controller.setup(new GameDecorator(game, tournamentDecorator));
 | 
			
		||||
 | 
			
		||||
            controller.setup(tournamentDecorator, fileIO, factoryDecorator, box, new GameDecorator(game));
 | 
			
		||||
            controller.loadContent();
 | 
			
		||||
        } catch (IOException e) {
 | 
			
		||||
            e.printStackTrace();
 | 
			
		||||
            //TODO LOGGER
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -45,6 +45,10 @@ public class Game implements Serializable {
 | 
			
		|||
        this.participant1 = participant1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setParticipant2(Participant participant2) {
 | 
			
		||||
        this.participant2 = participant2;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public Participant getParticipant2() {
 | 
			
		||||
        return participant2;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -67,7 +71,4 @@ public class Game implements Serializable {
 | 
			
		|||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setParticipant2(Participant participant2) {
 | 
			
		||||
        this.participant2 = participant2;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,6 +6,7 @@ import javafx.fxml.FXML;
 | 
			
		|||
import javafx.scene.control.ChoiceBox;
 | 
			
		||||
import javafx.scene.control.Label;
 | 
			
		||||
import javafx.scene.control.TextField;
 | 
			
		||||
import javafx.scene.layout.Pane;
 | 
			
		||||
 | 
			
		||||
public class GameController extends FXController{
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -29,10 +30,8 @@ public class GameController extends FXController{
 | 
			
		|||
 | 
			
		||||
    @FXML
 | 
			
		||||
    void saveGamerResult(ActionEvent event) {
 | 
			
		||||
        gameDecorator.setPoints1(Integer.parseInt(pointsTeamOne.getText()));
 | 
			
		||||
        gameDecorator.setPoints2(Integer.parseInt(pointsTeamTwo.getText()));
 | 
			
		||||
        gameDecorator.setLocation(placesChoiceBox.getValue());
 | 
			
		||||
        gameDecorator.getTournamentDecorator().refreshGameParticipants();
 | 
			
		||||
        gameDecorator.saveGame(pointsTeamOne.getText(), pointsTeamTwo.getText(), placesChoiceBox.getValue());
 | 
			
		||||
        getTournamentDecorator().refreshGameParticipants();
 | 
			
		||||
        loadContent();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -44,9 +43,9 @@ public class GameController extends FXController{
 | 
			
		|||
        pointsTeamTwo.setText(String.valueOf(gameDecorator.getPoints2()));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setup(GameDecorator gameDecorator) {
 | 
			
		||||
    public void setup(TournamentDecorator tournamentDecorator, FileIO fileIO, FactoryDecorator factoryDecorator, Pane pane, GameDecorator gameDecorator) {
 | 
			
		||||
        super.setup(tournamentDecorator, fileIO, factoryDecorator, pane);
 | 
			
		||||
        this.gameDecorator = gameDecorator;
 | 
			
		||||
        loadContent();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -8,24 +8,16 @@ import java.util.List;
 | 
			
		|||
 | 
			
		||||
public class GameDecorator {
 | 
			
		||||
    private Game game;
 | 
			
		||||
    private TournamentDecorator tournamentDecorator;
 | 
			
		||||
    private List<IsObserver> listener = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
    public GameDecorator (Game game, TournamentDecorator tournamentDecorator) {
 | 
			
		||||
    public GameDecorator (Game game) {
 | 
			
		||||
        this.game = game;
 | 
			
		||||
        this.tournamentDecorator = tournamentDecorator;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public TournamentDecorator getTournamentDecorator() {
 | 
			
		||||
        return tournamentDecorator;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setPoints1(int points1) {
 | 
			
		||||
        game.setPoints1(points1);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setPoints2(int points2) {
 | 
			
		||||
        game.setPoints2(points2);
 | 
			
		||||
    public void saveGame(String points1, String points2, Place place){
 | 
			
		||||
        game.setPoints1(Integer.parseInt(points1));
 | 
			
		||||
        game.setPoints2(Integer.parseInt(points2));
 | 
			
		||||
        game.setPlace(place);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getPoints1() {
 | 
			
		||||
| 
						 | 
				
			
			@ -53,9 +45,4 @@ public class GameDecorator {
 | 
			
		|||
    public Place getLocation() {
 | 
			
		||||
        return game.getPlace();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setLocation(Place place) {
 | 
			
		||||
        game.setLocation(place);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue