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


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

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


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

示例1: 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


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