Merge branch 'main' of http://sheziwanglo.cn:3000/hyskai/_TheStrongestSnail
This commit is contained in:
commit
93c4c67a16
@ -1131,7 +1131,7 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 503.5, y: -1938.7665}
|
||||
m_AnchoredPosition: {x: 503.5, y: -1061.7666}
|
||||
m_SizeDelta: {x: 911, y: 289.4}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &376604315
|
||||
@ -3538,7 +3538,7 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 686, y: -1387.5}
|
||||
m_AnchoredPosition: {x: 686, y: -1389.0555}
|
||||
m_SizeDelta: {x: 1018, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &1071890038
|
||||
@ -4627,7 +4627,7 @@ MonoBehaviour:
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1789203778}
|
||||
m_Enabled: 1
|
||||
m_Enabled: 0
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 8ee1a43c8ad7f8c41bad48013bf5af49, type: 3}
|
||||
m_Name:
|
||||
@ -5765,6 +5765,9 @@ MonoBehaviour:
|
||||
userNameField: {fileID: 2007997901}
|
||||
passwordField: {fileID: 2068924169}
|
||||
verifyCodeField: {fileID: 345431930}
|
||||
mmField: {fileID: 2068924169}
|
||||
qrmmField: {fileID: 259615312}
|
||||
yqmField: {fileID: 951076517}
|
||||
pwdBtn: {fileID: 1969202727}
|
||||
yzmBtn: {fileID: 622588872}
|
||||
regImg: {fileID: 382632865}
|
||||
@ -5776,3 +5779,4 @@ MonoBehaviour:
|
||||
loginBtn: {fileID: 2003261318}
|
||||
regbtn: {fileID: 376604313}
|
||||
rigistBtn: {fileID: 855157915}
|
||||
rigBtn: {fileID: 528990237}
|
||||
|
@ -13,6 +13,9 @@ public class logoPanel : MonoBehaviour
|
||||
public InputField userNameField;
|
||||
public InputField passwordField;
|
||||
public InputField verifyCodeField;
|
||||
public InputField mmField;
|
||||
public InputField qrmmField;
|
||||
public InputField yqmField;
|
||||
|
||||
public Button pwdBtn;
|
||||
public Button yzmBtn;
|
||||
@ -29,6 +32,10 @@ public class logoPanel : MonoBehaviour
|
||||
public GameObject regbtn;
|
||||
public Button rigistBtn;
|
||||
|
||||
public Button rigBtn;
|
||||
|
||||
|
||||
|
||||
public delegate void TokenReceivedDelegate(string token);
|
||||
public static event TokenReceivedDelegate OnTokenReceived;
|
||||
|
||||
@ -39,8 +46,44 @@ public class logoPanel : MonoBehaviour
|
||||
pwdBtn.onClick.AddListener(OnClickPwdBtn);
|
||||
loginBtn.onClick.AddListener(() => StartCoroutine(OnClickLoginBtn()));
|
||||
rigistBtn.onClick.AddListener(OnClickRigistBtn);
|
||||
rigBtn.onClick.AddListener(() => StartCoroutine(OnClickRegBtn()));
|
||||
}
|
||||
|
||||
public IEnumerator OnClickRegBtn()
|
||||
{
|
||||
loginbody body = new loginbody
|
||||
{
|
||||
userName = userNameField.text,
|
||||
password = passwordField.text,
|
||||
verifyCode = int.Parse(verifyCodeField.text)
|
||||
};
|
||||
|
||||
string jsonBody = JsonUtility.ToJson(body);
|
||||
using (UnityWebRequest webRequest = new UnityWebRequest("http://121.40.42.41:8080/snail/user/register", "POST"))
|
||||
{
|
||||
// 创建并设置上传和下载处理器
|
||||
webRequest.uploadHandler = new UploadHandlerRaw(System.Text.Encoding.UTF8.GetBytes(jsonBody));
|
||||
webRequest.uploadHandler.contentType = "application/json";
|
||||
webRequest.downloadHandler = new DownloadHandlerBuffer();
|
||||
|
||||
// 发送请求
|
||||
yield return webRequest.SendWebRequest();
|
||||
|
||||
// 检查请求结果
|
||||
if (webRequest.result == UnityWebRequest.Result.Success)
|
||||
{
|
||||
string registerResponse = webRequest.downloadHandler.text;
|
||||
Debug.Log("Register Response: " + registerResponse);
|
||||
// 可在此处解析注册响应并进行后续处理
|
||||
// 比如解析返回的token并触发事件
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("注册失败! " + webRequest.error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnClickRigistBtn()
|
||||
{
|
||||
yzm.gameObject.SetActive(true);
|
||||
@ -54,6 +97,8 @@ public class logoPanel : MonoBehaviour
|
||||
yzmBtn.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//µã»÷µÇ¼°´Å¥
|
||||
private IEnumerator OnClickLoginBtn()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user