public static void Invoke(object rootObject, Type scopeType, NetworkReader reader) { int signalType = reader.ReadInt32(); MethodInfo method = GetMethod(scopeType, signalType); SignalInvocation.Invoke(rootObject, method, new object[] { reader }); }
public static SignalInvocation GetMessageInvocation(Type scopeType, NetworkReader reader) { int signalType = reader.ReadInt32(); // create a new invocation object and assign its method and reader parameter SignalInvocation invocation = new SignalInvocation(); invocation.method = GetMethod(scopeType, signalType); invocation.parameters = new object[] { reader }; return(invocation); }
public void ProcessMessage(NetworkMessage msg) { #if UNITY_EDITOR && SCOPE_DEBUGGING // log incoming signal ScopeDebugger.AddIncomingSignal(this, msg.reader); msg.reader.SeekZero(); #endif // if not pause, invoke the signal immediately if (!_isPaused) { MethodBindingCache.Invoke(this, cachedType, msg.reader); } // if paused, enqueue paused signal for later processing else { SignalInvocation inv = MethodBindingCache.GetMessageInvocation(cachedType, msg.reader); pausedMessages.Enqueue(inv); } }