public void Post(int peerId, short opCode, object serializableObject) { IPeer peer = master.GetPeer(peerId); if (peer == null) { Dj.Errorf("Post to peer#{0} failed", peerId); } else { peer.SendMessage(opCode, Capn.Crunchatize(serializableObject)); } }
public static bool Invoke(IWriteStream writeStream, IPeer peer, ResponseCallback responseCallback) { if (peer == null) { Logger.Error($"{nameof(peer)} 为 null"); return(false); } if (!_messages.TryGetValue(MessageType.RpcInvoke, out var func)) { Logger.Error($"没有注册${nameof(RpcInvoke)}"); return(false); } return(peer.SendMessage(writeStream, responseCallback)); }
public static bool Invoke(MessageType messageType, IRpc rpc, IWriteStream writeStream, IPeer peer, ResponseCallback responseCallback) { if (peer == null) { Logger.Error($"{nameof(peer)} 为 null"); return(false); } if (!_messages.TryGetValue(MessageType.RpcInvoke, out var func)) { Logger.Error($"没有注册${nameof(RpcInvoke)}"); return(false); } rpc.SerializeFields(writeStream); writeStream.ShiftLeft((short)messageType); return(peer.SendMessage(writeStream, responseCallback)); }
public void Send(IMessage operation, IPeer peer, DeliveryMethod mode, byte channelId = 0) { peer.SendMessage(operation, mode, channelId); }
public void SendUdp(byte[] data) { PeerUdp?.SendMessage((short)EMsgSC.G2C_UdpMessage, data); //PeerUdp.SendMessage((short) EMsgSC.G2C_UdpMessage, data,EDeliveryMethod.Unreliable); }
public void SendTcp(EMsgSC type, BaseMsg msg) { PeerTcp?.SendMessage((short)type, msg); }
public void SendMessage(short opCode, ISerializablePacket packet) { Peer?.SendMessage(opCode, packet); }
private void removePlayer() { peer.SendMessage((short)ServerCommProtocl.PreGameKick); onPeerLeft(peer); }
public void SendMsg(object type, BaseMsg data) { _peer?.SendMessage((short)type, data); }