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


C++ CClientChatManager::getDynamicChannelDbIndexFromId方法代码示例

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


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

示例1:

// ***************************************************************************
void	CClientChatManager::processChatString( NLMISC::CBitMemStream& bms, IChatDisplayer &chatDisplayer)
{
	// before displaying anything, must ensure dynamic channels are up to date
	// NB: only processChatString() have to do this. Other methods cannot be in dyn_chat mode
	updateDynamicChatChannels(chatDisplayer);

	// serial
	CChatMsg chatMsg;
	bms.serial( chatMsg );
	CChatGroup::TGroupType	type = static_cast<CChatGroup::TGroupType>(chatMsg.ChatMode);
	ucstring	senderStr;

	bool complete = true;
	complete &= STRING_MANAGER::CStringManagerClient::instance()->getString(chatMsg.SenderNameId, senderStr);

	if (type == CChatGroup::dyn_chat)
	{
		// retrieve the DBIndex from the dynamic chat id
		sint32 dbIndex = ChatMngr.getDynamicChannelDbIndexFromId(chatMsg.DynChatChanID);
		// if the client database is not yet up to date, put the chat message in buffer
		if (dbIndex < 0)
			complete = false;
	}

	// if !complete, wait
	if (!complete)
	{
		_ChatBuffer.push_back(CChatMsgNode(chatMsg, false));
		//nldebug("<impulseChat> Received CHAT, put in buffer : waiting association");
		return;
	}

	// display
	ucstring	ucstr;
	buildChatSentence(chatMsg.CompressedIndex, senderStr, chatMsg.Content, type, ucstr);
	chatDisplayer.displayChat(chatMsg.CompressedIndex, ucstr, chatMsg.Content, type, chatMsg.DynChatChanID, senderStr);
}
开发者ID:CCChaos,项目名称:RyzomCore,代码行数:38,代码来源:client_chat_manager.cpp

示例2: flushBuffer

// ***************************************************************************
void CClientChatManager::flushBuffer(IChatDisplayer &chatDisplayer)
{
	// before displaying anything, must ensure dynamic channels are up to date
	updateDynamicChatChannels(chatDisplayer);

	// **** Process waiting messages
	{
		list<CChatMsgNode>::iterator itMsg;
		for( itMsg = _ChatBuffer.begin(); itMsg != _ChatBuffer.end(); )
		{
			CChatGroup::TGroupType	type = static_cast<CChatGroup::TGroupType>(itMsg->ChatMode);
			ucstring sender, content;

			// all strings received?
			bool complete = true;
			if (itMsg->SenderNameId != 0)
				complete &= STRING_MANAGER::CStringManagerClient::instance()->getString(itMsg->SenderNameId, sender);
			if(itMsg->UsePhraseId)
				complete &= STRING_MANAGER::CStringManagerClient::instance()->getDynString(itMsg->PhraseId, content);
			else
				content= itMsg->Content;

			if (type == CChatGroup::dyn_chat)
			{
				// retrieve the DBIndex from the dynamic chat id
				sint32 dbIndex = ChatMngr.getDynamicChannelDbIndexFromId(itMsg->DynChatChanID);
				// if the client database is not yet up to date, leave the chat message in buffer
				if (dbIndex < 0)
					complete = false;
			}

			// if complete, process
			if (complete)
			{
				ucstring ucstr;
				if (itMsg->SenderNameId == 0)
				{
					ucstr = content;
				}
				else
				{
					if(itMsg->DisplayAsTell)
						buildTellSentence(sender, content, ucstr);
					else
						buildChatSentence(itMsg->CompressedIndex, sender, content, type, ucstr);
				}

				// display
				if(itMsg->DisplayAsTell)
					chatDisplayer.displayTell(/*itMsg->CompressedIndex, */ucstr, sender);
				else
					chatDisplayer.displayChat(itMsg->CompressedIndex, ucstr, content, type, itMsg->DynChatChanID, sender);

				list<CChatMsgNode>::iterator itTmp = itMsg++;
				_ChatBuffer.erase( itTmp );
			}
			else
			{
				++itMsg;
			}
		}
	}
} // flushBuffer //
开发者ID:CCChaos,项目名称:RyzomCore,代码行数:64,代码来源:client_chat_manager.cpp


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