partial void ImplSendMessage(NetMessage msg, ReliabilityMode reliable, BroadcastMode broadcast) { var lmsg = Manager.Room.PlayerServer.CreateMessage(msg.Data.Length); msg.Clone(lmsg); NetMessage.RecycleMessage(msg); int seq; var method = reliable.PlayerDelivery(out seq); switch (broadcast) { case BroadcastMode.All: if (_observersAndOwner.Count > 0) { Manager.Room.PlayerServer.SendMessage(lmsg, _observersAndOwner, method, seq); } break; case BroadcastMode.Others: if (_observers.Count > 0) { Manager.Room.PlayerServer.SendMessage(lmsg, _observers, method, seq); } break; case BroadcastMode.Owner: Manager.Room.PlayerServer.SendMessage(lmsg, Owner.Connection, method, seq); break; default: throw new NotImplementedException(); } }
protected internal override void SendToPlayers(List <Player> players, NetMessage msg, ReliabilityMode mode) { var lmsg = _playerServer.CreateMessage(msg.Data.Length); msg.Clone(lmsg); NetMessage.RecycleMessage(msg); var method = mode.PlayerDelivery(out var seq); var conns = new List <NetConnection>(players.Count); // ReSharper disable once ForCanBeConvertedToForeach speed is necessary for (int i = 0; i < players.Count; i++) { if (players[i] == null) { continue; } conns.Add(players[i].Connection as NetConnection); } if (conns.Count == 0) { return; } _playerServer.SendMessage(lmsg, conns, method, seq); }
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); }
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 SendMessage(NetMessage msg, ReliabilityMode mode) { var lmsg = DispatchClient.CreateMessage(msg.Data.Length); msg.Clone(lmsg); NetMessage.RecycleMessage(msg); var method = mode.RoomDelivery(); DispatchClient.SendMessage(lmsg, method); }
protected internal override void SendToAllPlayers(NetMessage msg, ReliabilityMode mode) { var lmsg = PlayerServer.CreateMessage(msg.Data.Length); msg.Clone(lmsg); NetMessage.RecycleMessage(msg); var method = mode.PlayerDelivery(out var seq); PlayerServer.SendToAll(lmsg, null, method, seq); }
protected internal override void SendExcept(NetMessage msg, Player except, ReliabilityMode mode) { var lmsg = _playerServer.CreateMessage(msg.Data.Length); msg.Clone(lmsg); NetMessage.RecycleMessage(msg); var method = mode.PlayerDelivery(out var seq); _playerServer.SendToAll(lmsg, except.Connection as NetConnection, method, seq); }
partial void ImplSendToPlayer(Player player, NetMessage msg, ReliabilityMode mode) { var lmsg = PlayerServer.CreateMessage(msg.Data.Length); msg.Clone(lmsg); NetMessage.RecycleMessage(msg); var method = mode.RoomDelivery(); PlayerServer.SendMessage(lmsg, player.Connection, method); }
protected internal override void SendToPlayers(NetMessage msg, ReliabilityMode mode) { var lmsg = _playerServer.CreateMessage(msg.Data.Length); msg.Clone(lmsg); NetMessage.RecycleMessage(msg); var method = mode.RoomDelivery(); _playerServer.SendToAll(lmsg, method); }
partial void ImplementationSendMessage(NetMessage msg, ReliabilityMode mode) { var lmsg = _room.DispatchClient.CreateMessage(msg.Data.Length); msg.Clone(lmsg); NetMessage.RecycleMessage(msg); var method = mode.RoomDelivery(); _room.DispatchClient.SendMessage(lmsg, method); }
partial void ImplSendToAll(NetMessage msg, ReliabilityMode mode) { var lmsg = _server.RoomServer.CreateMessage(msg.Data.Length); msg.Clone(lmsg); NetMessage.RecycleMessage(msg); var method = mode.RoomDelivery(); _server.RoomServer.SendToAll(lmsg, method); }
partial void ImplSendExcept(NetMessage msg, Player except, ReliabilityMode mode) { var lmsg = PlayerServer.CreateMessage(msg.Data.Length); msg.Clone(lmsg); NetMessage.RecycleMessage(msg); var method = mode.RoomDelivery(); PlayerServer.SendToAll(lmsg, except.Connection, method, 0); }
partial void ImplementationSendMessage(NetMessage msg, ReliabilityMode mode) { var lmsg = Room.PlayerServer.CreateMessage(msg.Data.Length); msg.Clone(lmsg); NetMessage.RecycleMessage(msg); int seq; var method = mode.PlayerDelivery(out seq); Room.PlayerServer.SendMessage(lmsg, Connection, method, seq); }
partial void ImplSendToAllPlayersExcept(Player player, NetMessage msg, ReliabilityMode mode) { var lmsg = PlayerServer.CreateMessage(msg.Data.Length); msg.Clone(lmsg); NetMessage.RecycleMessage(msg); int seq; var method = mode.PlayerDelivery(out seq); PlayerServer.SendToAll(lmsg, player.Connection, method, seq); }
public void SendMessageToAll(NetMessage message) { for (int i = 0; i < m_clientList.Count; ++i) { ServerVisitor client = m_clientList[i]; if (client != null) { client.Sender.SendMessage(message.Clone()); } } }
protected internal override void SendToPlayer(Player player, NetMessage msg, ReliabilityMode mode, bool recycle) { var lmsg = PlayerServer.CreateMessage(msg.Data.Length); msg.Clone(lmsg); if (recycle) { NetMessage.RecycleMessage(msg); } var method = mode.PlayerDelivery(out var seq); PlayerServer.SendMessage(lmsg, player.Connection as NetConnection, method, seq); }
protected internal override void SendSceneView(NetMessage msg, ReliabilityMode mode) { var lmsg = _playerServer.CreateMessage(msg.Data.Length); msg.Clone(lmsg); NetMessage.RecycleMessage(msg); var method = mode.PlayerDelivery(out var seq); if (seq == 2) { seq = 3; //don't use player channel... } _playerServer.SendToAll(lmsg, null, method, seq); }
partial void ImplSend(NetMessage msg, ReliabilityMode mode, bool recycle) { var lmsg = Server.PlayerServer.CreateMessage(msg.Data.Length); msg.Clone(lmsg); if (recycle) { NetMessage.RecycleMessage(msg); } int seq; var method = mode.PlayerDelivery(out seq); Server.PlayerServer.SendMessage(lmsg, Connection, method, seq); }
partial void ImplSendToPlayers(Player[] players, NetMessage msg, ReliabilityMode mode) { var lmsg = PlayerServer.CreateMessage(msg.Data.Length); msg.Clone(lmsg); NetMessage.RecycleMessage(msg); var method = mode.RoomDelivery(); var conns = players.Where(p => p != null).Select(p => p.Connection).ToArray(); if (conns.Length == 0) { return; } PlayerServer.SendMessage(lmsg, conns, method, 0); }
partial void ImplSendMessage(NetMessage msg, ReliabilityMode mode) { var lmsg = _room.PlayerServer.CreateMessage(msg.Data.Length); msg.Clone(lmsg); NetMessage.RecycleMessage(msg); int seq; var method = mode.PlayerDelivery(out seq); if (seq == 2) { seq = 3; //don't use player channel... } _room.PlayerServer.SendToAll(lmsg, null, method, seq); }
protected internal override void SendToConnections(List <object> connections, NetMessage msg, ReliabilityMode reliable) { var lmsg = _playerServer.CreateMessage(msg.Data.Length); msg.Clone(lmsg); NetMessage.RecycleMessage(msg); var method = reliable.PlayerDelivery(out var seq); var conns = new List <NetConnection>(connections.Count); // ReSharper disable once ForCanBeConvertedToForeach speed is necessary for (var i = 0; i < connections.Count; i++) { conns.Add(connections[i] as NetConnection); } _playerServer.SendMessage(lmsg, conns, method, seq); }
partial void ImplSendExcept(NetMessage msg, Player player, ReliabilityMode mode) { var lmsg = Manager.Room.PlayerServer.CreateMessage(msg.Data.Length); msg.Clone(lmsg); NetMessage.RecycleMessage(msg); int seq; var method = mode.PlayerDelivery(out seq); var conns = _observersAndOwner.Where(c => c != player.Connection).ToArray(); if (conns.Length == 0) { return; } Manager.Room.PlayerServer.SendMessage(lmsg, conns, method, seq); }
partial void ImplSendMessage(NetMessage msg, List <Player> players, ReliabilityMode mode) { var lmsg = Manager.Room.PlayerServer.CreateMessage(msg.Data.Length); msg.Clone(lmsg); NetMessage.RecycleMessage(msg); int seq; var method = mode.PlayerDelivery(out seq); var conns = new List <NetConnection>(players.Count); // ReSharper disable once LoopCanBeConvertedToQuery - speed foreach (var p in players) { conns.Add(p.Connection); } if (conns.Count == 0) { return; } Manager.Room.PlayerServer.SendMessage(lmsg, conns, method, seq); }