@@ -21,12 +21,12 @@ public class NetworkList<T> : NetworkVariableBase where T : unmanaged, IEquatabl
21
21
public delegate void OnListChangedDelegate ( NetworkListEvent < T > changeEvent ) ;
22
22
23
23
/// <summary>
24
- /// The callback to be invoked when the list gets changed
24
+ /// Creates A NetworkList/>
25
25
/// </summary>
26
26
public event OnListChangedDelegate OnListChanged ;
27
27
28
28
/// <summary>
29
- /// Constructor method for <see cref="NetworkList"/>
29
+ /// Constructor method for <see cref="NetworkList{T} "/>
30
30
/// </summary>
31
31
public NetworkList ( ) { }
32
32
@@ -132,7 +132,7 @@ public override void WriteDelta(FastBufferWriter writer)
132
132
}
133
133
}
134
134
135
- /// <inheritdoc cref="NetworkVariable{T}.Writeield "/>
135
+ /// <inheritdoc cref="NetworkVariable{T}.WriteField "/>
136
136
public override void WriteField ( FastBufferWriter writer )
137
137
{
138
138
writer . WriteValueSafe ( ( ushort ) m_List . Length ) ;
@@ -158,12 +158,12 @@ public override void ReadField(FastBufferReader reader)
158
158
/// <inheritdoc cref="NetworkVariable{T}.ReadDelta"/>
159
159
public override void ReadDelta ( FastBufferReader reader , bool keepDirtyDelta )
160
160
{
161
- /// This is only invoked by <see cref="NetworkVariableDeltaMessage"/> and the only time
162
- /// keepDirtyDelta is set is when it is the server processing. To be able to handle previous
163
- /// versions, we use IsServer to keep the dirty states received and the keepDirtyDelta to
164
- /// actually mark this as dirty and add it to the list of <see cref="NetworkObject"/>s to
165
- /// be updated. With the forwarding of deltas being handled by <see cref="NetworkVariableDeltaMessage"/>,
166
- /// once all clients have been forwarded the dirty events, we clear them by invoking <see cref="PostDeltaRead"/>.
161
+ // This is only invoked by <see cref="NetworkVariableDeltaMessage"/> and the only time
162
+ // keepDirtyDelta is set is when it is the server processing. To be able to handle previous
163
+ // versions, we use IsServer to keep the dirty states received and the keepDirtyDelta to
164
+ // actually mark this as dirty and add it to the list of <see cref="NetworkObject"/>s to
165
+ // be updated. With the forwarding of deltas being handled by <see cref="NetworkVariableDeltaMessage"/>,
166
+ // once all clients have been forwarded the dirty events, we clear them by invoking <see cref="PostDeltaRead"/>.
167
167
var isServer = m_NetworkManager . IsServer ;
168
168
reader . ReadValueSafe ( out ushort deltaCount ) ;
169
169
for ( int i = 0 ; i < deltaCount ; i ++ )
@@ -406,13 +406,22 @@ internal override void PostDeltaRead()
406
406
}
407
407
}
408
408
409
- /// <inheritdoc cref="NetworkVariable{T}.GetEnumerator"/>
409
+ /// <summary>
410
+ /// Returns an enumerator that iterates through the <see cref="NetworkList{T}" />.
411
+ /// </summary>
412
+ /// <returns>An enumerator for the <see cref="NetworkList{T}"/>.</returns>
410
413
public IEnumerator < T > GetEnumerator ( )
411
414
{
412
415
return m_List . GetEnumerator ( ) ;
413
416
}
414
417
415
- /// <inheritdoc cref="NetworkVariable{T}.Add"/>
418
+ /// <summary>
419
+ /// Adds an item to the end of the <see cref="NetworkList{T}"/>.
420
+ /// </summary>
421
+ /// <param name="item">The item to be added to the list.</param>
422
+ /// <remarks>
423
+ /// This method checks for write permissions before adding the item.
424
+ /// </remarks>
416
425
public void Add ( T item )
417
426
{
418
427
// check write permissions
@@ -434,7 +443,12 @@ public void Add(T item)
434
443
HandleAddListEvent ( listEvent ) ;
435
444
}
436
445
437
- /// <inheritdoc cref="NetworkVariable{T}.Clear"/>
446
+ /// <summary>
447
+ /// Removes all items from the <see cref="NetworkList{T}"/>.
448
+ /// </summary>
449
+ /// <remarks>
450
+ /// This method checks for write permissions before clearing the list.
451
+ /// </remarks>
438
452
public void Clear ( )
439
453
{
440
454
// check write permissions
@@ -454,14 +468,25 @@ public void Clear()
454
468
HandleAddListEvent ( listEvent ) ;
455
469
}
456
470
457
- /// <inheritdoc cref="NetworkVariable{T}.Contains"/>
471
+ /// <summary>
472
+ /// Determines whether the <see cref="NetworkList{T}"/> contains a specific value.
473
+ /// </summary>
474
+ /// <param name="item">The object to locate in the <see cref="NetworkList{T}"/>.</param>
475
+ /// <returns><see langword="true" /> if the <see cref="item"/> is found in the <see cref="NetworkList{T}"/>; otherwise, <see langword="false" />.</returns>
458
476
public bool Contains ( T item )
459
477
{
460
478
int index = m_List . IndexOf ( item ) ;
461
479
return index != - 1 ;
462
480
}
463
481
464
- /// <inheritdoc cref="NetworkVariable{T}.Remove"/>
482
+ /// <summary>
483
+ /// Removes the first occurrence of a specific object from the NetworkList.
484
+ /// </summary>
485
+ /// <remarks>
486
+ /// This method checks for write permissions before removing the item.
487
+ /// </remarks>
488
+ /// <param name="item">The object to remove from the list.</param>
489
+ /// <returns><see langword="true" /> if the item was successfully removed from the list; otherwise, <see langword="false" />.</returns>
465
490
public bool Remove ( T item )
466
491
{
467
492
// check write permissions
@@ -488,16 +513,29 @@ public bool Remove(T item)
488
513
return true ;
489
514
}
490
515
491
- /// <inheritdoc cref="NetworkVariable{T}.Count"/>
516
+ /// <summary>
517
+ /// Gets the number of elements contained in the <see cref="NetworkList{T}"/>.
518
+ /// </summary>
492
519
public int Count => m_List . Length ;
493
520
494
- /// <inheritdoc cref="NetworkVariable{T}.IndexOf"/>
521
+ /// <summary>
522
+ /// Determines the index of a specific <see cref="item"/> in the <see cref="NetworkList{T}"/>.
523
+ /// </summary>
524
+ /// <param name="item">The object to remove from the list.</param>
525
+ /// <returns>The index of the <see cref="item"/> if found in the list; otherwise, -1.</returns>
495
526
public int IndexOf ( T item )
496
527
{
497
528
return m_List . IndexOf ( item ) ;
498
529
}
499
530
500
- /// <inheritdoc cref="NetworkVariable{T}.Insert"/>
531
+ /// <summary>
532
+ /// Inserts <see cref="item"/> to the <see cref="NetworkList{T}"/> at the specified <see cref="index"/>.
533
+ /// </summary>
534
+ /// <remarks>
535
+ /// This method checks for write permissions before inserting the item.
536
+ /// </remarks>
537
+ /// <param name="index">The index at which the item should be inserted.</param>
538
+ /// <param name="item">The item to insert.</param>
501
539
public void Insert ( int index , T item )
502
540
{
503
541
// check write permissions
@@ -527,7 +565,13 @@ public void Insert(int index, T item)
527
565
HandleAddListEvent ( listEvent ) ;
528
566
}
529
567
530
- /// <inheritdoc cref="NetworkVariable{T}.RemoveAt"/>
568
+ /// <summary>
569
+ /// Removes the <see cref="NetworkList{T}"/> item at the specified <see cref="index"/>.
570
+ /// </summary>
571
+ /// <remarks>
572
+ /// This method checks for write permissions before removing the item.
573
+ /// </remarks>
574
+ /// <param name="index">The index of the element to remove.</param>
531
575
public void RemoveAt ( int index )
532
576
{
533
577
// check write permissions
@@ -549,9 +593,14 @@ public void RemoveAt(int index)
549
593
HandleAddListEvent ( listEvent ) ;
550
594
}
551
595
552
-
553
-
554
- /// <inheritdoc cref="NetworkVariable{T}.this"/>
596
+ /// <summary>
597
+ /// Gets or sets the element at the specified index in the <see cref="NetworkList{T}"/>.
598
+ /// </summary>
599
+ /// <remarks>
600
+ /// This method checks for write permissions before setting the value.
601
+ /// </remarks>
602
+ /// <param name="index">The zero-based index of the element to get or set.</param>
603
+ /// <value>The element at the specified index.</value>
555
604
public T this [ int index ]
556
605
{
557
606
get => m_List [ index ] ;
@@ -587,7 +636,7 @@ private void HandleAddListEvent(NetworkListEvent<T> listEvent)
587
636
}
588
637
589
638
/// <summary>
590
- /// This is actually unused left- over from a previous interface
639
+ /// This method should not be used. It is left over from a previous interface
591
640
/// </summary>
592
641
public int LastModifiedTick
593
642
{
0 commit comments