コード例 #1
0
 /**
  * Handles a JoinGameCommand
  *
  * @param JoinGameCommand $command
  * @return void
  */
 public function handleJoinGameCommand(JoinGameCommand $command)
 {
     ContextContainer::setContext($command->getContext());
     try {
         $miniGame = $this->gameManager->load($command->getGameId());
         $miniGame->addPlayerToGame($command->getPlayerOptions());
         $this->gameManager->save($miniGame);
     } catch (\Exception $e) {
         $this->errorHandler->handle(new UnableToAddPlayerEvent($command->getGameId(), $command->getPlayerId(), $e->getMessage()), $command->getContext());
     }
     ContextContainer::reset();
 }