Ejemplo n.º 1
0
    public IEnumerator sendScores(long score)
    {
        Debug.Log("Welcome to send score");
        string sailsUrl = "https://immense-lake-57494.herokuapp.com/scores";

        Score body = new Score();

        body.user_id   = Convert.ToString(AccountManager.idCurrentUser);
        body.level_id  = Convert.ToString(LevelGenerator.levelId);
        body.score     = score;
        body.updatedAt = null;
        body.createdAt = null;
        string bodyJson = JsonUtility.ToJson(body);

        yield return(StartCoroutine(_webRequester.PostComplete(sailsUrl, bodyJson)));

        Debug.Log("Bye Bye from postJson");
    }
Ejemplo n.º 2
0
    //working
    public IEnumerator addLevel(string name, string description, string weather, int maxScore, string json)
    {
        clearList();
        Debug.Log("Adding level to user " + AccountManager.idCurrentUser + "...");
        string sailsUrl = "https://immense-lake-57494.herokuapp.com/levels";

        AddLevel body = new AddLevel();

        body.name           = name;
        body.json           = json;
        body.createdAt      = null;
        body.updatedAt      = null;
        body.description    = description;
        body.weather_savior = weather;
        body.maxScore       = maxScore;
        body.idUser         = AccountManager.idCurrentUser;

        string bodyJson = JsonUtility.ToJson(body);

        yield return(StartCoroutine(_webRequester.PostComplete(sailsUrl, bodyJson)));

        Debug.Log("Level Added");
        UpdateList();
    }