2024-11-13 21:52:56 +08:00
|
|
|
|
using JetBrains.Annotations;
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using System;
|
2024-11-13 10:44:34 +08:00
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
2024-11-13 21:52:56 +08:00
|
|
|
|
using Unity.VisualScripting.Antlr3.Runtime;
|
2024-11-13 10:44:34 +08:00
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
public class Test : MonoBehaviour
|
|
|
|
|
{
|
2024-11-13 21:52:56 +08:00
|
|
|
|
public string token;
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD> token ʱ<><CAB1><EFBFBD><EFBFBD><EFBFBD>˷<EFBFBD><CBB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> token
|
|
|
|
|
public void HandleTokenReceived(string receivedToken)
|
|
|
|
|
{
|
|
|
|
|
token = receivedToken; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> token
|
|
|
|
|
// <20>״ε<D7B4><CEB5>ü<EFBFBD><C3BC>س<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>
|
|
|
|
|
//LoadGameEscapeData();
|
|
|
|
|
// Debug.Log("<22><><EFBFBD>յ<EFBFBD><D5B5>µ<EFBFBD> token: " + token);
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-13 10:44:34 +08:00
|
|
|
|
public UpdateUserInfo updateUserInfo;
|
2024-11-13 12:06:05 +08:00
|
|
|
|
public int sec;
|
2024-11-13 10:44:34 +08:00
|
|
|
|
// Start is called before the first frame update
|
|
|
|
|
void Start()
|
|
|
|
|
{
|
2024-11-13 21:52:56 +08:00
|
|
|
|
// ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD> token ʱ<><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD> HandleTokenReceived
|
|
|
|
|
LoginAndGetToken.OnTokenReceived += HandleTokenReceived;
|
2024-11-13 10:44:34 +08:00
|
|
|
|
updateUserInfo = new UpdateUserInfo();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Update is called once per frame
|
|
|
|
|
void Update()
|
|
|
|
|
{
|
|
|
|
|
TestButton();
|
|
|
|
|
}
|
|
|
|
|
public async void TestButton()
|
|
|
|
|
{
|
|
|
|
|
if(Input.GetKey(KeyCode.X))
|
2024-11-13 21:52:56 +08:00
|
|
|
|
{
|
|
|
|
|
sjdlkjf();
|
|
|
|
|
//Debug.Log("nnnnnnnnnnnnnnnn"+sec);
|
2024-11-13 10:44:34 +08:00
|
|
|
|
}
|
2024-11-13 21:52:56 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public async void sjdlkjf()
|
|
|
|
|
{
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7>ֵ
|
|
|
|
|
string Authorization = token;
|
|
|
|
|
//Debug.Log("Loding(Authorization)<29><><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7>ֵ" + Authorization);
|
|
|
|
|
|
|
|
|
|
// 5.1<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɱ
|
|
|
|
|
Dictionary<string, string> head51 = new Dictionary<string, string>
|
|
|
|
|
{
|
|
|
|
|
{ "Authorization", Authorization }, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩͷ
|
|
|
|
|
};
|
|
|
|
|
|
2024-11-14 18:09:37 +08:00
|
|
|
|
string response51 = await web.SendRequest("http://121.40.42.41:8080/snail/LatestGame511/queryLatest", "POST", "{}", head51);
|
2024-11-13 21:52:56 +08:00
|
|
|
|
Debug.Log("5.1<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɱ(<28><><EFBFBD><EFBFBD>)" + response51); // <20><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ<EFBFBD><CFB7><EFBFBD>飺
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD>JSON<4F><4E><EFBFBD><EFBFBD>
|
|
|
|
|
string json = response51;
|
|
|
|
|
Response response = JsonConvert.DeserializeObject<Response>(json);
|
|
|
|
|
|
|
|
|
|
int gameEscapeId = response.data.gameEscapeModel.id;
|
|
|
|
|
Debug.Log(gameEscapeId);
|
|
|
|
|
//Debug.Log("<22><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>idΪ: " + gameEscapeId);
|
|
|
|
|
|
|
|
|
|
int carrySeconds = response.data.carrySeconds;
|
|
|
|
|
Debug.Log("====================================================================================="+carrySeconds);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-13 10:44:34 +08:00
|
|
|
|
}
|
2024-11-13 21:52:56 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Serializable]
|
|
|
|
|
public class GameEscapeModel
|
|
|
|
|
{
|
|
|
|
|
public int id; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϷID
|
|
|
|
|
public string gameNo; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//[Serializable]
|
|
|
|
|
//public class GameEscapeRoomResponseVo
|
|
|
|
|
//{
|
|
|
|
|
// public int escapeId; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ<EFBFBD><CFB7>ID
|
|
|
|
|
// public int roomNo; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
[Serializable]
|
|
|
|
|
public class Data
|
|
|
|
|
{
|
|
|
|
|
public int carrySeconds; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
public GameEscapeModel gameEscapeModel; // Ƕ<><EFBFBD>GameEscapeModel<65><6C><EFBFBD><EFBFBD>
|
|
|
|
|
//public List<GameEscapeRoomResponseVo> gameEscapeRoomResponseVoList; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>б<EFBFBD>
|
|
|
|
|
public object gameEscapeUserModel; // <20>û<EFBFBD>ģ<EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD>Ϊ<EFBFBD>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD>ж<EFBFBD><D0B6><EFBFBD>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Serializable]
|
|
|
|
|
public class Response
|
|
|
|
|
{
|
|
|
|
|
public int code; // ״̬<D7B4><CCAC>
|
|
|
|
|
public string message; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|
|
|
|
public Data data; // <20><><EFBFBD>ݶ<EFBFBD><DDB6><EFBFBD>
|
|
|
|
|
}
|