_TheStrongestSnail/TheStrongestSnail/Assets/Scripts/Login/11/motherFucker511.cs
wulongxiao 2c61dc24b5 jiekou
2024-11-14 18:25:21 +08:00

51 lines
1.4 KiB
C#

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Threading.Tasks;
public class motherFucker511 : MonoBehaviour
{
public int gameEscapeId;
public int carrySeconds;
// 定义一个事件,当 gameEscapeId 被更新时触发
public static event Action<int> OnGameEscapeIdUpdated;
private string token; // 用于保存收到的 token
void Start()
{
// 监听登录获取 token
LoginAndGetToken.OnTokenReceived += HandleTokenReceived;
}
void HandleTokenReceived(string token)
{
this.token = token;
Debug.Log("HandleTokenReceived监听=============================================================================================================:" + token);
gameEscape(token);
}
public async Task gameEscape(string token)
{
// 用来给请求头赋值
string Authorization = token;
// 设置请求头
Dictionary<string, string> head51 = new Dictionary<string, string>
{
{ "Authorization", Authorization }
};
// 发送请求并接收响应
string response51 = await web.SendRequest("http://121.40.42.41:8080/snail/LatestGame511/queryLatest", "POST", "{}", head51);
Debug.Log("5.1查询最近一场大屠杀" + response51);
}
}