Class NetworkPropertySync<K, V>
Provides an abstraction to track changes on a property contained on a NetworkPropertiesTable. A NetworkPropertiesTable component is needed in the same entity or any of its parents. This class simplifies the access to the property value with the methods ReadValue(NetworkPropertiesTable) and WriteValue(NetworkPropertiesTable, V).
Inheritance
Implements
Inherited Members
Namespace: Evergine.Networking.Components
Assembly: Evergine.Networking.dll
Syntax
public abstract class NetworkPropertySync<K, V> : Component, IDependencyObject where K : struct, IConvertible
Type Parameters
Name | Description |
---|---|
K | |
V | The type of the property value. |
Constructors
NetworkPropertySync()
Initializes a new instance of the NetworkPropertySync<K, V> class.
Declaration
public NetworkPropertySync()
Fields
propertiesTableProvider
The NetworkCustomPropertiesProvider provider.
Declaration
protected NetworkCustomPropertiesProvider propertiesTableProvider
Field Value
Type | Description |
---|---|
NetworkCustomPropertiesProvider |
Properties
HasValue
Gets a value indicating whether the custom property table has a value defined for this PropertyKey.
Declaration
public bool HasValue { get; }
Property Value
Type | Description |
---|---|
bool |
IsLocalPlayerProvider
Gets a value indicating whether the custom property comes from the local player NetworkPropertiesTable.
Declaration
public bool IsLocalPlayerProvider { get; }
Property Value
Type | Description |
---|---|
bool |
IsReady
Gets a value indicating whether this instance is ready to synchronize the property value.
Declaration
public bool IsReady { get; }
Property Value
Type | Description |
---|---|
bool |
PropertyKey
Gets or sets the key of the custom property.
Declaration
[RenderProperty(Tooltip = "The key of the custom property")]
public K PropertyKey { get; set; }
Property Value
Type | Description |
---|---|
K |
PropertyKeyByte
Gets or sets the property key stored as a byte.
Declaration
public byte PropertyKeyByte { get; set; }
Property Value
Type | Description |
---|---|
byte |
PropertyValue
Gets or sets the value of the custom property.
Declaration
public V PropertyValue { get; set; }
Property Value
Type | Description |
---|---|
V |
ProviderFilter
Gets or sets a value that restricts which NetworkCustomPropertiesProvider is valid during the resolution of dependencies.
Declaration
[RenderProperty(Tooltip = "Restricts which provider is valid during the resolution of dependencies")]
public NetworkPropertyProviderFilter ProviderFilter { get; set; }
Property Value
Type | Description |
---|---|
NetworkPropertyProviderFilter |
Methods
OnActivated()
Invoked when the object is activated once is attached.
Declaration
protected override void OnActivated()
Overrides
OnAttached()
Invoked when the object is attached to the system.
Declaration
protected override bool OnAttached()
Returns
Type | Description |
---|---|
bool | True if all is OK. |
Overrides
OnDeactivated()
Invoked when the object is deactivated.
Declaration
protected override void OnDeactivated()
Overrides
OnDetach()
Invoked when the object is detached.
Declaration
protected override void OnDetach()
Overrides
OnPropertyAddedOrChanged()
Called every time a value with the target property key is added or modified.
Declaration
protected abstract void OnPropertyAddedOrChanged()
OnPropertyReadyToSet()
Called every time the target property is ready to be set.
Declaration
protected virtual void OnPropertyReadyToSet()
OnPropertyRemoved()
Called every time a value with the target property key is removed.
Declaration
protected abstract void OnPropertyRemoved()
ReadValue(NetworkPropertiesTable)
Defines a delegate to read the value from the player NetworkPropertiesTable.
Declaration
protected abstract V ReadValue(NetworkPropertiesTable propertiesTable)
Parameters
Type | Name | Description |
---|---|---|
NetworkPropertiesTable | propertiesTable | The properties table that contains the player custom properties. |
Returns
Type | Description |
---|---|
V | The property value. |
WriteValue(NetworkPropertiesTable, V)
Defines a delegate to write the value in the player NetworkPropertiesTable.
Declaration
protected abstract void WriteValue(NetworkPropertiesTable propertiesTable, V value)
Parameters
Type | Name | Description |
---|---|---|
NetworkPropertiesTable | propertiesTable | The properties table that contains the player custom properties. |
V | value | The value to write. |