NetworkConnectionToServer.cs 931 B

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