void AGameSession::UnregisterPlayer(const APlayerController* ExitingPlayer)
{
	if (GetNetMode() != NM_Standalone &&
		ExitingPlayer != NULL &&
		ExitingPlayer->PlayerState &&
		ExitingPlayer->PlayerState->UniqueId.IsValid() &&
		ExitingPlayer->PlayerState->UniqueId->IsValid())
	{
		UnregisterPlayer(ExitingPlayer->PlayerState->SessionName, ExitingPlayer->PlayerState->UniqueId);
	}
}
示例#2
0
void WSServer::RegisterPlayer(ClientID client, Player& player)
{
	auto i = m_mapPlayerToClient.find(&player);
	if (i != m_mapPlayerToClient.end())
		if (UnregisterClient(i->second, true))
			UnregisterPlayer(i->second);
		
	m_mapPlayerToClient[&player] = client;
	m_mapClientToPlayer[client] = &player;
	m_players.insert(&player);

	std::cout << "INFO: Client registered: " << client << " -> " << player.GetName() << std::endl;
	m_controller.OnPlayerConnected(player);
}
void AGameSession::NotifyLogout(const APlayerController* PC)
{
	// Unregister the player from the online layer
	UnregisterPlayer(PC);
}
void AGameSession::NotifyLogout(FName InSessionName, const FUniqueNetIdRepl& UniqueId)
{
	// Unregister the player from the online layer
	UnregisterPlayer(InSessionName, UniqueId);
}
示例#5
0
void WSServer::OnWebSocketDisconnect(ClientID client)
{
	LOCK(m_mutex);
	UnregisterPlayer(client);
}