Пример #1
0
        // ========================== MESSAGE HANDLERS - AUTH ============================

        // -------------------------------------------------------------------------------
        // OnAuthRequestMessage
        // @Client -> @Server
        // -------------------------------------------------------------------------------
        void OnClientMessageRequestAuth(NetworkConnection conn, ClientMessageRequestAuth msg)
        {
            ServerMessageResponseAuth message = new ServerMessageResponseAuth
            {
                success          = true,
                text             = "",
                causesDisconnect = false
            };

            if (checkApplicationVersion && msg.clientVersion != Application.version)
            {
                message.text    = systemText.versionMismatch;
                message.success = false;
            }
            else
            {
                base.OnServerAuthenticated.Invoke(conn);
            }

            conn.Send(message);

            if (!message.success)
            {
                conn.isAuthenticated = false;
                conn.Disconnect();
            }
        }
Пример #2
0
        // -------------------------------------------------------------------------------
        // ClientAuthenticate
        // @Client -> @Server
        // -------------------------------------------------------------------------------
        public void ClientAuthenticate()
        {
            ClientMessageRequestAuth authRequestMessage = new ClientMessageRequestAuth
            {
                clientVersion = Application.version
            };

            NetworkClient.Send(authRequestMessage);
        }