Fixed parameter read issue
This commit is contained in:
parent
5b2c77aec8
commit
916f4677f6
@ -378,8 +378,8 @@ namespace MLAPI.Data
|
|||||||
object[] returnVal = new object[paramCount];
|
object[] returnVal = new object[paramCount];
|
||||||
for (int i = 0; i < paramCount; i++)
|
for (int i = 0; i < paramCount; i++)
|
||||||
{
|
{
|
||||||
//FieldType fieldType = (FieldType)reader.ReadBits(5);
|
FieldType fieldType = (FieldType)reader.ReadBits(5);
|
||||||
FieldType fieldType = (FieldType)reader.ReadByte();
|
|
||||||
switch (fieldType)
|
switch (fieldType)
|
||||||
{
|
{
|
||||||
case FieldType.Bool:
|
case FieldType.Bool:
|
||||||
|
@ -174,28 +174,6 @@ namespace MLAPI.MonoBehaviours.Core
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This would not allow for cross projects.
|
|
||||||
MethodInfo method = null;
|
|
||||||
if (cachedMethods.ContainsKey(methodName))
|
|
||||||
method = cachedMethods[methodName];
|
|
||||||
else
|
|
||||||
method = GetType().GetMethod(methodName, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.NonPublic);
|
|
||||||
|
|
||||||
if (method.GetParameters().Length != methodParams.Length)
|
|
||||||
{
|
|
||||||
Debug.LogWarning("MLAPI: The parameter amounts are not matching.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < method.GetParameters().Length; i++)
|
|
||||||
{
|
|
||||||
if (method.GetParameters()[i].GetType() != methodParams[i].GetType())
|
|
||||||
{
|
|
||||||
Debug.LogWarning("MLAPI: The " + (i + 1) + "th parameter has the wrong type");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
ulong hash = Data.Cache.GetMessageAttributeHash(methodName);
|
ulong hash = Data.Cache.GetMessageAttributeHash(methodName);
|
||||||
using (BitWriter writer = new BitWriter())
|
using (BitWriter writer = new BitWriter())
|
||||||
{
|
{
|
||||||
@ -210,7 +188,6 @@ namespace MLAPI.MonoBehaviours.Core
|
|||||||
FieldTypeHelper.WriteFieldType(writer, methodParams[i], fieldType);
|
FieldTypeHelper.WriteFieldType(writer, methodParams[i], fieldType);
|
||||||
}
|
}
|
||||||
|
|
||||||
//SendToServerTarget("MLAPI_COMMAND", "MLAPI_INTERNAL", writer.Finalize());
|
|
||||||
InternalMessageHandler.Send(NetId.ServerNetId.GetClientId(), "MLAPI_COMMAND", "MLAPI_INTERNAL", writer.Finalize());
|
InternalMessageHandler.Send(NetId.ServerNetId.GetClientId(), "MLAPI_COMMAND", "MLAPI_INTERNAL", writer.Finalize());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user