Guest User

Untitled

a guest
Sep 16th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.08 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class LoginWindow : WindowBase
  5. {
  6.     private string username = "";
  7.     private string password = "";
  8.     // Use this for initialization
  9.     protected override void Start ()
  10.     {
  11.         base.Start();
  12.         initializeWindow("Login",new Rect((Screen.width * 0.5f) - 150,Screen.height * 0.5f,300,150),3,KeyCode.T,LoginFunc,true);
  13.     }
  14.    
  15.     protected override void Update()
  16.     {
  17.         base.Update();
  18.     }
  19.     // Update is called once per frame
  20.     protected override void OnGUI ()
  21.     {
  22.         base.OnGUI();
  23.     }
  24.     void LoginFunc(int id)
  25.     {
  26.         GUI.Label(new Rect(xySpacing.x,(xySpacing.y + 20),75,20),"Account: ");
  27.         username = GUI.TextField(new Rect(xySpacing.x + 75,(xySpacing.y + 20),125,20),username);
  28.        
  29.         GUI.Label(new Rect(xySpacing.x,(xySpacing.y + 40),75,20),"Password: ");
  30.         password = GUI.PasswordField(new Rect(xySpacing.x + 75,(xySpacing.y +  40),125,20),password,'*');
  31.         if(GUI.Button(new Rect(windowRect.width * 0.5f,(windowRect.height - xySpacing.y) - 35,125,35),"Login"))
  32.         {
  33.             Debug.Log("Logging in. Account: " + username + "password: " + password);
  34.         }
  35.     }
  36. }
Add Comment
Please, Sign In to add comment