Пример #1
0
 public void Game_Disconnected(object sender, ConnectionEventArgs ev)
 {
     MessageBox(new IntPtr(0), "You lost connection to the server.", "Disconnected", 0);
     Environment.Exit(1);
 }
        private void Server_Disconnected(object sender, ConnectionEventArgs ev)
        {
            ev.Connection.MessageReceived -= this.Server_MessageReceived;
            ev.Connection.Disconnected -= this.Server_Disconnected;

            var player = this.players.GetPlayer (ev.Connection);
            if(player != null && player.State == PlayerState.LoggedIn)
                this.Disconnect (ev.Connection);
        }
Пример #3
0
        public void NetworkDisconnected(object sender, ConnectionEventArgs ev)
        {
            if(this.ExitingGame)
                return;

            MessageBox(new IntPtr(0), "Connection to server lost.", "Disconnected", 0);

            this.Engine.Unload();
            this.Exit();
        }
 private void Server_ConnectionMade(object sender, ConnectionEventArgs ev)
 {
     ev.Connection.MessageReceived += this.Server_MessageReceived;
     ev.Connection.Disconnected += this.Server_Disconnected;
 }