Advertisement
vitelize

Unity Login Interface

Jul 17th, 2012
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.92 KB | None | 0 0
  1. // From http://blogs.floriancavallo.fr/post/2012/07/17/Unity-Creer-une-interface-de-Login.aspx
  2.  
  3. public class UserInterface : MonoBehaviour {
  4.     public  string username ;
  5.     public string password;
  6.     private Rect windowRect = new Rect (200, 150, 350, 250);
  7.  
  8.     void OnGUI(){        
  9.         windowRect = GUI.Window (0, windowRect, WindowFunction, "Identification");     
  10.     }
  11.  
  12.     void WindowFunction (int windowID) {
  13.  
  14.         GUIStyle LoginStyle = new GUIStyle();      
  15.         LoginStyle.fontSize= 13 ;
  16.         LoginStyle.normal.textColor = Color.black;
  17.        
  18.         GUI.Label(new Rect(90,50,150,25),"Login :",LoginStyle);
  19.         GUI.Label(new Rect(90,100,150,25),"Password :",LoginStyle);
  20.  
  21.         username = GUI.TextField(new Rect(170, 50, 150, 25), username, 20);
  22.         password = GUI.PasswordField(new Rect(170,100,150,25),password, "*"[0], 25);
  23.        
  24.         if (GUI.Button(new Rect(125,175,100,25), "Login")){
  25.             //makeLogin(username, password);
  26.         };
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement