本文整理汇总了C++中IPlayerProfile::CreateSaveGameEnumerator方法的典型用法代码示例。如果您正苦于以下问题:C++ IPlayerProfile::CreateSaveGameEnumerator方法的具体用法?C++ IPlayerProfile::CreateSaveGameEnumerator怎么用?C++ IPlayerProfile::CreateSaveGameEnumerator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPlayerProfile
的用法示例。
在下文中一共展示了IPlayerProfile::CreateSaveGameEnumerator方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateSaveGames
void CFlashMenuObject::UpdateSaveGames()
{
CFlashMenuScreen* pScreen = m_pCurrentFlashMenuScreen;
if(!pScreen)
return;
//*************************************************************************
std::vector<SaveGameMetaData> saveGameData;
//*************************************************************************
pScreen->CheckedInvoke("resetSPGames");
// TODO: find a better place for this as it needs to be set only once -- CW
gEnv->pSystem->SetFlashLoadMovieHandler(this);
if(!m_pPlayerProfileManager)
return;
IPlayerProfile *pProfile = m_pPlayerProfileManager->GetCurrentProfile(m_pPlayerProfileManager->GetCurrentUser());
if(!pProfile)
return;
ILocalizationManager* pLocMgr = gEnv->pSystem->GetLocalizationManager();
ISaveGameEnumeratorPtr pSGE = pProfile->CreateSaveGameEnumerator();
ISaveGameEnumerator::SGameDescription desc;
//get the meta data into the struct
for (int i=0; i<pSGE->GetCount(); ++i)
{
pSGE->GetDescription(i, desc);
int kills = 0;
float levelPlayTimeSec = 0.0f;
float gamePlayTimeSec = 0.0f;
int difficulty = g_pGameCVars->g_difficultyLevel;
desc.metaData.xmlMetaDataNode->getAttr("sp_kills", kills);
desc.metaData.xmlMetaDataNode->getAttr("sp_levelPlayTime", levelPlayTimeSec);
desc.metaData.xmlMetaDataNode->getAttr("sp_gamePlayTime", gamePlayTimeSec);
desc.metaData.xmlMetaDataNode->getAttr("sp_difficulty", difficulty);
SaveGameMetaData data;
data.name = desc.name;
data.buildVersion = desc.metaData.buildVersion;
data.description = desc.description;
data.fileVersion = desc.metaData.fileVersion;
data.gamePlayTimeSec = gamePlayTimeSec;
data.gameRules = desc.metaData.gameRules;
data.humanName = desc.humanName;
data.levelName = g_pGame->GetMappedLevelName(desc.metaData.levelName);
data.levelPlayTimeSec = levelPlayTimeSec;
data.saveTime = desc.metaData.saveTime;
data.kills = kills;
data.difficulty = difficulty;
saveGameData.push_back(data);
}
if(saveGameData.size())
{
//sort by the set sorting rules
std::sort(saveGameData.begin(), saveGameData.end(), SaveGameDataCompare(m_eSaveGameCompareMode));
//send sorted data to flash
int start = (m_bSaveGameSortUp)?0:saveGameData.size()-1;
int end = (m_bSaveGameSortUp)?saveGameData.size():-1;
int inc = (m_bSaveGameSortUp)?1:-1;
for(int i = start; i != end; i+=inc)
{
SaveGameMetaData data = saveGameData[i];
wstring levelPlayTimeString;
pLocMgr->LocalizeDuration((int)data.levelPlayTimeSec, levelPlayTimeString);
wstring gamePlayTimeSecString;
pLocMgr->LocalizeDuration((int)data.gamePlayTimeSec, gamePlayTimeSecString);
wstring dateString;
pLocMgr->LocalizeDate(data.saveTime, true, true, true, dateString);
wstring timeString;
pLocMgr->LocalizeTime(data.saveTime, true, false, timeString);
dateString+=L" ";
dateString+=timeString;
bool levelStart = (ValidateName(data.name))?true:false;
SFlashVarValue args[12] =
{
data.name,
data.description,
data.humanName,
data.levelName,
data.gameRules,
data.fileVersion,
data.buildVersion,
levelPlayTimeString.c_str(),
dateString.c_str(),
levelStart,
//.........这里部分代码省略.........