public void ProcessRPCMessage(RPCMessageBody message) { if (message.type == RPCMessageBody.Type.call) { ProcessRemoteCall(message); } else { ProcessReturnValue(message); } }
protected void ProcessReturnValue(RPCMessageBody message) { foreach (var handle in registeredReturnHandles) { // find matched handle if (handle.signature == message.rpcSignature) { handle.isReady = true; handle.returnValue = message.rpcVariable; registeredReturnHandles.Remove(handle); break; } } }
public RPCReturnHandle Call(string functionName, RPCVariable parameter) { var signature = new RPCSignature(functionName); var messageBody = new RPCMessageBody(signature, parameter, RPCMessageBody.Type.call); var transmitableBody = new TransmitableRPCMessageBody(); transmitableBody.InitFromOriginalObejct(messageBody); var message = new Message(Message.Type.RPC, transmitableBody.Encode()); MessageCollector.instance.Collect(message); var returnHanlde = new RPCReturnHandle(signature); registeredReturnHandles.Add(returnHanlde); return(returnHanlde); }
protected virtual void ProcessRemoteCall(RPCMessageBody message) { throw new System.NotImplementedException(); }