本文整理汇总了C++中IPlayerProfile::GetAttribute方法的典型用法代码示例。如果您正苦于以下问题:C++ IPlayerProfile::GetAttribute方法的具体用法?C++ IPlayerProfile::GetAttribute怎么用?C++ IPlayerProfile::GetAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPlayerProfile
的用法示例。
在下文中一共展示了IPlayerProfile::GetAttribute方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetProfileValue
bool COptionsManager::GetProfileValue(const char* key, string &value)
{
if(!m_pPlayerProfileManager)
{
if(gEnv->pSystem->IsEditor())
{
if(strcmp(key, "ColorLine") == 0)
{
value = m_defaultColorLine;
}
else if(strcmp(key, "ColorOver") == 0)
{
value = m_defaultColorOver;
}
else if(strcmp(key, "ColorText") == 0)
{
value = m_defaultColorText;
}
else
{
value.clear();
}
return true;
}
return false;
}
IPlayerProfile *pProfile = m_pPlayerProfileManager->GetCurrentProfile(m_pPlayerProfileManager->GetCurrentUser());
if(!pProfile) return false;
return pProfile->GetAttribute(key, value);
}
示例2: ProcessEvent
virtual void ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo )
{
switch(event)
{
case eFE_Activate:
{
if (IsPortActive(pActInfo, eIP_Get))
{
IPlayerProfile* pProfile = NULL;
if (IPlayerProfileManager *pProfileMan = gEnv->pGame->GetIGameFramework()->GetIPlayerProfileManager())
{
const char* user = pProfileMan->GetCurrentUser();
pProfile = pProfileMan->GetCurrentProfile(user);
TFlowInputData data;
if (!pProfile || pProfile->GetAttribute(GetPortString(pActInfo, eIP_Name), data))
{
ActivateOutput(pActInfo, eOP_Value, data);
}
else
{
ActivateOutput(pActInfo, eOP_Error, 1);
}
}
}
if (IsPortActive(pActInfo, eIP_Set))
{
IPlayerProfile* pProfile = NULL;
if (IPlayerProfileManager *pProfileMan = gEnv->pGame->GetIGameFramework()->GetIPlayerProfileManager())
{
const char *user = pProfileMan->GetCurrentUser();
pProfile = pProfileMan->GetCurrentProfile( user );
if(!pProfile || !pProfile->SetAttribute(GetPortString(pActInfo, eIP_Name), GetPortAny(pActInfo, eIP_Set)))
{
ActivateOutput(pActInfo, eOP_Error, 1);
}
}
}
}
break;
}
}
示例3: UpdateSingleplayerDifficulties
void CFlashMenuObject::UpdateSingleplayerDifficulties()
{
if(!m_apFlashMenuScreens[MENUSCREEN_FRONTENDSTART])
return;
if(!m_pPlayerProfileManager)
return;
IPlayerProfile *pProfile = m_pPlayerProfileManager->GetCurrentProfile(m_pPlayerProfileManager->GetCurrentUser());
if(!pProfile)
return;
string sGeneralPath = "Singleplayer.Difficulty";
int iDifficulties = 8;
/* for(int i=0; i<EDifficulty_END; ++i)
{
string sPath = sGeneralPath;
char c[5];
itoa(i, c, 10);
sPath.append(c);
sPath.append(".available");
TFlowInputData data;
pProfile->GetAttribute(sPath, data, false);
bool bDone = false;
data.GetValueWithConversion(bDone);
if(bDone)
{
iDifficulties += i*2;
}
}
*/
int iDifficultiesDone = 0;
for(int i=0; i<EDifficulty_END; ++i)
{
string sPath = sGeneralPath;
char c[5];
itoa(i, c, 10);
sPath.append(c);
sPath.append(".done");
TFlowInputData data;
pProfile->GetAttribute(sPath, data, false);
bool bDone = false;
data.GetValueWithConversion(bDone);
if(bDone)
{
iDifficultiesDone += std::max(i*2,1);
}
}
TFlowInputData data;
pProfile->GetAttribute("Singleplayer.LastSelectedDifficulty", data, false);
int iDiff = 2;
data.GetValueWithConversion(iDiff);
if(iDiff<=0)
{
iDiff = 2;
}
m_apFlashMenuScreens[MENUSCREEN_FRONTENDSTART]->Invoke("Root.MainMenu.SinglePlayer.enableDifficulties", iDifficulties);
m_apFlashMenuScreens[MENUSCREEN_FRONTENDSTART]->Invoke("Root.MainMenu.SinglePlayer.enableDifficultiesStats", iDifficultiesDone);
m_apFlashMenuScreens[MENUSCREEN_FRONTENDSTART]->Invoke("Root.MainMenu.SinglePlayer.selectDifficulty", iDiff);
}