Guest User

Untitled

a guest
Jun 23rd, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.47 KB | None | 0 0
  1. //--------------------------------------------------------------
  2. //--------------------------------------------------------------
  3. // Programmed and Scripted by: THATSWAN "Richard Swanson" © 2009
  4. //--------------------------------------------------------------
  5. //--------------------------------------------------------------
  6.  
  7. //------------------------------------ REGISTRATION GUI
  8.  
  9.  
  10. var userNameData = "USERNAME";
  11. var passwordData = "PASSWORD";
  12. var emailData = "EMAIL ADDRESS";
  13. var activeTextField = "nothing";
  14. var updateText = false;
  15.  
  16. // GUI TEXTFIELD
  17. var userNameText : GUIText;
  18. var passWordText : GUIText;
  19. var eMailText : GUIText;
  20.  
  21. // 2D TEXTURES
  22.  
  23.  
  24. var editTexture: Texture2D; // edit BTN
  25. var regTexture: Texture2D; // registration BG
  26.  
  27. var regBGTexture: GUIStyle; // registration BG
  28. var editBtn : GUIStyle;
  29. var regBtn : GUIStyle;
  30. var cancelBtn : GUIStyle;
  31.  
  32. // BACK BTN
  33. var backBtnTexture: Texture2D;
  34. var backBtn : GUIStyle;
  35.  
  36. var newBlackBox : Texture2D;
  37. fadeInOut.fadeOutGraphic = newBlackBox;
  38.  
  39. // ------------- SOUND
  40. var currentButtonClicked = "";
  41. var clickSound : AudioSource;
  42.  
  43. function playClickSound(){
  44. //clickSound.pitch = 1.5;
  45. clickSound.Play();
  46. yield new WaitForSeconds(0.5);
  47.  
  48. if(currentButtonClicked == "back clicked"){
  49. Application.LoadLevel(2);
  50. }
  51. }
  52.  
  53. function Start () { // --------------- FADE THAT MOFO
  54. Time.timeScale = 1.0;
  55. fadeInOut.fadeIn();
  56. }
  57.  
  58.  
  59.  
  60.  
  61. function OnGUI () {
  62. // ------BG
  63. GUI.Box(Rect(4,0,482,322), "", regBGTexture);
  64.  
  65. // ---- BACK BTN
  66. if (GUI.Button (Rect(0,Screen.height - backBtnTexture.height, backBtnTexture.width, backBtnTexture.height), "", backBtn)) {
  67. loadingShit = true;
  68. print("BACK BUTTON CLICKED");
  69. currentButtonClicked = "back clicked";
  70. clickSound.pitch = 1.5;
  71. playClickSound();
  72. //Application.LoadLevel(2);
  73. }
  74.  
  75. // ---- EDIT BTN 1
  76. if (GUI.Button (Rect(Screen.width-120,53, editTexture.width, editTexture.height), "", editBtn)) {
  77. clickSound.Play();
  78. //PlayerPrefs.SetString("TEST", "THIS WORKS, BUT WHY NOT THE KEYBOARD?");
  79. activeTextField = "usernameEngaged";
  80. PlayerPrefs.SetString("sb_command", "getKeystrokes");
  81. updateText = true;
  82. }
  83. // ---- EDIT BTN 2
  84. if (GUI.Button (Rect(Screen.width-120,93, editTexture.width, editTexture.height), "", editBtn)) {
  85. clickSound.Play();
  86. activeTextField = "passwordEngaged";
  87. PlayerPrefs.SetString("sb_command", "getKeystrokes");
  88. updateText = true;
  89. }
  90. // ---- EDIT BTN 3
  91. if (GUI.Button (Rect(Screen.width-120,133, editTexture.width, editTexture.height), "", editBtn)) {
  92. clickSound.Play();
  93. activeTextField = "emailEngaged";
  94. PlayerPrefs.SetString("sb_command", "getKeystrokes");
  95. updateText = true;
  96. }
  97. // ---- REGISTER BTN
  98. if (GUI.Button (Rect(Screen.width-170,235, regTexture.width, regTexture.height), "", regBtn)) {
  99. clickSound.Play();
  100. }
  101. // ---- CANCEL BTN
  102. if (GUI.Button (Rect(Screen.width-330,235, regTexture.width, regTexture.height), "", cancelBtn)) {
  103. clickSound.Play();
  104. }
  105.  
  106. if (updateText == true) {
  107. userNameText.text = userNameData; //PlayerPrefs.GetString("sb_command");
  108. passWordText.text = passwordData;
  109. eMailText.text = emailData;
  110. }
  111.  
  112. }
  113.  
  114. function Update () {
  115.  
  116. if(activeTextField == "usernameEngaged"){
  117. userNameData = PlayerPrefs.GetString("sb_command");
  118. } else if (activeTextField == "passwordEngaged"){
  119. passwordData = PlayerPrefs.GetString("sb_command");
  120. } else if (activeTextField == "emailEngaged"){
  121. emailData = PlayerPrefs.GetString("sb_command");
  122. }
  123.  
  124. }
Add Comment
Please, Sign In to add comment