Photon Fusion 2.1.1

NetworkLinkedList< T > Struct Template Reference

Fusion type for networking LinkedLists. Maximum capacity is fixed, and is set with the CapacityAttribute.

Typical Usage: More...

Inherits .

Classes

struct  Enumerator
 Enumerator for NetworkLinkedList<T>. More...

Public Member Functions

void INetworkLinkedList. Add (object item)
 Adds an item to the networked linked list.
void Add (T value)
 Adds a value to the end of the list.
void Clear ()
 Removes and clears all list elements.
bool Contains (T value)
 Returns true if the value already exists in the list.
bool Contains (T value, IEqualityComparer< T > comparer)
 Returns true if the value already exists in the list.
void Dispose ()
 Releases all resources used by the NetworkLinkedList<T>.Enumerator.
Get (int index)
 Returns the value at supplied index.
Enumerator GetEnumerator ()
 Get the enumerator for the list.
int IndexOf (T value)
 Returns the index with this value. Returns -1 if not found.
int IndexOf (T value, IEqualityComparer< T > equalityComparer)
 Returns the index of the first occurrence of a value in the NetworkLinkedList.
bool MoveNext ()
 Advances the enumerator to the next element of the NetworkLinkedList<T>.
 NetworkLinkedList (byte *data, int capacity, IElementReaderWriter< T > rw)
 NetworkLinkedList constructor.
NetworkLinkedList< T > Remap (void *list)
 Remaps the current NetworkLinkedList to a new memory location.
bool Remove (T value)
 Removes the first found element with indicated value.
bool Remove (T value, IEqualityComparer< T > equalityComparer)
 Removes the first found element with indicated value.
void Reset ()
 Resets the enumerator to its initial position.
Set (int index, T value)
 Sets the value at supplied index.
T[] ToArray ()
 Copies all elements to a new array.

Static Public Attributes

const int ELEMENT_WORDS = 2
 Returns the number of words required to store a single element.
const int META_WORDS = 3
 Returns the number of words required to store the list metadata.

Properties

readonly int Capacity [get]
 Returns the max element count.
int Count [get]
 Returns the current element count.
readonly T Current [get]
 Gets the current element in the collection.
this[int index] [get, set]
 Element indexer.

Detailed Description

Fusion type for networking LinkedLists. Maximum capacity is fixed, and is set with the CapacityAttribute.

Typical Usage:

[Networked, Capacity(10)]<br></br>
NetworkLinkedList&lt;int&gt; syncedLinkedList => default;
readonly int Capacity
Returns the max element count.
Definition NetworkLinkedList.cs:148
NetworkLinkedList(byte *data, int capacity, IElementReaderWriter< T > rw)
NetworkLinkedList constructor.
Definition NetworkLinkedList.cs:426

Optional usage (for NetworkBehaviours ONLY - this is not legal in INetworkStructs):

[Networked, Capacity(4)]<br></br>
NetworkLinkedList&lt;int&gt; syncedLinkedList { get; } = MakeInitializer(new int[] { 1, 2, 3, 4 });<br></br>

Usage for modifying data:

var list = syncedLinkedList;
list.Add(123);
list[0] = 456;
list.Remove(0);
Template Parameters
TT can be a primitive, or an INetworkStruct.