protected internal override void SendToAllRooms(NetMessage msg, ReliabilityMode mode) { var lmsg = RoomServer.CreateMessage(msg.Data.Length); msg.Clone(lmsg); NetMessage.RecycleMessage(msg); var method = mode.RoomDelivery(); RoomServer.SendToAll(lmsg, method); }
protected internal override void SendToRoom(Room room, NetMessage msg, ReliabilityMode mode) { var lmsg = RoomServer.CreateMessage(msg.Data.Length); msg.Clone(lmsg); NetMessage.RecycleMessage(msg); var method = mode.RoomDelivery(); RoomServer.SendMessage(lmsg, room.Connection as NetConnection, method); }
protected internal override void SendToOtherRooms(Room except, NetMessage msg, ReliabilityMode mode) { var lmsg = RoomServer.CreateMessage(msg.Data.Length); msg.Clone(lmsg); NetMessage.RecycleMessage(msg); var method = mode.RoomDelivery(); RoomServer.SendToAll(lmsg, except.Connection as NetConnection, method, 0); }
private void LidgrenApproveRoomConnection(NetConnection sConn, IPEndPoint sender, NetMessage msg) { if (!ApproveRoomConnection(sender, msg, out var denyReason, out var room)) { sConn.Deny(denyReason); return; } room.Connection = sConn; var gbytes = room.Guid.ToByteArray(); var gmsg = RoomServer.CreateMessage(gbytes.Length); gmsg.Write(gbytes); sConn.Approve(gmsg); sConn.Tag = room; }