コード例 #1
0
void UserPresenceManagerLeaderImpl::OnMessageReceived(const NetworkConnectionPtr&, NetworkInMessage& message)
{
    // Messages to the MuteManagerLeader are considered requests.
    XStringPtr nameValue = message.ReadString();
    int32 muteValue = message.ReadInt32();

    // Set the internal state and tell the baraboo about the new state.
    SetName(nameValue);
    SetMuteState(muteValue > 0 ? true : false);
}
コード例 #2
0
void XSessionImpl::OnMessageReceived(const NetworkConnectionPtr& connection, NetworkInMessage& message)
{
	XStringPtr command = message.ReadString();

	JSONMessagePtr jMsg = JSONMessage::CreateFromMessage(command->GetString());

	// Route the incoming message to the appropriate function to handle it
	if (!m_messageRouter.CallHandler(jMsg, connection))
	{
		// There was a problem with the message that was sent.  Boot the connection
		connection->Disconnect();
	}
}
コード例 #3
0
void SessionServer::OnMessageReceived(const NetworkConnectionPtr& connection, NetworkInMessage& message)
{
    XStringPtr command = message.ReadString();

	JSONMessagePtr jMsg = JSONMessage::CreateFromMessage(command->GetString());

	// Route the incoming message to the appropriate function to handle it
	if (!m_messageRouter.CallHandler(jMsg, connection))
	{
		// We got a bad or unexpected message; break the connection
		connection->Disconnect();
	}
}
コード例 #4
0
void CreateOperation::Deserialize(NetworkInMessage& msg)
{
	m_elementType	= (ElementType)msg.ReadByte();
	m_name			= msg.ReadString();
	m_elementGuid	= msg.ReadInt64();
	m_parentGuid	= msg.ReadInt64();
	m_startingValue.Deserialize(msg);

	// Read the number of ancestors
	uint32 numAncestors = msg.ReadUInt32();
	m_hierarchy.reserve(numAncestors);

	// Read the GUIDs of the ancestors
	for (uint32 i = 0; i < numAncestors; ++i)
	{
		m_hierarchy.push_back(msg.ReadInt64());
	}

	// NOTE: authority level is NOT included in the op when serialized; it changes as the op is sent around the network
}