Class SyncList<T>
Inheritance
System.Object
FishNet.Object.Synchronizing.Internal.SyncBase
SyncList<T>
Implements
System.Collections.Generic.IList<T>
System.Collections.Generic.ICollection<T>
System.Collections.Generic.IReadOnlyList<T>
System.Collections.Generic.IReadOnlyCollection<T>
System.Collections.Generic.IEnumerable<T>
System.Collections.IEnumerable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Assembly: FishNet.Runtime.dll
Syntax
[Serializable]
public class SyncList<T> : SyncBase, IList<T>, ICollection<T>, IReadOnlyList<T>, IReadOnlyCollection<T>, IEnumerable<T>, IEnumerable
Type Parameters
Constructors
SyncList(SyncTypeSettings)
Declaration
public SyncList(SyncTypeSettings settings = default(SyncTypeSettings))
Parameters
SyncList(IEqualityComparer<T>, SyncTypeSettings)
Declaration
public SyncList(IEqualityComparer<T> comparer, SyncTypeSettings settings = default(SyncTypeSettings))
Parameters
Type |
Name |
Description |
System.Collections.Generic.IEqualityComparer<T> |
comparer |
|
SyncTypeSettings |
settings |
|
SyncList(List<T>, IEqualityComparer<T>, SyncTypeSettings)
Declaration
public SyncList(List<T> collection, IEqualityComparer<T> comparer = null, SyncTypeSettings settings = default(SyncTypeSettings))
Parameters
Type |
Name |
Description |
System.Collections.Generic.List<T> |
collection |
|
System.Collections.Generic.IEqualityComparer<T> |
comparer |
|
SyncTypeSettings |
settings |
|
Fields
Collection
Declaration
public List<T> Collection
Field Value
Type |
Description |
System.Collections.Generic.List<T> |
|
Properties
Count
Number of objects in the collection.
Declaration
public int Count { get; }
Property Value
Type |
Description |
System.Int32 |
|
Item[Int32]
Gets or sets value at an index.
Declaration
public T this[int i] { get; set; }
Parameters
Type |
Name |
Description |
System.Int32 |
i |
|
Property Value
Methods
Add(T)
Declaration
Parameters
Type |
Name |
Description |
T |
item |
|
AddRange(IEnumerable<T>)
Declaration
public void AddRange(IEnumerable<T> range)
Parameters
Type |
Name |
Description |
System.Collections.Generic.IEnumerable<T> |
range |
|
Clear()
Declaration
Contains(T)
Declaration
public bool Contains(T item)
Parameters
Type |
Name |
Description |
T |
item |
|
Returns
Type |
Description |
System.Boolean |
|
CopyTo(T[], Int32)
Copies values to an array.
Declaration
public void CopyTo(T[] array, int index)
Parameters
Type |
Name |
Description |
T[] |
array |
|
System.Int32 |
index |
|
Dirty(T)
Looks up obj in Collection and if found marks it's index as dirty.
While using this operation previous value will be the same as next.
This operation can be very expensive, and may fail if your value cannot be compared.
Declaration
Parameters
Type |
Name |
Description |
T |
obj |
Object to lookup.
|
Dirty(Int32)
Marks an index as dirty.
While using this operation previous value will be the same as next.
Declaration
public void Dirty(int index)
Parameters
Type |
Name |
Description |
System.Int32 |
index |
|
DirtyAll()
Dirties the entire collection forcing a full send.
This will not invoke the callback on server.
Declaration
Finalize()
Declaration
protected void Finalize()
Find(Predicate<T>)
Declaration
public T Find(Predicate<T> match)
Parameters
Type |
Name |
Description |
System.Predicate<T> |
match |
|
Returns
FindAll(Predicate<T>)
Finds all values using match.
Declaration
public List<T> FindAll(Predicate<T> match)
Parameters
Type |
Name |
Description |
System.Predicate<T> |
match |
|
Returns
Type |
Description |
System.Collections.Generic.List<T> |
|
FindIndex(Predicate<T>)
Declaration
public int FindIndex(Predicate<T> match)
Parameters
Type |
Name |
Description |
System.Predicate<T> |
match |
|
Returns
Type |
Description |
System.Int32 |
|
GetCollection(Boolean)
Gets the collection being used within this SyncList.
Declaration
public List<T> GetCollection(bool asServer)
Parameters
Type |
Name |
Description |
System.Boolean |
asServer |
True if returning the server value, false if client value. The values will only differ when running as host. While asServer is true the most current values on server will be returned, and while false the latest values received by client will be returned.
|
Returns
Type |
Description |
System.Collections.Generic.List<T> |
|
GetEnumerator()
Returns Enumerator for collection.
Declaration
public IEnumerator GetEnumerator()
Returns
Type |
Description |
System.Collections.IEnumerator |
|
IndexOf(T)
Declaration
public int IndexOf(T item)
Parameters
Type |
Name |
Description |
T |
item |
|
Returns
Type |
Description |
System.Int32 |
|
Initialized()
Called when the SyncType has been registered, but not yet initialized over the network.
Declaration
protected override void Initialized()
Overrides
FishNet.Object.Synchronizing.Internal.SyncBase.Initialized()
Insert(Int32, T)
Declaration
public void Insert(int index, T item)
Parameters
Type |
Name |
Description |
System.Int32 |
index |
|
T |
item |
|
InsertRange(Int32, IEnumerable<T>)
Inserts a range of values.
Declaration
public void InsertRange(int index, IEnumerable<T> range)
Parameters
Type |
Name |
Description |
System.Int32 |
index |
|
System.Collections.Generic.IEnumerable<T> |
range |
|
OnStartCallback(Boolean)
Called after OnStartXXXX has occurred.
Declaration
protected override void OnStartCallback(bool asServer)
Parameters
Type |
Name |
Description |
System.Boolean |
asServer |
True if OnStartServer was called, false if OnStartClient.
|
Overrides
FishNet.Object.Synchronizing.Internal.SyncBase.OnStartCallback(System.Boolean)
Remove(T)
Declaration
public bool Remove(T item)
Parameters
Type |
Name |
Description |
T |
item |
|
Returns
Type |
Description |
System.Boolean |
|
RemoveAll(Predicate<T>)
Removes all values within the collection.
Declaration
public int RemoveAll(Predicate<T> match)
Parameters
Type |
Name |
Description |
System.Predicate<T> |
match |
|
Returns
Type |
Description |
System.Int32 |
|
RemoveAt(Int32)
Declaration
public void RemoveAt(int index)
Parameters
Type |
Name |
Description |
System.Int32 |
index |
|
ResetState(Boolean)
Resets to initialized values.
Declaration
protected override void ResetState(bool asServer)
Parameters
Type |
Name |
Description |
System.Boolean |
asServer |
|
Overrides
FishNet.Object.Synchronizing.Internal.SyncBase.ResetState(System.Boolean)
Set(Int32, T, Boolean)
Declaration
public void Set(int index, T value, bool force = true)
Parameters
Type |
Name |
Description |
System.Int32 |
index |
|
T |
value |
|
System.Boolean |
force |
|
WriteDelta(PooledWriter, Boolean)
Writes all changed values.
Declaration
protected override void WriteDelta(PooledWriter writer, bool resetSyncTick = true)
Parameters
Type |
Name |
Description |
PooledWriter |
writer |
|
System.Boolean |
resetSyncTick |
True to set the next time data may sync.
|
Overrides
FishNet.Object.Synchronizing.Internal.SyncBase.WriteDelta(FishNet.Serializing.PooledWriter, System.Boolean)
WriteFull(PooledWriter)
Writes all values if not initial values.
Declaration
protected override void WriteFull(PooledWriter writer)
Parameters
Overrides
FishNet.Object.Synchronizing.Internal.SyncBase.WriteFull(FishNet.Serializing.PooledWriter)
Events
OnChange
Called when the SyncList changes.
Declaration
public event SyncList<T>.SyncListChanged OnChange
Event Type
Type |
Description |
FishNet.Object.Synchronizing.SyncList.SyncListChanged<> |
|
Implements
System.Collections.Generic.IList<T>
System.Collections.Generic.ICollection<T>
System.Collections.Generic.IReadOnlyList<T>
System.Collections.Generic.IReadOnlyCollection<T>
System.Collections.Generic.IEnumerable<T>
System.Collections.IEnumerable
Extension Methods