NetworkConnectionToServer.cs 884 B

123456789101112131415161718192021222324
  1. using System;
  2. using System.Runtime.CompilerServices;
  3. namespace Mirror
  4. {
  5. public class NetworkConnectionToServer : NetworkConnection
  6. {
  7. // Send stage three: hand off to transport
  8. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  9. protected override void SendToTransport(ArraySegment<byte> segment, int channelId = Channels.Reliable) =>
  10. Transport.active.ClientSend(segment, channelId);
  11. /// <summary>Disconnects this connection.</summary>
  12. public override void Disconnect()
  13. {
  14. // set not ready and handle clientscene disconnect in any case
  15. // (might be client or host mode here)
  16. // TODO remove redundant state. have one source of truth for .ready!
  17. isReady = false;
  18. NetworkClient.ready = false;
  19. Transport.active.ClientDisconnect();
  20. }
  21. }
  22. }