Exemple #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;
            }
        }
Exemple #2
0
        private void OnDisconnected(object sender, OnDisconnectedEventArgs e)
        {
            EvtDisconnectedArgs disArgs = new EvtDisconnectedArgs()
            {
            };

            OnDisconnectedEvent?.Invoke(disArgs);
        }
Exemple #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);
     }
 }
Exemple #5
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);
 }
Exemple #7
0
 protected void ClientHost_OnDisconnected(object sender, LibRDP.DisconnectEventArgs e)
 {
     Logger.Info(e.ErrCode + ", " + e.Reason);
     OnDisconnectedEvent?.Invoke(sender, e);
 }
Exemple #8
0
 public TCPServer(IPEndPoint endpoint, OnMessageEvent onMessage, OnEstablishedEvent onEstablished, OnDisconnectedEvent onDisconnected) : this(endpoint, onMessage)
 {
     OnEstablished  = onEstablished;
     OnDisconnected = onDisconnected;
 }
Exemple #9
0
 private void Disconnected(DisconnectionInfo info)
 {
     OnDisconnectedEvent?.Invoke(this, info);
 }
Exemple #10
0
 public Task OnDisconnected(OnDisconnectedEvent theEvent)
 {
     return(Task.CompletedTask);
 }
Exemple #11
0
 public override void OnDisconnected(string p0)
 {
     OnDisconnectedEvent?.Invoke(this, p0);
 }