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


C++ CL_NetGameEvent::to_string方法代码示例

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


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

示例1: on_event_received

// An event was received from a client
void Server::on_event_received(CL_NetGameConnection *connection, const CL_NetGameEvent &e)
{
	cl_log_event("events", "Client sent event: %1", e.to_string());

	ServerUser *user = ServerUser::get_user(connection);
	if(user)
	{
		bool handled_event = false;

		if (user->id == 0)	// User has not logged in, so route events to login dispatcher
		{
			// Route login events
			handled_event = login_events.dispatch(e, user);
		}
		else
		{
			// Route game events
			handled_event = game_events.dispatch(e, user);
		}

		if (!handled_event)
		{
			// We received an event which we didn't hook up
			cl_log_event("events", "Unhandled event: %1", e.to_string());
		}
	}
}
开发者ID:animehunter,项目名称:clanlib-2.3,代码行数:28,代码来源:server.cpp

示例2: on_evento_recibido

//Evento Cliente: Recibido
void Servidor::on_evento_recibido(CL_NetGameConnection *conexion, const CL_NetGameEvent &e)
{

	UsuarioServidor *usuario = UsuarioServidor::get_usuario(conexion);

	if(usuario)
	{
		bool evento_manejado = false;

		if (usuario->id == 0)	// Usuario no se ha logeado, enrutar a eventos del despachador de login
		{
			//Despachador de eventos de login
			evento_manejado = eventos_login.dispatch(e, usuario);
		}
		else
		{
			//Despachador de eventos del juego
			evento_manejado = eventos_juego.dispatch(e, usuario);
		}

		if (!evento_manejado)
		{
			//Evento no manejado 
			cl_log_event("eventos", "Evento no manejado: %1", e.to_string());
		}
	}
}
开发者ID:vladimirdlc,项目名称:Tanknation,代码行数:28,代码来源:servidor.cpp

示例3: onEventArrived

void ServerImpl::onEventArrived(
		CL_NetGameConnection *p_conn,
		const CL_NetGameEvent &p_event
)
{
	cl_log_event(LOG_EVENT, "event %1 arrived", p_event.to_string());

	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);
		}

		// 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);
	}

}
开发者ID:bercik,项目名称:gear,代码行数:46,代码来源:Server.cpp

示例4: on_event_received

void Server::on_event_received(CL_NetGameConnection *connection, const CL_NetGameEvent &e)
{
	cl_log_event("system", "Client sent event: %1", e.to_string());

	ServerPlayer *player = ServerPlayer::get_player(connection);

	handle_event(player, e);
}
开发者ID:animehunter,项目名称:clanlib-2.3,代码行数:8,代码来源:server.cpp

示例5: 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());
	}
}
开发者ID:genail,项目名称:gear,代码行数:10,代码来源:RankingClient.cpp

示例6: on_event_set_maparea_army_strength

void GameEvents::on_event_set_maparea_army_strength(const CL_NetGameEvent &e)
{
	int map_area_id = e.get_argument(0);
	int army_strength = e.get_argument(1);

	MapArea *map_area = client->get_game_model()->get_map()->get_area_by_id(map_area_id);

	if(map_area != 0 && army_strength >= 1 && army_strength <= 8)
		map_area->army_strength = army_strength;
	else
		cl_log_event("error", "Invalid event: %1", e.to_string());
}
开发者ID:PaulFSherwood,项目名称:cplusplus,代码行数:12,代码来源:game_events.cpp

示例7: on_event_player_joined_game

void GameEvents::on_event_player_joined_game(const CL_NetGameEvent &e)
{
	int player_id = e.get_argument(0);
	CL_String player_name = e.get_argument(1);
	int visual_id = e.get_argument(2);

	GamePlayer *player = client->get_game_model()->get_players()->create_player(player_name, player_id, visual_id);
	if(player)
		client->get_game_view()->player_joined_game(player);
	else
		cl_log_event("error", "Invalid event: %1", e.to_string());
}
开发者ID:PaulFSherwood,项目名称:cplusplus,代码行数:12,代码来源:game_events.cpp

示例8: on_event_game_has_started

void GameEvents::on_event_game_has_started(const CL_NetGameEvent &e)
{
	if (client->get_game_model()->get_map()->validate())
	{
		client->get_game_view()->start_game();
	}
	else
	{
		// TODO: Show an error to user
		cl_log_event("error", "Unable to start game: Map is invalid", e.to_string());
	}
}
开发者ID:PaulFSherwood,项目名称:cplusplus,代码行数:12,代码来源:game_events.cpp

