ReplicatedConfigEntry
Updated 2 years agoXan.ROR2VoidPlayerCharacterCommon.AdvancedConfigs.Networked.ReplicatedConfigEntryBase
This type is internal, and is used for Reflective purposes. It provides non-generic access to ReplicatedConfigEntry
via boxed values (stored as object
rather than as T
).
Xan.ROR2VoidPlayerCharacterCommon.AdvancedConfigs.Networked.ReplicatedConfigEntry<T>
This class represents a complex container for ConfigEntry<T>
(from BepInEx). It concurrently stores two instances of the configuration value, one of which is network-managed (downloaded from the host), and the other of which is stored on the local user's computer via the BepInEx ConfigFile
class.
Public Fields and Properties
T ReplicatedValue { get; internal set; }
This value is downloaded from the host of a multiplayer session. When the host sends a network packet instructing a configuration synchronization to occur, this value is written to. See Value
for a more suitable property.
T LocalValue { get; set; }
This value provides a proxy to the Value
property of the internally stored ConfigEntry<T>
from BepInEx. See Value
for a more suitable property.
override Type Type { get; }
The type of the value represented by T
.
override string Key { get; }
The key associated with the locally stored ConfigEntry<T>
.
override string Section { get; }
The section associated with the locally stored ConfigEntry<T>
.
T Value { get; }
If the client is in the main menu, in a singleplayer run, or is the host of a multiplayer run, this returns LocalValue
. If the client has joined someone else's multiplayer run (they are not the host), this returns ReplicatedValue
Note: This state is determined with the following expression: Run.instance == null || NetworkServer.active
public ConfigEntry<T> LocalBackingConfig { get; }
A reference to the locally instantiated ConfigEntry<T>
that backs the local value of this replicated config.
Public Constructors
ReplicatedConfigEntry(ConfigEntry<T> backingConfig)
Wraps the provided ConfigEntry<T>
into a ReplicatedConfigEntry<T>
.
Public Events
SettingChanged
Uses ChangeOccurredDelegate
. This fires when either the local or remote value is changed.
KNOWN BUG: This does not fire if the backing ConfigEntry<T>
is changed. This bug is fixed in a pre-release build 2.0.1.
delegate
: ChangeOccurredDelegate(T newValue, bool fromHost)
This delegate is used in the SettingChanged
event. The first parameter is the new value. The second parameter is true if the local user is currently in the main menu or a singleplayer run, or is the host of the current multiplayer session.
Note: fromHost
is determined with the following expression: Run.instance == null || NetworkServer.active