using UnityEngine; using UnityEngine.Networking; using System.Collections; using UnityEngine.UI; using Unity.VisualScripting; using System; using UnityEngine.SceneManagement; public class RequestData : MonoBehaviour { // Start is called before the first frame update void Start() { string LoginUrl = EnviromentSetting.serverIp + "/api/login/"; //StartCoroutine(RequestData(LoginUserName.text, Loginpassword.text, LoginUrl)); } // Update is called once per frame //private IEnumerator RequestData(string mobileNumber, string password, string url) //{ // // Create a form and add parameters to the POST request // WWWForm form = new WWWForm(); // form.AddField("mobile_number", mobileNumber); // form.AddField("password", password); // // Assign the form to the request // UnityWebRequest request = UnityWebRequest.Post(url, form); // // Send the request and wait for a response // yield return request.SendWebRequest(); // //Debug.Log("接收信息request: " + request.result); // // Check for errors in the request // if (request.result == UnityWebRequest.Result.Success) // { // // Output the error if there's a problem // Debug.Log("接收信息Response: " + request.downloadHandler.text); // //SceneManager.LoadScene("Loading"); // } // else // { // // Output the response data if the request was successful // Debug.LogError("接收信息Response: " + request.downloadHandler.text); // } //} }