public void OnEntry()
    {
        if (MatchServerIP == "")
        {
            // Aucune IP n'a été transmise. On le signal sur la console puis on revient au menu principal.

            BloodAndBileEngine.Debugger.Log("IP du MatchServer invalide... retour au menu principal.", UnityEngine.Color.red);
            Client.ChangeState(new MainMenuState());
            return;
        }
        else
        {
            ClientConnectionsManager.AddConnection("MatchServer", MatchServerConnectionID);

            NetworkHandlers = new BloodAndBileEngine.Networking.HandlersManager();
            InputHandlers   = new BloodAndBileEngine.InputHandlersManager();

            // Handlers

            BloodAndBileEngine.Networking.NetworkSocket.RegisterOnDisconnectionCallback(OnConnectionLost);
            BloodAndBileEngine.Networking.NetworkSocket.RegisterOnConnectionEstablishedCallback(OnConnectionEstablished);
            NetworkHandlers.Add <BloodAndBileEngine.Networking.NetworkMessage>(20001, OnMatchStarted);
            NetworkHandlers.Add <BloodAndBileEngine.Networking.NetworkMessages.ConditionCheckResponseMessage>(60001, OnAuthentificationResponseReceived);

            ConnectToMatchServer(); // Lancement de la connexion au Match Server.
        }
    }
示例#2
0
 public void OnEntry()
 {
     NetworkHandlers = new BloodAndBileEngine.Networking.HandlersManager();
     InputHandlers   = new InputHandlersManager();
     BloodAndBileEngine.Networking.NetworkSocket.RegisterOnDisconnectionCallback(OnDisconnected);
     InputHandlers.Add("StartMatchmaking", StartMatchmaking);
     if (ClientConnectionsManager.GetConnectionIDFromName("MasterServer") == -1)
     {
         BloodAndBileEngine.Debugger.Log("Pas de connexion à un Master Server ! Retour au LoginState...", UnityEngine.Color.red);
         Client.ChangeState(new LoginState());
     }
 }
示例#3
0
    void Start()
    {
        NetworkSocket.Initialise(25001, 500); // Initialise un socket au port 25000 avec 500 connexions au max.
        InitialiseModules();
        Activate();
        BloodAndBileEngine.NetworkCommandManager.Initialize();
        InputHandlers = new BloodAndBileEngine.InputHandlersManager();
        InputHandlers.Add("Activate", (object[] parameters) => Activate());
        InputHandlers.Add("Deactivate", (object[] parameters) => Deactivate());

        PlayerControlManager = new BloodAndBileEngine.PlayerControlCommandManager();
        PlayerControlManager.SetExecuteLocally();
    }
示例#4
0
 public void Initialise()
 {
     InputHandlers = new BloodAndBileEngine.InputHandlersManager();
 }