_TheStrongestSnail/TheStrongestSnail/Assets/Scripts/Login/WebConnact.cs

544 lines
20 KiB
C#
Raw Normal View History

2024-11-11 19:48:32 +08:00
using System;
using System.Collections;
using System.Collections.Generic;
using System.Xml.Linq;
using UnityEngine;
using UnityEngine.Networking;
using System.Threading.Tasks;
using Newtonsoft.Json;
2024-11-11 19:48:32 +08:00
public class WebConnact : MonoBehaviour
{
private string token; // <20><><EFBFBD><EFBFBD> token <20>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9>
void Start()
{
// <20><><EFBFBD>ڳ<EFBFBD><DAB3><EFBFBD>¼ע<C2BC><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>¼<EFBFBD>󷵻ص<F3B7B5BB>token
// <20><><EFBFBD>˵<EFBFBD>¼<EFBFBD><C2BC><EFBFBD>ڴ˷<DAB4><CBB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬʱ<CDAC><CAB1>
// <20><><EFBFBD>ü<EFBFBD><C3BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>ص<EFBFBD><D8B5>ķ<EFBFBD><C4B7><EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD>м<EFBFBD><D0BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>token<65><6E><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
LoginAndGetToken.OnTokenReceived += HandleTokenReceived;
// <20><><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD> gameEscapeId <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD> HandleGameEscapeIdUpdated
selectGameEscape512.OnGameEscapeIdUpdated += HandleGameEscapeIdUpdated;
}
void HandleTokenReceived(string receivedToken)
{
// <20><><EFBFBD><EFBFBD> token
token = receivedToken; // <20><><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD><D5B5><EFBFBD> token <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//Debug.Log("HandleTokenReceived<65><64><EFBFBD><EFBFBD>:" + token);
// <20>״ε<D7B4><CEB5><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ʱû<CAB1><C3BB> escapeId <20><><EFBFBD>Դ<EFBFBD><D4B4>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD>˴<EFBFBD> -1
Loding(token, -1);
}
void HandleGameEscapeIdUpdated(int newGameEscapeId)
{
Debug.Log("GameEscapeId <20>Ѹ<EFBFBD><D1B8><EFBFBD>Ϊ: " + newGameEscapeId);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Loding <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> escapeId
Loding(token, newGameEscapeId);
}
// <20><><EFBFBD><EFBFBD> token <20>͸<EFBFBD><CDB8>º<EFBFBD><C2BA><EFBFBD> escapeId
public async void Loding(string token, int newGameEscapeId)
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7>ֵ
string Authorization = token;
Debug.Log("Loding(Authorization)<29><><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7>ֵ: " + Authorization);
// <20><><EFBFBD><EFBFBD> newGameEscapeId <20><><EFBFBD>dz<EFBFBD>ʼֵ<CABC><D6B5>-1<><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD>
int escapeId = newGameEscapeId != -1 ? newGameEscapeId : 0;
Debug.Log("ʹ<><CAB9><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> escapeId: " + escapeId);
// <20><>ʣ<EFBFBD>µ<EFBFBD><C2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߼<EFBFBD>
// <20><><EFBFBD><EFBFBD><E7A3BA><EFBFBD><EFBFBD>Ҫ<EFBFBD>õ<EFBFBD> escapeId <20>ĵط<C4B5>ֱ<EFBFBD><D6B1>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD>
//1.3<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD>Ϣ//<2F><>ͨ<EFBFBD><CDA8>
User_InformationHead user = new User_InformationHead();
Dictionary<string, string> head13 = new Dictionary<string, string>
{
{ "Authorization", Authorization }, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩͷ
};
string UserNewInfoBody = @"
{
""nickName"": ""wulongxiao"",
""headImg"": ""https://fantasymonster-app.oss-cn-hangzhou.aliyuncs.com/upload/imgs/127e4e42d7c0405aab53359c1b278a9c.png"",
""gender"": 1,
""birthday"": ""2023-12-12 12:12:12""
}";
//<2F><>ӡ JSON <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E5A3AC><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>
Debug.Log("JSON Request Data: " + UserNewInfoBody);
string response13 = await web.SendRequest("http://121.40.42.41:8080/snail/user/update", "POST", UserNewInfoBody, head13);
Debug.Log("1.3<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD>Ϣ" + response13);
////1.4<EFBFBD><EFBFBD>ѯ<EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Dictionary<string, string> head14 = new Dictionary<string, string>
{
{ "Authorization", Authorization }, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩͷ
};
string response14 = await web.SendRequest("http://121.40.42.41:8080/snail/user/queryUserInfo", "POST", "{}", head14);
Debug.Log("1.4<EFBFBD><EFBFBD>ѯ<EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" + response14);
//2.1<EFBFBD>̳<EFBFBD><EFBFBD>б<EFBFBD>//<2F><>ͨ<EFBFBD><CDA8>
Mall_List mall_virtual = new Mall_List();
mall_virtual.productType = 0;
mall_virtual.pageNo = 1;
mall_virtual.pageSize = 20;
string mall_virtualponse = await web.SendRequest("http://121.40.42.41:8080/snail/product/page", "POST", JsonUtility.ToJson(mall_virtual));
Debug.Log("2.1<EFBFBD>̳<EFBFBD><EFBFBD>б<EFBFBD><EFBFBD><EFBFBD>" + mall_virtualponse);
//2.1<EFBFBD><EFBFBD><EFBFBD>̳<EFBFBD><EFBFBD>б<EFBFBD>//<2F><>ͨ<EFBFBD><CDA8>
Mall_List mall = new Mall_List();
mall.productType = 1;
//mall.pageNo = 1;
//mall.pageSize = 20;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>ʡ<EFBFBD>Բ<EFBFBD>д<EFBFBD><D0B4>Ĭ<EFBFBD><C4AC><EFBFBD><EFBFBD>1<EFBFBD><31>20
string response21 = await web.SendRequest("http://121.40.42.41:8080/snail/product/page", "POST", JsonUtility.ToJson(mall));
Debug.Log("2.1<EFBFBD>̳<EFBFBD><EFBFBD>б<EFBFBD><EFBFBD><EFBFBD>" + response21);
//2.2<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD>̳<EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>//<2F><>ͨ<EFBFBD><CDA8>
Dictionary<string, string> head22 = new Dictionary<string, string>
{
{ "Authorization", Authorization }, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩͷ
};
Product_Details product = new Product_Details();
product.productId = 1;
string response22 = await web.SendRequest("http://121.40.42.41:8080/snail/product/info", "POST", JsonUtility.ToJson(product), head22);
Debug.Log("JSON Request Data: " + JsonUtility.ToJson(product));
Debug.Log("2.2<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD>̳<EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>" + response22);
//2.3<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֧<EFBFBD><EFBFBD><EFBFBD><EFBFBD>//<2F><>ͨ<EFBFBD><CDA8>
Mall_buy mall_Buy = new Mall_buy();
Dictionary<string, string> head23 = new Dictionary<string, string>
{
{ "Authorization", Authorization }, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩͷ
};
mall_Buy.userId = 106;
mall_Buy.productId = 1;
string response23 = await web.SendRequest("http://121.40.42.41:8080/snail/product/buy", "POST", JsonUtility.ToJson(mall_Buy), head23);
Debug.Log("2.3<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֧<EFBFBD><EFBFBD><EFBFBD><EFBFBD>" + response23);
//3.1<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҳ<EFBFBD><EFBFBD>//<2F><>ͨ<EFBFBD><CDA8>
Query_Announcement query_Announcement = new Query_Announcement();
query_Announcement.userId = 106;
query_Announcement.pageNo = 1;
query_Announcement.pageSize = 20;
string response31 = await web.SendRequest("http://121.40.42.41:8080/snail/notice/page", "POST", JsonUtility.ToJson(query_Announcement));
Debug.Log("3.1<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҳ<EFBFBD><EFBFBD>" + response31);
//3.2<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>飺//<2F><>ͨ<EFBFBD><CDA8>
int AnnouncementId = 1;
string response32 = await web.SendRequest($"http://121.40.42.41:8080/snail/notice/info?noticeId={AnnouncementId}", "GET");
Debug.Log("3.2<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>飺" + response32);
//=================================================================================================================================
//4.1<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD>ųط<EFBFBD>ҳ//<2F><>ͨ<EFBFBD><CDA8>
Dictionary<string, string> head41 = new Dictionary<string, string>
{
{ "Authorization", Authorization }, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩͷ
};
int orderByBeansCoin = 1;
string response41 = await web.SendRequest("http://121.40.42.41:8080/snail/cutePool/page", "POST", JsonUtility.ToJson(orderByBeansCoin), head41);
Debug.Log("<22><>ѯ<EFBFBD><D1AF><EFBFBD>ųط<C5B3>ҳ" + response41);
//=================================================================================================================================
//4.2<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>//<2F><>ͨ<EFBFBD><CDA8>
Dictionary<string, string> head42 = new Dictionary<string, string>
{
{ "Authorization", Authorization }, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩͷ
};
string buyCutePool = @"
{
""userId"": 106,
""cutePoolId"": 2
}";
//<2F><>ӡ JSON <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E5A3AC><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>
Debug.Log("JSON Request Data: " + buyCutePool);
string response42 = await web.SendRequest("http://121.40.42.41:8080/snail/cutePool/buy", "POST", buyCutePool, head42);
Debug.Log("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>" + response42);
//============================================================================================================================
//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>Ȩͷ
};
// ʹ<><CAB9><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> escapeId <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
string response51 = await web.SendRequest("http://121.40.42.41:8080/snail/gameEscape/queryLatest", "POST", "{}", head51);
Debug.Log("5.1<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɱ: " + response51);
//====================================================================================================================
// 5.1.2<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܰ棩:
Dictionary<string, string> head512 = new Dictionary<string, string>
{
{ "Authorization", Authorization }, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩͷ
};
string queryEscapeRoomListBody = $@"
{{
""userId"": 106,
""escapeId"": {escapeId}
}}";
string response512 = await web.SendRequest("http://121.40.42.41:8080/snail/gameEscape/queryEscapeRoomList", "POST", queryEscapeRoomListBody, head512);
Debug.Log("5.1.2<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܰ棩: " + response512);
//5.1.3<EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><EFBFBD>
Dictionary<string, string> head513 = new Dictionary<string, string>
{
{ "Authorization", Authorization }, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩͷ
};
string userBetBody = $@"
{{
""userId"": 106,
""escapeId"": {escapeId},
""bet"": 100,
""roomNo"":1
}}";
string response513 = await web.SendRequest("http://121.40.42.41:8080/snail/gameEscape/userBet", "POST", userBetBody, head513);
Debug.Log("5.1.3<EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><EFBFBD>" + response513);
//5.1.4<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD>ɱ
Dictionary<string, string> head514 = new Dictionary<string, string>
{
{ "Authorization", Authorization }, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩͷ
};
string selectKill = $@"
{{
""userId"": 106,
""escapeId"": {escapeId}
}}";
string response514 = await web.SendRequest("http://121.40.42.41:8080/snail/gameEscape/queryKill", "POST", selectKill, head514);
Debug.Log("5.1.4<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD>ɱ<EFBFBD><EFBFBD>" + response514);
//5.1.5<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Dictionary<string, string> head515 = new Dictionary<string, string>
{
{ "Authorization", Authorization }, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩͷ
};
string queryUserBetResult = $@"
{{
""userId"": 106,
""escapeId"": {escapeId}
}}";
string response515 = await web.SendRequest("http://121.40.42.41:8080/snail/gameEscape/queryUserBetResult", "POST", queryUserBetResult, head515);
Debug.Log("5.1.5<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD>㣺" + response515);
}
void OnDestroy()
{
// ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD>й©
LoginAndGetToken.OnTokenReceived -= HandleTokenReceived;
selectGameEscape512.OnGameEscapeIdUpdated -= HandleGameEscapeIdUpdated;
}
// Update is called once per frame
void Update()
{
}
}
/*public class WebConnact : MonoBehaviour
2024-11-11 19:48:32 +08:00
{
void Start()
{
//<2F><><EFBFBD>ڳ<EFBFBD><DAB3><EFBFBD>¼ע<C2BC><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>¼<EFBFBD>󷵻ص<F3B7B5BB>token
//<2F><><EFBFBD>˵<EFBFBD>¼<EFBFBD><C2BC><EFBFBD>ڴ˷<DAB4><CBB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬʱ<CDAC><CAB1>
//<2F><><EFBFBD>ü<EFBFBD><C3BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>ص<EFBFBD><D8B5>ķ<EFBFBD><C4B7><EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD>м<EFBFBD><D0BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>token<65><6E><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
LoginAndGetToken.OnTokenReceived += HandleTokenReceived;
//Loding();
// <20><><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD> gameEscapeId <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD> HandleGameEscapeIdUpdated
selectGameEscape512.OnGameEscapeIdUpdated += HandleGameEscapeIdUpdated;
2024-11-11 19:48:32 +08:00
}
void HandleTokenReceived(string token)
{
// ʹ<><CAB9> token
//string loginToken=token;
Debug.Log("HandleTokenReceived<65><64><EFBFBD><EFBFBD>:"+token);
2024-11-11 19:48:32 +08:00
Loding(token);
}
void HandleGameEscapeIdUpdated(int newGameEscapeId)
{
Debug.Log("GameEscapeId <20>Ѹ<EFBFBD><D1B8><EFBFBD>Ϊ: " + newGameEscapeId);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫִ<D2AA>е<EFBFBD><D0B5>߼<EFBFBD>
}
2024-11-11 19:48:32 +08:00
// <20><><EFBFBD><EFBFBD> token <20>͸<EFBFBD><CDB8>º<EFBFBD><C2BA><EFBFBD> escapeId
public async void Loding(string token, int newGameEscapeId)
2024-11-11 19:48:32 +08:00
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7>ֵ
2024-11-11 19:48:32 +08:00
string Authorization = token;
Debug.Log("Loding(Authorization)<29><><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7>ֵ" + Authorization);
2024-11-11 19:48:32 +08:00
// <20><><EFBFBD><EFBFBD> newGameEscapeId <20><><EFBFBD>dz<EFBFBD>ʼֵ<CABC><D6B5>-1<><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD>
int escapeId = newGameEscapeId != -1 ? newGameEscapeId : 0;
2024-11-11 19:48:32 +08:00
Debug.Log("ʹ<><CAB9><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> escapeId: " + escapeId);
2024-11-11 19:48:32 +08:00
//loginbody body = new loginbody();
//body.userName = "15151658596";// + 15151658596;
//body.password = "123456";// + 123456;
//body.verifyCode = 111111;
//string regisestrespose = await web.SendRequest("http://121.40.42.41:8080/snail/user/register", "POST", JsonUtility.ToJson(body));
//Debug.Log(regisestrespose);
//ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD> //<2F><>ͨ<EFBFBD><CDA8>
//loginbody body = new loginbody();
//body.userName = "15151658596";// + 15151658596;
//body.password = "123456";// + 123456;
//body.verifyCode = 111111;
//string loginResponse = await web.SendRequest("http://121.40.42.41:8080/snail/user/login", "POST", JsonUtility.ToJson(body));
//Debug.Log(loginResponse);
//<2F><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>//<2F><>ͨ<EFBFBD><CDA8>
////1.3<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD>Ϣ//<2F><>ͨ<EFBFBD><CDA8>
////User_InformationHead user = new User_InformationHead();
//Dictionary<string, string> head13 = new Dictionary<string, string>
2024-11-11 19:48:32 +08:00
//{
// { "Authorization", Authorization }, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩͷ
// };
//string UserNewInfoBody = @"
// {
// ""nickName"": ""wulongxiao"",
// ""headImg"": ""https://fantasymonster-app.oss-cn-hangzhou.aliyuncs.com/upload/imgs/127e4e42d7c0405aab53359c1b278a9c.png"",
// ""gender"": 1,
// ""birthday"": ""2023-12-12 12:12:12""
// }";
////<2F><>ӡ JSON <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E5A3AC><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>
//Debug.Log("JSON Request Data: " + UserNewInfoBody);
//string response13 = await web.SendRequest("http://121.40.42.41:8080/snail/user/update", "POST", UserNewInfoBody, head13);
//Debug.Log("1.3<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD>Ϣ" + response13);
////1.4<EFBFBD><EFBFBD>ѯ<EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//Dictionary<string, string> head14 = new Dictionary<string, string>
//{
// { "Authorization", Authorization }, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩͷ
// };
//string response14 = await web.SendRequest("http://121.40.42.41:8080/snail/user/queryUserInfo", "POST", "{}", head14);
//Debug.Log("1.4<EFBFBD><EFBFBD>ѯ<EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" + response14);
2024-11-11 19:48:32 +08:00
////2.1<EFBFBD>̳<EFBFBD><EFBFBD>б<EFBFBD>//<2F><>ͨ<EFBFBD><CDA8>
2024-11-11 19:48:32 +08:00
//Mall_List mall_virtual = new Mall_List();
//mall_virtual.productType = 0;
//mall_virtual.pageNo = 1;
//mall_virtual.pageSize = 20;
//string mall_virtualponse = await web.SendRequest("http://121.40.42.41:8080/snail/product/page", "POST", JsonUtility.ToJson(mall_virtual));
//Debug.Log("2.1<EFBFBD>̳<EFBFBD><EFBFBD>б<EFBFBD><EFBFBD><EFBFBD>" + mall_virtualponse);
2024-11-11 19:48:32 +08:00
////2.1<EFBFBD><EFBFBD><EFBFBD>̳<EFBFBD><EFBFBD>б<EFBFBD>//<2F><>ͨ<EFBFBD><CDA8>
2024-11-11 19:48:32 +08:00
//Mall_List mall = new Mall_List();
//mall.productType = 1;
////mall.pageNo = 1;
////mall.pageSize = 20;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>ʡ<EFBFBD>Բ<EFBFBD>д<EFBFBD><D0B4>Ĭ<EFBFBD><C4AC><EFBFBD><EFBFBD>1<EFBFBD><31>20
//string response21 = await web.SendRequest("http://121.40.42.41:8080/snail/product/page", "POST", JsonUtility.ToJson(mall));
//Debug.Log("2.1<EFBFBD>̳<EFBFBD><EFBFBD>б<EFBFBD><EFBFBD><EFBFBD>" + response21);
2024-11-11 19:48:32 +08:00
////2.2<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD>̳<EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>//<2F><>ͨ<EFBFBD><CDA8>
//Dictionary<string, string> head22 = new Dictionary<string, string>
//{
// { "Authorization", Authorization }, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩͷ
// };
2024-11-11 19:48:32 +08:00
//Product_Details product = new Product_Details();
//product.productId = 1;
//string response22 = await web.SendRequest("http://121.40.42.41:8080/snail/product/info", "POST", JsonUtility.ToJson(product), head22);
//Debug.Log("JSON Request Data: " + JsonUtility.ToJson(product));
//Debug.Log("2.2<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD>̳<EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>" + response22);
2024-11-11 19:48:32 +08:00
////2.3<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֧<EFBFBD><EFBFBD><EFBFBD><EFBFBD>//<2F><>ͨ<EFBFBD><CDA8>
//Mall_buy mall_Buy = new Mall_buy();
//Dictionary<string, string> head23 = new Dictionary<string, string>
//{
// { "Authorization", Authorization }, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩͷ
// };
//mall_Buy.userId = 106;
//mall_Buy.productId = 1;
//string response23 = await web.SendRequest("http://121.40.42.41:8080/snail/product/buy", "POST", JsonUtility.ToJson(mall_Buy), head23);
//Debug.Log("2.3<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֧<EFBFBD><EFBFBD><EFBFBD><EFBFBD>" + response23);
2024-11-11 19:48:32 +08:00
////3.1<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҳ<EFBFBD><EFBFBD>//<2F><>ͨ<EFBFBD><CDA8>
2024-11-11 19:48:32 +08:00
//Query_Announcement query_Announcement = new Query_Announcement();
//query_Announcement.userId = 106;
//query_Announcement.pageNo = 1;
//query_Announcement.pageSize = 20;
//string response31 = await web.SendRequest("http://121.40.42.41:8080/snail/notice/page", "POST", JsonUtility.ToJson(query_Announcement));
//Debug.Log("3.1<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҳ<EFBFBD><EFBFBD>" + response31);
2024-11-11 19:48:32 +08:00
////3.2<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>飺//<2F><>ͨ<EFBFBD><CDA8>
//int AnnouncementId = 1;
//string response32 = await web.SendRequest($"http://121.40.42.41:8080/snail/notice/info?noticeId={AnnouncementId}", "GET");
//Debug.Log("3.2<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>飺" + response32);
2024-11-11 19:48:32 +08:00
////4.1<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD>ųط<EFBFBD>ҳ//<2F><>ͨ<EFBFBD><CDA8>
//Dictionary<string, string> head41 = new Dictionary<string, string>
//{
// { "Authorization", Authorization }, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩͷ
// };
//int orderByBeansCoin = 1;
//string response41 = await web.SendRequest("http://121.40.42.41:8080/snail/cutePool/page", "POST", JsonUtility.ToJson(orderByBeansCoin), head41);
//Debug.Log("<22><>ѯ<EFBFBD><D1AF><EFBFBD>ųط<C5B3>ҳ" + response41);
2024-11-11 19:48:32 +08:00
////4.2<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>//<2F><>ͨ<EFBFBD><CDA8>
//Dictionary<string, string> head42 = new Dictionary<string, string>
//{
// { "Authorization", Authorization }, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩͷ
// };
//string buyCutePool = @"
// {
// ""userId"": 106,
// ""cutePoolId"": 2
// }";
////<2F><>ӡ JSON <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E5A3AC><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>
//Debug.Log("JSON Request Data: " + buyCutePool);
//string response42 = await web.SendRequest("http://121.40.42.41:8080/snail/cutePool/buy", "POST", buyCutePool, head42);
//Debug.Log("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>" + response42);
2024-11-11 19:48:32 +08:00
////5.1<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɱ//<2F><>ͨ<EFBFBD><CDA8>
//Dictionary<string, string> head51 = new Dictionary<string, string>
//{
// { "Authorization", Authorization }, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩͷ
// };
//string response51 = await web.SendRequest("http://121.40.42.41:8080/snail/gameEscape/queryLatest", "POST", "{}", head51);
//Debug.Log("5.1<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɱ" + response51);//<2F><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ<EFBFBD><CFB7><EFBFBD>
////5.1.2<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܰ棩
//Dictionary<string, string> head512 = new Dictionary<string, string>
//{
// { "Authorization", Authorization }, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩͷ
// };
//string queryEscapeRoomListBody = @"
// {
// ""userId"": 106,
// ""escapeId"": 24336
// }";
//string response512 = await web.SendRequest("http://121.40.42.41:8080/snail/gameEscape/queryEscapeRoomList", "POST", queryEscapeRoomListBody, head512);
//Debug.Log("5.1.2<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܰ棩" + response512);
////5.1.3<EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><EFBFBD>
//Dictionary<string, string> head513 = new Dictionary<string, string>
//{
// { "Authorization", Authorization }, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩͷ
// };
//string userBetBody = @"
// {
// ""userId"": 106,
// ""escapeId"": 24381,
// ""bet"": 100,
// ""roomNo"":1
// }";
//string response513 = await web.SendRequest("http://121.40.42.41:8080/snail/gameEscape/userBet", "POST", userBetBody, head513);
//Debug.Log("5.1.3<EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><EFBFBD>" + response513);
//5.1.4<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD>ɱ
Dictionary<string, string> head514 = new Dictionary<string, string>
{
{ "Authorization", Authorization }, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩͷ
};
string selectKill = @"
{
""userId"": 106,
""escapeId"": {escapeId}
}";
string response514 = await web.SendRequest("http://121.40.42.41:8080/snail/gameEscape/queryKill", "POST", selectKill, head514);
Debug.Log("5.1.4<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD>ɱ<EFBFBD><EFBFBD>" + response514);
//////5.1.5<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//Dictionary<string, string> head515 = new Dictionary<string, string>
//{
// { "Authorization", Authorization }, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩͷ
// };
//string queryUserBetResult = @"
// {
// ""userId"": 106,
// ""escapeId"": 24377
// }";
//string response515 = await web.SendRequest("http://121.40.42.41:8080/snail/gameEscape/queryUserBetResult", "POST", queryUserBetResult, head515);
//Debug.Log("5.1.5<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD>㣺" + response515);
//===========================================================================================================================
2024-11-11 19:48:32 +08:00
}
void OnDestroy()
{
LoginAndGetToken.OnTokenReceived -= HandleTokenReceived;
}
// Update is called once per frame
void Update()
{
}
}*/
2024-11-11 19:48:32 +08:00
[Serializable]
public class Search_room//<2F><>¼<EFBFBD><C2BC>ע<EFBFBD><D7A2><EFBFBD><EFBFBD>
{
public int userId;
}
//[Serializable]
//public class loginbody//<2F><>¼<EFBFBD><C2BC>ע<EFBFBD><D7A2><EFBFBD><EFBFBD>
//{
// public string userName;
// public string password;
// public int verifyCode;
//}
[System.Serializable]
public class User_InformationHead //<2F><><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD>Ϣ
{
public string nickName;
public string headImg;
public string gender;
public string birthday;
}
[Serializable]
public class Query_Announcement //<2F><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҳ
{
public int userId;
public int pageNo;
public int pageSize;
}
[Serializable]
public class Mall_List //<2F><>ȡ<EFBFBD>̳<EFBFBD><CCB3>б<EFBFBD>
{
public int productType;
public int pageNo;
public int pageSize;
}
[Serializable]
public class Product_Details//<2F><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><E9A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
public int productId;
}
[Serializable]
public class Mall_buy
{ public int productId;
public int userId;
}
[Serializable]
public class cutePoolPage {
public int orderByBeansCoin;
}
2024-11-11 19:48:32 +08:00