当前位置: 首页>>代码示例>>PHP>>正文


PHP DAO::updateSectorCosts方法代码示例

本文整理汇总了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);
 }
开发者ID:LordMatrix,项目名称:Ochorri,代码行数:7,代码来源:Player.class.php

示例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);
 }
开发者ID:LordMatrix,项目名称:Ochorri,代码行数:8,代码来源:Sector.class.php

示例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;
}
开发者ID:LordMatrix,项目名称:Ochorri,代码行数:31,代码来源:set_initial_sector.php


注:本文中的DAO::updateSectorCosts方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。