MAPG-103 don't use "position" everywhere
This commit is contained in:
parent
1179914f42
commit
bb29bfdfe1
@ -19,8 +19,8 @@ Container::$routeCollection->get('maps', 'maps', [MapGuesser\Controller\MapsCont
|
||||
Container::$routeCollection->group('game', function (MapGuesser\Routing\RouteCollection $routeCollection) {
|
||||
$routeCollection->get('game', '{mapId}', [MapGuesser\Controller\GameController::class, 'getGame']);
|
||||
$routeCollection->get('game-json', '{mapId}/json', [MapGuesser\Controller\GameController::class, 'getGameJson']);
|
||||
$routeCollection->get('position-json', '{mapId}/position.json', [MapGuesser\Controller\PositionController::class, 'getPosition']);
|
||||
$routeCollection->post('guess-json', '{mapId}/guess.json', [MapGuesser\Controller\PositionController::class, 'evaluateGuess']);
|
||||
$routeCollection->get('newPlace-json', '{mapId}/newPlace.json', [MapGuesser\Controller\GameFlowController::class, 'getNewPlace']);
|
||||
$routeCollection->post('guess-json', '{mapId}/guess.json', [MapGuesser\Controller\GameFlowController::class, 'evaluateGuess']);
|
||||
});
|
||||
Container::$routeCollection->group('admin', function (MapGuesser\Routing\RouteCollection $routeCollection) {
|
||||
$routeCollection->get('admin.maps', 'maps', [MapGuesser\Controller\MapAdminController::class, 'getMaps']);
|
||||
|
@ -53,7 +53,7 @@
|
||||
Game.startNewRound();
|
||||
};
|
||||
|
||||
xhr.open('GET', '/game/' + mapId + '/position.json', true);
|
||||
xhr.open('GET', '/game/' + mapId + '/newPlace.json', true);
|
||||
xhr.send();
|
||||
},
|
||||
|
||||
|
@ -6,7 +6,7 @@ use MapGuesser\Response\JsonContent;
|
||||
use MapGuesser\Interfaces\Response\IContent;
|
||||
use MapGuesser\Repository\PlaceRepository;
|
||||
|
||||
class PositionController
|
||||
class GameFlowController
|
||||
{
|
||||
const NUMBER_OF_ROUNDS = 5;
|
||||
const MAX_SCORE = 1000;
|
||||
@ -21,7 +21,7 @@ class PositionController
|
||||
$this->placeRepository = new PlaceRepository();
|
||||
}
|
||||
|
||||
public function getPosition(): IContent
|
||||
public function getNewPlace(): IContent
|
||||
{
|
||||
$mapId = (int) $this->request->query('mapId');
|
||||
|
||||
@ -33,11 +33,11 @@ class PositionController
|
||||
}
|
||||
|
||||
if (count($state['rounds']) === 0) {
|
||||
$newPosition = $this->placeRepository->getForMapWithValidPano($mapId);
|
||||
$state['rounds'][] = $newPosition;
|
||||
$place = $this->placeRepository->getForMapWithValidPano($mapId);
|
||||
$state['rounds'][] = $place;
|
||||
$session->set('state', $state);
|
||||
|
||||
$data = ['panoId' => $newPosition['panoId']];
|
||||
$data = ['panoId' => $place['panoId']];
|
||||
} else {
|
||||
$rounds = count($state['rounds']);
|
||||
$last = $state['rounds'][$rounds - 1];
|
||||
@ -93,11 +93,11 @@ class PositionController
|
||||
$exclude = array_merge($exclude, $round['placesWithoutPano'], [$round['placeId']]);
|
||||
}
|
||||
|
||||
$newPosition = $this->placeRepository->getForMapWithValidPano($mapId, $exclude);
|
||||
$state['rounds'][] = $newPosition;
|
||||
$place = $this->placeRepository->getForMapWithValidPano($mapId, $exclude);
|
||||
$state['rounds'][] = $place;
|
||||
$session->set('state', $state);
|
||||
|
||||
$panoId = $newPosition['panoId'];
|
||||
$panoId = $place['panoId'];
|
||||
} else {
|
||||
$state['rounds'] = [];
|
||||
$session->set('state', $state);
|
Loading…
Reference in New Issue
Block a user