当前位置: 首页>>代码示例>>C++>>正文


C++ CSteamID::BIndividualAccount方法代码示例

本文整理汇总了C++中CSteamID::BIndividualAccount方法的典型用法代码示例。如果您正苦于以下问题:C++ CSteamID::BIndividualAccount方法的具体用法?C++ CSteamID::BIndividualAccount怎么用?C++ CSteamID::BIndividualAccount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CSteamID的用法示例。


在下文中一共展示了CSteamID::BIndividualAccount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: FormatFilename

void CLogger::FormatFilename(wxString& string, CSteamID steamID)
{
	wxMutexLocker configLock(m_configLock);

	wxArrayString tags, replacements;

	tags.Add(_T("{SteamID}"));		replacements.Add(wxString(steamID.SteamRender(), wxConvUTF8));
	tags.Add(_T("{MySteamID}"));	replacements.Add(wxString(m_pSteamUser->GetSteamID().SteamRender(), wxConvUTF8));
	tags.Add(_T("{SteamID64}"));	replacements.Add(wxString::Format(_T("%llu"), steamID.ConvertToUint64()));
	tags.Add(_T("{MySteamID64}"));	replacements.Add(wxString::Format(_T("%llu"), m_pSteamUser->GetSteamID().ConvertToUint64()));

	tags.Add(_T("{Name}"));
	if(steamID.BIndividualAccount())
	{
		replacements.Add(wxString(m_pSteamFriends->GetFriendPersonaName(steamID), wxConvUTF8));
	}
	else
	{
		const char* cszChatRoomName = NULL;
		
		if(m_pClientFriends && m_pGetChatRoomName)
			cszChatRoomName = m_pGetChatRoomName(m_pClientFriends, steamID);

		if(*cszChatRoomName)
		{
			replacements.Add(wxString(cszChatRoomName, wxConvUTF8));
		}
		else
		{
			wxString name;
			for(int i = 0; i < m_pSteamFriends->GetFriendCountFromSource(steamID); i++)
			{
				name += wxString(m_pSteamFriends->GetFriendPersonaName(m_pSteamFriends->GetFriendFromSourceByIndex(steamID, i)), wxConvUTF8) + _T(" + ");
			}
			name.RemoveLast(3);

			replacements.Add(name);
		}
	}

	tags.Add(_T("{Nickname}"));

	if(steamID.BIndividualAccount())
	{
		const char* cszNickname = NULL;

		if(m_pClientFriends && m_pGetPlayerNickname)
			cszNickname = m_pGetPlayerNickname(m_pClientFriends, steamID);

		if(cszNickname)
		{
			replacements.Add(wxString(cszNickname, wxConvUTF8));
		}
		else
		{
			replacements.Add(wxString(m_pSteamFriends->GetFriendPersonaName(steamID), wxConvUTF8));
		}
	}
	else
	{
		replacements.Add(replacements.Last());
	}

	tags.Add(_T("{MyName}"));		replacements.Add(wxString(m_pSteamFriends->GetPersonaName(), wxConvUTF8));
	tags.Add(_T("{Date}"));			replacements.Add(wxDateTime::Now().Format(m_dateFormat));
	tags.Add(_T("{Time}"));			replacements.Add(wxDateTime::Now().Format(m_timeFormat));
	tags.Add(_T("{UnixTime}"));		replacements.Add(wxString::Format(_T("%lld"), (long long)wxDateTime::GetTimeNow()));
	
	string = TagsReplace(string, tags, replacements);

	static const wxChar* invalidChars[] = {_T("\\"), _T("/"), _T(":"), _T("*"), _T("?"), _T("\""), _T("<"), _T(">"), _T("|")};
	for(int i = 0; i < sizeof(invalidChars) / sizeof(*invalidChars); i++)
	{
		string.Replace(invalidChars[i], m_replacementChar);
	}
}
开发者ID:Moggers,项目名称:open-steamworks,代码行数:76,代码来源:Logger.cpp


注:本文中的CSteamID::BIndividualAccount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。