Beispiel #1
0
        private void GetPassword(PasswordPhase password)
        {
            //Get the users input.
            var input = connectedPlayer.ReceiveInput();

            //See if the password is empty
            if (string.IsNullOrEmpty(input))
            {
                connectedPlayer.SendMessage("Your password is invalid, please try again.");
                return;
            }

            //Make sure the length of the password meets the minimum requirement of the server
            if (input.Length < director.Server.MinimumPasswordSize)
            {
                connectedPlayer.SendMessage("Your password must be at least " + director.Server.MinimumPasswordSize + " characters long.");
                return;
            }

            //All things checkout, save the password for later.
            if (password == PasswordPhase.FirstPassword)
            {
                firstPassword = input;
                currentState  = CurrentState.EnteringPasswordSecond;
            }
            else
            {
                secondPassword = input;

                if (firstPassword != secondPassword)
                {
                    connectedPlayer.SendMessage("The two passwords you entered do not match! Please try again.");
                    currentState = CurrentState.EnteringPasswordFirst;
                    return;
                }
                connectedPlayer.SetPlayerCredentials(secondPassword);
                //We have the passwords verified and the username stored so lets finish up creating the character
                //and pass it on to the character customization states
                FinishSetup();
            }
        }
        private void GetPassword(PasswordPhase password)
        {
            //Get the users input.
            var input = connectedPlayer.ReceiveInput();

            //See if the password is empty
            if (string.IsNullOrEmpty(input))
            {
                connectedPlayer.SendMessage("Your password is invalid, please try again.");
                return;
            }

            //Make sure the length of the password meets the minimum requirement of the server
            if (input.Length < director.Server.MinimumPasswordSize)
            {
                connectedPlayer.SendMessage("Your password must be at least " + director.Server.MinimumPasswordSize + " characters long.");
                return;
            }

            //All things checkout, save the password for later.
            if (password == PasswordPhase.FirstPassword)
            {
                firstPassword = input;
                currentState = CurrentState.EnteringPasswordSecond;
            }
            else
            {
                secondPassword = input;

                if (firstPassword != secondPassword)
                {
                    connectedPlayer.SendMessage("The two passwords you entered do not match! Please try again.");
                    currentState = CurrentState.EnteringPasswordFirst;
                    return;
                }
                connectedPlayer.SetPlayerCredentials(secondPassword);
                //We have the passwords verified and the username stored so lets finish up creating the character
                //and pass it on to the character customization states
                FinishSetup();
            }
        }