本文整理汇总了C++中BattleUnit::getTimeUnits方法的典型用法代码示例。如果您正苦于以下问题:C++ BattleUnit::getTimeUnits方法的具体用法?C++ BattleUnit::getTimeUnits怎么用?C++ BattleUnit::getTimeUnits使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BattleUnit
的用法示例。
在下文中一共展示了BattleUnit::getTimeUnits方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
/**
* Update soldier stats when the soldier changes.
*/
void InventoryState::init()
{
BattleUnit *unit = _battleGame->getSelectedUnit();
unit->setCache(0);
_soldier->clear();
_btnRank->clear();
_txtName->setText(unit->getName(_game->getLanguage()));
_inv->setSelectedUnit(unit);
Soldier *s = _game->getSavedGame()->getSoldier(unit->getId());
if (s)
{
SurfaceSet *texture = _game->getResourcePack()->getSurfaceSet("BASEBITS.PCK");
texture->getFrame(s->getRankSprite())->setX(0);
texture->getFrame(s->getRankSprite())->setY(0);
texture->getFrame(s->getRankSprite())->blit(_btnRank);
std::string look = s->getArmor()->getSpriteInventory();
if (s->getGender() == GENDER_MALE)
look += "M";
else
look += "F";
if (s->getLook() == LOOK_BLONDE)
look += "0";
if (s->getLook() == LOOK_BROWNHAIR)
look += "1";
if (s->getLook() == LOOK_ORIENTAL)
look += "2";
if (s->getLook() == LOOK_AFRICAN)
look += "3";
look += ".SPK";
if (!CrossPlatform::fileExists(CrossPlatform::getDataFile("UFOGRAPH/" + look)))
{
look = s->getArmor()->getSpriteInventory() + ".SPK";
}
_game->getResourcePack()->getSurface(look)->blit(_soldier);
}
if (_tu)
{
std::wstringstream ss;
ss << _game->getLanguage()->getString("STR_TUS") << L'\x01' << unit->getTimeUnits();
_txtTus->setText(ss.str());
}
}
示例2: 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());
}
}
示例3: init
/**
* Update soldier stats when the soldier changes.
*/
void InventoryState::init()
{
BattleUnit *unit = _battleGame->getSelectedUnit();
unit->setCache(0);
_soldier->clear();
_btnRank->clear();
_txtName->setText(unit->getUnit()->getName(_game->getLanguage()));
_inv->setSelectedUnit(unit);
Soldier *s = dynamic_cast<Soldier*>(unit->getUnit());
if (s)
{
SurfaceSet *texture = _game->getResourcePack()->getSurfaceSet("BASEBITS.PCK");
texture->getFrame(s->getRankSprite())->setX(0);
texture->getFrame(s->getRankSprite())->setY(0);
texture->getFrame(s->getRankSprite())->blit(_btnRank);
std::string look = "MAN_0";
if (s->getGender() == GENDER_MALE)
look += "M";
else
look += "F";
if (s->getLook() == LOOK_BLONDE)
look += "0";
if (s->getLook() == LOOK_BROWNHAIR)
look += "1";
if (s->getLook() == LOOK_ORIENTAL)
look += "2";
if (s->getLook() == LOOK_AFRICAN)
look += "3";
look += ".SPK";
_game->getResourcePack()->getSurface(look)->blit(_soldier);
}
if (_tu)
{
std::wstringstream ss;
ss << _game->getLanguage()->getString("STR_TUS") << L'\x01' << unit->getTimeUnits();
_txtTus->setText(ss.str());
}
}
示例4: 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"");
}
}