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


C++ BattleUnit::getCarriedWeight方法代码示例

本文整理汇总了C++中BattleUnit::getCarriedWeight方法的典型用法代码示例。如果您正苦于以下问题:C++ BattleUnit::getCarriedWeight方法的具体用法?C++ BattleUnit::getCarriedWeight怎么用?C++ BattleUnit::getCarriedWeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BattleUnit的用法示例。


在下文中一共展示了BattleUnit::getCarriedWeight方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: updateStats

/**
 * Updates the soldier stats (Weight, TU).
 */
void InventoryState::updateStats()
{
	BattleUnit *unit = _battleGame->getSelectedUnit();
	if (_showMoreStatsInInventoryView)
	{
		int Weight = unit->getCarriedWeight(_inv->getSelectedItem());
		std::wstringstream ss;
		ss << _game->getLanguage()->getString("STR_WEIGHT") << L'\x01' << Weight << " /" << unit->getStats()->strength;
		_txtWeight->setText(ss.str());
		if (Weight > unit->getStats()->strength)
			_txtWeight->setSecondaryColor(Palette::blockOffset(2));
		else _txtWeight->setSecondaryColor(Palette::blockOffset(1));
	}
	if (_tu)
	{
		std::wstringstream ss;
		ss << _game->getLanguage()->getString("STR_TUS") << L'\x01' << unit->getTimeUnits();
		_txtTus->setText(ss.str());
	}
}
开发者ID:GregoryBonik,项目名称:OpenXcom,代码行数:23,代码来源:InventoryState.cpp

示例2: updateStats

/**
 * Updates the soldier stats (Weight, TU).
 */
void InventoryState::updateStats()
{
	BattleUnit *unit = _battleGame->getSelectedUnit();

	_txtTus->setText(tr("STR_TIME_UNITS_SHORT").arg(unit->getTimeUnits()));

	int weight = unit->getCarriedWeight(_inv->getSelectedItem());
	_txtWeight->setText(tr("STR_WEIGHT").arg(weight).arg(unit->getBaseStats()->strength));
	if (weight > unit->getBaseStats()->strength)
	{
		_txtWeight->setSecondaryColor(_game->getMod()->getInterface("inventory")->getElement("weight")->color2);
	}
	else
	{
		_txtWeight->setSecondaryColor(_game->getMod()->getInterface("inventory")->getElement("weight")->color);
	}

	_txtFAcc->setText(tr("STR_ACCURACY_SHORT").arg((int)(unit->getBaseStats()->firing * unit->getHealth()) / unit->getBaseStats()->health));

	_txtReact->setText(tr("STR_REACTIONS_SHORT").arg(unit->getBaseStats()->reactions));

	if (unit->getBaseStats()->psiSkill > 0)
	{
		_txtPSkill->setText(tr("STR_PSIONIC_SKILL_SHORT").arg(unit->getBaseStats()->psiSkill));
	}
	else
	{
		_txtPSkill->setText(L"");
	}

	if (unit->getBaseStats()->psiSkill > 0 || (Options::psiStrengthEval && _game->getSavedGame()->isResearched(_game->getMod()->getPsiRequirements())))
	{
		_txtPStr->setText(tr("STR_PSIONIC_STRENGTH_SHORT").arg(unit->getBaseStats()->psiStrength));
	}
	else
	{
		_txtPStr->setText(L"");
	}
}
开发者ID:atlimit8,项目名称:OpenXcom,代码行数:42,代码来源:InventoryState.cpp


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