Addressing PR feedback

This commit is contained in:
karlberg
2021-04-27 16:03:39 -07:00
parent 138b10c902
commit 2fc710d73b
32 changed files with 307 additions and 197 deletions
@@ -16,7 +16,7 @@
#include <AzNetworking/Serialization/ISerializer.h>
#include <AzNetworking/DataStructures/FixedSizeBitsetView.h>
#include <Source/NetworkEntity/NetworkEntityHandle.h>
#include <Source/MultiplayerTypes.h>
#include <Include/MultiplayerTypes.h>
#include <Include/IMultiplayer.h>
//! Macro to declare bindings for a multiplayer component inheriting from MultiplayerComponent
@@ -110,8 +110,8 @@ namespace Multiplayer
int32_t bitIndex,
TYPE& value,
const char* name,
uint16_t componentId,
uint16_t propertyId,
NetComponentId componentId,
PropertyIndex propertyIndex,
MultiplayerStats& stats
)
{
@@ -132,11 +132,11 @@ namespace Multiplayer
{
if (modifyRecord)
{
stats.RecordPropertyReceived(componentId, propertyId, updateSize);
stats.RecordPropertyReceived(componentId, propertyIndex, updateSize);
}
else
{
stats.RecordPropertySent(componentId, propertyId, updateSize);
stats.RecordPropertySent(componentId, propertyIndex, updateSize);
}
}
}
@@ -33,13 +33,13 @@ namespace Multiplayer
return componentData.m_componentName.GetCStr();
}
const char* MultiplayerComponentRegistry::GetComponentPropertyName(NetComponentId netComponentId, uint16_t propertyIndex) const
const char* MultiplayerComponentRegistry::GetComponentPropertyName(NetComponentId netComponentId, PropertyIndex propertyIndex) const
{
const ComponentData& componentData = GetMultiplayerComponentData(netComponentId);
return componentData.m_componentPropertyNameLookupFunction(propertyIndex);
}
const char* MultiplayerComponentRegistry::GetComponentRpcName(NetComponentId netComponentId, uint16_t rpcIndex) const
const char* MultiplayerComponentRegistry::GetComponentRpcName(NetComponentId netComponentId, RpcIndex rpcIndex) const
{
const ComponentData& componentData = GetMultiplayerComponentData(netComponentId);
return componentData.m_componentRpcNameLookupFunction(rpcIndex);
@@ -21,13 +21,14 @@ namespace Multiplayer
class MultiplayerComponentRegistry
{
public:
using NameLookupFunction = AZStd::function<const char*(uint16_t index)>;
using PropertyNameLookupFunction = AZStd::function<const char*(PropertyIndex index)>;
using RpcNameLookupFunction = AZStd::function<const char* (RpcIndex index)>;
struct ComponentData
{
AZ::Name m_gemName;
AZ::Name m_componentName;
NameLookupFunction m_componentPropertyNameLookupFunction;
NameLookupFunction m_componentRpcNameLookupFunction;
PropertyNameLookupFunction m_componentPropertyNameLookupFunction;
RpcNameLookupFunction m_componentRpcNameLookupFunction;
};
//! Registers a multiplayer component with the multiplayer system.
@@ -49,13 +50,13 @@ namespace Multiplayer
//! @param netComponentId the NetComponentId to return the property name of
//! @param propertyIndex the index off the network property to return the property name of
//! @return the name of the network property
const char* GetComponentPropertyName(NetComponentId netComponentId, uint16_t propertyIndex) const;
const char* GetComponentPropertyName(NetComponentId netComponentId, PropertyIndex propertyIndex) const;
//! Returns the Rpc name associated with the provided NetComponentId and rpcId.
//! @param netComponentId the NetComponentId to return the property name of
//! @param rpcIndex the index of the rpc to return the rpc name of
//! @return the name of the requested rpc
const char* GetComponentRpcName(NetComponentId netComponentId, uint16_t rpcIndex) const;
const char* GetComponentRpcName(NetComponentId netComponentId, RpcIndex rpcIndex) const;
//! Retrieves the stored component data for a given NetComponentId.
//! @param netComponentId the NetComponentId to return component data for
@@ -23,7 +23,7 @@
#include <Source/NetworkEntity/EntityReplication/ReplicationRecord.h>
#include <Source/NetworkEntity/NetworkEntityHandle.h>
#include <Source/NetworkInput/IMultiplayerComponentInput.h>
#include <Source/MultiplayerTypes.h>
#include <Include/MultiplayerTypes.h>
#include <AzCore/EBus/Event.h>
namespace Multiplayer