Skip to main content

MLAPI.NetworkVariable.Collections.NetworkDictionary-2

Event based NetworkVariable container for syncing Dictionaries

Inheritance#

System.Dynamic.ExpandoObject

System.Dynamic.ExpandoObject

Implements#

System.Collections.Generic.IDictionary<TKey, TValue>

System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey, TValue>>

System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey, TValue>>

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 NetworkDictionary<TKey, TValue> : IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable, INetworkVariable
Type Parameters#
NameDescription
TKeyThe type for the dictionary keys
TValueThe type for the dictionary values

Constructors#

NetworkDictionary()#

Creates a NetworkDictionary with the default value and settings

Declaration#

public NetworkDictionary()

NetworkDictionary(NetworkVariableSettings)#

Creates a NetworkDictionary with the default value and custom settings

Declaration#

public NetworkDictionary(NetworkVariableSettings settings)

Parameters#

TypeNameDescription
NetworkVariableSettingssettingsThe settings to use for the NetworkDictionary

NetworkDictionary(NetworkVariableSettings, IDictionary<TKey, TValue>)#

Creates a NetworkDictionary with a custom value and custom settings

Declaration#

public NetworkDictionary(NetworkVariableSettings settings, IDictionary<TKey, TValue> value)

Parameters#

TypeNameDescription
NetworkVariableSettingssettingsThe settings to use for the NetworkDictionary
System.Collections.Generic.IDictionary<TKey, TValue>valueThe initial value to use for the NetworkDictionary

NetworkDictionary(IDictionary<TKey, TValue>)#

Creates a NetworkDictionary with a custom value and the default settings

Declaration#

public NetworkDictionary(IDictionary<TKey, TValue> value)

Parameters#

TypeNameDescription
System.Collections.Generic.IDictionary<TKey, TValue>valueThe initial value to use for the NetworkDictionary

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[TKey]#

Declaration#

public TValue this[TKey key] { get; set; }

Parameters#

TypeNameDescription
TKeykey

Property Value#

TypeDescription
TValue

Keys#

Declaration#

public ICollection<TKey> Keys { get; }

Property Value#

TypeDescription
System.Collections.Generic.ICollection<TKey>

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

Values#

Declaration#

public ICollection<TValue> Values { get; }

Property Value#

TypeDescription
System.Collections.Generic.ICollection<TValue>

Methods#

Add(TKey, TValue)#

Declaration#

public void Add(TKey key, TValue value)

Parameters#

TypeNameDescription
TKeykey
TValuevalue

Add(KeyValuePair<TKey, TValue>)#

Declaration#

public void Add(KeyValuePair<TKey, TValue> item)

Parameters#

TypeNameDescription
System.Collections.Generic.KeyValuePair<TKey, TValue>item

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(KeyValuePair<TKey, TValue>)#

Declaration#

public bool Contains(KeyValuePair<TKey, TValue> item)

Parameters#

TypeNameDescription
System.Collections.Generic.KeyValuePair<TKey, TValue>item

Returns#

TypeDescription
System.Boolean

ContainsKey(TKey)#

Declaration#

public bool ContainsKey(TKey key)

Parameters#

TypeNameDescription
TKeykey

Returns#

TypeDescription
System.Boolean

CopyTo(KeyValuePair<TKey, TValue>[], Int32)#

Declaration#

public void CopyTo(KeyValuePair<TKey, TValue>[] array, int arrayIndex)

Parameters#

TypeNameDescription
System.Collections.Generic.KeyValuePair<TKey, TValue>[]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<KeyValuePair<TKey, TValue>> GetEnumerator()

Returns#

TypeDescription
System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<TKey, TValue>>

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(TKey)#

Declaration#

public bool Remove(TKey key)

Parameters#

TypeNameDescription
TKeykey

Returns#

TypeDescription
System.Boolean

Remove(KeyValuePair<TKey, TValue>)#

Declaration#

public bool Remove(KeyValuePair<TKey, TValue> item)

Parameters#

TypeNameDescription
System.Collections.Generic.KeyValuePair<TKey, TValue>item

Returns#

TypeDescription
System.Boolean

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

TryGetValue(TKey, out TValue)#

Declaration#

public bool TryGetValue(TKey key, out TValue value)

Parameters#

TypeNameDescription
TKeykey
TValuevalue

Returns#

TypeDescription
System.Boolean

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#

OnDictionaryChanged#

The callback to be invoked when the dictionary gets changed

Declaration#

public event NetworkDictionary<TKey, TValue>.OnDictionaryChangedDelegate OnDictionaryChanged

Event Type#

TypeDescription
NetworkDictionary.OnDictionaryChangedDelegate<>

Explicit Interface Implementations#

IEnumerable.GetEnumerator()#

Declaration#

IEnumerator IEnumerable.GetEnumerator()

Returns#

TypeDescription
System.Collections.IEnumerator

Implements#

System.Collections.Generic.IDictionary<TKey, TValue>

System.Collections.Generic.ICollection<T>

System.Collections.Generic.IEnumerable<T>

System.Collections.IEnumerable

INetworkVariable