示例#1
0
    public void SaveScore()
    {
        string dni     = Data.Instance.userData.dni;
        int    score   = GetTotalStars();
        int    level   = Data.Instance.userData.level;
        string hash    = Md5Test.Md5Sum(Data.Instance.userData.dni + score + "pontura");
        string urlReal = url + "setUser.php?dni=" + dni + "&score=" + score + "&level=" + level + "&hash=" + hash;

        print("save: " + urlReal);
        StartCoroutine(LoadJson(urlReal, null));
    }
示例#2
0
    // remember to use StartCoroutine when calling this function!
    IEnumerator PostScores(string name, int score)
    {
        //This connects to a server side php script that will add the name and score to a MySQL DB.
        // Supply it with a string representing the players name and the players score.
        string hash = Md5Test.Md5Sum(name + score + secretKey);

        string post_url = addScoreURL + "name=" + WWW.EscapeURL(name) + "&score=" + score + "&hash=" + hash;

        // Post the URL to the site and create a download object to get the result.
        WWW hs_post = new WWW(post_url);

        yield return(hs_post); // Wait until the download is done

        if (hs_post.error != null)
        {
            print("There was an error posting the high score: " + hs_post.error);
        }
    }
示例#3
0
    IEnumerator AddFacebookId(int userId, string facebookId)
    {
        string hash     = Md5Test.Md5Sum(userId.ToString() + facebookId + secretKey);
        string post_url = addFacebookId + "facebookId=" + facebookId + "&id=" + userId + "&hash=" + hash;

        print("AddFacebookId : " + post_url);
        WWW hs_post = new WWW(post_url);

        yield return(hs_post);

        if (hs_post.error != null)
        {
            Debug.Log("addFacebookID ERROR" + hs_post.error);
        }
        else
        {
            SocialEvents.OnFacebookIdAdded();
        }
    }
示例#4
0
    IEnumerator PostScores(int userId, int hiscore)
    {
        Debug.Log("SEt hiscore id: " + userId + " score= " + hiscore);
        string hash     = Md5Test.Md5Sum(userId.ToString() + hiscore.ToString() + secretKey);
        string post_url = addScore_URL + "id=" + userId.ToString() + "&hiscore=" + hiscore + "&hash=" + hash;

        print("PostScores : " + post_url);
        WWW hs_post = new WWW(post_url);

        yield return(hs_post);

        if (hs_post.error != null)
        {
            print("There was an error posting the high score: " + hs_post.error);
        }
        else
        {
            print(hs_post.text);
        }
    }
示例#5
0
    IEnumerator PostCompetitionScore(int userId, int levelId, int score, bool isNew)
    {
        Debug.Log("SEt hiscore id: " + userId + " levelId: " + levelId + " score= " + score);
        string hash     = Md5Test.Md5Sum(userId.ToString() + levelId.ToString() + score.ToString() + secretKey);
        string post_url = addScore_URL + "id=" + userId.ToString() + "&levelID=" + levelId.ToString() + "&score=" + score + "&new=" + isNew + "&hash=" + hash;

        print("Post Competition Score : " + post_url);
        WWW hs_post = new WWW(post_url);

        yield return(hs_post);

        if (hs_post.error != null)
        {
            print("There was an error posting the high score: " + hs_post.error);
        }
        else
        {
            print("SAVED_ " + hs_post.text);
        }
    }
示例#6
0
    IEnumerator CreateUserRoutine(string username, string facebookId, int hiscore, string email, string password)
    {
        username = username.Replace(" ", "_");
        string hash     = Md5Test.Md5Sum(username + facebookId + secretKey);
        string post_url = createUser_URL + "facebookId=" + facebookId + "&username="******"&hiscore=" + hiscore.ToString() + "&email=" + email + "&password="******"&hash=" + hash;

        print("CreateUser : "******"No pudo crear el nuevo user: "******"user agregado: " + hs_post.text);
            int userId = int.Parse(hs_post.text);
            SetUserData(Data.Instance.userData.username, facebookId, userId, hiscore, email);
        }
    }
示例#7
0
 static void Md5Tes()
 {
     //Md5Test.T();
     Md5Test.T1();
 }