using System.Collections;
using System.Collections.Generic;
using Common;
using DG.Tweening;
using UnityEngine;
using UnityEngine.UI;
public class Regiestpanel : BasePanel
{
private InputField usernameIF;
private InputField passwordIF;
private InputField rePasswordIF;
private RegisteRequest registeRequest;
private void Start()
{
registeRequest = GetComponent<RegisteRequest>();
usernameIF = transform.Find("UserNameLabel/UserNameLabelInput").GetComponent<InputField>();
passwordIF = transform.Find("PassWordLabel/PassWordLabelInput").GetComponent<InputField>();
rePasswordIF = transform.Find("RePassWordLabel/PassWordLabelInput").GetComponent<InputField>();
transform.Find("RegisterButton").GetComponent<Button>().onClick.AddListener(OnRegisterClick);
transform.Find("CloseButton").GetComponent<Button>().onClick.AddListener(OnCloseClick);
}
public override void OnEnter()
{
gameObject.SetActive(true);
transform.localScale = Vector3.zero;
transform.DOScale(1, 0.4f);
transform.localPosition = new Vector3(1000, 0, 0);
transform.DOLocalMove(Vector3.zero, 1f);
}
private void OnRegisterClick()
{
string msg = "";
if (string.IsNullOrEmpty(usernameIF.text))
{
msg += "用户名不能为空";
}
if (string.IsNullOrEmpty(passwordIF.text))
{
msg += "\n密码不能为空";
}
if (string.IsNullOrEmpty(rePasswordIF.text))
{
msg += "\n密码不能为空";
}
if (passwordIF.text!=rePasswordIF.text)
{
msg += "\n密码不一致";
}
if (msg!=null)
{
uiMag.ShowMessage(msg);return;
}
else//经行注册发送到服务器端
{
registeRequest.SendRequest(usernameIF.text,passwordIF.text);
}
}
private void OnCloseClick()
{
transform.DOScale(0, 0.4f);
Tweener tweener = transform.DOLocalMove(new Vector3(1000, 0, 0), 0.4f);
tweener.OnComplete(() => uiMag.PopPanel());
}
public override void OnExit()
{
base.OnExit();
gameObject.SetActive(false);
}
public void OnRegisterResponse(ReturnCode returnCode)
{
if (returnCode==ReturnCode.Success)
{
uiMag.ShowMessageSync("注册成功");
}
}
}为什么这里的最后一个方法老师您说不实在unity主线程里这个是如何知道的是异步的呢怎么样判断