using UnityEngine; using UnityEngine.UI; using System.Collections; using UnityEngine.Networking; using TMPro; using System.Text; [RequireComponent(typeof(Button))] public class Save_WEB : MonoBehaviour { private static WaitForSeconds _waitForSeconds2 = new WaitForSeconds(2); public static void SaveWEB(string Filename, string xmls) { _G.FileName = "mt_"+Filename; if(_G.FileName!="") { //GameObject.Find("FN").GetComponent().text = _G.FileName; //byte[] bytes = SaveXML.BuildXmlBytes(); //string xmls = Encoding.UTF8.GetString(bytes); //transform.parent.GetComponent().alpha = 0; //transform.GetComponent().alpha = 0; StaticCoroutine.Start(SendTextToFile(xmls)); } } public static IEnumerator SendTextToFile(string xmls) { WWWForm form = new(); _G.PATH="free"; //NEW VERSION form.AddField("filename", _G.PATH+"/cloud/"+_G.FileName); //print("pathfile==="+_G.PATH+"/cloud/"+_G.FileName); form.AddField("filedata", xmls); //LIVE VERSION //form.AddField("filename", _G.FileName);//////////////////////////////////////////////////////////// //form.AddField("xmldata", xmls);//////////////////////////////////////////////////////////// //string path = ThisOnly.geturlSaveWeb(); string path = "https://ukitchenit.com/members/savecloud.php"; print("Save path====="+path); using UnityWebRequest webRequest = UnityWebRequest.Post(path, form); yield return webRequest.SendWebRequest(); if (webRequest.result == UnityWebRequest.Result.ConnectionError) { GameObject.Find("FN").GetComponent().text = "error!"; } else { //GameObject.Find("FN").GetComponent().text = _G.FileName; //_M.PH(2, 0, "ffffff", 1, 1); yield return new WaitForSeconds(1); //Get.o2("HIDER", "MESSAGE").SetActive(false); UnityWebRequest.ClearCookieCache(); //StaticCoroutine.Start(SendTextToFileBK(xmls)); } yield break; } // public static IEnumerator SendTextToFileBK(string xmls) // { // WWWForm form = new WWWForm(); // form.AddField("filename", _G.PATH+"/cloudbk/"+_G.FileName+_G.BKN); // form.AddField("filedata", xmls); // string path = ThisOnly.geturlSaveWeb();//_G.path+"members/savecloud.php" // using UnityWebRequest webRequest = UnityWebRequest.Post(path, form); // yield return webRequest.SendWebRequest(); // if (webRequest.result == UnityWebRequest.Result.ConnectionError) // { // GameObject.Find("FN").GetComponent().text = "error!"; // } // else // { // GameObject.Find("FN").GetComponent().text = _G.FileName; // //_M.PH(2, 0, "ffffff", 1, 1); // yield return _waitForSeconds2; // Get.o2("HIDER", "MESSAGE").SetActive(false); // _G.BKN += 1; // if (_G.BKN == 4) _G.BKN = 1; // UnityWebRequest.ClearCookieCache(); // } // yield break; // } }