//update player quest when they are completed private IEnumerator UpdatePlayerQuests(QuestPlayerData q) { PlayerQuestUpdateInProgress = true; string playerQuestToJson = q.SaveToString(); //Debug.Log(playerQuestToJson); WWWForm form = new WWWForm(); form.AddField("myform_hash", hash); form.AddField("myform_playerquest", playerQuestToJson); using (WWW w = new WWW(website + updatePlayerQuestUrl, form)) { yield return(w); if (w.error != null) { Debug.Log(w.error); //if there is an error, tell us } else { //Debug.Log("www player quest update ok"); //Debug.Log("php: " + w.text); //here we return the data our PHP told us } } PlayerQuestUpdateInProgress = false; }
private IEnumerator AddNewPlayerQuests(QuestPlayerData q) { string playerQuestToJson = q.SaveToString(); //Debug.Log(playerQuestToJson); WWWForm form = new WWWForm(); form.AddField("myform_hash", hash); form.AddField("myform_playerquest", playerQuestToJson); using (WWW w = new WWW(website + addPlayerQuestUrl, form)) { yield return(w); if (w.error != null) { Debug.Log(w.error); //if there is an error, tell us } else { Debug.Log("www player quest addition in the database ok"); Debug.Log("php: " + w.text); //here we return the data our PHP told us //reload players quests in order to get proper id. StartGettingPlayerQuestId(q); } } }