feat: handle Req request and remove handling of lobby events

This commit is contained in:
2021-05-05 18:59:07 +02:00
parent a9c80cb19b
commit c2d1c2cc98
3 changed files with 32 additions and 7 deletions

View File

@ -88,9 +88,15 @@ class GameLogic {
.buildEntityEvent());
//TODO: add infinity stone usage effect in GameLogic.executeRequest
}
case DisconnectRequest -> {
result.add(new EventBuilder(EventType.DisconnectEvent)
.buildGameEvent());
case Req -> {
result.add(new EventBuilder(EventType.GameStateEvent)
.withEntities(state.entities.export())
.withTurnOrder((EntityID[])state.turnOrder.toArray())
.withMapSize(state.mapSize)
.withActiveCharacter(state.activeCharacter)
.withStoneCooldowns(state.stoneCooldown.export())
.withWinCondition(state.won)
.buildGameStateEvent());
}
}
@ -182,11 +188,8 @@ class GameLogic {
}
return true;
}
case DisconnectRequest -> {
//TODO: add check for DisconnectRequest in GameLogic.checkRequest
case Req -> {
return true;
}
}