Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //--------------------------------------------------------------
- //--------------------------------------------------------------
- // Programmed and Scripted by: THATSWAN "Richard Swanson" © 2009
- //--------------------------------------------------------------
- //--------------------------------------------------------------
- //------------------------------------ REGISTRATION GUI
- var userNameData = "USERNAME";
- var passwordData = "PASSWORD";
- var emailData = "EMAIL ADDRESS";
- var activeTextField = "nothing";
- var updateText = false;
- // GUI TEXTFIELD
- var userNameText : GUIText;
- var passWordText : GUIText;
- var eMailText : GUIText;
- // 2D TEXTURES
- var editTexture: Texture2D; // edit BTN
- var regTexture: Texture2D; // registration BG
- var regBGTexture: GUIStyle; // registration BG
- var editBtn : GUIStyle;
- var regBtn : GUIStyle;
- var cancelBtn : GUIStyle;
- // BACK BTN
- var backBtnTexture: Texture2D;
- var backBtn : GUIStyle;
- var newBlackBox : Texture2D;
- fadeInOut.fadeOutGraphic = newBlackBox;
- // ------------- SOUND
- var currentButtonClicked = "";
- var clickSound : AudioSource;
- function playClickSound(){
- //clickSound.pitch = 1.5;
- clickSound.Play();
- yield new WaitForSeconds(0.5);
- if(currentButtonClicked == "back clicked"){
- Application.LoadLevel(2);
- }
- }
- function Start () { // --------------- FADE THAT MOFO
- Time.timeScale = 1.0;
- fadeInOut.fadeIn();
- }
- function OnGUI () {
- // ------BG
- GUI.Box(Rect(4,0,482,322), "", regBGTexture);
- // ---- BACK BTN
- if (GUI.Button (Rect(0,Screen.height - backBtnTexture.height, backBtnTexture.width, backBtnTexture.height), "", backBtn)) {
- loadingShit = true;
- print("BACK BUTTON CLICKED");
- currentButtonClicked = "back clicked";
- clickSound.pitch = 1.5;
- playClickSound();
- //Application.LoadLevel(2);
- }
- // ---- EDIT BTN 1
- if (GUI.Button (Rect(Screen.width-120,53, editTexture.width, editTexture.height), "", editBtn)) {
- clickSound.Play();
- //PlayerPrefs.SetString("TEST", "THIS WORKS, BUT WHY NOT THE KEYBOARD?");
- activeTextField = "usernameEngaged";
- PlayerPrefs.SetString("sb_command", "getKeystrokes");
- updateText = true;
- }
- // ---- EDIT BTN 2
- if (GUI.Button (Rect(Screen.width-120,93, editTexture.width, editTexture.height), "", editBtn)) {
- clickSound.Play();
- activeTextField = "passwordEngaged";
- PlayerPrefs.SetString("sb_command", "getKeystrokes");
- updateText = true;
- }
- // ---- EDIT BTN 3
- if (GUI.Button (Rect(Screen.width-120,133, editTexture.width, editTexture.height), "", editBtn)) {
- clickSound.Play();
- activeTextField = "emailEngaged";
- PlayerPrefs.SetString("sb_command", "getKeystrokes");
- updateText = true;
- }
- // ---- REGISTER BTN
- if (GUI.Button (Rect(Screen.width-170,235, regTexture.width, regTexture.height), "", regBtn)) {
- clickSound.Play();
- }
- // ---- CANCEL BTN
- if (GUI.Button (Rect(Screen.width-330,235, regTexture.width, regTexture.height), "", cancelBtn)) {
- clickSound.Play();
- }
- if (updateText == true) {
- userNameText.text = userNameData; //PlayerPrefs.GetString("sb_command");
- passWordText.text = passwordData;
- eMailText.text = emailData;
- }
- }
- function Update () {
- if(activeTextField == "usernameEngaged"){
- userNameData = PlayerPrefs.GetString("sb_command");
- } else if (activeTextField == "passwordEngaged"){
- passwordData = PlayerPrefs.GetString("sb_command");
- } else if (activeTextField == "emailEngaged"){
- emailData = PlayerPrefs.GetString("sb_command");
- }
- }
Add Comment
Please, Sign In to add comment