Exemplo n.º 1
0
 public function attached($presenter)
 {
     parent::attached($presenter);
     $this->wdata = $this->WDataModel->get($this->presenter->getParameter('destination'));
     $this->template->village = $this->village = $this->villageService->getVillage($this->presenter->getParameter('id'));
     $this->units = $this->unitService->getUnits($this->village);
     $this->template->units = $this->units;
     $this->template->names = $this->unitService->getNames();
     $unitData = [];
     switch ($this->village->getOwner()->tribe) {
         case App\FrontModule\Model\User\UserService::TRIBE_ROMANS:
             foreach (App\GameModule\Model\Units\UnitService::ROMANS as $unit) {
                 $unitData[] = $this->unitFactory->getUnit($unit);
             }
             break;
         case App\FrontModule\Model\User\UserService::TRIBE_TEUTONS:
             foreach (App\GameModule\Model\Units\UnitService::TEUTONS as $unit) {
                 $unitData[] = $this->unitFactory->getUnit($unit);
             }
             break;
         case App\FrontModule\Model\User\UserService::TRIBE_GAULS:
             foreach (App\GameModule\Model\Units\UnitService::GAULS as $unit) {
                 $unitData[] = $this->unitFactory->getUnit($unit);
             }
             break;
     }
     $this->template->unitData = $unitData;
     $this->template->setFile(__DIR__ . '/SendUnitsControl.latte');
 }
Exemplo n.º 2
0
 public function renderStable()
 {
     $this->units = $this->unitService->getAvailableUnits($this->village, App\GameModule\Model\Building\BuildingModel::STABLE);
     $this->template->units = $this->units;
     $this->template->available = $this->unitService->getTrainableUnits($this->village, $this->units);
     $this->template->current = $this->unitService->getUnits($this->village);
     $queue = $this->trainingModel->getByBuilding($this->village, App\GameModule\Model\Building\BuildingModel::STABLE);
     foreach ($queue as $item) {
         $item->unit = $this->unitFactory->getUnit($item->unit);
     }
     $this->template->queue = $queue;
     $this->template->setFile(__DIR__ . '/Template/Stable.latte');
 }