Пример #1
0
 /**
  * Hex info
  */
 public function actionInfo()
 {
     if (!Yii::$app->request->isAjax) {
         return $this->goHome();
     }
     $game = Game::fromSession();
     $imperium = $game->getImperium();
     if (empty($imperium)) {
         return $this->goHome();
     }
     $data = [];
     $id = Yii::$app->request->post('hex');
     if (preg_match('/^hex(\\-?[0123])(\\-?[0123])$/', $id, $match)) {
         $data = $imperium->getHexInfo([(int) $match[1], (int) $match[2]]);
     }
     return Json::encode($data);
 }