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 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 head51 = new Dictionary { { "Authorization", Authorization } }; // 发送请求并接收响应 string response51 = await web.SendRequest("http://121.40.42.41:8080/snail/LatestGame511/queryLatest", "POST", "{}", head51); Debug.Log("5.1查询最近一场大屠杀" + response51); } }