Exemple #1
0
        public static void Start()
        {
            random = new Random();
            int RandomWordIndex = random.Next(0, Words.NumberOfWords());

            if (Words.NumberOfWords() <= 0)
            {
                Write.MiddleC("You need to add words first");
                WaitFunctions.WaitForSeconds(3);
                HangManMenu.ChooseLevelMenu();
                return;
            }

            Lives        = 3;
            Board        = new List <string>();
            Word         = Words.GetWord(RandomWordIndex);
            playerAnswer = new string[Word.Length];

            for (int i = 0; i < playerAnswer.Length; i++)
            {
                playerAnswer[i] = "...";
            }

            SetKeyBoard(Word);
            SetBoard();

            Update();
        }
 public void navigateToLoginPage()
 {
     Driver.driver.Url = Constants.URL;
     WaitFunctions.explicitWaitUntilDisplayed(Driver.driver, signInButton, 17);
     verifyLandingPageTitleIsCorrect();
     clickSignInButton();
 }
        public void populateLoginDetails(String userName, String passWord)
        {
            WaitFunctions.explicitWaitUntilDisplayed(Driver.driver, userLoginName, 17);

            setUserName(userName);

            setPassword(passWord);

            clickSaveButton();
        }
 public void verifyAllLoginElementsAreVisible()
 {
     WaitFunctions.explicitWaitUntilDisplayed(Driver.driver, userLoginName, 17);
     WaitFunctions.explicitWaitUntilDisplayed(Driver.driver, userPassword, 17);
     WaitFunctions.explicitWaitUntilDisplayed(Driver.driver, saveButton, 17);
 }
Exemple #5
0
        ///<summary> Updating frames </summary>
        public static void Update()
        {
            DispalyBoard(0);
            string Character;
            int    AnswerLength = 0;

            while (true)
            {
                Character = Console.ReadLine();
                Character = Character.ToUpper();

                //Checking if the user entered more than one character
                while (Character.Length > 1)
                {
                    DispalyBoard(1);
                    Character = Console.ReadLine();
                    Character = Character.ToUpper();
                }
                //Check if the user entered a character does not exist on the keyboard

                while (!CheckCharacterExist(Character))
                {
                    DispalyBoard(2);
                    Character = Console.ReadLine();
                    Character = Character.ToUpper();

                    if (Character.Length > 1)
                    {
                        break;
                    }
                }

                if (Character.Length > 1)
                {
                    DispalyBoard(1);
                    continue;
                }

                if (CheckAnswer(Character))
                {
                    for (int i = 0; i < Board.Count; i++)
                    {
                        if (Character == Board[i])
                        {
                            Board[i] = " ";
                            break;
                        }
                    }
                    AnswerLength++;
                    DispalyBoard(3);
                }

                else
                {
                    Lives--;
                    DispalyBoard(4);
                }

                if (Lives <= 0)
                {
                    break;
                }

                if (AnswerLength == Word.Length)
                {
                    break;
                }
            }

            ClearFunctions.ClearAll();
            if (Lives <= 0)
            {
                Write.MiddleC("OPS, You Lost :(");
                WaitFunctions.WaitForSeconds(4);
                ClearFunctions.ClearAll();
                WaitFunctions.WaitForSeconds(1);
            }

            else
            {
                for (int i = 0; i < 3; i++)
                {
                    Write.Middle("You Win!");
                    WaitFunctions.WaitForMS(800);
                    ClearFunctions.ClearAll();
                    WaitFunctions.WaitForMS(300);
                }
            }

            HangManMenu.MatchResultMenu();
        }