本文整理汇总了PHP中DAO::updateSectorCosts方法的典型用法代码示例。如果您正苦于以下问题:PHP DAO::updateSectorCosts方法的具体用法?PHP DAO::updateSectorCosts怎么用?PHP DAO::updateSectorCosts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DAO
的用法示例。
在下文中一共展示了DAO::updateSectorCosts方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateResources
function updateResources($resources = array())
{
require_once '../DAO/DAO.class.php';
$connection = new DAO();
$connection->connect();
$connection->updateSectorCosts($this->getId(), $newCosts, 1, 0);
}
示例2: updateCosts
function updateCosts($newCosts = array(), $mode = 1, $operator)
{
//mode=0 substitute; mode=1 add to existent
require_once '../DAO/DAO.class.php';
$connection = new DAO();
$connection->connect();
$connection->updateSectorCosts($this->getId(), $newCosts, $mode, $operator);
}
示例3: DAO
require '../config/map.cfg.php';
require_once "../test/register_functions.php";
$connection = new DAO();
$connection->connect();
$rs = $connection->getAllSectors();
$allSectors = array();
while (!$rs->EOF) {
$sector = new Sector($rs->fields[0], $rs->fields[1], $rs->fields[2], $rs->fields[3], $rs->fields[4], $rs->fields[5], $rs->fields[6], $rs->fields[7], explode(",", $rs->fields[8]), explode(",", $rs->fields[9]), $rs->fields[10]);
array_push($allSectors, $sector);
$rs->moveNext();
}
$allSectors = Sector::indexByCoordinate($allSectors);
$suitableSectors = array();
$origins = array();
$minDistance = 3;
$suitableSectors = array_diff_key($allSectors, getForbidden($allSectors));
if (count($suitableSectors) > 0) {
$sector = $suitableSectors[array_rand($suitableSectors)];
$rs = $connection->updateSector($sector->getId(), $playerId, $playerId, 0);
$startCoordinates = $sector->getCoordinateX() . "," . $sector->getCoordinateY();
//Create Command center and capitol in initial sector
$now = $_SERVER['REQUEST_TIME'];
$connection->insertBuilding(0, $sector->getId(), 0);
$connection->updateBuilding(1, 0, $sector->getId());
$connection->insertBuilding(1, $sector->getId(), 0);
$connection->updateBuilding(1, 1, $sector->getId());
$connection->updateSectorCosts($sector->getId(), array(0, 0, 5, 5, 0), 0);
$inserted = true;
} else {
$inserted = false;
}