Пример #1
0
 /**
  * Renvoie les Hexas liés aux Rivieres de cette collection
  * @return HexaCollection
  */
 public function getHexas()
 {
     if (is_null($this->cacheHexas)) {
         $this->cacheHexas = HexaBusiness::getFromRivieres($this);
         $this->cacheHexas->store();
     }
     return $this->cacheHexas;
 }
Пример #2
0
 /**
  * Génère la carte entière de cases vierges, océaniques
  */
 public function genererHexasVierges()
 {
     $this->resetCacheHexas();
     $id = HexaBusiness::getNextId();
     for ($y = 0; $y < $this->getHauteur(); $y++) {
         for ($x = 0; $x < $this->getLargeur(); $x++) {
             $hexa = $this->createHexa();
             $hexa->setId($id);
             $hexa->setX($x);
             $hexa->setY($y);
             $this->getHexas()->ajout($hexa);
             $id++;
         }
     }
     $this->getHexas()->store();
 }
Пример #3
0
 /**
  * Renvoie les Hexas liés à l'objet
  * @return HexaCollection
  */
 public function getHexas()
 {
     if (is_null($this->cacheHexas)) {
         $this->cacheHexas = HexaBusiness::getByJoueur($this);
         $this->cacheHexas->store();
     }
     return $this->cacheHexas;
 }
Пример #4
0
 function menuConstruireInfra()
 {
     $ret = array('error' => 0, 'errorMsg' => '');
     if (!isset($_POST['idHexa'])) {
         $ret['error'] = 1;
         $ret['errorMsg'] = 'Champs manquants';
         echo json_encode($ret);
         exit;
     }
     if (!$this->checkDroit(Droit::LOGGE_PARTIE)) {
         $ret['error'] = 2;
         $ret['errorMsg'] = 'Pas le droit';
         echo json_encode($ret);
         exit;
     }
     $hexa = HexaBusiness::GetById($_POST['idHexa']);
     if (is_null($hexa)) {
         $ret['error'] = 2;
         $ret['errorMsg'] = 'Hexa inexistant';
         echo json_encode($ret);
         exit;
     }
     if (!$hexa->peutConstruire(SessionBusiness::getCookieSession()->getJoueur())) {
         $ret['error'] = 3;
         $ret['errorMsg'] = 'Le joueur ne peut pas contruire sur cette case';
         echo json_encode($ret);
         exit;
     }
     $this->data['hexa'] = $hexa;
     $ret['idHexa'] = $hexa->getId();
     $ret['html'] = $this->getTemplateStr('elements/cadres/menuConstruireInfra.php');
     echo json_encode($ret);
 }
Пример #5
0
 /**
  * @return void
  */
 public function delete()
 {
     HexaBusiness::delete($this);
 }