本文整理汇总了C++中PlayerInfo::PISetString方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerInfo::PISetString方法的具体用法?C++ PlayerInfo::PISetString怎么用?C++ PlayerInfo::PISetString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerInfo
的用法示例。
在下文中一共展示了PlayerInfo::PISetString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnSuccess
void ReqLogin::OnSuccess()
{
// Check for session ID or login failure
TheVe1ReqManager::Instance()->SetLoggedIn(false);
// Format of XML:
// <session/> <- Child(1)
PXml p = m_xml.getChildNode(1);
if (SafeStrCmp(p.getName(), "session"))
{
#ifdef XML_DEBUG
std::cout << "found session element\n";
#endif
std::string sessionId = p.getText();
std::string playername;
int objId = -1; // object ID for local player
// Get player name and object ID for local player
p = m_xml.getChildNode(2);
if (SafeStrCmp(p.getName(), "playername"))
{
playername = p.getText();
std::cout << "**Got player name! \"" << playername << "\"\n";
}
else
{
// Got session ID but no player name, WTF ?
std::cout << "Got session ID but no player name, WTF??\n";
}
p = m_xml.getChildNode(3);
if (SafeStrCmp(p.getName(), "objid"))
{
objId = ToInt(p.getText());
std::cout << "**Got local player object ID: " << objId << "\n";
}
else
{
// Got session ID but we don't know the object ID for the local player. WTF ?
std::cout << "Got session ID but we don't know the object ID for the local player. WTF?\n";
}
p = m_xml.getChildNode(4);
if (SafeStrCmp(p.getName(), "loc"))
{
int loc = ToInt(p.getText());
// TODO Use ResetLocalPlayer() to set start pos/loc ?????
TheGSStartGame::Instance()->SetStartLoc(loc);
std::cout << "Got start location: " << loc << "\n";
}
else
{
// Reset here to well known start location.
ResetLocalPlayer();
std::cout << "No start location.\n";
}
std::cout << "Got session ID! " << sessionId << "\n";
TheVe1ReqManager::Instance()->SetSessionId(sessionId);
TheVe1ReqManager::Instance()->SetLoggedIn(true);
// Check if we are set up
std::string playerInfoFilename = playername + ".txt";
// TODO Sanitise the filename
ThePlayerInfoManager::Instance()->SetCurrentPlayer(playerInfoFilename);
ThePlayerInfoManager::Instance()->Save();
PlayerInfo* pi = ThePlayerInfoManager::Instance()->GetPI();
pi->PISetInt(PI_KEY("player obj id"), objId);
pi->PISetString(PI_KEY("playername"), playername);
pi->PISetString(PI_KEY("email"), m_email);
pi->Save();
// Set options for this player
TheGSOptions::Instance()->LoadSettingsFromPI(pi);
// TODO Do we need to set this via ObjectUpdater too, so it gets sent to all clients ?
// Set ID of this player object as the local player ID
SetLocalPlayerId(objId);
Assert(pi);
// Play happy logged in sound
TheSoundManager::Instance()->PlayWav("Sound/button112.wav");
if (GetGameMode() == AMJU_MODE_EDIT)
{
TheGame::Instance()->SetCurrentState(TheGSStartGame::Instance());
}
else
{
// Handle research info: session, mode, etc.
ChooseMode();
}
//.........这里部分代码省略.........