From c8160868f670c5dbc941030263cdb0f9515436e1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Albin=20Cor=C3=A9n?= <2108U9@gmail.com>
Date: Sat, 21 Apr 2018 23:10:54 +0200
Subject: [PATCH] Added XML comments
---
MLAPI/Attributes/BinaryIgnore.cs | 2 +-
MLAPI/Attributes/ClientRpc.cs | 3 ++
MLAPI/Attributes/Command.cs | 3 ++
MLAPI/Attributes/TargetRpc.cs | 3 ++
MLAPI/Data/FixedQueue.cs | 33 ++++++++++++++++---
.../MonoBehaviours/Core/NetworkedBehaviour.cs | 17 +++++++++-
MLAPI/MonoBehaviours/Core/TrackedObject.cs | 3 ++
7 files changed, 58 insertions(+), 6 deletions(-)
diff --git a/MLAPI/Attributes/BinaryIgnore.cs b/MLAPI/Attributes/BinaryIgnore.cs
index 01eca65..d363a1a 100644
--- a/MLAPI/Attributes/BinaryIgnore.cs
+++ b/MLAPI/Attributes/BinaryIgnore.cs
@@ -3,7 +3,7 @@
namespace MLAPI.Attributes
{
///
- /// The attribute to use for variables that should be automatically. replicated from Server to Client.
+ /// The attribute to use for fields that should be ignored by the BinarySerializer
///
[AttributeUsage(AttributeTargets.Field)]
public class BinaryIgnore : Attribute
diff --git a/MLAPI/Attributes/ClientRpc.cs b/MLAPI/Attributes/ClientRpc.cs
index 3a01756..f89b049 100644
--- a/MLAPI/Attributes/ClientRpc.cs
+++ b/MLAPI/Attributes/ClientRpc.cs
@@ -2,6 +2,9 @@
namespace MLAPI.Attributes
{
+ ///
+ /// This attribute is used to specify that this is a remote Client RPC
+ ///
[AttributeUsage(AttributeTargets.Method)]
public class ClientRpc : Attribute
{
diff --git a/MLAPI/Attributes/Command.cs b/MLAPI/Attributes/Command.cs
index 5eb7f60..a8dd4b6 100644
--- a/MLAPI/Attributes/Command.cs
+++ b/MLAPI/Attributes/Command.cs
@@ -2,6 +2,9 @@
namespace MLAPI.Attributes
{
+ ///
+ /// This attribute is used to specify that this is a remote Command
+ ///
[AttributeUsage(AttributeTargets.Method)]
public class Command : Attribute
{
diff --git a/MLAPI/Attributes/TargetRpc.cs b/MLAPI/Attributes/TargetRpc.cs
index da78777..f41e313 100644
--- a/MLAPI/Attributes/TargetRpc.cs
+++ b/MLAPI/Attributes/TargetRpc.cs
@@ -2,6 +2,9 @@
namespace MLAPI.Attributes
{
+ ///
+ /// This attribute is used to specify that this is a remote Target RPC
+ ///
[AttributeUsage(AttributeTargets.Method)]
public class TargetRpc : Attribute
{
diff --git a/MLAPI/Data/FixedQueue.cs b/MLAPI/Data/FixedQueue.cs
index f27279b..2caa50e 100644
--- a/MLAPI/Data/FixedQueue.cs
+++ b/MLAPI/Data/FixedQueue.cs
@@ -2,20 +2,36 @@
namespace MLAPI.Data
{
- public class FixedQueue
+ ///
+ /// Queue with a fixed size
+ ///
+ /// The type of the queue
+ public sealed class FixedQueue
{
- protected readonly T[] queue;
- protected int queueCount = 0;
- protected int queueStart;
+ private readonly T[] queue;
+ private int queueCount = 0;
+ private int queueStart;
+ ///
+ /// The amount of enqueued objects
+ ///
public int Count { get => queueCount; }
+ ///
+ /// Creates a new FixedQueue with a given size
+ ///
+ /// The size of the queue
public FixedQueue(int maxSize)
{
queue = new T[maxSize];
queueStart = 0;
}
+ ///
+ /// Enqueues an object
+ ///
+ ///
+ ///
public bool Enqueue(T t)
{
queue[(queueStart + queueCount) % queue.Length] = t;
@@ -27,6 +43,10 @@ namespace MLAPI.Data
return false;
}
+ ///
+ /// Dequeues an object
+ ///
+ ///
public T Dequeue()
{
if (--queueCount == -1) throw new IndexOutOfRangeException("Cannot dequeue empty queue!");
@@ -35,6 +55,11 @@ namespace MLAPI.Data
return res;
}
+ ///
+ /// Gets the element at a given virtual index
+ ///
+ ///
+ ///
public T ElementAt(int index) => queue[(queueStart + index) % queue.Length];
}
}
diff --git a/MLAPI/MonoBehaviours/Core/NetworkedBehaviour.cs b/MLAPI/MonoBehaviours/Core/NetworkedBehaviour.cs
index 1191928..eba61f5 100644
--- a/MLAPI/MonoBehaviours/Core/NetworkedBehaviour.cs
+++ b/MLAPI/MonoBehaviours/Core/NetworkedBehaviour.cs
@@ -156,6 +156,11 @@ namespace MLAPI.MonoBehaviours.Core
}
}
+ ///
+ /// Calls a Command method on server
+ ///
+ /// Method name to invoke
+ /// Method parameters to send
protected void InvokeCommand(string methodName, params object[] methodParams)
{
if (NetworkingManager.singleton.isServer)
@@ -192,6 +197,11 @@ namespace MLAPI.MonoBehaviours.Core
}
}
+ ///
+ /// Calls a ClientRpc method on all clients
+ ///
+ /// Method name to invoke
+ /// Method parameters to send
protected void InvokeClientRpc(string methodName, params object[] methodParams)
{
if (!NetworkingManager.singleton.isServer)
@@ -224,6 +234,11 @@ namespace MLAPI.MonoBehaviours.Core
}
}
+ ///
+ /// Calls a TargetRpc method on the owner client
+ ///
+ /// Method name to invoke
+ /// Method parameters to send
protected void InvokeTargetRpc(string methodName, params object[] methodParams)
{
if (!NetworkingManager.singleton.isServer)
@@ -673,7 +688,7 @@ namespace MLAPI.MonoBehaviours.Core
InternalMessageHandler.Send(ownerClientId, messageType, channelName, data, networkId, networkedObject.GetOrderIndex(this));
}
- ///
+ /// gh
/// Sends a buffer to the client that owns this object from the server. Only handlers on this NetworkedBehaviour will get invoked
///
/// The class type to send
diff --git a/MLAPI/MonoBehaviours/Core/TrackedObject.cs b/MLAPI/MonoBehaviours/Core/TrackedObject.cs
index 07df96a..ea3e938 100644
--- a/MLAPI/MonoBehaviours/Core/TrackedObject.cs
+++ b/MLAPI/MonoBehaviours/Core/TrackedObject.cs
@@ -45,6 +45,9 @@ namespace MLAPI.MonoBehaviours.Core
}
}
+ ///
+ /// Gets the total time history we have for this object
+ ///
public float TotalTimeHistory
{
get