private IEnumerator sending() { Connect connect = new Connect(); User user = GameObject.Find("User").GetComponent<User>(); string url = connect.getURL() + "/Comment/addComment.php"; WWWForm form = new WWWForm(); //userid content hash form.AddField("userID", user.getID()); form.AddField("storeID", store.getId()); form.AddField("content", inputText.text); form.AddField("hash", connect.getHash()); byte[] rawData = form.data; WWW www = new WWW(url, rawData); yield return www; // check for errors if (www.error == null) { string temp = www.text; Debug.Log(www.text); if (temp.Length == 5) //check { //add comment jbc.addSuccess(inputText.text); closeAdd (); } else if (temp.Length == 18) { errorText.text = "資料錯誤"; } else { errorText.text = "資料錯誤(2)"; } } else { errorText.text = "請檢查裝置連線"; Debug.Log("WWW Error: " + www.error); } }
private IEnumerator startLoad() { Connect connect = new Connect(); string url = connect.getURL() + "/login/loadUser.php"; // isSucess = false; WWWForm form = new WWWForm(); form.AddField("act", getAccount()); form.AddField("hash", connect.getHash()); byte[] rawData = form.data; WWW www = new WWW(url, rawData); yield return www; // check for errors if (www.error == null) { JSONObject jsonReader; string encoding = www.text; Debug.Log(encoding); jsonReader = new JSONObject(encoding); userfill(jsonReader); Debug.Log(id + " " + account + " " + password + " " + nickname + " " + gender + " " + email + " " + isFB); save2SQL(); } else { Debug.Log("WWW Error: " + www.error); } }
private IEnumerator startLoad(string type) { Connect connect = new Connect(); string url = connect.getURL() + "/Comment/getComment.php"; // isSucess = false; Debug.Log("storeID=" + store.getId()); WWWForm form = new WWWForm(); form.AddField("storeID", store.getId()); form.AddField("sortType",type); form.AddField("hash", connect.getHash()); byte[] rawData = form.data; WWW www = new WWW(url, rawData); yield return www; // check for errors if (www.error == null) { string encoding = www.text; Debug.Log(encoding); commentData = new JSONObject(encoding); total_Comment = commentData.Count; generateCommentBuild(); accessData(commentData); } else { Debug.Log("WWW Error: " + www.error); } }
private IEnumerator sendRate(Comment comm) { Connect connect = new Connect(); string url = connect.getURL() + "/Comment/addRate.php"; WWWForm form = new WWWForm(); Debug.Log (user.getID()); form.AddField("userID", user.getID()); form.AddField("comment_id", comm.id); form.AddField("hash", connect.getHash()); byte[] rawData = form.data; WWW www = new WWW(url, rawData); yield return www; // check for errors if (www.error == null) { Debug.Log(www.text); if (www.text.Length == 5) { Text trate = GameObject.Find(comment_uri + comm.index.ToString() + "/Rate/Text").GetComponent<Text>(); Comment temp = GameObject.Find(comment_uri + comm.index.ToString()).GetComponent<Comment>(); temp.rate++; trate.text = temp.rate.ToString(); } } else { Debug.Log("WWW Error: " + www.error); } }
private IEnumerator fastFBlogin() { Connect connect = new Connect(); string url = connect.getURL() + "/login/haveFBaccount.php"; // isSucess = false; WWWForm form = new WWWForm(); var aToken = AccessToken.CurrentAccessToken; Debug.Log(aToken.UserId); form.AddField("act", "FB" + aToken.UserId); form.AddField("hash", connect.getHash()); byte[] rawData = form.data; WWW www = new WWW(url, rawData); yield return www; // check for errors if (www.error == null) { string temp = www.text; Debug.Log("temp:" + temp + " num:" + temp.Length); Debug.Log(www.text); user.setAccount("FB" + aToken.UserId); //set Account if (temp.Length == 5) //already { user.loadAllfromServer(); Debug.Log("FB Register password:"******"/me?fields=name", HttpMethod.GET, GetUsername); FB.API("/me?fields=gender", HttpMethod.GET, GetUsergender); FB.API("/me/picture?height=145&width=157", HttpMethod.GET, DisplayProfilePic); clrFBPanel(); ls.ShowFBLogin(); } } else { hint.text = "請檢查裝置連線"; Debug.Log("WWW Error: " + www.error); } }
private IEnumerator doFBRegist() { Connect connect = new Connect(); string url = connect.getURL() + "/login/addFBUser.php"; // isSucess = false; WWWForm form = new WWWForm(); form.AddField("act", user.getAccount()); form.AddField("name", user.getName()); form.AddField("nickname", user.getNickname()); form.AddField("gender", user.getGender()); form.AddField("email", user.getEmail()); form.AddField("isFB", "1"); form.AddField("hash", connect.getHash()); byte[] rawData = form.data; WWW www = new WWW(url, rawData); yield return www; // check for errors if (www.error == null) { string temp = www.text; Debug.Log("temp:" + temp + " num:" + temp.Length); Debug.Log(www.text); if (temp.Length == 5) //check { hint.text = "註冊成功"; //Login user.loadAllfromServer(); Debug.Log("FB Register password:"******"重複的帳號或Email"; } else { hint.text = "資料錯誤"; } } else { hint.text = "請檢查裝置連線"; Debug.Log("WWW Error: " + www.error); } //isSucess = false; }