public void ExecuteRPCStack()
{
// If there are any pending RPC calls, then do them now on the main thread
if (rpcStack.Count != 0)
{
lock (rpcStackMutex)
{
NetworkingStreamRPC stream = rpcStack[0];
rpcStackExceptionMethodName = stream.MethodName;
rpcStack.RemoveAt(0);
foreach (KeyValuePair<int, KeyValuePair<MethodInfo, List<IBRPCIntercept>>> rpc in RPCs)
{
if (stream == null)
return;
if (rpc.Value.Key.Name == stream.MethodName)
{
CurrentRPCSender = stream.Sender;
rpc.Value.Key.Invoke(this, stream.Arguments);
CurrentRPCSender = null;
return;
}
}
throw new NetworkException(13, "Invoked network method " + rpcStackExceptionMethodName + " not found or not marked with [BRPC]");
}
}
}