Browse Source

Relationship Game-GameService

main
fdai7920 11 months ago
parent
commit
4d5857149e
  1. 13
      src/main/java/de/hsfulda/onses/models/Game.java
  2. 1
      src/main/java/de/hsfulda/onses/services/GameService.java

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

@ -1,8 +1,13 @@
package de.hsfulda.onses.models; package de.hsfulda.onses.models;
import de.hsfulda.onses.services.GameService;
import java.util.ArrayList; import java.util.ArrayList;
public class Game { public class Game {
private GameService gameService;
private final ArrayList<Card> drawCardDeck = new ArrayList<>(); private final ArrayList<Card> drawCardDeck = new ArrayList<>();
private Card lastPlayedCard = null; private Card lastPlayedCard = null;
@ -24,4 +29,12 @@ public class Game {
drawCardDeck.add(card); drawCardDeck.add(card);
} }
public GameService getGameService() {
return gameService;
}
public Game setGameService(GameService gameService) {
this.gameService = gameService;
return this;
}
} }

1
src/main/java/de/hsfulda/onses/services/GameService.java

@ -10,6 +10,7 @@ public class GameService {
private final Game game; private final Game game;
public GameService(Game game) { public GameService(Game game) {
this.game = game; this.game = game;
this.game.setGameService(this);
} }
public GameService() { public GameService() {
this(new Game()); this(new Game());

Loading…
Cancel
Save