本文整理匯總了PHP中city::rscAmt方法的典型用法代碼示例。如果您正苦於以下問題:PHP city::rscAmt方法的具體用法?PHP city::rscAmt怎麽用?PHP city::rscAmt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類city
的用法示例。
在下文中一共展示了city::rscAmt方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: fopen
<?php
// 1065 - transfer resources from a sub-city to a group city
include "./slotFunctions.php";
include "./cityClass.php";
$cityID = $_SESSION['selectedItem'];
$unitFile = fopen($gamePath . '/unitDat.dat', 'r+b');
$slotFile = fopen($gamePath . '/gameSlots.slt', 'rb');
$fromCity = new city($cityID, $unitFile);
$fromCity->slotFile($slotFile);
$toCity = new city($fromCity->cityData[29], $unitFile);
$toCity->slotFile($slotFile);
$transferOpt = [0, 0.1, 0.25, 0.5, 1.0];
$transferAmt = $fromCity->rscAmt($postVals[1]) * $transferOpt[$postVals[2]];
if ($transferAmt > 0) {
$fromCity->addRsc($postVals[1], -$transferAmt);
$toCity->addRsc($postVals[1], $transferAmt);
}
echo '<script>messageBox("Transfered ' . $ransferAmt . ' resources.", document.getElementByType("Body"))</script>';
fclose($slotFile);
fclose($unitFile);