mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
feat: SyncList now supports any IList implementation (#704)
This commit is contained in:
parent
523c2eff49
commit
040bcb45ad
@ -54,7 +54,7 @@ public abstract class SyncList<T> : IList<T>, SyncObject
|
||||
{
|
||||
public delegate void SyncListChanged(Operation op, int itemIndex, T item);
|
||||
|
||||
readonly List<T> objects = new List<T>();
|
||||
readonly IList<T> objects;
|
||||
|
||||
public int Count => objects.Count;
|
||||
public bool IsReadOnly { get; private set; }
|
||||
@ -88,6 +88,17 @@ struct Change
|
||||
protected virtual void SerializeItem(NetworkWriter writer, T item) {}
|
||||
protected virtual T DeserializeItem(NetworkReader reader) => default;
|
||||
|
||||
|
||||
protected SyncList()
|
||||
{
|
||||
objects = new List<T>();
|
||||
}
|
||||
|
||||
protected SyncList(IList<T> objects)
|
||||
{
|
||||
this.objects = objects;
|
||||
}
|
||||
|
||||
public bool IsDirty => changes.Count > 0;
|
||||
|
||||
// throw away all the changes
|
||||
|
Loading…
Reference in New Issue
Block a user