Exemple #1
0
 public void Dispose()
 {
     if (NetworkSocket.Connected)
     {
         NetworkSocket.Shutdown(SocketShutdown.Both);
         NetworkSocket.Disconnect(true);
     }
     NetworkSocket.Close(1000);
 }
Exemple #2
0
        public static void Exit()
        {
            EngineMultimedia.StopMultimedia();

            //limpa o endereço do servidor
            if (NetworkSocket.Connected(NetworkSocketEnum.GameServer))
            {
                Common.Configuration.IPAddress[(int)NetworkSocketEnum.GameServer].Clear();
                NetworkSocket.Disconnect(NetworkSocketEnum.GameServer);
            }

            Application.Exit();
        }
Exemple #3
0
    /**
     * <summary> Met à jour les match servers déconnectés en supprimant toutes les IDs de connexion se trouvant dans DisconnectedClients de
     * OnlineClients. </summary>
     */
    void UpdateDisconnectedMatchServers()
    {
        foreach (int coID in DisconnectedMatchServers)
        {
            if (MatchServerIPs.ContainsKey(coID))
            {
                NetworkSocket.Disconnect(coID);
                MatchServerIPs.Remove(coID);
                BloodAndBileEngine.Debugger.Log("Match Server retiré ! ID : " + coID, Color.yellow);
            }
        }

        DisconnectedMatchServers.Clear();
    }
Exemple #4
0
 public void Deactivate()
 {
     if (!Activated)
     {
         BloodAndBileEngine.Debugger.Log("Le module Match Servers est déjà désactivé !", Color.yellow); return;
     }
     Activated = false;
     Handlers.Clear();                         // On ne veut pas que le module réagisse aux messages reçus, donc on supprime tous les handlers.
     foreach (int coID in MatchServerIPs.Keys) // Déconnexion de tous les match servers.
     {
         NetworkSocket.Disconnect(coID);
     }
     MatchServerIPs.Clear();
 }
    public void DisconnectFromServer()
    {
        if (_networkSocket == null)
        {
            return;
        }

        if (!_networkSocket.IsConnected)
        {
            return;
        }

        _networkSocket.Disconnect();
        _networkSocket = null;
    }
        public void BackgroundImage_MouseUp(object sender, EventArgs e)
        {
            if (EngineMessageBox.Visible)
            {
                return;
            }

            EngineMultimedia.Play(EngineSoundEnum.Click);

            NetworkSocket.Disconnect(NetworkSocketEnum.WorldServer);

            Common.Configuration.IPAddress[(int)NetworkSocketEnum.WorldServer] = new IPAddress(IP, Port);

            LoginServerPacket.ConnectWorldServer(Index);

            EngineMessageBox.Enabled = false;
            EngineMessageBox.Show("Aguardando conexão");
        }
Exemple #7
0
    /**
     * <summary> Réponse à l'authentification. </summary>
     */
    void OnAuthentificationResponse(NetworkMessageInfo info, BloodAndBileEngine.Networking.NetworkMessages.ConditionCheckResponseMessage message)
    {
        if (message.Accepted)
        {
            Debugger.Log("Authentification au Master Server acceptée !");
            ClientConnectionsManager.AddConnection("MasterServer", info.ConnectionID);

            // Mise à jour des informations client.

            Client.Username = Username;

            // Transition vers le "MainMenuState".
            Client.ChangeState(new MainMenuState());
        }
        else
        {
            Debugger.Log("Authentification au Master Server refusée ! Raison : " + message.Reason, UnityEngine.Color.red);
            NetworkSocket.Disconnect(info.ConnectionID); // On se déconnecte du master server.
        }
    }
        /// <summary>
        /// Volta a tela de seleção de personagem.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private static void CharacterButton_MouseUp(object sender, EventArgs e)
        {
            EngineMultimedia.Play(EngineSoundEnum.Click);

            //pede a lista de personagens
            WorldPacket.RequestPreLoad();

            //muda para seleção de personagem
            EngineCore.GameState          = 3;
            WindowCharacter.SelectedIndex = 0;

            Visible = false;

            //limpa o endereço do servidor para uma nova conexão
            Common.Configuration.IPAddress[(int)NetworkSocketEnum.GameServer].Clear();
            NetworkSocket.Disconnect(NetworkSocketEnum.GameServer);

            //limpa a lista de jogadores.
            GameClient.Client.Player.Clear();

            //limpa as informações do jogador local.
            GameClient.Client.PlayerLocal.Character.Clear();
        }