Ejemplo n.º 1
0
        void ServerIdentificationResponse(User u, NetworkConnection client)
        {
            ServerIdentificationResponseMessage msg = new ServerIdentificationResponseMessage();

            msg.isSuccessful  = u.isIdentified;
            msg.userId        = u.userId;
            msg.userName      = u.userName; // temporary
            msg.currentGameId = u.currentGameId;

            client.Send(ServerIdentificationResponseMessage.ID, msg);
            Debug.Log("Server sent ServerIdentificationResponse " + msg.isSuccessful);
        }
Ejemplo n.º 2
0
        void OnClientIdentified(NetworkMessage netMsg)
        {
            ServerIdentificationResponseMessage msg = netMsg.ReadMessage <ServerIdentificationResponseMessage>();

            if (msg.isSuccessful)
            {
                ClockMaster.clientSingleton.startSyncClient(); // sync clock
                Debug.Log("Client successfully identified");
                user = new User(msg.userId, msg.userName);
                user.isIdentified  = true;
                user.currentGameId = msg.currentGameId;
                // If client was in game on identification, join it
                if (msg.currentGameId != 0)
                {
                    // TODO - rejoin logic
                }
            }
            else
            {
                Debug.Log("Client failed identification");
            }
        }