本文整理汇总了C++中CInterfaceManager::addServerID方法的典型用法代码示例。如果您正苦于以下问题:C++ CInterfaceManager::addServerID方法的具体用法?C++ CInterfaceManager::addServerID怎么用?C++ CInterfaceManager::addServerID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CInterfaceManager
的用法示例。
在下文中一共展示了CInterfaceManager::addServerID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: execute
virtual void execute (CCtrlBase *pCaller, const string &Params)
{
string sValue = getParam(Params,"value");
string sTarget = getParam(Params,"target");
string sRemoveTitle = getParam(Params,"remove_title");
if (sTarget.empty()) return;
if (sTarget.rfind(':') == string::npos)
{
if (pCaller == NULL) return;
sTarget = pCaller->getId() + ":" + sTarget;
}
else
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
string elt = sTarget.substr(0,sTarget.rfind(':'));
CInterfaceElement *pIE;
if (pCaller != NULL)
pIE = pIM->getElementFromId(pCaller->getId(), elt);
else
pIE = pIM->getElementFromId(elt);
if (pIE == NULL) return;
sTarget = pIE->getId() + ":" + sTarget.substr(sTarget.rfind(':')+1,sTarget.size());
}
CInterfaceExprValue evValue;
if (CInterfaceExpr::eval(sValue, evValue, NULL))
{
bool bRemoveTitle = false;
if (!sRemoveTitle.empty())
fromString(sRemoveTitle, bRemoveTitle);
CInterfaceManager *pIM = CInterfaceManager::getInstance();
if (bRemoveTitle)
{
CStringPostProcessRemoveTitle *pSPPRT = new CStringPostProcessRemoveTitle;
if (evValue.toInteger())
pIM->addServerID (sTarget, (uint32)evValue.getInteger(), pSPPRT);
}
else
{
if (evValue.toInteger())
pIM->addServerID (sTarget, (uint32)evValue.getInteger(), NULL);
}
}
}
示例2: rebuildThemaPage
// ***************************************************************************
void CEncyclopediaManager::rebuildThemaPage(uint32 themaName)
{
uint32 i;
CEncyMsgThema *pThema = NULL;
// Select the right album
for (i = 0; i < _Albums.size(); ++i)
{
pThema = _Albums[i].getThema(themaName);
if (pThema != NULL)
{
_AlbumNameSelected = _Albums[i].Name;
break;
}
}
if (pThema == NULL)
return;
// Update the right page
CInterfaceManager *pIM = CInterfaceManager::getInstance();
// Hide and show good group
CInterfaceElement *pIE = pIM->getElementFromId(PAGE_ENCY_ALBUM);
nlassert(pIE != NULL);
pIE->setActive(false);
pIE = pIM->getElementFromId(PAGE_ENCY_HELP);
pIE->setActive(false);
pIE = pIM->getElementFromId(PAGE_ENCY_THEMA);
pIE->setActive(true);
// Setup title
CViewTextID *pVT = dynamic_cast<CViewTextID*>(pIM->getElementFromId(PAGE_ENCY_THEMA ":title"));
nlassert(pVT != NULL);
pVT->setTextId(pThema->Name);
// Setup rewards
pVT = dynamic_cast<CViewTextID*>(pIM->getElementFromId(PAGE_ENCY_THEMA ":reward_text:desc"));
nlassert(pVT != NULL);
pVT->setTextId(pThema->RewardText);
// Setup brick reward
pIM->getDbProp("UI:VARIABLES:ENCY:REWARDBRICK:SHEET")->setValue32(pThema->RewardSheet);
CViewText *pRBVT = dynamic_cast<CViewText*>(pIM->getElementFromId(PAGE_ENCY_THEMA ":reward:desc"));
nlassert(pRBVT != NULL);
STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance();
CEntitySheet *pES = SheetMngr.get(CSheetId(pThema->RewardSheet));
if (pES != NULL)
{
if (pES->type() == CEntitySheet::ITEM)
{
const ucstring desc(pSMC->getItemLocalizedDescription(CSheetId(pThema->RewardSheet)));
pRBVT->setText(desc);
}
else if (pES->type() == CEntitySheet::SBRICK)
{
const ucstring desc(pSMC->getSBrickLocalizedDescription(CSheetId(pThema->RewardSheet)));
pRBVT->setText(desc);
}
else if (pES->type() == CEntitySheet::SPHRASE)
{
const ucstring desc(pSMC->getSPhraseLocalizedDescription(CSheetId(pThema->RewardSheet)));
pRBVT->setText(desc);
}
}
// Setup the total number of steps
uint32 nNbSteps = pThema->NbTask - 1; // 0th is the rite
pIM->getDbProp("UI:VARIABLES:ENCY:STEPS")->setValue32(nNbSteps);
// Count number of tasks done
uint32 nNbTaskDone = 0;
for (i = 0; i < pThema->NbTask; ++i)
if (pThema->getTaskState((uint8)i) == 2) // 2 == finished
++nNbTaskDone;
pIM->getDbProp("UI:VARIABLES:ENCY:DONE")->setValue32(nNbTaskDone);
// setup rite & tasks
for (i = 0; i < pThema->NbTask; ++i)
{
string sTmp;
if (i == 0)
sTmp = PAGE_ENCY_THEMA ":todo2:rite";
else
sTmp = PAGE_ENCY_THEMA ":todo:task" + toString(i);
// setup task description
CViewTextID *pText = dynamic_cast<CViewTextID*>(pIM->getElementFromId(sTmp+":desc"));
nlassert(pText != NULL);
pText->setTextId(pThema->TaskName[i]);
// setup task NPC name
CStringPostProcessNPCRemoveTitle *pSPPRT = new CStringPostProcessNPCRemoveTitle;
pIM->addServerID (sTmp+":npc:uc_hardtext", pThema->TaskNPCName[i], pSPPRT);
// If the task is not known gray it
if (pThema->getTaskState((uint8)i) == 0)
pText->setAlpha(80);
else
pText->setAlpha(160);
//.........这里部分代码省略.........