fix: implemented proper game start in Lobby

This commit is contained in:
Yannik Bretschneider 2021-06-06 19:30:38 +02:00
parent 2995564cdf
commit c56a356994

View File

@ -1,6 +1,7 @@
package uulm.teamname.marvelous.server.lobby;
import org.tinylog.Logger;
import uulm.teamname.marvelous.gamelibrary.config.CharacterProperties;
import uulm.teamname.marvelous.gamelibrary.entities.EntityType;
import uulm.teamname.marvelous.gamelibrary.events.Event;
import uulm.teamname.marvelous.gamelibrary.events.EventBuilder;
@ -16,6 +17,7 @@ import uulm.teamname.marvelous.server.lobbymanager.LobbyConnection;
import uulm.teamname.marvelous.server.lobbymanager.Participant;
import java.util.*;
import java.util.stream.Collectors;
public class Lobby {
private final String gameID;
@ -42,7 +44,9 @@ public class Lobby {
LobbyConnection connection,
PartyConfig partyConfig,
CharacterConfig characterConfig,
ScenarioConfig scenarioConfig) {
ScenarioConfig scenarioConfig,
List<Integer> player1Characters,
List<Integer> player2Characters) {
this.gameID = gameID;
this.connection = connection;
@ -71,7 +75,9 @@ public class Lobby {
partyConfig.maxRoundTime,
this::turnTimeout);
this.connection.broadcastEvents(game.getGameStateEvent());
var response = this.game.startGame(player1Characters, player2Characters);
this.connection.broadcastEvents(response);
}
/**