
Untitled
By: a guest on
Aug 10th, 2012 | syntax:
C# | size: 1.08 KB | hits: 14 | expires: Never
using UnityEngine;
using System.Collections;
public class LoginWindow : WindowBase
{
private string username = "";
private string password = "";
// Use this for initialization
protected override void Start ()
{
base.Start();
initializeWindow("Login",new Rect((Screen.width * 0.5f) - 150,Screen.height * 0.5f,300,150),3,KeyCode.T,LoginFunc,true);
}
protected override void Update()
{
base.Update();
}
// Update is called once per frame
protected override void OnGUI ()
{
base.OnGUI();
}
void LoginFunc(int id)
{
GUI.Label(new Rect(xySpacing.x,(xySpacing.y + 20),75,20),"Account: ");
username = GUI.TextField(new Rect(xySpacing.x + 75,(xySpacing.y + 20),125,20),username);
GUI.Label(new Rect(xySpacing.x,(xySpacing.y + 40),75,20),"Password: ");
password = GUI.PasswordField(new Rect(xySpacing.x + 75,(xySpacing.y + 40),125,20),password,'*');
if(GUI.Button(new Rect(windowRect.width * 0.5f,(windowRect.height - xySpacing.y) - 35,125,35),"Login"))
{
Debug.Log("Logging in. Account: " + username + "password: " + password);
}
}
}