public void SendHelpButton() { string mUserIds = ""; List <Transform> arrItem = gridView.gameObject.GetComponent <UIGrid>().GetChildList(); for (int i = 0; i < arrItem.Count; i++) { if (arrItem[i].FindChild("Checkbox").gameObject.GetComponent <UIToggle>().value) { mUserIds += arrItem[i].gameObject.GetComponent <ItemSelectFriend>().UserId + ","; } } DFB.FBSendLife(mUserIds.Split(','), result => { int leng = mUserIds.Split(',').Length; if (!String.IsNullOrEmpty(result.Error)) { Debug.Log(result.Error); } else { Debug.Log(result.Text); var dict = Json.Deserialize(result.Text) as IDictionary; if (dict != null && dict["request"] != null) { //--------------Achievement 1------------------------------------ DialogAchievement.AddDataAchievement(1, leng - 1); CloseButton(); } } }); }
public void AcceptAllButton() { List <Transform> arrItemReceive = gridViewReceive.gameObject.GetComponent <UIGrid>().GetChildList(); List <Transform> arrItemRequest = gridViewRequest.gameObject.GetComponent <UIGrid>().GetChildList(); if (transform.FindChild("TabReceiveOn").gameObject.activeInHierarchy) { for (int i = 0; i < arrItemReceive.Count; i++) { arrItemReceive[i].GetComponent <ItemReceive>().DeleteItemButton(); } lbInbox.gameObject.SetActive(true); } else if (arrItemRequest.Count > 0) { string mUserId = ""; for (int i = 0; i < arrItemRequest.Count; i++) { mUserId += arrItemRequest[i].gameObject.GetComponent <ItemReceive>().UserId + ","; } DFB.FBSendLife(mUserId.Split(','), result => { if (!String.IsNullOrEmpty(result.Error)) { Debug.Log(result.Error); } else { Debug.Log(result.Text); fb_result = result.Text; var dict = Json.Deserialize(result.Text) as IDictionary; if (dict["cancelled"] != null) { fb_result += " Bam cancel => ko xoa request"; Debug.Log(" Bam cancel => ko xoa request"); } else { fb_result += " Xoa list arrItemRequest.Count " + arrItemRequest.Count; for (int i = 0; i < arrItemRequest.Count; i++) { arrItemRequest[i].GetComponent <ItemReceive>().DeleteItemButton(); //arrItemRequest.RemoveAt(i); } } ShowNoMessage(); } }); } }
//Send backrequest and delete curent request public void SendButton() { DFB.FBSendLife(this.userId.Split(','), result => { if (!String.IsNullOrEmpty(result.Error)) { Debug.Log(result.Error); } else { IDictionary dict = Json.Deserialize(result.Text) as IDictionary; bool cancel = dict["cancelled"] != null && (bool)dict["cancelled"]; if (!cancel) { DeleteItemButton(); } } }); }