Photon Fusion
2.1.1
This static class provides utility methods for working with NetworkBehaviour objects. More...
Classes | |
| struct | ArrayInitializer< T > |
| A utility structure for initializing NetworkArray and NetworkLinkedList with inline initialization. More... | |
| struct | DictionaryInitializer< K, V > |
| A utility structure for initializing NetworkDictionary with inline initialization. More... | |
Static Public Member Functions | |
| static T[] | CloneArray< T > (T[] array) |
| Creates a new array that is a clone of the specified array. | |
| static void | CopyFromNetworkArray< T > (NetworkArray< T > networkArray, ref T[] dstArray) |
| Copies the values from a NetworkArray to a destination array. | |
| static void | CopyFromNetworkDictionary< D, K, V > (NetworkDictionary< K, V > networkDictionary, ref D dictionary) |
| Copies the values from a NetworkDictionary to a destination dictionary. | |
| static void | CopyFromNetworkList< T > (NetworkLinkedList< T > networkList, ref T[] dstArray) |
| Copies the values from a NetworkLinkedList to a destination array. | |
| static int[] | GetCustomSharedModeReadOnlyOffsets (Type type, int baseOffset=0) |
| Retrieves words offsets of properties with NetworkedAttribute.PluginAuthority set. | |
| static int | GetStaticWordCount (Type type) |
| Retrieves the static word count for a given type. If the word count for the type has not been computed yet, it is computed and stored. | |
| static int | GetWordCount (NetworkBehaviour behaviour) |
| Retrieves the word count for a given NetworkBehaviour. If the NetworkBehaviour has a dynamic word count, it is returned. Otherwise, the static word count for the type of the NetworkBehaviour is returned. | |
| static bool | HasStaticWordCount (Type type) |
| Checks if a given type has a static word count. A type has a static word count if it is a subclass of NetworkBehaviour and its word count is non-negative. | |
| static void | InitializeNetworkArray< T > (NetworkArray< T > networkArray, T[] sourceArray, string name) |
| Initializes a NetworkArray with the values from a source array. | |
| static void | InitializeNetworkDictionary< D, K, V > (NetworkDictionary< K, V > networkDictionary, D dictionary, string name) |
| Initializes a NetworkDictionary with the values from a source dictionary. | |
| static void | InitializeNetworkList< T > (NetworkLinkedList< T > networkList, T[] sourceArray, string name) |
| Initializes a NetworkLinkedList with the values from a source array. | |
| static void | InternalOnDestroy (SimulationBehaviour obj) |
| This method is not meant to be called directly. Calls are injected by the Weaver. | |
| static void | InternalOnDisable (SimulationBehaviour obj) |
| This method is not meant to be called directly. Calls are injected by the Weaver. | |
| static void | InternalOnEnable (SimulationBehaviour obj) |
| This method is not meant to be called directly. Calls are injected by the Weaver. | |
| static SerializableDictionary< K, V > | MakeSerializableDictionary< K, V > (Dictionary< K, V > dictionary) |
| Wraps a Dictionary in a SerializableDictionary. | |
| static void | NotifyNetworkUnwrapFailed (NetworkBehaviourId id) |
| Logs a warning message indicating that a network unwrap operation failed. | |
| static void | NotifyNetworkWrapFailed< T > (T value) |
| Logs a warning message indicating that a network wrap operation failed. | |
| static void | NotifyNetworkWrapFailed< T > (T value, Type wrapperType) |
| Logs a warning message indicating that a network wrap operation failed for a specific wrapper type. | |
| static void | ThrowIfBehaviourNotInitialized (NetworkBehaviour behaviour) |
| Checks if the NetworkBehaviour object is initialized and throws an exception if it is not. | |
| static void | ThrowIfRunnerNotSet (NetworkRunner runner) |
This static class provides utility methods for working with NetworkBehaviour objects.
|
static |
Creates a new array that is a clone of the specified array.
| T | The type of the elements in the array. |
| array | The array to clone. |
|
static |
Copies the values from a NetworkArray to a destination array.
| T | The type of the elements in the NetworkArray and destination array. |
| networkArray | The NetworkArray from which to copy the values. |
| dstArray | The destination array to which to copy the values. |
If the length of the destination array is not equal to the length of the NetworkArray, a new array of the correct length is created and assigned to the destination array.
| T | : | unmanaged |
|
static |
Copies the values from a NetworkDictionary to a destination dictionary.
| D | The type of the destination dictionary. Must implement IDictionary{K, V} and have a parameterless constructor. |
| K | The type of the keys in the NetworkDictionary and destination dictionary. Must be unmanaged. |
| V | The type of the values in the NetworkDictionary and destination dictionary. Must be unmanaged. |
| networkDictionary | The NetworkDictionary from which to copy the values. |
| dictionary | The destination dictionary to which to copy the values. If the destination dictionary is null, a new dictionary of type D is created. |
| D | : | IDictionary | |
| D | : | K | |
| D | : | V | |
| D | : | new() | |
| K | : | unmanaged | |
| V | : | unmanaged |
|
static |
Copies the values from a NetworkLinkedList to a destination array.
| T | The type of the elements in the NetworkLinkedList and destination array. |
| networkList | The NetworkLinkedList from which to copy the values. |
| dstArray | The destination array to which to copy the values. If the length of the destination array is not equal to the count of the NetworkLinkedList, a new array of the correct length is created and assigned to the destination array. |
| T | : | unmanaged |
|
static |
Retrieves the static word count for a given type. If the word count for the type has not been computed yet, it is computed and stored.
| type | The type for which to retrieve the static word count. |
| System.ArgumentException | Thrown when the provided type is not a subclass of NetworkBehaviour. |
| System.InvalidOperationException | Thrown when the provided type does not have a weaved attribute or its word count is negative. |
|
static |
Retrieves the word count for a given NetworkBehaviour. If the NetworkBehaviour has a dynamic word count, it is returned. Otherwise, the static word count for the type of the NetworkBehaviour is returned.
| behaviour | The NetworkBehaviour for which to retrieve the word count. |
| System.InvalidOperationException | Thrown when the dynamic word count or the static word count is negative. |
|
static |
Checks if a given type has a static word count. A type has a static word count if it is a subclass of NetworkBehaviour and its word count is non-negative.
| type | The type to check. |
| System.ArgumentException | Thrown when the provided type is not a subclass of NetworkBehaviour. |
| System.InvalidOperationException | Thrown when the provided type does not have a weaved attribute. |
|
static |
Initializes a NetworkArray with the values from a source array.
| T | The type of the elements in the NetworkArray and source array. |
| networkArray | The NetworkArray to initialize. |
| sourceArray | The source array from which to copy the values. |
| name | The name of the NetworkArray for logging purposes. |
If the length of the source array is greater than the length of the NetworkArray, a warning is logged and only the first elements up to the length of the NetworkArray are copied.
| T | : | unmanaged |
|
static |
Initializes a NetworkDictionary with the values from a source dictionary.
| D | The type of the source dictionary. Must implement IDictionary{K, V}. |
| K | The type of the keys in the NetworkDictionary and source dictionary. Must be unmanaged. |
| V | The type of the values in the NetworkDictionary and source dictionary. Must be unmanaged. |
| networkDictionary | The NetworkDictionary to initialize. |
| dictionary | The source dictionary from which to copy the values. |
| name | The name of the NetworkDictionary for logging purposes. |
If the count of the source dictionary is greater than the capacity of the NetworkDictionary, a warning is logged and only the first elements up to the capacity of the NetworkDictionary are copied.
| D | : | IDictionary | |
| D | : | K | |
| D | : | V | |
| K | : | unmanaged | |
| V | : | unmanaged |
|
static |
Initializes a NetworkLinkedList with the values from a source array.
| T | The type of the elements in the NetworkLinkedList and source array. Must be unmanaged. |
| networkList | The NetworkLinkedList to initialize. |
| sourceArray | The source array from which to copy the values. |
| name | The name of the NetworkLinkedList for logging purposes. |
If the length of the source array is greater than the capacity of the NetworkLinkedList, a warning is logged and only the first elements up to the capacity of the NetworkLinkedList are copied.
| T | : | unmanaged |
|
static |
This method is not meant to be called directly. Calls are injected by the Weaver.
| obj | SimulationBehaviour object. |
|
static |
This method is not meant to be called directly. Calls are injected by the Weaver.
| obj | SimulationBehaviour object. |
|
static |
This method is not meant to be called directly. Calls are injected by the Weaver.
| obj | SimulationBehaviour object. |
|
static |
Wraps a Dictionary in a SerializableDictionary.
| K | The type of the keys in the dictionary. Must be unmanaged. |
| V | The type of the values in the dictionary. Must be unmanaged. |
| dictionary | The dictionary to wrap. |
| K | : | unmanaged | |
| V | : | unmanaged |
|
static |
Logs a warning message indicating that a network wrap operation failed.
| T | The type of the value that failed to be wrapped. |
| value | The value that failed to be wrapped. |
|
static |
Logs a warning message indicating that a network wrap operation failed for a specific wrapper type.
| T | The type of the value that failed to be wrapped. |
| value | The value that failed to be wrapped. |
| wrapperType | The type that was attempted to be used as a wrapper. |
|
static |
Checks if the NetworkBehaviour object is initialized and throws an exception if it is not.
| behaviour | The NetworkBehaviour object to check. |
| System.InvalidOperationException | Thrown when the NetworkBehaviour object is not initialized. |
|
static |
| runner |
| ArgumentNullException |