本文整理汇总了PHP中Globals::getGoods方法的典型用法代码示例。如果您正苦于以下问题:PHP Globals::getGoods方法的具体用法?PHP Globals::getGoods怎么用?PHP Globals::getGoods使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Globals
的用法示例。
在下文中一共展示了Globals::getGoods方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_file_loc
$template->assign('PageTopic', 'Planet : ' . $planet->getName() . ' [Sector #' . $planet->getSectorID() . ']');
require_once get_file_loc('menu.inc');
create_planet_menu($planet);
$PHP_OUTPUT .= '<p>There are no goods present on your ship or the planet!</p>';
$present = false;
$table .= '<p>';
$table .= '<table class="standard">';
$table .= '<tr>';
$table .= '<th></th>';
$table .= '<th>Good</th>';
$table .= '<th>Ship</th>';
$table .= '<th>Planet</th>';
$table .= '<th>Amount</th>';
$table .= '<th>Transfer to</th>';
$table .= '</tr>';
$GOODS =& Globals::getGoods();
foreach ($GOODS as $goodID => $good) {
if (!$ship->hasCargo($goodID) && !$planet->hasStockpile($goodID)) {
continue;
}
if (!$present) {
$present = true;
$PHP_OUTPUT = "";
}
$container = create_container('planet_stockpile_processing.php');
$container['good_id'] = $goodID;
$PHP_OUTPUT .= create_echo_form($container);
$PHP_OUTPUT .= '<tr>';
$PHP_OUTPUT .= '<td class="left"><img src="' . $good['ImageLink'] . '" width="13" height="16" title="' . $good['Name'] . '" alt=""></td>';
$PHP_OUTPUT .= '<td>' . $good['Name'] . '</td>';
$PHP_OUTPUT .= '<td align="center">' . $ship->getCargo($goodID) . '</td>';
示例2: foreach
$Locations =& SmrLocation::getAllLocations();
Sorter::sortByNumMethod($Locations, 'getName');
foreach ($Locations as &$Location) {
?>
<option value="<?php
echo $Location->getTypeID();
?>
"><?php
echo $Location->getName();
?>
</option><?php
}
unset($Location);
break;
case 'Goods':
$Goods =& Globals::getGoods();
foreach ($Goods as &$Good) {
?>
<option value="<?php
echo $Good['ID'];
?>
"><?php
echo $Good['Name'];
?>
</option><?php
}
unset($Good);
break;
default:
}
?>
示例3: create_error
<?php
if (!$player->isLandedOnPlanet()) {
create_error('You are not on a planet!');
}
$planet =& $player->getSectorPlanet();
$template->assign('PageTopic', 'Planet : ' . $planet->getName() . ' [Sector #' . $player->getSectorID() . ']');
require_once get_file_loc('menu.inc');
create_planet_menu($planet);
$template->assignByRef('ThisPlanet', $planet);
$template->assign('PlanetBuildings', Globals::getPlanetBuildings());
$template->assign('Goods', Globals::getGoods());
示例4: debug
function &findRoutes(&$player)
{
debug('Finding Routes');
$galaxies =& SmrGalaxy::getGameGalaxies($player->getGameID());
$tradeGoods = array(GOOD_NOTHING => false);
$goods =& Globals::getGoods();
foreach ($goods as $goodID => &$good) {
if ($player->meetsAlignmentRestriction($good['AlignRestriction'])) {
$tradeGoods[$goodID] = true;
} else {
$tradeGoods[$goodID] = false;
}
}
unset($good);
$tradeRaces = array();
$races =& Globals::getRaces();
foreach ($races as $raceID => &$race) {
$tradeRaces[$raceID] = false;
}
unset($race);
$tradeRaces[$player->getRaceID()] = true;
$galaxy =& $player->getSector()->getGalaxy();
$maxNumberOfPorts = 2;
$routesForPort = -1;
$numberOfRoutes = 1000;
$maxDistance = 15;
$startSectorID = $galaxy->getStartSector();
$endSectorID = $galaxy->getEndSector();
$db = new SmrMySqlDatabase();
$db->query('SELECT routes FROM route_cache WHERE game_id=' . $db->escapeNumber($player->getGameID()) . ' AND max_ports=' . $db->escapeNumber($maxNumberOfPorts) . ' AND goods_allowed=' . $db->escapeObject($tradeGoods) . ' AND races_allowed=' . $db->escapeObject($tradeRaces) . ' AND start_sector_id=' . $db->escapeNumber($startSectorID) . ' AND end_sector_id=' . $db->escapeNumber($endSectorID) . ' AND routes_for_port=' . $db->escapeNumber($routesForPort) . ' AND max_distance=' . $db->escapeNumber($maxDistance));
if ($db->nextRecord()) {
$routes = unserialize(gzuncompress($db->getField('routes')));
debug('Using Cached Routes: #' . count($routes));
return $routes;
} else {
debug('Generating Routes');
$allSectors = array();
foreach ($galaxies as &$galaxy) {
$allSectors += $galaxy->getSectors();
//Merge arrays
}
unset($galaxy);
$distances =& Plotter::calculatePortToPortDistances($allSectors, $maxDistance, $startSectorID, $endSectorID);
if ($maxNumberOfPorts == 1) {
$allRoutes = RouteGenerator::generateOneWayRoutes($allSectors, $distances, $tradeGoods, $tradeRaces, $routesForPort);
} else {
$allRoutes = RouteGenerator::generateMultiPortRoutes($maxNumberOfPorts, $allSectors, $tradeGoods, $tradeRaces, $distances, $routesForPort, $numberOfRoutes);
}
unset($distances);
$allRoutes =& $allRoutes[RouteGenerator::EXP_ROUTE];
$routesMerged = array();
foreach ($allRoutes as $multi => &$routesByMulti) {
$routesMerged += $routesByMulti;
//Merge arrays
}
unset($routesByMulti);
unset($allSectors);
SmrPort::clearCache();
SmrSector::clearCache();
$db->query('INSERT INTO route_cache ' . '(game_id, max_ports, goods_allowed, races_allowed, start_sector_id, end_sector_id, routes_for_port, max_distance, routes)' . ' VALUES (' . $db->escapeNumber($player->getGameID()) . ', ' . $db->escapeNumber($maxNumberOfPorts) . ', ' . $db->escapeObject($tradeGoods) . ', ' . $db->escapeObject($tradeRaces) . ', ' . $db->escapeNumber($startSectorID) . ', ' . $db->escapeNumber($endSectorID) . ', ' . $db->escapeNumber($routesForPort) . ', ' . $db->escapeNumber($maxDistance) . ', ' . $db->escapeObject($routesMerged, true) . ')');
debug('Found Routes: #' . count($routesMerged));
return $routesMerged;
}
}