public void SaveProductToCart(ProductOptions productOptions, OnRequestCompleteCallback onRequestComplete) { var _url = GameHiddenOptions.Instance.ServerURL + _urlPostCartProduct; Debug.Log(_url); byte[] pictureBytes = null; bool hasBytes = false; if (productOptions.picture_bytes != null) { hasBytes = true; pictureBytes = productOptions.picture_bytes; productOptions.picture_bytes = null; } var wwwForm = new WWWForm(); wwwForm.AddField("data", JsonUtility.ToJson(productOptions)); if (hasBytes) { wwwForm.AddBinaryData("picture_bytes", pictureBytes); } OnRequestComplete = onRequestComplete; StartCoroutine(WaitForRequest(_url, wwwForm)); }
public void Comanda(Client client, OnRequestCompleteCallback onRequestComplete) { var _url = GameHiddenOptions.Instance.ServerURL + _urlPostDoComanda; Debug.Log(_url); var wwwForm = new WWWForm(); wwwForm.AddField("client", JsonUtility.ToJson(client)); OnRequestComplete = onRequestComplete; StartCoroutine(WaitForComandaRequest(_url, wwwForm)); }