本文整理汇总了PHP中Neuron_Core_Tools::resourceToText方法的典型用法代码示例。如果您正苦于以下问题:PHP Neuron_Core_Tools::resourceToText方法的具体用法?PHP Neuron_Core_Tools::resourceToText怎么用?PHP Neuron_Core_Tools::resourceToText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Neuron_Core_Tools
的用法示例。
在下文中一共展示了Neuron_Core_Tools::resourceToText方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getName
public function getName()
{
/*
$res,
$showRunes = true,
$dot = true,
$village = false,
$runeId = 'rune',
$html = true,
$income = array (),
$capacity = array ()
*/
return Neuron_Core_Tools::resourceToText($this->getLogArray(), false, false, false, false, false);
}
示例2: getChooseSpecialUnits
private function getChooseSpecialUnits($target, $squads, $error = null)
{
$page = new Neuron_Core_Template();
$page->setTextSection('specialUnits', 'battle');
$page->set('error', $error);
$page->set('target', Neuron_Core_Tools::output_varchar($target->getName()));
$page->set('targetId', $target->getId());
$distance = Dolumar_Map_Map::getDistanceBetweenVillages($this->village, $target, false);
$page->set('distance', Neuron_Core_Tools::output_distance($distance));
foreach ($this->village->getAttackSlots($target) as $k => $v) {
if (isset($squads[$k])) {
$unitId = $squads[$k]->getSquad()->getId() . '_' . $squads[$k]->getUnitId();
$page->addListValue('slots', array('id' => $k, 'unit' => $unitId));
}
}
$duration = $this->village->battle->getMoveDuration($squads, $distance);
if ($duration > 60 * 60 * 24) {
$page->set('duration', $duration);
}
$honour = Dolumar_Battle_Battle::getHonourPenalty($this->village, $target);
if ($honour > 0) {
//$bigger = round ( ($this->village->getScore () / $target->getScore ()) * 100) - 100;
$bigger = round(Dolumar_Battle_Battle::getSizeDifference($this->village, $target) * 100 - 100);
$page->set('honour', $honour);
$page->set('size', $bigger);
}
// Fetch thze special units
$units = $this->village->getSpecialUnits();
foreach ($units as $v) {
$actions = $v->getEffects();
// Prepare the actions
$aActions = array();
foreach ($actions as $action) {
if ($action instanceof Dolumar_Effects_Battle) {
$aActions[] = array('name' => $action->getName(), 'id' => $action->getId(), 'cost' => Neuron_Core_Tools::resourceToText($action->getCost($v, $target), false, false, false, 'rune', false));
}
}
if (count($aActions) > 0) {
asort($aActions);
// Add the special unit to the list
$page->addListValue('specialunits', array('id' => $v->getId(), 'name' => Neuron_Core_Tools::output_varchar($v->getName(false, true)), 'actions' => $aActions));
}
}
return $page->parse('battle/specialUnits.phpt');
}
示例3: getConfirmCast
protected function getConfirmCast($objUnit, $objSpell, $objTarget, $inputData = null)
{
$text = Neuron_Core_Text::__getInstance();
$page = new Neuron_Core_Template();
$page->setTextSection('confirm', $this->sTextFile);
if (isset($objTarget)) {
$page->set('target', Neuron_Core_Tools::output_varchar($objTarget->getName()));
}
$page->set('spell', Neuron_Core_Tools::output_varchar($objSpell->getName()));
$page->set('cost', Neuron_Core_Tools::resourceToText($objSpell->getCost($objUnit, $objTarget)));
$page->set('about', Neuron_Core_Tools::output_varchar($objSpell->getDescription()));
$page->set('duration', $objSpell->getType_text());
$page->set('difficulty', $objSpell->getDifficulty());
$page->set('probability', $this->getProbability($objUnit, $objSpell, $objTarget));
$page->set('toCast', Neuron_Core_Tools::putIntoText($text->get('toCast', 'confirm', $this->sTextFile), array('spell' => Neuron_Core_Tools::output_varchar($objSpell->getName()))));
// Set hidden values
$page->set('inputData', $inputData);
return $page->parse('magic/confirm.phpt');
}
示例4: resourceToText
public static function resourceToText($res, $showRunes = true, $dot = true, $village = false, $runeId = 'rune')
{
return Neuron_Core_Tools::resourceToText($res, $showRunes, $dot, $village, $runeId);
}
示例5: getOutputData
public function getOutputData($objUnit, $objTarget)
{
return array('title' => $this->getName(), 'id' => $this->getId(), 'description' => $this->getDescription(), 'cost' => Neuron_Core_Tools::resourceToText($this->getCost($objUnit, $objTarget)), 'type' => $this->getType_text(), 'difficulty' => $this->getDifficulty());
}
示例6: getCustomContent
public function getCustomContent($input)
{
$runes = $this->getUsedRunes();
$runes = array_keys($runes);
// Fetch the unit
$objUnit = $this->getSpecialUnit();
$page = new Neuron_Core_Template();
if ($this instanceof Dolumar_Buildings_WizardTower) {
$page->set('runetype', $runes[0]);
}
$page->set('bid', $this->getId());
$page->set('vid', $this->getVillage()->getId());
// Check for actions
$sAction = isset($input['action']) ? $input['action'] : null;
switch ($sAction) {
case 'train':
if ($this->trainUnit()) {
$page->set('isTrained', true);
} else {
$page->set('isTrained', false);
$page->set('trainError', $this->getError());
}
break;
case 'learn':
$spell = isset($input['effect']) ? $input['effect'] : false;
$spells = count($this->getKnownEffects()) - count($this->getFreeEffects());
if ($spell && $spells < $this->getLevel()) {
$spell = $this->getAvailableEffect($spell);
if ($spell && !$this->doesKnowEffect($spell) && $spell->canLearnSpell($this)) {
$db = Neuron_Core_Database::__getInstance();
$db->insert('specialUnits_effects', array('b_id' => $this->getId(), 'e_id' => $spell->getId()));
$this->aKnownActions = null;
}
}
break;
}
$page->setTextSection(strtolower($this->getClassName()), 'buildings');
// Textfile
$page->set('textfile', $this->sCastTextFile);
$page->set('canTrain', $this->canTrainUnits());
$page->set('capacity', $this->getSpecialUnitCapacity());
$page->set('training_cost', Neuron_Core_Tools::resourceToText($objUnit->getTrainingCost()));
// Show duration countdown if training
if ($this->isTraining()) {
$units = $this->getTrainingUnits();
$page->set('training_countdown', Neuron_Core_Tools::getCountdown($units[0]['vsu_tEndDate']));
}
// Inhabitans
$page->set('inhabitans', $this->getUnitCount(true));
$page->set('inhabitans_in', $this->getUnitCount(false));
// Window
$page->set('actionWindow', $objUnit->getWindowAction());
$page->set('freeSpellSlots', $this->countFreeEffectSlots());
$page->set('unitname', $this->getSpecialunit()->getName(false));
$page->set('unitsname', $this->getSpecialunit()->getName(true));
// See if you can choose a new spell
$spells = $this->countFreeEffectSlots();
if ($spells > 0) {
// Player has to choose a new spell!
foreach ($this->getAvailableEffects() as $v) {
if (!$this->doesKnowEffect($v) && $v->canLearnSpell($this)) {
$page->addListValue('spells', $v->getOutputData($this->getSpecialUnit(), $this->getVillage()));
}
}
}
return $page->parse('buildings/specialunits.phpt');
}