public void SendMessage(MyMessageId id, IPacketData data, bool reliable, List <EndpointId> endpoints, byte index = 0) { MyNetworkWriter.MyPacketDescriptor packet = this.InitSendStream(EndpointId.Null, reliable ? MyP2PMessageEnum.ReliableWithBuffering : MyP2PMessageEnum.Unreliable, id, index); packet.Recipients.AddRange(endpoints); packet.Data = data; MyNetworkWriter.SendPacket(packet); }
protected void SendControlMessage <T>(ulong user, ref T message, bool reliable = true) where T : struct { ITransportCallback callback; MyControlMessageEnum enum2; this.m_controlMessageTypes.TryGetValue(typeof(T), out enum2); this.m_controlMessageHandlers.TryGetValue((int)enum2, out callback); MyControlMessageCallback <T> callback2 = (MyControlMessageCallback <T>)callback; if (MySyncLayer.CheckSendPermissions(user, callback2.Permission)) { MyNetworkWriter.MyPacketDescriptor packet = MyNetworkWriter.GetPacketDescriptor(new EndpointId(user), reliable ? MyP2PMessageEnum.ReliableWithBuffering : MyP2PMessageEnum.Unreliable, 0); packet.Header.WriteUShort((ushort)enum2); callback2.Write(packet.Header, ref message); MyNetworkWriter.SendPacket(packet); } }
public void SendMessage(MyMessageId id, IPacketData data, bool reliable, EndpointId endpoint, byte index = 0) { MyNetworkWriter.MyPacketDescriptor packet = this.InitSendStream(endpoint, reliable ? MyP2PMessageEnum.ReliableWithBuffering : MyP2PMessageEnum.Unreliable, id, index); packet.Data = data; MyNetworkWriter.SendPacket(packet); }
public void SendFlush(ulong sendTo) { MyNetworkWriter.SendPacket(this.InitSendStream(new EndpointId(sendTo), MyP2PMessageEnum.ReliableWithBuffering, MyMessageId.FLUSH, 0)); }