Browse Source

Relationship PlayerService_Game

main
fdai7920 11 months ago
parent
commit
7bdd76cca4
  1. 16
      src/main/java/de/hsfulda/onses/models/Game.java
  2. 10
      src/main/java/de/hsfulda/onses/services/PlayerService.java

16
src/main/java/de/hsfulda/onses/models/Game.java

@ -1,12 +1,14 @@
package de.hsfulda.onses.models; package de.hsfulda.onses.models;
import de.hsfulda.onses.services.GameService; import de.hsfulda.onses.services.GameService;
import de.hsfulda.onses.services.PlayerService;
import java.util.ArrayList; import java.util.ArrayList;
public class Game { public class Game {
private GameService gameService; private GameService gameService;
private PlayerService playerService;
private final ArrayList<Card> drawCardDeck = new ArrayList<>(); private final ArrayList<Card> drawCardDeck = new ArrayList<>();
@ -37,4 +39,18 @@ public class Game {
this.gameService = gameService; this.gameService = gameService;
return this; return this;
} }
public PlayerService getPlayerService() {
return playerService;
}
public Game setPlayerService(PlayerService playerService) {
this.playerService = playerService;
return this;
}
public Game()
{
this.playerService = new PlayerService().setGame(this);
}
} }

10
src/main/java/de/hsfulda/onses/services/PlayerService.java

@ -1,11 +1,13 @@
package de.hsfulda.onses.services; package de.hsfulda.onses.services;
import de.hsfulda.onses.models.Game;
import de.hsfulda.onses.models.Player; import de.hsfulda.onses.models.Player;
import java.util.ArrayList; import java.util.ArrayList;
public class PlayerService { public class PlayerService {
private Game game;
private boolean currentTurn = true; // true --> real player, false --> Bot private boolean currentTurn = true; // true --> real player, false --> Bot
private final ArrayList<Player> playerList = new ArrayList<>(); private final ArrayList<Player> playerList = new ArrayList<>();
@ -31,4 +33,12 @@ public class PlayerService {
return this; return this;
} }
public Game getGame() {
return game;
}
public PlayerService setGame(Game game) {
this.game = game;
return this;
}
} }
Loading…
Cancel
Save