private IEnumerator SentOfferAPI(offerData data, Action <UnityWebRequest> callBack) { var request = new UnityWebRequest($"{Config.URL()}/offer", "POST"); var bodyRaw = new UTF8Encoding().GetBytes(JsonUtility.ToJson(data)); request.uploadHandler = new UploadHandlerRaw(bodyRaw); request.downloadHandler = new DownloadHandlerBuffer(); request.SetRequestHeader("x-auth", PlayerPrefs.GetString("token")); request.SetRequestHeader("Content-Type", "application/json"); yield return(request.SendWebRequest()); callBack(request); }
public void OnClick_MyBookItem(int bookId) { var OfferData = new offerData() { book_deal = currentBookID.ToString(), book_offer = bookId.ToString(), user_deal = currentUserID.ToString() }; AndroidNativeFunctions.ShowProgressDialog("Loading . . ."); StartCoroutine(SentOfferAPI(OfferData, action => { var TemList = new List <Transform>(); int x = MarketPage.childCount; for (int i = 0; i < x; i++) { TemList.Add(MarketPage.GetChild(i)); } for (int i = 0; i < x; i++) { Destroy(TemList[i].gameObject); } TemList.Clear(); x = MyBookPage.childCount; for (int i = 0; i < x; i++) { TemList.Add(MyBookPage.GetChild(i)); } for (int i = 0; i < x; i++) { Destroy(TemList[i].gameObject); } TemList.Clear(); x = MyBookSelectPage.childCount; for (int i = 0; i < x; i++) { TemList.Add(MyBookSelectPage.GetChild(i)); } for (int i = 0; i < x; i++) { Destroy(TemList[i].gameObject); } LoadBook(); UIManager.ShowDialog(); AndroidNativeFunctions.HideProgressDialog(); })); }