Skip to main content

MLAPI.NetworkVariable.Collections.NetworkList-1

Event based NetworkVariable container for syncing Lists

Inheritance#

System.Dynamic.ExpandoObject

System.Dynamic.ExpandoObject

Implements#

System.Collections.Generic.IList<T>

System.Collections.Generic.ICollection<T>

System.Collections.Generic.IEnumerable<T>

System.Collections.IEnumerable

INetworkVariable

Inherited Members#

Object.Equals(Object)

Object.Equals(Object, Object)

Object.GetHashCode()

Object.GetType()

Object.MemberwiseClone()

Object.ReferenceEquals(Object, Object)

Object.ToString()

Namespace: System.Dynamic.ExpandoObject#
Assembly: MLAPI.dll#
Syntax#
public class NetworkList<T> : IList<T>, ICollection<T>, IEnumerable<T>, IEnumerable, INetworkVariable
Type Parameters#
NameDescription
TThe type for the list

Constructors#

NetworkList()#

Creates a NetworkList with the default value and settings

Declaration#

public NetworkList()

NetworkList(NetworkVariableSettings)#

Creates a NetworkList with the default value and custom settings

Declaration#

public NetworkList(NetworkVariableSettings settings)

Parameters#

TypeNameDescription
NetworkVariableSettingssettingsThe settings to use for the NetworkList

NetworkList(NetworkVariableSettings, IList<T>)#

Creates a NetworkList with a custom value and custom settings

Declaration#

public NetworkList(NetworkVariableSettings settings, IList<T> value)

Parameters#

TypeNameDescription
NetworkVariableSettingssettingsThe settings to use for the NetworkList
System.Collections.Generic.IList<T>valueThe initial value to use for the NetworkList

NetworkList(IList<T>)#

Creates a NetworkList with a custom value and the default settings

Declaration#

public NetworkList(IList<T> value)

Parameters#

TypeNameDescription
System.Collections.Generic.IList<T>valueThe initial value to use for the NetworkList

Fields#

Settings#

The settings for this container

Declaration#

public readonly NetworkVariableSettings Settings

Field Value#

TypeDescription
NetworkVariableSettings

Properties#

Count#

Declaration#

public int Count { get; }

Property Value#

TypeDescription
System.Int32

IsReadOnly#

Declaration#

public bool IsReadOnly { get; }

Property Value#

TypeDescription
System.Boolean

Item[Int32]#

Declaration#

public T this[int index] { get; set; }

Parameters#

TypeNameDescription
System.Int32index

Property Value#

TypeDescription
T

LastSyncedTime#

Gets the last time the variable was synced

Declaration#

public float LastSyncedTime { get; }

Property Value#

TypeDescription
System.Single

RemoteTick#

Declaration#

public ushort RemoteTick { get; }

Property Value#

TypeDescription
System.UInt16

Methods#

Add(T)#

Declaration#

public void Add(T item)

Parameters#

TypeNameDescription
Titem

CanClientRead(UInt64)#

Gets Whether or not a specific client can read to the varaible

Declaration#

public bool CanClientRead(ulong clientId)

Parameters#

TypeNameDescription
System.UInt64clientIdThe clientId of the remote client

Returns#

TypeDescription
System.BooleanWhether or not the client can read to the variable

CanClientWrite(UInt64)#

Gets Whether or not a specific client can write to the varaible

Declaration#

public bool CanClientWrite(ulong clientId)

Parameters#

TypeNameDescription
System.UInt64clientIdThe clientId of the remote client

Returns#

TypeDescription
System.BooleanWhether or not the client can write to the variable

Clear()#

Declaration#

public void Clear()

Contains(T)#

Declaration#

public bool Contains(T item)

Parameters#

TypeNameDescription
Titem

Returns#

TypeDescription
System.Boolean

CopyTo(T[], Int32)#

Declaration#

public void CopyTo(T[] array, int arrayIndex)

Parameters#

TypeNameDescription
T[]array
System.Int32arrayIndex

GetChannel()#

Returns the name of the channel to be used for syncing

Declaration#

public NetworkChannel GetChannel()

Returns#

TypeDescription
NetworkChannelThe name of the channel to be used for syncing

GetEnumerator()#

Declaration#

public IEnumerator<T> GetEnumerator()

Returns#

TypeDescription
System.Collections.Generic.IEnumerator<T>

IndexOf(T)#

Declaration#

public int IndexOf(T item)

Parameters#

TypeNameDescription
Titem

Returns#

TypeDescription
System.Int32

Insert(Int32, T)#

Declaration#

public void Insert(int index, T item)

Parameters#

TypeNameDescription
System.Int32index
Titem

IsDirty()#

Gets Whether or not the container is dirty

Declaration#

public bool IsDirty()

Returns#

TypeDescription
System.BooleanWhether or not the container is dirty

ReadDelta(Stream, Boolean, UInt16, UInt16)#

Reads delta from the reader and applies them to the internal value

Declaration#

public void ReadDelta(Stream stream, bool keepDirtyDelta, ushort localTick, ushort remoteTick)

Parameters#

TypeNameDescription
System.IO.StreamstreamThe stream to read the delta from
System.BooleankeepDirtyDeltaWhether or not the delta should be kept as dirty or consumed
System.UInt16localTickThe local network tick at which this var was written, on the machine it was written
System.UInt16remoteTickThe remote network tick at which this var was sent by the host

ReadField(Stream, UInt16, UInt16)#

Reads the complete state from the reader and applies it

Declaration#

public void ReadField(Stream stream, ushort localTick, ushort remoteTick)

Parameters#

TypeNameDescription
System.IO.StreamstreamThe stream to read the state from
System.UInt16localTickThe local network tick at which this var was written, on the machine it was written
System.UInt16remoteTickThe remote network tick at which this var was sent by the host

Remove(T)#

Declaration#

public bool Remove(T item)

Parameters#

TypeNameDescription
Titem

Returns#

TypeDescription
System.Boolean

RemoveAt(Int32)#

Declaration#

public void RemoveAt(int index)

Parameters#

TypeNameDescription
System.Int32index

ResetDirty()#

Resets the dirty state and marks the variable as synced / clean

Declaration#

public void ResetDirty()

SetNetworkBehaviour(NetworkBehaviour)#

Sets NetworkBehaviour the container belongs to.

Declaration#

public void SetNetworkBehaviour(NetworkBehaviour behaviour)

Parameters#

TypeNameDescription
NetworkBehaviourbehaviourThe behaviour the container behaves to

WriteDelta(Stream)#

Writes the dirty changes, that is, the changes since the variable was last dirty, to the writer

Declaration#

public void WriteDelta(Stream stream)

Parameters#

TypeNameDescription
System.IO.StreamstreamThe stream to write the dirty changes to

WriteField(Stream)#

Writes the complete state of the variable to the writer

Declaration#

public void WriteField(Stream stream)

Parameters#

TypeNameDescription
System.IO.StreamstreamThe stream to write the state to

Events#

OnListChanged#

The callback to be invoked when the list gets changed

Declaration#

public event NetworkList<T>.OnListChangedDelegate OnListChanged

Event Type#

TypeDescription
NetworkList.OnListChangedDelegate<>

Explicit Interface Implementations#

IEnumerable.GetEnumerator()#

Declaration#

IEnumerator IEnumerable.GetEnumerator()

Returns#

TypeDescription
System.Collections.IEnumerator

Implements#

System.Collections.Generic.IList<T>

System.Collections.Generic.ICollection<T>

System.Collections.Generic.IEnumerable<T>

System.Collections.IEnumerable

INetworkVariable