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


C++ CChatChannel类代码示例

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


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

示例1: ADDTOCALLSTACK

void CChat::FormatName(CGString &sName, const CChatMember *pMember, bool bSystem)	//static
{
	ADDTOCALLSTACK("CChat::FormatName");
	// Format chat name with proper color
	// 0 = Yellow (user)
	// 1 = Purple (moderator)
	// 2 = Blue (muted)
	// 3 = Purple (unused?)
	// 4 = White (me)
	// 5 = Green (system)

	int iColor = 0;
	if ( pMember )
	{
		CChatChannel *pChannel = pMember->GetChannel();
		if ( pChannel )
		{
			LPCTSTR pszName = const_cast<CChatMember *>(pMember)->GetChatName();
			if ( pChannel->IsModerator(pszName) )
				iColor = 1;
			else if ( !pChannel->HasVoice(pszName) )
				iColor = 2;

			sName.Format("%d%s", iColor, pszName);
			return;
		}
	}

	iColor = bSystem ? 5 : 4;
	sName.Format("%d%s", iColor, "SYSTEM");
}
开发者ID:bucketyied,项目名称:Source,代码行数:31,代码来源:CChat.cpp

示例2: ADDTOCALLSTACK

void CChat::DecorateName(CGString &sName, const CChatChanMember * pMember, bool fSystem) // static
{
	ADDTOCALLSTACK("CChat::DecorateName");
	CChatChannel * pChannel = NULL;
	if (pMember)
		pChannel = pMember->GetChannel();
	// 0 = yellow
	// 1 = purple
	// 2 = blue
	// 3 = purple
	// 4 = white
	// 5 = green
	int iResult = 0;
	if (!pMember || !pChannel) // Must be a system command if these are invalid
	{
		if (fSystem)
			iResult = 5;
		else
			iResult = 4;
	}
	else if (pChannel->IsModerator(pMember->GetChatName()))
		iResult = 1;
	else if (!pChannel->HasVoice(pMember->GetChatName()))
		iResult = 2;

	if (!pMember || !pChannel)
		sName.Format("%i%s", iResult, "SYSTEM");
	else
		sName.Format("%i%s", iResult, static_cast<LPCTSTR>(pMember->GetChatName()));
}
开发者ID:WangXYZ,项目名称:SphereServer_Source,代码行数:30,代码来源:CChat.cpp

示例3: GetFirstChannel

CChatChannel * CChat::FindChannel(lpctstr pszChannel) const
{
	CChatChannel * pChannel = GetFirstChannel();
	for ( ; pChannel != nullptr; pChannel = pChannel->GetNext())
	{
		if (strcmp(pChannel->GetName(), pszChannel) == 0)
			break;
	}
	return pChannel;
}
开发者ID:Sphereserver,项目名称:Source2,代码行数:10,代码来源:CChat.cpp


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