登录完成
This commit is contained in:
parent
6fd35d739c
commit
4ed4a6076f
@ -817,7 +817,7 @@ MonoBehaviour:
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 252707970}
|
||||
m_Enabled: 1
|
||||
m_Enabled: 0
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: f381a54ea0a90e3448e8ae6e3cf61375, type: 3}
|
||||
m_Name:
|
||||
@ -836,9 +836,7 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 764bdc3f3af765b46a38c1133bfcbd2f, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
pwdLoginBtn: {fileID: 0}
|
||||
yzmLoginBtn: {fileID: 0}
|
||||
loginBtn: {fileID: 0}
|
||||
loginBtn: {fileID: 1493573621}
|
||||
getYzmBtn: {fileID: 1341634595}
|
||||
id: {fileID: 998972941}
|
||||
pwd: {fileID: 1477048540}
|
||||
|
@ -1,13 +1,15 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Unity.VisualScripting.Antlr3.Runtime;
|
||||
using UnityEditor.PackageManager;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class LoginPanel : MonoBehaviour
|
||||
{
|
||||
public Button pwdLoginBtn;
|
||||
public Button yzmLoginBtn;
|
||||
|
||||
public Button loginBtn;
|
||||
public Button getYzmBtn;
|
||||
public InputField id;
|
||||
@ -18,8 +20,7 @@ public class LoginPanel : MonoBehaviour
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
pwdLoginBtn.onClick.AddListener(OnClickPwdLoginBtn);
|
||||
yzmLoginBtn.onClick.AddListener(OnClickYzmLoginBtn);
|
||||
|
||||
loginBtn.onClick.AddListener(OnClickLoginBtn);
|
||||
getYzmBtn.onClick.AddListener(OnClickGetYzmBtn);
|
||||
}
|
||||
@ -31,22 +32,26 @@ public class LoginPanel : MonoBehaviour
|
||||
|
||||
public void OnClickLoginBtn()
|
||||
{
|
||||
Login();
|
||||
}
|
||||
|
||||
//登录逻辑
|
||||
public async void Login()
|
||||
{
|
||||
auth_login loginBody = new auth_login
|
||||
{
|
||||
clientId = id.text,
|
||||
grantType = pwd.text
|
||||
};
|
||||
//Debug.Log(JsonUtility.ToJson(loginBody));
|
||||
string response = await web.SendRequest(web.URL + "/auth/login", "POST", JsonUtility.ToJson(loginBody));
|
||||
Debug.Log("登录" + response);
|
||||
// 解析服务器返回的数据
|
||||
server serverData = JsonConvert.DeserializeObject<server>(response);
|
||||
//token = serverData.data.access_token;
|
||||
Debug.Log(serverData.data.access_token);
|
||||
|
||||
}
|
||||
|
||||
public void OnClickYzmLoginBtn()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void OnClickPwdLoginBtn()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user