Пример #1
0
        private void SetStatus(ConnectionStatus status)
        {
            switch (status)
            {
            case ConnectionStatus.Connecting:

                if (Status != ConnectionStatus.Connecting)
                {
                    Status = ConnectionStatus.Connecting;
                }

                break;

            case ConnectionStatus.Connected:

                if (Status != ConnectionStatus.Connected)
                {
                    Status = ConnectionStatus.Connected;
                    MstTimer.Instance.StartCoroutine(Peer.SendDelayedMessages());
                    OnConnectedEvent?.Invoke();
                }

                break;

            case ConnectionStatus.Disconnected:

                if (Status != ConnectionStatus.Disconnected)
                {
                    Status = ConnectionStatus.Disconnected;
                    OnDisconnectedEvent?.Invoke();
                }

                break;
            }
        }
Пример #2
0
        private void OnDisconnected(object sender, OnDisconnectedEventArgs e)
        {
            EvtDisconnectedArgs disArgs = new EvtDisconnectedArgs()
            {
            };

            OnDisconnectedEvent?.Invoke(disArgs);
        }
Пример #3
0
 public virtual void OnDisconnected(HPacket packet)
 {
     IsConnected = false;
     _entities.Clear();
     _wallItems.Clear();
     _floorItems.Clear();
     if (DisableEventHandlers == false)
     {
         try { OnDisconnectedEvent.Invoke(this, packet); } catch { }; //Invoke event handler
     }
 }
 /// <inheritdoc />
 protected override void OnDisconnected()
 {
     try
     {
         OnDisconnectedEvent?.Invoke();
     }
     catch (Exception ex)
     {
         Debug.LogException(ex);
     }
 }
Пример #5
0
        async Task OnConnectClient(TcpClient client)
        {
            var clientEndpoint = client.Client.RemoteEndPoint;

            mainContext.Post(_ => OnEstablished.Invoke(client), null);
            clients.Add(client);

            await NetworkStreamHandler(client);

            mainContext.Post(_ => OnDisconnected.Invoke(clientEndpoint), null);
            clients.Remove(client);
        }
Пример #6
0
 public void Disconnect(DisconnectionType disconnectionType = DisconnectionType.Unknown)
 {
     if (client_peer != null)
     {
         client_peer.Shutdown();
         IsConnected = IsConnecting = false;
         if (disconnectionType != DisconnectionType.Unknown)
         {
             OnDisconnected(client_peer.address, client_peer.port, disconnectionType, disconnect_reason);
             OnDisconnectedEvent?.Invoke(client_peer.address, client_peer.port, disconnectionType, disconnect_reason);
         }
         else if (disconnectionType == DisconnectionType.Unknown)
         {
             OnDisconnected(client_peer.address, client_peer.port, DisconnectionType.ByUser, string.Empty);
             OnDisconnectedEvent?.Invoke(client_peer.address, client_peer.port, DisconnectionType.ByUser, string.Empty);
         }
         if (RakNet_Peer.debugLevel >= RakDebugLevel.Low)
         {
             Debug.Log("[Client] Disconnected... (" + disconnectionType + ")");
         }
         client_peer = null;
     }
 }
 public override void OnClientDisconnect(NetworkConnection conn)
 {
     base.OnClientDisconnect(conn);
     OnDisconnectedEvent?.Invoke(conn);
 }
Пример #8
0
 protected void ClientHost_OnDisconnected(object sender, LibRDP.DisconnectEventArgs e)
 {
     Logger.Info(e.ErrCode + ", " + e.Reason);
     OnDisconnectedEvent?.Invoke(sender, e);
 }
Пример #9
0
 private void Disconnected(DisconnectionInfo info)
 {
     OnDisconnectedEvent?.Invoke(this, info);
 }
Пример #10
0
 public override void OnDisconnected(string p0)
 {
     OnDisconnectedEvent?.Invoke(this, p0);
 }