本文整理汇总了C++中CryFixedStringT::Format方法的典型用法代码示例。如果您正苦于以下问题:C++ CryFixedStringT::Format方法的具体用法?C++ CryFixedStringT::Format怎么用?C++ CryFixedStringT::Format使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CryFixedStringT
的用法示例。
在下文中一共展示了CryFixedStringT::Format方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FullSerialize
void CSmartMine::FullSerialize( TSerialize ser )
{
uint32 targetCount = m_trackedEntities.size();
ser.Value( "MineEnabled", m_enabled );
ser.Value( "MineFaction", m_factionId );
ser.Value( "MineTargetCount", targetCount );
CryFixedStringT<16> targetName;
if (ser.IsReading())
{
m_trackedEntities.clear();
for(uint32 i = 0; i < targetCount; ++i)
{
m_trackedEntities.push_back();
targetName.Format( "MineTarget_%d", i );
ser.Value( targetName.c_str(), m_trackedEntities[i] );
}
}
else
{
for(uint32 i = 0; i < targetCount; ++i)
{
targetName.Format( "MineTarget_%d", i );
ser.Value( targetName.c_str(), m_trackedEntities[i] );
}
}
StateMachineSerializeBehavior( SStateEventSerialize( ser ) );
}
示例2: OnDLCRemoved
void CDLCManager::OnDLCRemoved(const char* sDLCRootFolder)
{
//clear all the data
for( int iDLC = 0; iDLC < MAX_DLC_COUNT; iDLC++ )
{
if( IsDLCLoaded( iDLC ) )
{
if( strcmpi( m_dlcContents[iDLC].root.c_str(), sDLCRootFolder ) == 0 )
{
m_loadedDLCs &= ~BIT(iDLC);
m_allowedDLCs &= ~BIT(iDLC);
//close the paks
CryFixedStringT<ICryPak::g_nMaxPath> path;
path.Format("%s/dlcLevelExtras.pak", sDLCRootFolder);
CryLog( "DLC: Closing %s", path.c_str() );
gEnv->pCryPak->ClosePack( path.c_str() );
path.Format("%s/dlcData.pak", sDLCRootFolder);
CryLog( "DLC: Closing %s", path.c_str() );
gEnv->pCryPak->ClosePack( path.c_str() );
}
}
}
}
示例3: GetUnlockDisplayString
bool SUnlock::GetUnlockDisplayString( EUnlockType type, const char* name, CryFixedStringT<32>& outStr )
{
// TODO: Setup Playlist unlocks and any others
bool retval = false;
switch( type )
{
case eUT_Weapon:
{
const CItemSharedParams* pItemShared = g_pGame->GetGameSharedParametersStorage()->GetItemSharedParameters( name, false );
if( pItemShared )
{
outStr.Format( pItemShared->params.display_name.c_str() );
retval = true;
}
break;
}
case eUT_CreateCustomClass:
{
CEquipmentLoadout *pEquipmentLoadout = g_pGame->GetEquipmentLoadout();
if( pEquipmentLoadout )
{
const char* packageName = pEquipmentLoadout->GetPackageDisplayFromName( name );
if( packageName )
{
outStr.Format( CHUDUtils::LocalizeString(packageName) );
retval = true;
}
}
break;
}
case eUT_Attachment:
{
const char* pAttachmentName = strstr(name, ".");
if( pAttachmentName && pAttachmentName[0] )
{
CEquipmentLoadout* pEquipmentLoadout = g_pGame->GetEquipmentLoadout();
if( pEquipmentLoadout )
{
if( const CEquipmentLoadout::SEquipmentItem *pUnlockItem = pEquipmentLoadout->GetItemByName( pAttachmentName+1 ) )
{
outStr.Format( pUnlockItem->m_displayName.c_str() );
retval = true;
}
}
}
break;
}
}
return retval;
}
示例4: Report
void CGameStats::Report()
{
if(!m_serverReport)
return;
int playerCount = m_playerMap.size();
if (CGameServerNub * pServerNub = CCryAction::GetCryAction()->GetGameServerNub())
playerCount = pServerNub->GetPlayerCount();
//All server reporting is done here
m_serverReport->SetReportParams(playerCount,m_teamMap.size());
m_serverReport->SetServerValue("gamemode",m_playing?"game":"pre-game");
CryFixedStringT<32> timeleft("-");
if(IGameRulesSystem* pGR = gEnv->pGame->GetIGameFramework()->GetIGameRulesSystem())
{
IGameRules *pR = pGR->GetCurrentGameRules();
if(pR && pR->IsTimeLimited() && m_playing)
{
timeleft.Format("%.0f",pR->GetRemainingGameTime());
}
}
m_serverReport->SetServerValue("timeleft",timeleft);
CryFixedStringT<256> tempStr;
m_serverReport->SetServerValue("numplayers",tempStr.Format("%d",playerCount));
int i=0;
string mode;
for(PlayerStatsMap::const_iterator it=m_playerMap.begin();it!=m_playerMap.end();++it)
{
static string value;
m_serverReport->SetPlayerValue(i, "player", it->second.name);
value.Format("%d",it->second.rank);
m_serverReport->SetPlayerValue(i, "rank", value);
value.Format("%d",it->second.team?it->second.team:(it->second.spectator?0:1));
m_serverReport->SetPlayerValue(i, "team", value);
for (std::map<string, int>::const_iterator sit=it->second.scores.begin(); sit!=it->second.scores.end(); ++sit)
m_serverReport->SetPlayerValue(i, sit->first, tempStr.Format("%d",sit->second));
++i;
}
while (i < playerCount)
{
m_serverReport->SetPlayerValue(i, "player", "<connecting>");
++i;
}
}
示例5: RevertCVarChanges
void CRevertibleConfigLoader::RevertCVarChanges()
{
if (!m_savedCVars.empty())
{
CryLog ("Need to undo %" PRISIZE_T " %s...", m_savedCVars.size(), (m_savedCVars.size() == 1) ? "variable" : "variables");
IConsole * pConsole = gEnv->pConsole;
CryFixedStringT<128> cmd;
//Revert the saved cvars in reverse order to handle duplicate settings of the same cvar (which shouldn't be done but people ignore warnings)
for (int n = m_savedCVars.size()-1; n >= 0; --n)
{
ICVar * var = gEnv->pConsole->GetCVar(m_savedCVars[n].m_name);
if (var && var->GetType() == CVAR_STRING && strlen(m_savedCVars[n].m_value) == 0)
{
var->Set(m_savedCVars[n].m_value);
}
else
{
cmd.Format("%s %s", m_savedCVars[n].m_name, m_savedCVars[n].m_value);
}
pConsole->ExecuteString(cmd.c_str(), true);
}
m_cvarsTextBlock.EmptyWithoutFreeing();
m_savedCVars.clear();
}
}
示例6: LoadMod
bool CModInfoManager::LoadMod(const char* modName)
{
CryFixedStringT<256> command;
command.Format("g_loadMod %s", modName);
gEnv->pConsole->ExecuteString(command.c_str());
return true;
}
示例7: GetUsableText
//------------------------------------------------------------------------
int CScriptBind_Item::GetUsableText(IFunctionHandler *pH)
{
CItem *pItem = GetItem(pH);
if (!pItem)
return pH->EndFunction();
CryFixedWStringT<64> localizedString;
CryFixedStringT<64> finalString;
CryFixedStringT<64> tempString;
tempString.Format("@ui_item_pickup %s", pItem->GetSharedItemParams()->params.display_name.c_str());
localizedString = CHUDUtils::LocalizeStringW(tempString.c_str());
finalString.Format("%ls", localizedString.c_str());
return pH->EndFunction(finalString.c_str());
}
示例8: ParseAntiCheatConfig
void CAntiCheatManager::ParseAntiCheatConfig(const char * filename)
{
CCryFile file;
CryFixedStringT<128> realFileName;
realFileName.Format("%s/%s", PathUtil::GetGameFolder().c_str(), filename);
if (file.Open( realFileName.c_str(), "rb", ICryPak::FOPEN_HINT_QUIET | ICryPak::FOPEN_ONDISK ))
{
const size_t fileSize = file.GetLength();
char* pBuffer = new char [fileSize];
file.ReadRaw(pBuffer, fileSize);
XmlNodeRef xmlData = gEnv->pSystem->LoadXmlFromBuffer(pBuffer, fileSize);
SAFE_DELETE_ARRAY(pBuffer);
if(xmlData)
{
CryLog("Parsing Anti-Cheat Configuration...");
ParseAntiCheatConfig(xmlData);
}
else
{
CryLog("Unable to parse Anti-Cheat Configuration");
}
}
else
{
CryLog("Unable to load '%s'", realFileName.c_str());
}
}
示例9: CreateAudioListener
void CView::CreateAudioListener()
{
if (m_pAudioListener == NULL)
{
SEntitySpawnParams oEntitySpawnParams;
oEntitySpawnParams.sName = "SoundListener";
oEntitySpawnParams.pClass = gEnv->pEntitySystem->GetClassRegistry()->FindClass("SoundListener");
m_pAudioListener = gEnv->pEntitySystem->SpawnEntity(oEntitySpawnParams, true);
if (m_pAudioListener != NULL)
{
m_pAudioListener->SetFlagsExtended(m_pAudioListener->GetFlagsExtended() | ENTITY_FLAG_EXTENDED_AUDIO_LISTENER);
gEnv->pEntitySystem->AddEntityEventListener(m_pAudioListener->GetId(), ENTITY_EVENT_DONE, this);
CryFixedStringT<64> sTemp;
sTemp.Format("SoundListener(%d)", static_cast<int>(m_pAudioListener->GetId()));
m_pAudioListener->SetName(sTemp.c_str());
IEntityAudioProxyPtr pIEntityAudioProxy = crycomponent_cast<IEntityAudioProxyPtr>(m_pAudioListener->CreateProxy(ENTITY_PROXY_AUDIO));
CRY_ASSERT(pIEntityAudioProxy.get());
}
else
{
CryFatalError("<Sound>: audio listener creation failed in CView ctor!");
}
}
}
示例10: DesignerWarningFunc
int DesignerWarningFunc(const char * message)
{
if (g_pGameCVars->designer_warning_enabled && (!gEnv->IsDedicated()))
{
GameWarning("!DESIGNER WARNING\n%s", message);
}
// kept because autotests gather all designer warnings out of logs with this form
CryLogAlways("---DESIGNER_WARNING: %s", message);
CryLogAlways("----------------------------------------");
#if ENABLE_FEATURE_TESTER
// If feature testing is in progress, write each designer warning out as a failed feature test
CFeatureTester * featureTester = CFeatureTester::GetInstance();
if (featureTester)
{
CAutoTester * autoTestResultWriter = featureTester->GetAutoTesterIfActive();
if (autoTestResultWriter)
{
CryFixedStringT<32> warningName;
warningName.Format("DesignerWarning%04u", s_numDesignerWarningsHit);
autoTestResultWriter->AddSimpleTestCase("DesignerWarnings", warningName.c_str(), 0.1f, message);
}
}
#endif
s_numDesignerWarningsHit++;
return 0;
}
示例11: CreateAudioListener
void CView::CreateAudioListener()
{
if (m_pAudioListener == nullptr)
{
SEntitySpawnParams oEntitySpawnParams;
oEntitySpawnParams.sName = "AudioListener";
oEntitySpawnParams.pClass = gEnv->pEntitySystem->GetClassRegistry()->FindClass("AudioListener");
m_pAudioListener = gEnv->pEntitySystem->SpawnEntity(oEntitySpawnParams, true);
if (m_pAudioListener != nullptr)
{
// We don't want the audio listener to serialize as the entity gets completely removed and recreated during save/load!
m_pAudioListener->SetFlags(m_pAudioListener->GetFlags() | (ENTITY_FLAG_TRIGGER_AREAS | ENTITY_FLAG_NO_SAVE));
m_pAudioListener->SetFlagsExtended(m_pAudioListener->GetFlagsExtended() | ENTITY_FLAG_EXTENDED_AUDIO_LISTENER);
gEnv->pEntitySystem->AddEntityEventListener(m_pAudioListener->GetId(), ENTITY_EVENT_DONE, this);
CryFixedStringT<64> sTemp;
sTemp.Format("AudioListener(%d)", static_cast<int>(m_pAudioListener->GetId()));
m_pAudioListener->SetName(sTemp.c_str());
IEntityAudioProxyPtr pIEntityAudioProxy = crycomponent_cast<IEntityAudioProxyPtr>(m_pAudioListener->CreateProxy(ENTITY_PROXY_AUDIO));
CRY_ASSERT(pIEntityAudioProxy.get());
}
else
{
CryFatalError("<Audio>: Audio listener creation failed in CView::CreateAudioListener!");
}
}
else
{
m_pAudioListener->SetFlagsExtended(m_pAudioListener->GetFlagsExtended() | ENTITY_FLAG_EXTENDED_AUDIO_LISTENER);
m_pAudioListener->InvalidateTM(ENTITY_XFORM_POS);
}
}
示例12: GetSharedParameters
void CItemComponent::GetSharedParameters(XmlNodeRef rootParams)
{
// Parameters get stored under a combination of the class name and the section name for the parameters.
CryFixedStringT<256> sharedName;
sharedName.Format("item::%s::%s", GetEntity()->GetClass()->GetName(), "itemBase");
ISharedParamsManager* pSharedParamsManager = gEnv->pGameFramework->GetISharedParamsManager();
CRY_ASSERT(pSharedParamsManager);
m_itemBaseParameter = CastSharedParamsPtr<SItemBaseParameter>(pSharedParamsManager->Get(sharedName));
// If no parameter set exists we should attempt to create and register one.
if (!m_itemBaseParameter)
{
SItemBaseParameter sharedParams;
// Load in the base item shared parameters.
XmlNodeRef itemBaseParams = rootParams->findChild("itemBase");
if (itemBaseParams)
sharedParams.Read(itemBaseParams);
// Register a new set of parameters and retrieve a shared pointer to them.
m_itemBaseParameter = CastSharedParamsPtr<SItemBaseParameter>(pSharedParamsManager->Register(sharedName, sharedParams));
}
// Double check the shared parameter.
CRY_ASSERT(m_itemBaseParameter.get());
}
示例13:
CryFixedStringT<64> CPickAndThrowProxy::GetSharedParamsName() const
{
const char* szEntityClassName = m_player.GetEntityClassName();
CryFixedStringT<64> sharedParamsName;
sharedParamsName.Format("%s_%s", SPnTProxyParams::s_typeInfo.GetName(), szEntityClassName);
return sharedParamsName;
}
示例14: LocaliseInGamePresenceString
/*static*/
void CGameBrowser::LocaliseInGamePresenceString(CryFixedStringT<MAX_PRESENCE_STRING_SIZE> &out, const char* stringId, const int32 gameModeId, const int32 mapId)
{
#if USE_CRYLOBBY_GAMESPY
out.Format("%s:%d:%d", stringId, gameModeId, mapId);
#else
out = CHUDUtils::LocalizeString("@mp_rp_gameplay", GetGameModeStringFromId(gameModeId), GetMapStringFromId(mapId));
#endif
}
示例15: Init
//------------------------------------------------------------------------
bool CVehicleDamageBehaviorEffect::Init(IVehicle *pVehicle, const CVehicleParams &table)
{
m_pVehicle = pVehicle;
m_pDamageEffect = NULL;
m_slot = -1;
CVehicleParams effectParams = table.findChild("Effect");
if(!effectParams)
{
return false;
}
string effectName = effectParams.getAttr("effect");
CryFixedStringT<256> sharedParamsName;
sharedParamsName.Format("%s::DamageBehaviorEffect::%s", pVehicle->GetEntity()->GetClass()->GetName(), effectName.c_str());
ISharedParamsManager *pSharedParamsManager = CCryAction::GetCryAction()->GetISharedParamsManager();
CRY_ASSERT(pSharedParamsManager);
m_pSharedParams = CastSharedParamsPtr<SSharedParams>(pSharedParamsManager->Get(sharedParamsName));
if(!m_pSharedParams)
{
SSharedParams sharedParams;
sharedParams.effectName = effectName;
sharedParams.damageRatioMin = 1.0f;
sharedParams.updateFromHelper = false;
table.getAttr("damageRatioMin", sharedParams.damageRatioMin);
sharedParams.disableAfterExplosion = false;
effectParams.getAttr("disableAfterExplosion", sharedParams.disableAfterExplosion);
effectParams.getAttr("updateFromHelper", sharedParams.updateFromHelper);
m_pSharedParams = CastSharedParamsPtr<SSharedParams>(pSharedParamsManager->Register(sharedParamsName, sharedParams));
}
CRY_ASSERT(m_pSharedParams.get());
return true;
}