本文整理汇总了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);