public override void ClientDisconnect()
 {
     if (!LiteNetLib4MirrorServer.IsActive())
     {
         LiteNetLib4MirrorCore.StopTransport();
     }
 }
 public bool ServerSend(int connectionId, int channelId, ArraySegment <byte> data)
 {
     // ReSharper disable once ConvertIfStatementToReturnStatement
     if (channelId < channels.Length)
     {
         return(LiteNetLib4MirrorServer.Send(connectionId, channels[channelId], data.Array, data.Offset, data.Count, (byte)channelId));
     }
     return(LiteNetLib4MirrorServer.Send(connectionId, channels[0], data.Array, data.Offset, data.Count, 0));
 }
 public override bool ServerSend(int connectionId, int channelId, byte[] data)
 {
     // ReSharper disable once ConvertIfStatementToReturnStatement
     if (channelId < channels.Length)
     {
         return(LiteNetLib4MirrorServer.Send(connectionId, channels[channelId], data, 0, data.Length, (byte)channelId));
     }
     return(LiteNetLib4MirrorServer.Send(connectionId, channels[0], data, 0, data.Length, 0));
 }
Beispiel #4
0
        public override void ServerSend(int connectionId, int channelId, ArraySegment <byte> segment)
        {
            byte channel = (byte)(channelId < channels.Length ? channelId : 0);

            if (!LiteNetLib4MirrorServer.Send(connectionId, channels[0], segment.Array, segment.Offset, segment.Count, channel))
            {
                Debug.Log($"LNL: Server failed to send for connectionId{connectionId}");
            }
        }
        public override bool ServerSend(List <int> connectionIds, int channelId, ArraySegment <byte> data)
        {
            byte channel = (byte)(channelId < channels.Length ? channelId : 0);
            bool success = true;

            foreach (int id in connectionIds)
            {
                success &= LiteNetLib4MirrorServer.Send(id, channels[0], data.Array, data.Offset, data.Count, channel);
            }
            return(success);
        }
 public override bool ServerSend(int connectionId, int channelId, NetworkWriter data)
 {
     try
     {
         ArraySegment <byte> bytes = data.ToArraySegment();
         // ReSharper disable once ConvertIfStatementToReturnStatement
         if (channelId < channels.Length)
         {
             return(LiteNetLib4MirrorServer.Send(connectionId, channels[channelId], bytes.Array, bytes.Offset, bytes.Count, (byte)channelId));
         }
         return(LiteNetLib4MirrorServer.Send(connectionId, channels[0], bytes.Array, bytes.Offset, bytes.Count, 0));
     }
     finally
     {
         NetworkWriterPool.Recycle(data);
     }
 }
 public bool ServerSend(int connectionId, int channelId, ArraySegment <byte> data)
 {
     return(LiteNetLib4MirrorServer.Send(connectionId, channels[channelId], data.Array, data.Offset, data.Count, (byte)channelId));
 }
 public override string ServerGetClientAddress(int connectionId)
 {
     return(LiteNetLib4MirrorServer.GetClientAddress(connectionId));
 }
 public override bool ServerDisconnect(int connectionId)
 {
     return(connectionId == 0 || LiteNetLib4MirrorServer.Disconnect(connectionId));
 }
 public override bool ServerSend(int connectionId, int channelId, byte[] data)
 {
     return(LiteNetLib4MirrorServer.Send(connectionId, channels[channelId], data, 0, data.Length, (byte)channelId));
 }
 public override void ServerStart()
 {
     LiteNetLib4MirrorServer.StartServer(GenerateCode());
 }
 public override bool ServerActive()
 {
     return(LiteNetLib4MirrorServer.IsActive());
 }
Beispiel #13
0
        /*public override bool ServerSend(List<int> connectionIds, int channelId, ArraySegment<byte> data)
         * {
         *      byte channel = (byte)(channelId < channels.Length ? channelId : 0);
         *      bool success = true;
         *      foreach (int id in connectionIds)
         *      {
         *              success &= LiteNetLib4MirrorServer.Send(id, channels[0], data.Array, data.Offset, data.Count, channel);
         *      }
         *      return success;
         * }*/

        public override void ServerSend(int connectionId, int channelId, ArraySegment <byte> data)
        {
            byte channel = (byte)(channelId < channels.Length ? channelId : 0);

            LiteNetLib4MirrorServer.Send(connectionId, channels[0], data.Array, data.Offset, data.Count, channel);
        }
Beispiel #14
0
 public override void ServerStart()
 {
     LiteNetLib4MirrorServer.StartServer(GetConnectKey());
 }