Ejemplo n.º 1
0
    public void LoginButton()
    {
        auth.SignInWithEmailAndPasswordAsync(Username, Password).ContinueWith(task => {
            if (task.IsCanceled)
            {
                Debug.LogError("SignInWithEmailAndPasswordAsync canceled");
                return;
            }
            if (task.IsFaulted)
            {
                Debug.LogError("SignInWithEmailAndPasswordAsync error" + task.Exception);
                return;
            }

            Firebase.Auth.FirebaseUser NewUser = task.Result;
            Debug.LogFormat("Firebase user signed in: {0} ({1})", NewUser.DisplayName, NewUser.UserId);
        });

        GameObject tmp      = GameObject.Find("debugText");
        cvsDebug   cvsdebug = tmp.GetComponent <cvsDebug> ();

        if (Password == "" || Username == "")
        {
            cvsdebug.debugLog = "Empty Field";
            return;
        }

        if (!Username.Contains("@"))
        {
            cvsdebug.debugLog = "User do not exist";
            return;
        }
        if (Password != "123456")
        {
            cvsdebug.debugLog = "incorrect password";
            return;
        }



        List <bool> UnlockedC = new List <bool> (new bool[] { false, true, true });
        List <bool> UnlockedI = new List <bool> (new bool[] { true, true, true });

        Account.account.Setup(100, 10, 10000, 1000, 0, Username, 1, 1, UnlockedC, UnlockedI);
        print("Login Successful");
        Application.LoadLevel("MainMenu");
    }
Ejemplo n.º 2
0
    public void RegisterButton()
    {
        auth.CreateUserWithEmailAndPasswordAsync(Email, Password).ContinueWith(task => {
            if (task.IsCanceled)
            {
                Debug.LogError("CreateUserWithEmailAndPasswordAsync canceled");
                return;
            }
            if (task.IsFaulted)
            {
                Debug.LogError("CreateUserWithEmailAndPasswordAsync error" + task.Exception);
                return;
            }
            Firebase.Auth.FirebaseUser NewUser = task.Result;
            Debug.LogFormat("Firebase user created: {0} ({1})", NewUser.DisplayName, NewUser.UserId);
        });

        auth.SignInWithEmailAndPasswordAsync(Email, Password).ContinueWith(task => {
            if (task.IsCanceled)
            {
                Debug.LogError("SignInWithEmailAndPasswordAsync canceled");
                return;
            }
            if (task.IsFaulted)
            {
                Debug.LogError("SignInWithEmailAndPasswordAsync error" + task.Exception);
                return;
            }

            Firebase.Auth.FirebaseUser NewUser = task.Result;
            Debug.LogFormat("Firebase user signed in: {0} ({1})", NewUser.DisplayName, NewUser.UserId);
        });

        GameObject tmp      = GameObject.Find("debugText");
        cvsDebug   cvsdebug = tmp.GetComponent <cvsDebug> ();

        if (Username == "" || Email == "" || Password == "" || ConfirmPassword == "")
        {
            cvsdebug.debugLog = "Empty Field";
            return;
        }
        if (Password != ConfirmPassword)
        {
            cvsdebug.debugLog = "Passwords don't match ";
            return;
        }
        if (Password.Length <= 4)
        {
            cvsdebug.debugLog = "Password too short";
            return;
        }
        if (Email == "*****@*****.**")
        {
            cvsdebug.debugLog = "User exists";
            return;
        }
        if (!Email.Contains("@") || !Email.Contains("."))
        {
            cvsdebug.debugLog = "Email Invalid";
            return;
        }

        List <bool> UnlockedC = new List <bool> (new bool[] { false, true, true });
        List <bool> UnlockedI = new List <bool> (new bool[] { true, true, true });

        Account.account.Setup(0, 1, 900, 100, 0, Username, 0, 0, UnlockedC, UnlockedI);
        print("gold: " + Account.account.GetGold().ToString());
        print("Registration Successful");
        Application.LoadLevel("MainMenu");
    }