Advertisement
Guest User

Untitled

a guest
Aug 24th, 2019
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var s :String;
  2. var username :String;
  3. var pw :String;
  4. var pw2 :String;
  5. var info:String;
  6. var success :boolean;
  7. var skin:GUISkin;
  8. var LogoStyle :GUIStyle;
  9. var DescribtionStyle :GUIStyle;
  10. var obj :GameObject[];
  11. var login :boolean;
  12. function getting(extension :String){
  13. var url :String = "http://www.yourlink.org/" + extension;
  14. var www : WWW = new WWW (url);
  15. yield www;
  16. s = www.text;
  17. }
  18. function write(uname :String, pw :String, pw2 :String){
  19. if(pw == pw2){
  20. if(uname.Contains("^") || uname.Contains("°") || uname.Contains("'") || uname.Contains("§") || uname.Contains("$") || uname.Contains("%") || uname.Contains("") || uname.Contains("/") || uname.Contains("=") || uname.Contains("?") || uname.Contains("*") || uname.Contains("~") || uname.Contains("@")){
  21. s = "Username isn't formal right";
  22. }else{
  23. if(uname.Length > 6){
  24. if(pw.Length > 6){
  25. var www : WWW = new WWW ("http://www.yourlinkorg/write_new.php?username="+username+"&pw="+pw);
  26. yield www;
  27. s = www.text;
  28. }else s="Password is too short (min. 7 Chars)";
  29. }else s="Username is too short (min. 7 Chars)";
  30. }
  31. }else{
  32. s = "Passwords do not match";
  33. }
  34. }
  35.  
  36.  
  37. function OnGUI () {
  38. GUI.skin = skin;
  39.  
  40.  
  41. username = GUI.TextField(Rect(obj[2].transform.position.x, obj[2].transform.position.y, 348, 48), username, 25);
  42.  
  43. pw = GUI.PasswordField(Rect(obj[4].transform.position.x, obj[4].transform.position.y, 348, 48), pw , "*"[0], 25);
  44.  
  45. pw2 = GUI.PasswordField(Rect(obj[6].transform.position.x, obj[6].transform.position.y, 348, 48), pw2 , "*"[0], 25);
  46.  
  47. GUI.Label(Rect(obj[0].transform.position.x, obj[0].transform.position.y,Screen.width , Screen.width), "Loginnation", LogoStyle);
  48. GUI.Label(Rect(obj[1].transform.position.x, obj[1].transform.position.y, Screen.width, Screen.width), "Username:", DescribtionStyle);
  49. GUI.Label(Rect(obj[3].transform.position.x, obj[3].transform.position.y, Screen.width, Screen.width), "Password:", DescribtionStyle);
  50. GUI.Label(Rect(obj[7].transform.position.x, obj[7].transform.position.y, Screen.width, Screen.width), "Repeat password:", DescribtionStyle);
  51.  
  52. if(GUI.Button(Rect(obj[5].transform.position.x, obj[5].transform.position.y, 166, 39),"Enter")){
  53. if(login){
  54. getting("process.php?username="+username+"&passwort="+pw+"&info=success");
  55. username = "";
  56. pw = "";
  57. pw2 = "";
  58. }else{
  59. write(username, pw, pw2);
  60. }
  61. }
  62. if(GUI.Button(Rect(obj[9].transform.position.x, obj[9].transform.position.y, 166, 39),"New")){
  63. login = false;
  64. }
  65. if(GUI.Button(Rect(obj[10].transform.position.x, obj[10].transform.position.y, 166, 39),"Login")){
  66. login = true;
  67. }
  68.  
  69. if(s != "true"){
  70. GUI.Label(Rect(obj[8].transform.position.x, obj[8].transform.position.y, Screen.width, Screen.width), s, DescribtionStyle);
  71.  
  72. }else{
  73. GUI.Label(Rect(obj[8].transform.position.x, obj[8].transform.position.y, Screen.width, Screen.width), "Successfully Logged in", DescribtionStyle);
  74.  
  75. }
  76. }
  77. function Update(){
  78. if(s == "true"){
  79. success = true;
  80. }
  81. if(success){
  82. PlayerPrefs.SetString("username", username);
  83. PlayerPrefs.SetString("passwort", pw);
  84. Application.LoadLevel("MainPage");
  85. }else{
  86. PlayerPrefs.DeleteKey("username");
  87. PlayerPrefs.DeleteKey("passwort");
  88. }
  89. if(login){
  90. iTween.MoveTo(obj[5], iTween.Hash("x", Screen.width / 2 + 10, "y", Screen.height / 2 + 100)); //Button
  91. iTween.MoveTo(obj[6], iTween.Hash("y", -600)); //pw2f
  92. iTween.MoveTo(obj[7], iTween.Hash("x", Screen.width + 20));//pw2d
  93. iTween.MoveTo(obj[8], iTween.Hash("x", Screen.width / 2 - 165, "y", Screen.height / 2 + 173));
  94. iTween.MoveTo(obj[9], iTween.Hash("x", Screen.width / 2 - 165, "y", Screen.height / 2 + 100)); //registrier Button
  95. iTween.MoveTo(obj[10], iTween.Hash("x", Screen.width / 2 - 165, "y", Screen.height + 100)); //login Button
  96. }else{
  97. iTween.MoveTo(obj[5], iTween.Hash("x", Screen.width / 2 + 16, "y", Screen.height / 2 + 187)); //Button
  98. iTween.MoveTo(obj[6], iTween.Hash("x", Screen.width / 2 - 165, "y", Screen.height / 2 + 131));
  99. iTween.MoveTo(obj[7], iTween.Hash("x", Screen.width / 2 - 165, "y", Screen.height / 2 + 109));
  100. iTween.MoveTo(obj[8], iTween.Hash("x", Screen.width / 2 - 245, "y", Screen.height / 2 + 240));
  101. iTween.MoveTo(obj[9], iTween.Hash("x", -400, "y", Screen.height / 2 + 100)); //registrier Button
  102. iTween.MoveTo(obj[10], iTween.Hash("x", Screen.width / 2 - 165, "y", Screen.height / 2 + 187)); //login Button
  103. }
  104. }
  105.  
  106. function Start () {
  107. obj = new GameObject[11];
  108.  
  109. obj[0] = new GameObject(); // LOGO
  110. obj[0].transform.position.x = Screen.width / 2 - 165;
  111. obj[0].transform.position.y = Screen.height / 2 - 198;
  112. obj[1] = new GameObject(); //Username describtion
  113. obj[1].transform.position.x = Screen.width / 2 - 165;
  114. obj[1].transform.position.y = Screen.height / 2 - 96;
  115. obj[2] = new GameObject(); //Username text_field
  116. obj[2].transform.position.x = Screen.width / 2 - 165;
  117. obj[2].transform.position.y = Screen.height / 2 - 77;
  118. obj[3] = new GameObject(); //password describtion
  119. obj[3].transform.position.x = Screen.width / 2 - 165;
  120. obj[3].transform.position.y = Screen.height / 2 + 5;
  121. obj[4] = new GameObject(); //password field
  122. obj[4].transform.position.x = Screen.width / 2 - 165;
  123. obj[4].transform.position.y = Screen.height / 2 + 26;
  124. obj[5] = new GameObject(); //login button
  125. obj[5].transform.position.x = Screen.width / 2 - 165;
  126. obj[5].transform.position.y = Screen.height / 2 + 100;
  127. obj[6] = new GameObject(); //password 2 field
  128. obj[6].transform.position.x = Screen.width / 2 - 165;
  129. obj[6].transform.position.y = -600;
  130. obj[7] = new GameObject(); //password 2 text
  131. obj[7].transform.position.x = Screen.width + 20;
  132. obj[7].transform.position.y = Screen.height / 2 + 109;
  133. obj[8] = new GameObject(); //Info text
  134. obj[8].transform.position.x = Screen.width / 2 - 165;
  135. obj[8].transform.position.y = Screen.height / 2 + 173;
  136. obj[9] = new GameObject(); //registrier button
  137. obj[9].transform.position.x = Screen.width / 2 + 10;
  138. obj[9].transform.position.y = Screen.height / 2 + 100;
  139. obj[10] = new GameObject(); //Login Button
  140. obj[10].transform.position.x = Screen.width / 2 + 10;
  141. obj[10].transform.position.y = Screen.height / 2 + 100;
  142. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement