前两个页面迁移完成
This commit is contained in:
1 parent
ba324aa68d
commit
e7044b3cde
67 files changed
+6373
-3171
No files matched your search
@@ -0,0 +1,78 @@
|
||||
using Assets.Cyp;
|
||||
using Assets.Scripts;
|
||||
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()
|
||||
{
|
||||
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()
|
||||
{
|
||||
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();
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user