Skip to content

Commit 03c12db

Browse files
committed
Fixed class name spelling and improved XML documentation
1 parent 0caa9ea commit 03c12db

File tree

2 files changed

+39
-12
lines changed

2 files changed

+39
-12
lines changed

MLAPI/Data/AttributeMessageMode.cs

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,40 @@
55

66
namespace MLAPI.Configuration
77
{
8-
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
8+
/// <summary>
9+
/// Represents the length of a var int encoded hash
10+
/// Note that the HashSize does not say anything about the actual final output due to the var int encoding
11+
/// It just says how many bytes the maximum will be
12+
/// </summary>
913
public enum HashSize
1014
{
15+
/// <summary>
16+
/// Two byte hash
17+
/// </summary>
1118
VarIntTwoBytes,
19+
/// <summary>
20+
/// Four byte hash
21+
/// </summary>
1222
VarIntFourBytes,
23+
/// <summary>
24+
/// Eight byte hash
25+
/// </summary>
1326
VarIntEightBytes
1427
}
15-
#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member
1628
}
1729

1830
namespace MLAPI
1931
{
2032
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
2133
public delegate void RpcDelegate(uint clientId, Stream stream);
2234

23-
public class ReflectionMehtod
35+
internal class ReflectionMethod
2436
{
25-
public MethodInfo method;
26-
public Type[] parameterTypes;
27-
public object[] parameterRefs;
37+
private MethodInfo method;
38+
private Type[] parameterTypes;
39+
private object[] parameterRefs;
2840

29-
public ReflectionMehtod(MethodInfo methodInfo)
41+
public ReflectionMethod(MethodInfo methodInfo)
3042
{
3143
method = methodInfo;
3244
ParameterInfo[] parameters = methodInfo.GetParameters();
@@ -39,7 +51,7 @@ public ReflectionMehtod(MethodInfo methodInfo)
3951
}
4052
}
4153

42-
public object Invoke(object instance, Stream stream)
54+
internal object Invoke(object instance, Stream stream)
4355
{
4456
using (PooledBitReader reader = PooledBitReader.Get(stream))
4557
{
@@ -53,16 +65,31 @@ public object Invoke(object instance, Stream stream)
5365
}
5466
}
5567

68+
/// <summary>
69+
/// Attribute used on methods to me marked as ServerRPC
70+
/// ServerRPC methods can be requested from a client and will execute on the server
71+
/// Remember that a host is a server and a client
72+
/// </summary>
73+
[AttributeUsage(AttributeTargets.Method, Inherited = true, AllowMultiple = false)]
5674
public class ServerRPC : Attribute
5775
{
76+
/// <summary>
77+
/// Whether or not the ServerRPC should only be run if executed by the owner of the object
78+
/// </summary>
5879
public bool RequireOwnership = true;
59-
internal ReflectionMehtod reflectionMethod;
80+
internal ReflectionMethod reflectionMethod;
6081
internal RpcDelegate rpcDelegate;
6182
}
6283

84+
/// <summary>
85+
/// Attribute used on methods to me marked as ClientRPC
86+
/// ClientRPC methods can be requested from the server and will execute on a client
87+
/// Remember that a host is a server and a client
88+
/// </summary>
89+
[AttributeUsage(AttributeTargets.Method, Inherited = true, AllowMultiple = false)]
6390
public class ClientRPC : Attribute
6491
{
65-
internal ReflectionMehtod reflectionMethod;
92+
internal ReflectionMethod reflectionMethod;
6693
internal RpcDelegate rpcDelegate;
6794
}
6895

MLAPI/MonoBehaviours/Core/NetworkedBehaviour.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ private void CacheAttributes()
576576
if (LogHelper.CurrentLogLevel <= LogLevel.Error) LogHelper.LogWarning("Invalid return type of RPC. Has to be either void or RpcResponse<T> with a serializable type");
577577
}
578578

579-
attributes[0].reflectionMethod = new ReflectionMehtod(methods[i]);
579+
attributes[0].reflectionMethod = new ReflectionMethod(methods[i]);
580580
}
581581

582582
ulong hash = HashMethodName(methods[i].Name);
@@ -613,7 +613,7 @@ private void CacheAttributes()
613613
if (LogHelper.CurrentLogLevel <= LogLevel.Error) LogHelper.LogWarning("Invalid return type of RPC. Has to be either void or RpcResponse<T> with a serializable type");
614614
}
615615

616-
attributes[0].reflectionMethod = new ReflectionMehtod(methods[i]);
616+
attributes[0].reflectionMethod = new ReflectionMethod(methods[i]);
617617
}
618618

619619
ulong hash = HashMethodName(methods[i].Name);

0 commit comments

Comments
 (0)