Example #1
0
 public void Register()
 {
     // When the form is downloaded, RegistrationFormDownloaded is called
     accountInfo.TryToDownloadRegistrationForm(RegistrationFormDownloaded);
     // Equivalent to:
     // StartCoroutine ( AS_Login.TryToDownloadRegistrationForm (accountInfo, RegistrationFormDownloaded) );
 }
Example #2
0
    void Start()
    {
        // This simulates different user inputs
        randomNum    = UnityEngine.Random.Range(1000, 9999);
        username    += "_" + randomNum.ToString();
        newUsername += "_" + randomNum.ToString();

        // 0) Download the registration Form as "accountInfo" - this is done by calling DownloadedRegistrationForm when the download is done..!
        accountInfo.TryToDownloadRegistrationForm(RegistrationFormDownloaded);
    }
Example #3
0
    // Called by OnGUI and provides a basic login GUI layout
    void LoginGUI(bool enablePasswordRecovery)
    {
        // Tittle
        GUILayout.Label("~~~==== Login ====~~~", GUILayout.Width(300));
        GUILayout.Label(" ", GUILayout.Width(100));

        // Username Propmpt
        GUILayout.BeginHorizontal();
        GUILayout.Label("Username: "******"Password: "******"Login", new GUILayoutOption[] { GUILayout.Width(200), GUILayout.Height(20) }))
        {
            // Calls the appropriate php script (its location is specified from the crentials)
            // with the following arguments {username, password} and when it gets a response,
            // it calls the function "setLoginState" with the appropriate arguments
            usernameLogin.TryToLogin(passwordLogin, LoginAttempted);

            // Equivalent to:
            // StartCoroutine ( AS_Login.TryToLogin( usernameLogin, passwordLogin, LoginAttempted ) ) ;

            guiMessage = "Attempting to Log In..";
        }


        // Register Button - Attempts to download the registration form (which fields are required in order to log in
        if (GUILayout.Button("Register", new GUILayoutOption[] { GUILayout.Width(200), GUILayout.Height(20) }))
        {
            passwordPrompt  = "";
            passwordConfirm = "";
            emailConfirm    = "";
            // When the form is downloaded, RegistrationFormDownloaded is called
            accountInfo.TryToDownloadRegistrationForm(RegistrationFormDownloaded);
            // Equivalent to:
            // StartCoroutine ( AS_Login.TryToDownloadRegistrationForm (accountInfo, RegistrationFormDownloaded) );

            guiMessage = "Loading..";
        }

        // Password Recovery screen
        if (enablePasswordRecovery)
        {
            if (GUILayout.Button("Retrieve Password", new GUILayoutOption[] { GUILayout.Width(200), GUILayout.Height(20) }))
            {
                loginState = AS_LoginState.RecoverPassword;
            }
        }

        // Tutorial
#if UNITY_EDITOR
        GUILayout.Label("", GUILayout.Height(10));
        GUILayout.Label("\bGetting Started:" +
                        "\n1) From the Menu Bar select Window->Online Account System" +
                        "\n2) Follow the Setup Guide" +
                        "\n3) Try to Register and then Login to Manage your Account" +
                        "\n\nThis message was printed from AS_LoginGUI.cs", GUILayout.Width(500));
#endif
    }