示例9: on_evento_recibido

//Evento Server: Recibido
void Cliente::on_evento_recibido(const CL_NetGameEvent &e) 
{
	cl_log_event("eventos", "Servidor envio evento: %1", e.to_string());

	bool evento_manejado = false;
	
	if(!logged_in)
	{
		// Usuario no se ha logeado, enrutar a eventos del despachador de login
		 evento_manejado = eventos_login.dispatch(e);
	}
	else
	{
		// Usuario logiado, enrutar a eventos del despachador del juego
		 evento_manejado = eventos_juego.dispatch(e);
	}

	if(! evento_manejado)
	{
		//Evento no manejado 
		cl_log_event("eventos", "Evento no manejado: %1", e.to_string());
	}
}
开发者ID:vladimirdlc,项目名称:Tanknation,代码行数:24,代码来源:cliente.cpp

示例10: on_event_received

// An event was received from server
void Client::on_event_received(const CL_NetGameEvent &e) 
{
	cl_log_event("events", "Server sent event: %1", e.to_string());

	bool handled_event = false;
	
	if(!logged_in)
	{
		// We haven't logged in, so route events to login dispatcher
		handled_event = login_events.dispatch(e);
	}
	else
	{
		// We have logged in, so route events to game dispatcher
		handled_event = game_events.dispatch(e);
	}

	if(!handled_event)
	{
		// We received an event which we didn't hook up
		cl_log_event("events", "Unhandled event: %1", e.to_string());
	}
}
开发者ID:animehunter,项目名称:clanlib-2.3,代码行数:24,代码来源:client.cpp

示例11: on_event_player_left_game

void GameEvents::on_event_player_left_game(const CL_NetGameEvent &e)
{
	int player_id = e.get_argument(0);
	
	GamePlayer *player = client->get_game_model()->get_players()->get_player(player_id);
	if(player)
	{
		client->get_game_view()->player_left_game(player);

		client->get_game_model()->get_players()->remove_player(player);
	}
	else
		cl_log_event("error", "Invalid event: %1", e.to_string());
}
开发者ID:PaulFSherwood,项目名称:cplusplus,代码行数:14,代码来源:game_events.cpp

示例12: on_event_set_maparea_ownership

void GameEvents::on_event_set_maparea_ownership(const CL_NetGameEvent &e)
{
	int map_area_id = e.get_argument(0);
	int player_id = e.get_argument(1);

	MapArea *map_area = client->get_game_model()->get_map()->get_area_by_id(map_area_id);
	GamePlayer *player = client->get_game_model()->get_players()->get_player(player_id);

	if(map_area != 0 && player != 0)
	{
		map_area->player_id = player->id;
		client->get_game_view()->update_map();
	}
	else
		cl_log_event("error", "Invalid event: %1", e.to_string());
}
开发者ID:PaulFSherwood,项目名称:cplusplus,代码行数:16,代码来源:game_events.cpp

示例13: handle_event

// TODO: This method should not be public, but it needs to currently to make it possible 
// for AI player to directly send an event to server
void Server::handle_event(ServerPlayer *player, const CL_NetGameEvent &e)
{
	bool handled_event = false;
	if (player->id == 0)
	{
		handled_event = login_events->get_dispatcher().dispatch(e, player);
	}
	else
	{
		if (player->lobby_player)
			handled_event = lobby_events->get_dispatcher().dispatch(e, player->lobby_player);

		if (player->game_player)
			if(player->game_player->current_game)
				handled_event |= game_events->get_dispatcher().dispatch(e, player->game_player->current_game, player->game_player);
	}

	if (!handled_event)
		cl_log_event("system", "Unhandled event: %1", e.to_string());
}
开发者ID:animehunter,项目名称:clanlib-2.3,代码行数:22,代码来源:server.cpp

示例14: onEventArrived

void ServerImpl::onEventArrived(CL_NetGameConnection *p_conn, const CL_NetGameEvent &p_event)
{
    cl_log_event(LOG_EVENT, "event %1 arrived", p_event.to_string());
    m_parent->handleEvent(p_conn, p_event);
}
开发者ID:genail,项目名称:gear,代码行数:5,代码来源:Server.cpp


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