Ejemplo n.º 1
0
    public void Authenticate(Action <bool> callback)
    {
        if (Gamedonia.INSTANCE.debug)
        {
            Debug.Log("Facebook Authentication");
        }
        _callback = callback;

        if (!String.IsNullOrEmpty(_fb_uid) && !String.IsNullOrEmpty(_fb_access_token))
        {
            GDUser      user        = new GDUser();
            Credentials credentials = new Credentials();
            credentials.fb_uid          = _fb_uid;
            credentials.fb_access_token = _fb_access_token;
            user.credentials            = credentials;

            GamedoniaUsers.CreateUser(user, ProcessCreateUser);
        }
        else
        {
            Debug.LogError("Facebook id or token not present impossible to perform login with it");
            if (_callback != null)
            {
                _callback(false);
            }
        }
    }
Ejemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        // First create the credentials object for the account. In this example email credentials are used

        Credentials credentials = new Credentials();

        credentials.email    = email;
        credentials.password = password;

        // Create the user account with some profile data and attach it to the credentials created in the previous block
        GDUser user = new GDUser();

        user.credentials         = credentials;
        user.profile["email"]    = email;
        user.profile["name"]     = "";
        user.profile["color"]    = "";
        user.profile["hobby"]    = "";
        user.profile["film"]     = "";
        user.profile["age"]      = 0;
        user.profile["lvl"]      = 1;
        user.profile["wonAttr"]  = 0;
        user.profile ["friends"] = new Dictionary <string, object> ();

        // Make the request to Gamedonia Backend to create the account and process the result in a block.
        GamedoniaUsers.CreateUser(user, delegate(bool success){
            if (success)
            {
                Debug.Log("Success");
            }
            else
            {
                Debug.Log("Fail");
            }
        });
    }
Ejemplo n.º 3
0
    void OnGUI()
    {
        GUI.skin = skin;
        // Make a text field that modifies stringToEdit.
        //GUI.backgroundColor = Color.black;
        GUI.DrawTexture(UtilResize.ResizeGUI(new Rect(0, 0, 320, 480)), backgroundImg);

        GUI.Label(UtilResize.ResizeGUI(new Rect(80, 10, 220, 20)), "eMail*", "LabelBold");
        email = GUI.TextField(UtilResize.ResizeGUI(new Rect(80, 30, 220, 40)), email, 100);

        GUI.Label(UtilResize.ResizeGUI(new Rect(80, 75, 220, 20)), "Password*", "LabelBold");
        password = GUI.PasswordField(UtilResize.ResizeGUI(new Rect(80, 100, 220, 40)), password, '*');

        GUI.Label(UtilResize.ResizeGUI(new Rect(80, 145, 200, 20)), "Repeat Password*", "LabelBold");
        repassword = GUI.PasswordField(UtilResize.ResizeGUI(new Rect(80, 170, 220, 40)), repassword, '*');

        GUI.Label(UtilResize.ResizeGUI(new Rect(80, 215, 200, 20)), "Nickname*", "LabelBold");
        nickname = GUI.TextField(UtilResize.ResizeGUI(new Rect(80, 240, 220, 40)), nickname, 25);


        if (GUI.Button(UtilResize.ResizeGUI(new Rect(80, 290, 220, 50)), "Create"))
        {
            if ((email != "") &&
                (password != "") &&
                (repassword != "") &&
                (password == repassword))
            {
                Credentials credentials = new Credentials();
                credentials.email    = email.ToLower();
                credentials.password = password;
                GDUser user = new GDUser();
                user.credentials = credentials;
                user.profile.Add("nickname", nickname);
                user.profile.Add("registerDate", DateTime.Now);

                GamedoniaUsers.CreateUser(user, OnCreateUser);
            }
            else
            {
                errorMsg = "Fill all the fields with (*) correctly";
                Debug.Log(errorMsg);
            }
        }

        if (GUI.Button(UtilResize.ResizeGUI(new Rect(80, 345, 220, 50)), "Cancel"))
        {
            Application.LoadLevel("LoginScene");
        }

        if (errorMsg != "")
        {
            GUI.Box(new Rect((Screen.width - (UtilResize.resMultiplier() * 260)), (Screen.height - (UtilResize.resMultiplier() * 50)), (UtilResize.resMultiplier() * 260), (UtilResize.resMultiplier() * 50)), errorMsg);
            if (GUI.Button(new Rect(Screen.width - 20, Screen.height - UtilResize.resMultiplier() * 45, 16, 16), "x", "ButtonSmall"))
            {
                errorMsg = "";
            }
        }
    }
Ejemplo n.º 4
0
    void ProcessAuthentication(bool success)
    {
        GDUser      user        = new GDUser();
        Credentials credentials = new Credentials();

        credentials.open_udid = OpenUDIDPlugin.GetOpenUDID();
        user.credentials      = credentials;

        if (success)
        {
            credentials.gamecenter_id = Social.localUser.id;
        }

        GamedoniaUsers.CreateUser(user, ProcessCreateUser);
    }
Ejemplo n.º 5
0
    public void Authenticate(Action <bool> callback)
    {
        if (Gamedonia.INSTANCE.debug)
        {
            Debug.Log("Silent Authentication");
        }
        this.callback = callback;

        GDUser      user        = new GDUser();
        Credentials credentials = new Credentials();

        credentials.open_udid = OpenUDIDPlugin.GetOpenUDID();
        user.credentials      = credentials;

        GamedoniaUsers.CreateUser(user, ProcessCreateUser);
    }
Ejemplo n.º 6
0
    public void Registrate()
    {
        if (email.text == "")
        {
            emailImg.DOColor(errorColor, 1);
            errorMsg = "Vul al de velden correct in";
        }
        else
        {
            emailImg.DOColor(defaultColor, 1);
        }
        if (password.text == "")
        {
            passImg.DOColor(errorColor, 1);
            errorMsg = "Vul al de velden correct in";
        }
        else
        {
            passImg.DOColor(defaultColor, 1);
        }
        if (repassword.text == "")
        {
            passreImg.DOColor(errorColor, 1);
            errorMsg = "Vul al de velden correct in";
        }
        else
        {
            passreImg.DOColor(defaultColor, 1);
        }
        checkPasswords();

        if ((email.text != "") &&
            (password.text != "") &&
            (repassword.text != "") &&
            (password.text == repassword.text))
        {
            Loader.I.enableLoader();
            Credentials credentials = new Credentials();
            credentials.email    = email.text;
            credentials.password = password.text;
            GDUser user = new GDUser();
            user.credentials = credentials;

            user.profile.Add("email", email.text);
            user.profile.Add("name", "");
            user.profile.Add("color", "");
            user.profile.Add("hobby", "");
            user.profile.Add("film", "");
            user.profile.Add("age", 0);
            user.profile.Add("instelling", "");
            user.profile.Add("lvl", 1);
            user.profile.Add("wonAttr", 1);
            user.profile ["friends"] = new Dictionary <string, object> ();
            user.profile.Add("avatar", "");
            user.profile.Add("admin", false);
            user.profile.Add("created_profile", false);
            GamedoniaUsers.CreateUser(user, OnCreateUser);
        }
        else
        {
            errorMsgText.text = errorMsg;
            errorMsgText.DOFade(1, 1);
        }
    }