Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var s :String;
- var username :String;
- var pw :String;
- var pw2 :String;
- var info:String;
- var success :boolean;
- var skin:GUISkin;
- var LogoStyle :GUIStyle;
- var DescribtionStyle :GUIStyle;
- var obj :GameObject[];
- var login :boolean;
- function getting(extension :String){
- var url :String = "http://www.yourlink.org/" + extension;
- var www : WWW = new WWW (url);
- yield www;
- s = www.text;
- }
- function write(uname :String, pw :String, pw2 :String){
- if(pw == pw2){
- 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("@")){
- s = "Username isn't formal right";
- }else{
- if(uname.Length > 6){
- if(pw.Length > 6){
- var www : WWW = new WWW ("http://www.yourlinkorg/write_new.php?username="+username+"&pw="+pw);
- yield www;
- s = www.text;
- }else s="Password is too short (min. 7 Chars)";
- }else s="Username is too short (min. 7 Chars)";
- }
- }else{
- s = "Passwords do not match";
- }
- }
- function OnGUI () {
- GUI.skin = skin;
- username = GUI.TextField(Rect(obj[2].transform.position.x, obj[2].transform.position.y, 348, 48), username, 25);
- pw = GUI.PasswordField(Rect(obj[4].transform.position.x, obj[4].transform.position.y, 348, 48), pw , "*"[0], 25);
- pw2 = GUI.PasswordField(Rect(obj[6].transform.position.x, obj[6].transform.position.y, 348, 48), pw2 , "*"[0], 25);
- GUI.Label(Rect(obj[0].transform.position.x, obj[0].transform.position.y,Screen.width , Screen.width), "Loginnation", LogoStyle);
- GUI.Label(Rect(obj[1].transform.position.x, obj[1].transform.position.y, Screen.width, Screen.width), "Username:", DescribtionStyle);
- GUI.Label(Rect(obj[3].transform.position.x, obj[3].transform.position.y, Screen.width, Screen.width), "Password:", DescribtionStyle);
- GUI.Label(Rect(obj[7].transform.position.x, obj[7].transform.position.y, Screen.width, Screen.width), "Repeat password:", DescribtionStyle);
- if(GUI.Button(Rect(obj[5].transform.position.x, obj[5].transform.position.y, 166, 39),"Enter")){
- if(login){
- getting("process.php?username="+username+"&passwort="+pw+"&info=success");
- username = "";
- pw = "";
- pw2 = "";
- }else{
- write(username, pw, pw2);
- }
- }
- if(GUI.Button(Rect(obj[9].transform.position.x, obj[9].transform.position.y, 166, 39),"New")){
- login = false;
- }
- if(GUI.Button(Rect(obj[10].transform.position.x, obj[10].transform.position.y, 166, 39),"Login")){
- login = true;
- }
- if(s != "true"){
- GUI.Label(Rect(obj[8].transform.position.x, obj[8].transform.position.y, Screen.width, Screen.width), s, DescribtionStyle);
- }else{
- GUI.Label(Rect(obj[8].transform.position.x, obj[8].transform.position.y, Screen.width, Screen.width), "Successfully Logged in", DescribtionStyle);
- }
- }
- function Update(){
- if(s == "true"){
- success = true;
- }
- if(success){
- PlayerPrefs.SetString("username", username);
- PlayerPrefs.SetString("passwort", pw);
- Application.LoadLevel("MainPage");
- }else{
- PlayerPrefs.DeleteKey("username");
- PlayerPrefs.DeleteKey("passwort");
- }
- if(login){
- iTween.MoveTo(obj[5], iTween.Hash("x", Screen.width / 2 + 10, "y", Screen.height / 2 + 100)); //Button
- iTween.MoveTo(obj[6], iTween.Hash("y", -600)); //pw2f
- iTween.MoveTo(obj[7], iTween.Hash("x", Screen.width + 20));//pw2d
- iTween.MoveTo(obj[8], iTween.Hash("x", Screen.width / 2 - 165, "y", Screen.height / 2 + 173));
- iTween.MoveTo(obj[9], iTween.Hash("x", Screen.width / 2 - 165, "y", Screen.height / 2 + 100)); //registrier Button
- iTween.MoveTo(obj[10], iTween.Hash("x", Screen.width / 2 - 165, "y", Screen.height + 100)); //login Button
- }else{
- iTween.MoveTo(obj[5], iTween.Hash("x", Screen.width / 2 + 16, "y", Screen.height / 2 + 187)); //Button
- iTween.MoveTo(obj[6], iTween.Hash("x", Screen.width / 2 - 165, "y", Screen.height / 2 + 131));
- iTween.MoveTo(obj[7], iTween.Hash("x", Screen.width / 2 - 165, "y", Screen.height / 2 + 109));
- iTween.MoveTo(obj[8], iTween.Hash("x", Screen.width / 2 - 245, "y", Screen.height / 2 + 240));
- iTween.MoveTo(obj[9], iTween.Hash("x", -400, "y", Screen.height / 2 + 100)); //registrier Button
- iTween.MoveTo(obj[10], iTween.Hash("x", Screen.width / 2 - 165, "y", Screen.height / 2 + 187)); //login Button
- }
- }
- function Start () {
- obj = new GameObject[11];
- obj[0] = new GameObject(); // LOGO
- obj[0].transform.position.x = Screen.width / 2 - 165;
- obj[0].transform.position.y = Screen.height / 2 - 198;
- obj[1] = new GameObject(); //Username describtion
- obj[1].transform.position.x = Screen.width / 2 - 165;
- obj[1].transform.position.y = Screen.height / 2 - 96;
- obj[2] = new GameObject(); //Username text_field
- obj[2].transform.position.x = Screen.width / 2 - 165;
- obj[2].transform.position.y = Screen.height / 2 - 77;
- obj[3] = new GameObject(); //password describtion
- obj[3].transform.position.x = Screen.width / 2 - 165;
- obj[3].transform.position.y = Screen.height / 2 + 5;
- obj[4] = new GameObject(); //password field
- obj[4].transform.position.x = Screen.width / 2 - 165;
- obj[4].transform.position.y = Screen.height / 2 + 26;
- obj[5] = new GameObject(); //login button
- obj[5].transform.position.x = Screen.width / 2 - 165;
- obj[5].transform.position.y = Screen.height / 2 + 100;
- obj[6] = new GameObject(); //password 2 field
- obj[6].transform.position.x = Screen.width / 2 - 165;
- obj[6].transform.position.y = -600;
- obj[7] = new GameObject(); //password 2 text
- obj[7].transform.position.x = Screen.width + 20;
- obj[7].transform.position.y = Screen.height / 2 + 109;
- obj[8] = new GameObject(); //Info text
- obj[8].transform.position.x = Screen.width / 2 - 165;
- obj[8].transform.position.y = Screen.height / 2 + 173;
- obj[9] = new GameObject(); //registrier button
- obj[9].transform.position.x = Screen.width / 2 + 10;
- obj[9].transform.position.y = Screen.height / 2 + 100;
- obj[10] = new GameObject(); //Login Button
- obj[10].transform.position.x = Screen.width / 2 + 10;
- obj[10].transform.position.y = Screen.height / 2 + 100;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement