private void ProcessRequestRemoteCall(RequestRemoteCall packet) { lock (responseCallbacks) { var response = new RespondRemoteCall(); response.PacketId = packet.PacketId; response.RespondTo = packet.Player; if (functions.ContainsKey(packet.FunctionName) == false) { Debug.LogError("Got RPCCall but there's no function : " + packet.FunctionName); response.Exception = new NotImplementedException(packet.FunctionName); response.IsSuccess = false; } else { try { var ret = functions[packet.FunctionName].Invoke(packet.Player, packet.Args); response.Result = ret; response.IsSuccess = true; } catch (Exception e) { response.Exception = e; response.IsSuccess = false; } Send(response); } } }
public void OnRequestRemoteCall(RequestRemoteCall packet) { EzService target; lock (Sessions) { target = Sessions.FirstOrDefault(x => x.Player.PlayerId == packet.Player.PlayerId); if (target == null) { return; } } packet.Player = Player; target.SendPacket(packet); }