Advertisement
Guest User

Untitled

a guest
Jul 4th, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.77 KB | None | 0 0
  1. //this script has the best english ever Kappa.
  2.  
  3. /*
  4.  * the broblem:
  5.  * in the void "SubmitButton" there are 2 lines that set the submit name and password to a string to use in the script but the script is void "LoginButton" dont see the string or don't get that string???
  6.  */
  7. using UnityEngine;
  8. using System.Collections;
  9. using UnityEngine.UI;
  10. using UnityEngine.SceneManagement;
  11.     public class loginScript : MonoBehaviour {
  12.     public  Text name;// login tab for username
  13.     public  Text pw; // login tab for password
  14.     public Text createName; // create account tab username
  15.     public Text createPw; // create account tab password
  16.  
  17.     public void SubmitButton()
  18.     {
  19.         string createUsername = createName.text.ToString();
  20.         string createPassword = createPw.text.ToString();
  21.  
  22.     }
  23.  
  24.     public void LoginButton()
  25.     {
  26.         string userName = name.text.ToString();
  27.         string password = pw.text.ToString();
  28.  
  29.         if (string.IsNullOrEmpty(userName)) // check if there is a letter in the textfield
  30.         {
  31.             Debug.Log("ERROR | No content in login or password tab"); //if not this error will log
  32.         }
  33.         // if it has 0 errors this will check if the submited text is the same as the text in the login screen
  34.         else if (userName.Contains(createUsername) && password.Contains(createPassword))
  35.         {
  36.             SceneManager.LoadScene("mainMenu");
  37.  
  38.         }
  39.         //error message if the username or password is not the same as submitted
  40.         if (userName.Contains(createUsername) && password.Contains(createPassword) == false)
  41.         {
  42.             Debug.Log("ERROR | Wrong username or password");
  43.         }
  44.     }
  45.  
  46.  
  47.     public void QuitButton() // quit button
  48.     {
  49.         Application.Quit();
  50.     }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement