using Assets.Scripts; using DG.Tweening; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; using System.Collections; using System.Collections.Generic; using System.Reflection; using System.Text; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI; public class LoginController : MonoBehaviour { [SerializeField] InputField phone; [SerializeField] InputField pwd; [SerializeField] Button login; [SerializeField] RawImage loading; // Start is called before the first frame update void Start() { transform.Find("RawImage").DOMove(new Vector3(0.5f,0.5f,0),1); if (login != null) { login.onClick.AddListener(Submit); } if (loading != null) { loading.texture.wrapMode = TextureWrapMode.Repeat; } } async void Submit() { if (phone == null || pwd == null) { Utils.showToast(gameObject, "未绑定", 1); return; } //if (string.IsNullOrEmpty(phone.text) || string.IsNullOrEmpty(pwd.text)) //{ // Utils.showToast(gameObject, "请输入信息", 1); // return; //} //var res = await Global.userApi.Login(phone.text, pwd.text, ""); //测试用 var res = await ConfigHelper.userApi.Login("15651831367", "123456", ""); //var res = await NoAuthApi.Login(phone.text, pwd.text); if (res.result) { ConfigHelper.CurrentUser = res.data; SceneManager.LoadScene("2-Main"); } else { } } // Update is called once per frame void Update() { Debug.Log($"{phone.isFocused}, ${pwd != null}, ${Input.GetKeyDown(KeyCode.Tab)}"); if (phone.isFocused && pwd != null && Input.GetKeyDown(KeyCode.Tab)) { pwd.ActivateInputField(); } //if (Input.GetKeyDown(KeyCode.Return) && ) //{ //} //if (Input.GetKeyDown(KeyCode.Return)) { // Debug.Log("回车键"); // if (pwd.isFocused) // { // this.Submit(); // } //} } }