// Use this for initialization void Start() { /*JSONObject j = new JSONObject (JSONObject.Type.OBJECT); j.AddField ("num", "0.5"); j.AddField ("mondai", "korehanani"); JSONObject arr = new JSONObject (JSONObject.Type.ARRAY); j.AddField ("kaito", arr); arr.Add (1); arr.Add (2); arr.Add (3); string encoded = j.print (); Debug.Log (encoded); JSONObject str = new JSONObject (encoded); accessData (str);*/ WWWForm form = new WWWForm (); form.AddField("anss[]", 1); form.AddField("anss[]", 4); form.AddField("setno", 1); string url = "http://hanamaroid-quiz.herokuapp.com/post"; db = GameObject.Find ("DataBase").GetComponentInChildren<DataBase> (); string results = db.POST (url, form).ToString (); Debug.Log (results); }
// Use this for initialization void Start() { string loginID = GameObject.Find ("data").GetComponent<data> ().loginID; string password = GameObject.Find ("data").GetComponent<data> ().Passward; //GameObject.Find("data").GetComponent<data>().ID.Add(loginID, 1);//IDを1にする WWWForm form = new WWWForm (); form.AddField ("name", loginID); form.AddField ("userid", password); string url = "http://hanamaroid-quiz.herokuapp.com/createu"; db = GameObject.Find ("DataBase").GetComponentInChildren<DataBase> (); string results = db.POST (url, form).ToString (); Debug.Log (results); }
// Use this for initialization void Start() { //string loginID = GameObject.Find ("data").GetComponent<data> ().loginID; //string password = GameObject.Find ("data").GetComponent<data> ().Passward; //int Result = GameObject.Find ("data").GetComponent<data> ().Result; //GameObject.Find("data").GetComponent<data>().ID.Add(loginID, 1);//IDを1にする WWWForm form = new WWWForm (); //Result = 4;//////// string name = GameObject.Find("data").GetComponent<data>().loginID; string setno; int subject = GameObject.Find("data").GetComponent<data>().subject; if(subject == 0) setno = "sci"; else setno = "soc"; int grade = GameObject.Find("data").GetComponent<data>().grade; if(grade == 0) setno += "101"; else if(grade == 1) setno += "201"; else setno += "301"; string percent = (GameObject.Find("data").GetComponent<data>().Result*10).ToString(); form.AddField ("name", name); form.AddField ("percent", percent);//(Result*10).ToString()); form.AddField ("setno", setno); string url = "http://hanamaroid-quiz.herokuapp.com/cal_ranking"; db = GameObject.Find ("DataBase").GetComponentInChildren<DataBase> (); //string results = db.POST (url, form).ToString (); //Debug.Log (results); GameObject.Find("data").GetComponent<data>().Ranking = db.POST (url, form).ToString (); //guiText.text = db.POST (url, form).ToString (); guiText.text = percent + "%"; //results = "{\"name\":\"sci101\",\"ranking\":6,\"total\":20}"; //JSONObject j = new JSONObject (results); //Debug.Log(j[1]); //access data (and print it) }