示例#1
0
        private void TryToLogUp()
        {
            ColorEngine.Yellow();
            Console.WriteLine();
            Console.WriteLine(new string('*', 10) + "Create account:" + new string('*', 10));

            CurrentUserAccount = GetAccountWithData();
            Validator          = new UsersValidator(CurrentUserAccount);

            if (Validator.IsValid())
            {
                bool ifCreationIsSuccessfully = DataBase.CreateNewUserAccount(CurrentUserAccount);
                if (ifCreationIsSuccessfully)
                {
                    ColorEngine.Yellow();
                    Console.Write($"Welcome {CurrentUserAccount.Name}...");
                    Console.WriteLine("\tLet's start to play");
                    Console.WriteLine();
                }
                else
                {
                    ColorEngine.Red();
                    Console.WriteLine("This account already exists.");
                    Again(TryToLogUp);
                }
            }
            else
            {
                Again(TryToLogUp);
            }
        }
示例#2
0
        private void TryToLogIn()
        {
            ColorEngine.Yellow();
            Console.WriteLine();
            Console.WriteLine(new string('*', 10) + "Login:"******"This account already exists.");
                    Again(TryToLogIn);
                }
                else
                {
                    ColorEngine.Yellow();
                    Console.Write($"Welcome {CurrentUserAccount.Name}...");
                    Console.WriteLine("\tLet's start to play");
                    Console.WriteLine();
                }
            }
            else
            {
                Again(TryToLogIn);
            }
        }