_TheStrongestSnail/TheStrongestSnail/Assets/Scripts/snailFactory/buyNewFactory.cs

38 lines
1.3 KiB
C#
Raw Normal View History

2024-12-01 23:17:54 +08:00
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
//9.39.3,开启新的工厂卡槽
public class buyNewFactory : MonoBehaviour
{
public async Task<BuyNewFactoryResponse> BuyNewFactory() // 9.1
{
// 准备请求的头部信息,包含授权令牌
Dictionary<string, string> head = new Dictionary<string, string>
{
{ "Authorization", Global.global.serverResponse.data.token }
};
// 异步发送请求以获取最新的蜗牛骑士信息
string response93 = await web.SendRequest(web.URL + "/snail/factory/openSlot", "POST", "{}", head);
// 调试输出接收到的响应
Debug.Log("9.3,开启新的工厂卡槽" + response93);
// 将响应反序列化为对象
BuyNewFactoryResponse buyNewFactoryResponse = JsonConvert.DeserializeObject<BuyNewFactoryResponse>(response93);
// 返回解析后的对象
return buyNewFactoryResponse;
}
}
//=============返回==========================================================================
public class BuyNewFactoryResponse : Response
{
public string data;
}
//返回参数code200成功
//        message成功提示语
//        datanull