// HANDLERS

    /**
     * <summary> Quand on reçoit la liste des IPs des Match Server. </summary>
     */
    void OnMatchServersListReceived(BloodAndBileEngine.Networking.NetworkMessageInfo info, BloodAndBileEngine.Networking.NetworkMessages.IPListMessage message)
    {
        BloodAndBileEngine.Debugger.Log("Liste des Match Servers reçue !");
        MatchServerIPs = message.IPList;

        if (MatchServerIPs.Length > 0)
        {
            foreach (string IP in MatchServerIPs)
            {
                BloodAndBileEngine.Debugger.Log("--- " + IP);
            }

            IPsReceived      = true;
            MatchServerPings = new UnityEngine.Ping[MatchServerIPs.Length];
            for (int i = 0; i < MatchServerPings.Length; i++)
            {
                MatchServerPings[i] = new UnityEngine.Ping(MatchServerIPs[i]);
            }
        }
        else
        {
            BloodAndBileEngine.Debugger.Log("Pas de Match Servers !", UnityEngine.Color.red);
            // Retour au MainMenuState
            Client.ChangeState(new MainMenuState());
        }
    }
Ejemplo n.º 2
0
 /// <summary>
 /// A la réception d'un message du type "StateConstruction"
 /// Pour chaque IStateUpdateReceiver dans StateUpdateReceivers,
 /// on lance la méthode "OnStateConstruction" qui permet de construire le WorldState avec les informations reçues.
 /// </summary>
 /// <param name="info"></param>
 /// <param name="message"></param>
 void OnStateConstruction(BloodAndBileEngine.Networking.NetworkMessageInfo info, StateConstructionMessage message)
 {
     foreach (IStateUpdateReceiver receiver in StateUpdateReceivers)
     {
         receiver.OnStateConstruction(message);
     }
 }
Ejemplo n.º 3
0
 void OnAuthentificationResponseReceived(BloodAndBileEngine.Networking.NetworkMessageInfo info, BloodAndBileEngine.Networking.NetworkMessages.ConditionCheckResponseMessage msg)
 {
     if (msg.Accepted)
     {
         BloodAndBileEngine.Debugger.Log("Authentification au Master Server acceptée !");
         Connected = true;
     }
     else
     {
         BloodAndBileEngine.Debugger.Log("Authentification au Master Server refusée : " + msg.Reason, UnityEngine.Color.red);
         BloodAndBileEngine.Networking.NetworkSocket.Disconnect(MasterServerConnectionID); // Déconnexion du Master Server.
     }
 }
Ejemplo n.º 4
0
 void OnAuthentificationResponseReceived(BloodAndBileEngine.Networking.NetworkMessageInfo info, BloodAndBileEngine.Networking.NetworkMessages.ConditionCheckResponseMessage message)
 {
     if (message.Accepted)
     {
         BloodAndBileEngine.Debugger.Log("Authentification au Match Server acceptée !");
         BloodAndBileEngine.Debugger.Log("Attente d'un Match.");
         MatchServerConnected = true;
     }
     else
     {
         BloodAndBileEngine.Debugger.Log("Authentification au Match Server refusée : " + message.Reason, UnityEngine.Color.red);
         BloodAndBileEngine.Debugger.Log("Retour au MatchServerSearchState...", UnityEngine.Color.red);
         Client.ChangeState(new MatchServerSearchState());
     }
 }
Ejemplo n.º 5
0
 void OnMatchStarted(BloodAndBileEngine.Networking.NetworkMessageInfo info, BloodAndBileEngine.Networking.NetworkMessage message)
 {
     // Switch vers le OnlinePlayingState.
     Client.ChangeState(new OnlinePlayingState(MatchServerConnectionID));
 }