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


C++ CClientChatManager类代码示例

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


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

示例3: updateChatModeAndButton

//-----------------------------------------------
//	updateChatModeAndButton
//
//-----------------------------------------------
void CClientChatManager::updateChatModeAndButton(uint mode, uint32 dynamicChannelDbIndex)
{
	// Check if USER chat is active
	bool userActive = false;
	CChatGroupWindow *pCGW = PeopleInterraction.getChatGroupWindow();
	if (pCGW)
	{
		CInterfaceGroup* pIG = pCGW->getContainer()->getGroup("content:cb:user");
		if (pIG)
		userActive = pIG->getActive();
	}

	CChatGroup::TGroupType m = (CChatGroup::TGroupType)mode;

	if (userActive)
	{
		// Change the button of the user chat to the corresponding chat target
		if (pCGW)
		{
			CCtrlTextButton *pUserBut = dynamic_cast<CCtrlTextButton*>(pCGW->getContainer()->getCtrl("content:but_user"));
			CCtrlTextButton *pEmoteBut = dynamic_cast<CCtrlTextButton*>(pCGW->getContainer()->getCtrl("content:but_emote"));
			CInterfaceGroup *pEditBox = dynamic_cast<CInterfaceGroup*>(pCGW->getContainer()->getGroup("content:ebw"));

			CInterfaceManager *pIM = CInterfaceManager::getInstance();
			const bool teamActive = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:GROUP:0:PRESENT")->getValueBool();
			const bool guildActive = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:GUILD:NAME")->getValueBool();

			if (m == CChatGroup::team && ! teamActive)
				m = PeopleInterraction.TheUserChat.Filter.getTargetGroup();

			if (m == CChatGroup::guild && ! guildActive)
				m = PeopleInterraction.TheUserChat.Filter.getTargetGroup();

			if (pUserBut)
			{
				switch(m)
				{
					default:
					case CChatGroup::arround:
					case CChatGroup::say:		pUserBut->setHardText("uiFilterAround");	break;
					case CChatGroup::region:	pUserBut->setHardText("uiFilterRegion");	break;
					case CChatGroup::universe:	pUserBut->setHardText("uiFilterUniverse");	break;
					case CChatGroup::team:		if (teamActive) pUserBut->setHardText("uiFilterTeam");		break;
					case CChatGroup::guild:		if (guildActive) pUserBut->setHardText("uiFilterGuild");	break;
					case CChatGroup::dyn_chat:
						uint32 textId = ChatMngr.getDynamicChannelNameFromDbIndex(dynamicChannelDbIndex);
						ucstring title;
						STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title);
						if (title.empty())
						{
							// Dyn channel does not exist, don't change
							m = PeopleInterraction.TheUserChat.Filter.getTargetGroup();
							dynamicChannelDbIndex = PeopleInterraction.TheUserChat.Filter.getTargetDynamicChannelDbIndex();
						}
						else
						{
							pUserBut->setHardText(title.toUtf8());
						}
						break;
					// NB: user chat cannot have yubo_chat target
				}

				pUserBut->setActive(true);
				pUserBut->getParent()->updateCoords();
				pUserBut->updateCoords();
			}

			if (pEmoteBut)
			{
				pEmoteBut->setActive(true);
				pEmoteBut->updateCoords();
			}

			if (pEditBox && pUserBut && pEmoteBut)
			{
				pEditBox->setW(-pUserBut->getWReal()-pEmoteBut->getWReal()-8);
				pEditBox->setX(pUserBut->getWReal()+4);
			}

			PeopleInterraction.TheUserChat.Filter.setTargetGroup(m, dynamicChannelDbIndex);
			PeopleInterraction.ChatGroup.Filter.setTargetGroup(m, dynamicChannelDbIndex);
		}
	}
}
开发者ID:CCChaos,项目名称:RyzomCore,代码行数:88,代码来源:client_chat_manager.cpp

示例4: execute

	void execute (CCtrlBase * /* pCaller */, const std::string &sParams)
	{
		// Param
		ucstring text = CI18N::get ("uiTalkMemMsg"+sParams);

		// Find the base group
		if (!text.empty())
		{
			ChatMngr.setChatMode (CChatGroup::say);
			ChatMngr.chat(text);
		}
	}
开发者ID:CCChaos,项目名称:RyzomCore,代码行数:12,代码来源:client_chat_manager.cpp

示例5: actionPart

	void actionPart ()
	{
		// If the line starts with '/tell ', do not try to expand
		static const ucstring TELL_STR("/tell ");
		if (_GroupEdit->getInputString().substr(0, TELL_STR.length()) != TELL_STR)
		{
			if (_GroupEdit->expand()) return;
		}
		CInterfaceManager *im = CInterfaceManager::getInstance();
		if (!im->isInGame()) return;
		// there was no / at the start of the line so try to cycle through the last people on which a tell was done
		const ucstring *lastTellPeople = ChatMngr.cycleLastTell();
		if (!lastTellPeople) return;
		// Get chat box from ist edit box
		// If it isn't a user chat or the main chat, just display 'tell' with the name. Otherwise, change the target of the window
		CChatWindow *cw = getChatWndMgr().getChatWindowFromCaller(_GroupEdit);
		if (!cw) return;
		CFilteredChat *fc = PeopleInterraction.getFilteredChatFromChatWindow(cw);
		if (fc)
		{
			fc->Filter.setTargetPlayer(*lastTellPeople);
		}
		else
		{
			// it is not a filtered chat, display 'tell' (must be ingame)
			_GroupEdit->setCommand(ucstring("tell ") + *lastTellPeople + (ucchar) ' ', false);
		}
	}
开发者ID:Darkhunter,项目名称:Tranquillien-HCRP-Project-using-NeL,代码行数:28,代码来源:action_handler_edit.cpp

示例6: msgEntered

//=============================================================================================================
void CChatTargetFilter::msgEntered(const ucstring &msg, CChatWindow *chatWindow)
{
	// Special case for yubo chat
	if(_TargetGroup==CChatGroup::yubo_chat)
	{
		CInterfaceManager	*pIM= CInterfaceManager::getInstance();
		pIM->sendStringToYuboChat(msg);
		return;
	}

	// Common Target case
	if (ClientCfg.Local)
	{
		chatWindow->displayMessage(msg, CRGBA::White, _TargetGroup, _TargetDynamicChannelDbIndex);
		return;
	}

	// forward to the target
	if (_TargetPartyChat && _TargetPartyChat->getListener())
	{
		_TargetPartyChat->getListener()->msgEntered(msg, chatWindow);
	}
	else if (!_TargetPlayer.empty())
	{
		// the target must be a player, make a tell on him
		// TODO: adapt this to unicode when this is OK on server side
		ChatMngr.tell(_TargetPlayer.toString(), msg.toString());
		// direct output in the chat
		chatWindow->displayLocalPlayerTell(msg);
	}
	else
	{
		 // chat to a chat group (say, shout, universe) also for team (with special case in setChatMode)
		 // this mode is cached so this should be ok
		ChatMngr.setChatMode(_TargetGroup, ChatMngr.getDynamicChannelIdFromDbIndex(_TargetDynamicChannelDbIndex));
		// send the string
		ChatMngr.chat(msg, _TargetGroup == CChatGroup::team);
	}
}
开发者ID:mixxit,项目名称:solinia,代码行数:40,代码来源:chat_filter.cpp


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