Пример #1
0
    function mapHTML()
    {
        global $User;
        $mapTurn = $this->phase == 'Pre-game' || $this->phase == 'Diplomacy' ? $this->turn - 1 : $this->turn;
        $smallmapLink = 'map.php?gameID=' . $this->id . '&turn=' . $mapTurn . ($User->options->value['showMoves'] == 'No' ? '&hideMoves' : '');
        $largemapLink = $smallmapLink . '&mapType=large' . ($User->options->value['showMoves'] == 'No' ? '&hideMoves' : '');
        $staticFilename = Game::mapFilename($this->id, $mapTurn, 'small');
        if (file_exists($staticFilename) && $User->options->value['showMoves'] == 'Yes') {
            $smallmapLink = STATICSRV . $staticFilename . '?nocache=' . rand(0, 99999);
        }
        $map = '
		<div id="mapstore">
			<img id="mapImage" src="' . $smallmapLink . '" alt=" " title="' . l_t('The small map for the current phase. If you are starting a new turn this will show the last turn\'s orders') . '" />
			<p class="lightgrey" style="text-align:center">
				<a class="mapnav" href="#" onClick="loadMap(' . $this->id . ',' . $mapTurn . ',-1); return false;">
                      <img id="Start" src="' . l_s('images/historyicons/Start_disabled.png') . '" alt="' . l_t('Start') . '" title="' . l_t('View the map from the first turn') . '" /></a>
				<a class="mapnav" href="#" onClick="loadMapStep(' . $this->id . ',' . $mapTurn . ',-1); return false;"><img id="Backward" src="' . l_s('images/historyicons/Backward_disabled.png') . '" alt="' . l_t('Backward') . '" title="' . l_t('View the map from the previous turn') . '" /></a>
                <!--    The following is the toggle for removing the movement arrows. Uncomment this section if you want the movement arrow toggle.
                <a class="mapnav" href="#" onClick="toggleMoves(' . $this->id . ',' . $mapTurn . '); return false;"><img id="NoMoves" src="images/historyicons/hidemoves.png" alt="NoMoves" title="Toggle movement lines" />
                </a>                 -->
			   <a id="LargeMapLink" class="mapnav" href="' . $largemapLink . '" target="_blank" class="light"><img src="' . l_s('images/historyicons/external.png') . '" alt="' . l_t('Open large map') . '" title="' . l_t('This button will open the large map in a new window. The large map shows all the moves, and is useful when the small map isn\'t clear enough.') . '" /></a></span>
                     
				<a class="mapnav" href="#" onClick="loadMapStep(' . $this->id . ',' . $mapTurn . ',1); return false;"><img id="Forward" src="' . l_s('images/historyicons/Forward_disabled.png') . '" alt="' . l_t('Forward') . '" title="' . l_t('View the map from the next turn') . '" /></a>
				<a class="mapnav" href="#" onClick="loadMap(' . $this->id . ',' . $mapTurn . ',' . $mapTurn . '); return false;"><img id="End" src="' . l_s('images/historyicons/End_disabled.png') . '" alt="' . l_t('End') . '" title="' . l_t('View the map from the most recent turn') . '" /></a>' . ($this->Members->isJoined() ? '<a class="mapnav" href="#" onClick="togglePreview(' . $this->id . ',' . $mapTurn . '); return false;"><img id="Preview" src="images/historyicons/Preview.png" alt="PreviewMoves" title="Show server side stored orders on the map" /></a>' : '') . '
							
			</p>
			<p id="History" class="lightgrey"></p>
		</div>
';
        $this->mapJS($mapTurn);
        return $map;
    }
Пример #2
0
 protected function jsLiveBoardData()
 {
     $jsonBoardDataFile = Game::mapFilename($this->gameID, $this->phase == 'Diplomacy' ? $this->turn - 1 : $this->turn, 'json');
     if (!file_exists($jsonBoardDataFile)) {
         $jsonBoardDataFile = 'map.php?gameID=' . $this->gameID . '&turn=' . $this->turn . '&phase=' . $this->phase . '&mapType=json' . (defined('DATC') ? '&DATC=1' : '') . '&nocache=' . rand(0, 1000);
     } else {
         $jsonBoardDataFile .= '?phase=' . $this->phase . '&nocache=' . rand(0, 10000);
     }
     return '<script type="text/javascript" src="' . STATICSRV . $jsonBoardDataFile . '"></script>';
 }
Пример #3
0
 * Territories colored, orders entered, units drawn on.
 * Now add territory names, and game-over caption if finished
 */
// Territory names
$drawMap->addTerritoryNames();
if (DELETECACHE) {
    $drawMap->caption(round(microtime(true) - $GLOBALS['scriptStartTime'], 2) . 'sec, DB-Out:' . $DB->getqueries . ', DB-In:' . $DB->putqueries . (function_exists('memory_get_usage') ? ', ' . round(memory_get_usage() / 1024 / 1024, 3) . 'MB' : ''));
} elseif ($Game->phase == 'Finished' and $turn == $latestTurn) {
    $drawMap->caption($Game->gameovertxt(TRUE));
}
/*
 * All done; save map to disk, then generate a new JavaScript list
 * of available maps which includes the new map, and finally output
 * the map which was saved.
 */
$filename = Game::mapFilename($Game->id, $turn);
if (HIDEMOVES) {
    $filename = str_replace(".map", "-hideMoves.map", $filename);
}
if (defined('DATC') && $mapType != 'small') {
    $drawMap->saveThumbnail($filename . '-thumb');
}
// colorCorrect Patch
if (COLORCORRECT) {
    $filename = str_replace(".map", "-" . COLORCORRECT . ".map", $filename);
    $drawMap->colorEnhance(COLORCORRECT);
}
// End colorCorrect Patch
// Add countrynames for colorblind:
if (COUNTRYNAMES) {
    $filename = str_replace(".map", "-names.map", $filename);