예제 #1
0
 /// <summary>
 /// Send data to server
 /// </summary>
 public void SendData
 (
     byte packet_id,
     byte[] data,
     PacketPriority priority       = PacketPriority.IMMEDIATE_PRIORITY,
     PacketReliability reliability = PacketReliability.RELIABLE,
     NetChannel channel            = NetChannel.NET_EVENTS
 )
 {
     if (IsConnected)
     {
         client_peer?.BeginWrite(packet_id);
         client_peer?.WriteBytes(data);
         client_peer?.SendToServer(priority, reliability, channel);
     }
     else
     {
         if (RakNet_Peer.debugLevel >= RakDebugLevel.Low)
         {
             Debug.LogError("[Client] Is not connected!");
         }
     }
 }
 public void SendToServer(PacketPriority priority = PacketPriority.IMMEDIATE_PRIORITY, PacketReliability reliability = PacketReliability.RELIABLE, NetChannel channel = NetChannel.NET_EVENTS)
 {
     peer?.SendToServer(priority, reliability, channel);
 }