Class CustomSpaceComponent

Inheritance Relationships

Base Type

Class Documentation

class CustomSpaceComponent : public csp::multiplayer::ComponentBase

Can be used to prototype new component types or to support the replication of custom data.

Note

This class is used to replicate properties of primitive types of properties across multiple platforms. The supported primitive types are the ones supported by the “ReplicatedValue” class.

Public Functions

CustomSpaceComponent(SpaceEntity *Parent)

Constructs the custom space component, and associates it with the specified Parent space entity.

Parameters

Parent – The Space entity that owns this component.

const csp::common::String &GetApplicationOrigin() const

Gets a string that identifies the application origin.

Returns

The application origin for which this component has been generated.

void SetApplicationOrigin(const csp::common::String &Value)

Sets a string that identifies the application origin.

Parameters

Value – The application origin for which this component has been generated.

bool HasCustomProperty(const csp::common::String &Key) const

Checks if the property with the specified Key exists in the list of replicated properties.

Parameters

Key – Uniquely identifies the property for which the check is performed.

Returns

True if the property with the specified Key exists in the list of replicated properties, false otherwise.

const ReplicatedValue &GetCustomProperty(const csp::common::String &Key) const

Retrieves the replicated value of the property identified by the specified Key.

Parameters

Key – The ID of the property of which the value will be retrieved.

Returns

The value of the property identified by the provided Key.

void SetCustomProperty(const csp::common::String &Key, const ReplicatedValue &Value)

Sets a custom property by specifying a unique Key and its relative property Value.

Parameters
  • Key – Uniquely identifies this new property.

  • Value – The value to store for this new property.

void RemoveCustomProperty(const csp::common::String &Key)

Removes the specified property by Key.

Parameters

Key – The ID of the property that will be removed.

csp::common::List<csp::common::String> GetCustomPropertyKeys() const

Retrieves the list of all the keys of the properties available in the list of replicated values.

Returns

The list of available property keys.

int32_t GetNumProperties() const

Returns the amount of properties currently stored in the list of replicated values.

Returns

How many properties are currently stored in the list of replicated values of this component.

uint32_t GetCustomPropertySubscriptionKey(const csp::common::String &Key) const

Returns the hash of the provided Key.

Parameters

Key – The key for which an hash will be produced.

Returns

The resulting hash for the provided Key.