Exemplo n.º 1
0
 public function index()
 {
     $field = $this->params['field'];
     $game = Game::currentGame();
     $currentGameUser = $game->current_game_user;
     $leftShoots = $currentGameUser->getLeftShoots();
     if ($leftShoots) {
         $hit = Hit::createFor($field, $currentGameUser);
         $params = Json::encode(['game' => $game->type, 'field' => $hit->field, 'multiplier' => $hit->multiplier, 'scored' => $hit->handleScore(), 'winner' => $currentGameUser->isWinner(), 'shots_left' => $leftShoots - 1, 'shitty_round' => $currentGameUser->isShittyRound()]);
         Event::create(['name' => 'hit', 'params' => $params]);
     } else {
         Event::create(['name' => 'next_player', 'params' => '']);
     }
 }
Exemplo n.º 2
0
 public function next_player()
 {
     $game = Game::currentGame();
     $game->nextPlayer();
     Event::create(['name' => 'refresh', 'params' => json_encode([])]);
     $this->layout->renderAjax();
 }