示例#1
0
 public void Awake()
 {
     status      = NOT_STARTED;
     theOcean    = GameObject.Find("Ocean").GetComponent <OceanController>();
     movesAPIObj = GameObject.Find("MovesAPIRequests").GetComponent <MovesAPIRequests> ();
     jsonDataObj = GameObject.Find("JSONDataObject").GetComponent <JSONDataObject> ();
     dateObj     = GameObject.Find("DateObject").GetComponent <DateClass> ();
     startDate   = dateObj.getCurrentDateString();
 }
示例#2
0
    public string getAPIString()
    {
        Debug.Log("MovesAPIRequests getAPIString is Called!");

        if (MOVES_ACCESS_TOKEN == "")
        {
            Debug.Log("MOVES_ACCESS_TOKEN is empty, requesting one from playerPrefs.");
            MOVES_ACCESS_TOKEN = PlayerPrefs.GetString("MOVES_ACCESS_TOKEN");
        }

        dateString = dateObj.getCurrentDateString();
        return(movesApiUrl + dateString + "?access_token=" + MOVES_ACCESS_TOKEN);
    }
示例#3
0
    IEnumerator timedAPICalls()
    {
        Debug.Log("MovesApiChallenge timedAPICalls is called");

        string currentDate = dateObj.getCurrentDateString();

        while (stepsWalked < targetSteps && currentDate == startDate)
        {
            Debug.Log("inside while");

            string theSummary = jsonDataObj.getSummary();
            Debug.Log("theSummary is " + theSummary);

            getMovesAPIData();
            yield return(new WaitForSeconds(APIInterval));
        }
        // need to design a flag mechanism to turn off the calls and exit the function.
    }