本文整理汇总了C++中CL_NetGameEvent::get_name方法的典型用法代码示例。如果您正苦于以下问题:C++ CL_NetGameEvent::get_name方法的具体用法?C++ CL_NetGameEvent::get_name怎么用?C++ CL_NetGameEvent::get_name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CL_NetGameEvent
的用法示例。
在下文中一共展示了CL_NetGameEvent::get_name方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseEvent
void RankingClientImpl::parseEvent(const CL_NetGameEvent &p_event)
{
const CL_String eventName = p_event.get_name();
if (eventName == EVENT_RANKING_ENTRIES) {
parseEntriesEvent(p_event);
} else {
cl_log_event(LOG_ERROR, "event remains unhandled: %1", p_event.to_string());
}
}
示例2: parseEvent
void RaceStart::parseEvent(const CL_NetGameEvent &p_event)
{
assert(p_event.get_name() == EVENT_RACE_START);
int i = 0;
m_carPosition.x = static_cast<float> (p_event.get_argument(i++));
m_carPosition.y = static_cast<float> (p_event.get_argument(i++));
m_carRotation.set_radians(static_cast<float> (p_event.get_argument(i++)));
}
示例3: parseEvent
void CarState::parseEvent(const CL_NetGameEvent &p_event)
{
assert(p_event.get_name() == EVENT_CAR_STATE);
m_name = p_event.get_argument(0);
m_serialData = CL_NetGameEvent("");
const int argCount = static_cast<signed>(p_event.get_argument_count());
for (int i = 1; i < argCount; ++i) {
m_serialData.add_argument(p_event.get_argument(i));
}
}
示例4: handleEvent
void ServerImpl::handleEvent(CL_NetGameConnection *p_conn, const CL_NetGameEvent &p_event)
{
try {
bool unhandled = false;
const CL_String eventName = p_event.get_name();
// connection initialize events
if (eventName == EVENT_CLIENT_INFO) {
onClientInfo(p_conn, p_event);
}
// master server events
if (eventName == EVENT_INFO_REQUEST) {
onServerInfoRequest(p_conn, p_event);
}
// race events
else if (eventName == EVENT_CAR_STATE) {
onCarState(p_conn, p_event);
} else if (eventName == EVENT_VOTE_START) {
onVoteStart(p_conn, p_event);
} else if (eventName == EVENT_VOTE_TICK) {
onVoteTick(p_conn, p_event);
}
// unknown events remains unhandled
else {
unhandled = true;
}
if (unhandled) {
cl_log_event(
LOG_EVENT,
"event %1 remains unhandled",
p_event.to_string()
);
}
} catch (CL_Exception e) {
cl_log_event(LOG_ERROR, e.message);
}
}
示例5: parseEvent
void Goodbye::parseEvent(const CL_NetGameEvent &p_event)
{
assert(p_event.get_name() == EVENT_GOODBYE);
m_reason = static_cast<GoodbyeReason>(static_cast<int>(p_event.get_argument(0)));
}