Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.85 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.SceneManagement;
  5. using UnityEngine.UI;
  6.  
  7. public class LoginHandler : MonoBehaviour {
  8.  
  9.     public void Login() {
  10.  
  11.         InputField Username = GameObject.FindWithTag("Login_username").GetComponent<InputField>();
  12.         InputField Password = GameObject.FindWithTag("Login_password").GetComponent<InputField>();
  13.         Text LoginInfo = GameObject.FindWithTag("Login_info").GetComponent<Text>();
  14.  
  15.         if(User.Login(Username.text, Password.text)) {
  16.  
  17.             LoginInfo.enabled = true;
  18.             LoginInfo.color = Color.green;
  19.             LoginInfo.text = "Uspješan login! Učitavanje...";
  20.  
  21.             SceneManager.LoadScene("glavna");
  22.         } else {
  23.  
  24.             // NEKI ERROR
  25.             LoginInfo.enabled = true;
  26.             LoginInfo.color = Color.red;
  27.             LoginInfo.text = "Greška: Pogrešan username/password";
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement