本文整理汇总了C++中CGameContext::SendBroadcast方法的典型用法代码示例。如果您正苦于以下问题:C++ CGameContext::SendBroadcast方法的具体用法?C++ CGameContext::SendBroadcast怎么用?C++ CGameContext::SendBroadcast使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGameContext
的用法示例。
在下文中一共展示了CGameContext::SendBroadcast方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ConTime
void CGameContext::ConTime(IConsole::IResult *pResult, void *pUserData)
{
CGameContext *pSelf = (CGameContext *) pUserData;
if (!CheckClientID(pResult->m_ClientID))
return;
CPlayer *pPlayer = pSelf->m_apPlayers[pResult->m_ClientID];
if (!pPlayer)
return;
CCharacter* pChr = pPlayer->GetCharacter();
if (!pChr)
return;
char aBuftime[64];
int IntTime = (int) ((float) (pSelf->Server()->Tick() - pChr->m_StartTime)
/ ((float) pSelf->Server()->TickSpeed()));
str_format(aBuftime, sizeof(aBuftime), "Your time is %s%d:%s%d",
((IntTime / 60) > 9) ? "" : "0", IntTime / 60,
((IntTime % 60) > 9) ? "" : "0", IntTime % 60);
pSelf->SendBroadcast(aBuftime, pResult->m_ClientID);
}
示例2: ConSetTimerType
void CGameContext::ConSetTimerType(IConsole::IResult *pResult, void *pUserData)
{
CGameContext *pSelf = (CGameContext *) pUserData;
if (!CheckClientID(pResult->m_ClientID))
return;
CPlayer *pPlayer = pSelf->m_apPlayers[pResult->m_ClientID];
if (!pPlayer)
return;
const char msg[3][128] = {"game/round timer.", "broadcast.", "both game/round timer and broadcast."};
char aBuf[128];
if(pPlayer->m_TimerType <= 2 && pPlayer->m_TimerType >= 0)
str_format(aBuf, sizeof(aBuf), "Timer is displayed in", msg[pPlayer->m_TimerType]);
else if(pPlayer->m_TimerType == 3)
str_format(aBuf, sizeof(aBuf), "Timer isn't displayed.");
if(pResult->NumArguments() == 0) {
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD,"timer",aBuf);
return;
}
else if(str_comp_nocase(pResult->GetString(0), "gametimer") == 0) {
pSelf->SendBroadcast("", pResult->m_ClientID);
pPlayer->m_TimerType = 0;
}
else if(str_comp_nocase(pResult->GetString(0), "broadcast") == 0)
pPlayer->m_TimerType = 1;
else if(str_comp_nocase(pResult->GetString(0), "both") == 0)
pPlayer->m_TimerType = 2;
else if(str_comp_nocase(pResult->GetString(0), "none") == 0)
pPlayer->m_TimerType = 3;
else if(str_comp_nocase(pResult->GetString(0), "cycle") == 0) {
if(pPlayer->m_TimerType < 3)
pPlayer->m_TimerType++;
else if(pPlayer->m_TimerType == 3)
pPlayer->m_TimerType = 0;
}
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD,"timer",aBuf);
}
示例3: ConBroadcast
void CGameContext::ConBroadcast(IConsole::IResult *pResult, void *pUserData)
{
CGameContext *pSelf = (CGameContext *)pUserData;
pSelf->SendBroadcast(pResult->GetString(0), -1);
}