本文整理汇总了C++中BattleUnit::setCache方法的典型用法代码示例。如果您正苦于以下问题:C++ BattleUnit::setCache方法的具体用法?C++ BattleUnit::setCache怎么用?C++ BattleUnit::setCache使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BattleUnit
的用法示例。
在下文中一共展示了BattleUnit::setCache方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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());
}
}
示例3: init
/**
* Updates all 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 (_showMoreStatsInInventoryView && !_tu)
{
std::wstringstream ss2;
ss2 << _game->getLanguage()->getString("STR_FACCURACY") << L'\x01' << (int)(unit->getStats()->firing * unit->getAccuracyModifier());
_txtFAcc->setText(ss2.str());
std::wstringstream ss3;
ss3 << _game->getLanguage()->getString("STR_REACT") << L'\x01' << unit->getStats()->reactions;
_txtReact->setText(ss3.str());
if (unit->getStats()->psiSkill > 0)
{
std::wstringstream ss4;
ss4 << _game->getLanguage()->getString("STR_PSKILL") << L'\x01' << unit->getStats()->psiSkill;
_txtPSkill->setText(ss4.str());
std::wstringstream ss5;
ss5 << _game->getLanguage()->getString("STR_PSTRENGTH") << L'\x01' << unit->getStats()->psiStrength;
_txtPStr->setText(ss5.str());
}
else
{
_txtPSkill->setText(L"");
_txtPStr->setText(L"");
}
}
updateStats();
}
示例4: init
/**
* Updates all soldier stats when the soldier changes.
*/
void InventoryState::init()
{
State::init();
BattleUnit *unit = _battleGame->getSelectedUnit();
// no selected unit, close inventory
if (unit == 0)
{
btnOkClick(0);
return;
}
// skip to the first unit with inventory
if (!unit->hasInventory())
{
if (_parent)
{
_parent->selectNextPlayerUnit(false, false, true);
}
else
{
_battleGame->selectNextPlayerUnit(false, false, true);
}
// no available unit, close inventory
if (_battleGame->getSelectedUnit() == 0 || !_battleGame->getSelectedUnit()->hasInventory())
{
// starting a mission with just vehicles
btnOkClick(0);
return;
}
else
{
unit = _battleGame->getSelectedUnit();
}
}
unit->setCache(0);
_soldier->clear();
_rank->clear();
_txtName->setBig();
_txtName->setText(unit->getName(_game->getLanguage()));
_inv->setSelectedUnit(unit);
Soldier *s = unit->getGeoscapeSoldier();
if (s)
{
SurfaceSet *texture = _game->getMod()->getSurfaceSet("SMOKE.PCK");
texture->getFrame(20 + s->getRank())->setX(0);
texture->getFrame(20 + s->getRank())->setY(0);
texture->getFrame(20 + s->getRank())->blit(_rank);
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";
const std::set<std::string> &ufographContents = FileMap::getVFolderContents("UFOGRAPH");
std::string lcaseLook = look;
std::transform(lcaseLook.begin(), lcaseLook.end(), lcaseLook.begin(), tolower);
if (ufographContents.find("lcaseLook") == ufographContents.end() && !_game->getMod()->getSurface(look))
{
look = s->getArmor()->getSpriteInventory() + ".SPK";
}
_game->getMod()->getSurface(look)->blit(_soldier);
}
else
{
Surface *armorSurface = _game->getMod()->getSurface(unit->getArmor()->getSpriteInventory());
if (armorSurface)
{
armorSurface->blit(_soldier);
}
}
updateStats();
_refreshMouse();
}
示例5: init
/**
* Updates all soldier stats when the soldier changes.
*/
void InventoryState::init()
{
State::init();
BattleUnit *unit = _battleGame->getSelectedUnit();
// no selected unit, close inventory
if (unit == 0)
{
btnOkClick(0);
return;
}
// skip to the first unit with inventory
if (!unit->hasInventory())
{
if (_parent)
{
_parent->selectNextPlayerUnit(false, false, true);
}
else
{
_battleGame->selectNextPlayerUnit(false, false, true);
}
// no available unit, close inventory
if (_battleGame->getSelectedUnit() == 0 || !_battleGame->getSelectedUnit()->hasInventory())
{
// starting a mission with just vehicles
btnOkClick(0);
return;
}
else
{
unit = _battleGame->getSelectedUnit();
}
}
if (_parent)
_parent->getMap()->getCamera()->centerOnPosition(unit->getPosition(), false);
unit->setCache(0);
_soldier->clear();
_btnRank->clear();
_txtName->setBig();
_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)) && !_game->getResourcePack()->getSurface(look))
{
look = s->getArmor()->getSpriteInventory() + ".SPK";
}
_game->getResourcePack()->getSurface(look)->blit(_soldier);
}
else
{
Surface *armorSurface = _game->getResourcePack()->getSurface(unit->getArmor()->getSpriteInventory());
if (armorSurface)
{
armorSurface->blit(_soldier);
}
}
updateStats();
}
示例6: init
/**
* Updates all soldier stats when the soldier changes.
*/
void InventoryState::init()
{
BattleUnit *unit = _battleGame->getSelectedUnit();
// no selected unit, close inventory
if (unit == 0)
{
btnOkClick(0);
return;
}
// skip to the first unit with inventory
if (!unit->hasInventory())
{
if (_parent)
{
_parent->selectNextPlayerUnit(false, false, true);
}
else
{
_battleGame->selectNextPlayerUnit(false, false, true);
}
// no available unit, close inventory
if (_battleGame->getSelectedUnit() == 0)
{
// starting a mission with just vehicles
btnOkClick(0);
return;
}
else
{
unit = _battleGame->getSelectedUnit();
}
}
if (_parent)
_parent->getMap()->getCamera()->centerOnPosition(unit->getPosition());
unit->setCache(0);
_soldier->clear();
_btnRank->clear();
_txtName->setBig();
_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)) && !_game->getResourcePack()->getSurface(look))
{
look = s->getArmor()->getSpriteInventory() + ".SPK";
}
_game->getResourcePack()->getSurface(look)->blit(_soldier);
}
else
{
Surface *armorSurface = _game->getResourcePack()->getSurface(unit->getArmor()->getSpriteInventory());
if (armorSurface)
{
armorSurface->blit(_soldier);
}
}
if (_showMoreStatsInInventoryView && !_tu)
{
std::wstringstream ss2;
ss2 << tr("STR_FACCURACY") << L'\x01' << (int)(unit->getStats()->firing * unit->getAccuracyModifier());
_txtFAcc->setText(ss2.str());
std::wstringstream ss3;
ss3 << tr("STR_REACT") << L'\x01' << unit->getStats()->reactions;
_txtReact->setText(ss3.str());
if (unit->getStats()->psiSkill > 0)
{
std::wstringstream ss4;
ss4 << tr("STR_PSKILL") << L'\x01' << unit->getStats()->psiSkill;
_txtPSkill->setText(ss4.str());
//.........这里部分代码省略.........