ConfigurationReplicator
Updated 2 years agoXan.ROR2VoidPlayerCharacterCommon.AdvancedConfigs.Networked.ConfigurationReplicator
This class is responsible for dispatching networked updates to configuration values. Most of its members are internal, and it does not need to be explicitly used by the API user in most cases as it is automatic.
Public Methods
static ConfigurationReplicator CreateReplicator(string modId, Type configurationType)
Constructs a new instance of ConfigurationReplicator
for the provided mod ID, using the provided type as the class storing instances of ReplicatedConfigEntry
.
This raises an exception in the following cases:
ArgumentNullException
- IfmodId
orconfigurationType
is null.ArgumentException
- IfmodId
is null, empty, or whitespace, or ifconfigurationType
is not aclass
, or ifconfigurationType
is not (effectively) sealed (sealed class
orstatic class
), or ifconfigurationType
is generic.InvalidOperationException
- If, during collection of the replicated fields, a member decorated with[ReplicatedConfiguration]
is not an instance ofReplicatedConfigEntryBase
orIReplicatedConfigContainer
.
bool TrySendChanges(SettingChangedEventArgs e)
Attempts to send the changes made to the provided configuration entry (denoted by e
) across the network. This does nothing if the network server is not active (meaning this player is in multiplayer and is not the host). It will attempt to send only the config value in e
, but may send all configs if the registry of what options need to replicate is malformed, in which case a warning will be raised and the implementer should ensure everything in their code is correct.