Esempio n. 1
0
        // -------------------------------------------------------------------------------
        // RequestPlayerRegister
        // @Client
        // -------------------------------------------------------------------------------
        protected override bool RequestPlayerRegister(NetworkConnection conn, string playerName, string userName, string prefabName)
        {
            if (!base.RequestPlayerRegister(conn, playerName, userName, prefabName))
            {
                return(false);
            }

            ClientMessageRequestPlayerRegister message = new ClientMessageRequestPlayerRegister
            {
                playername = playerName,
                username   = userName,
                prefabname = prefabName
            };

            conn.Send(message);

            return(true);
        }
Esempio n. 2
0
        // -------------------------------------------------------------------------------
        // OnClientMessageRequestPlayerRegister
        // @Client -> @Server
        // -------------------------------------------------------------------------------
        void OnClientMessageRequestPlayerRegister(NetworkConnection conn, ClientMessageRequestPlayerRegister msg)
        {
            ServerMessageResponsePlayerRegister message = new ServerMessageResponsePlayerRegister
            {
                success          = true,
                text             = "",
                causesDisconnect = false
            };

            if (DatabaseManager.singleton.TryPlayerRegister(msg.playername, msg.username, msg.prefabname))
            {
                RegisterPlayer(msg.username, msg.playername, msg.prefabname);
                message.text = systemText.playerRegisterSuccess;
            }
            else
            {
                message.text    = systemText.playerRegisterFailure;
                message.success = false;
            }

            conn.Send(message);
        }