_TheStrongestSnail/TheStrongestSnail/Assets/Scripts/kuangChang10/openSlot105.cs
2024-12-02 17:51:28 +08:00

40 lines
1.1 KiB
C#

using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
//10.5开启卡槽
public class openSlot105 : MonoBehaviour
{
public async Task<bool> OpenSlot()
{
// 准备请求的头部信息,包含授权令牌
Dictionary<string, string> head = new Dictionary<string, string>
{
{ "Authorization", Global.global.serverResponse.data.token }
};
// 异步发送请求以获取最新的蜗牛骑士信息
string response0105 = await web.SendRequest(web.URL + "/snail/mining/openSlot", "POST", "{}", head);
// 调试输出接收到的响应
Debug.Log("10.5开启卡槽" + response0105);
// 将响应反序列化为对象
OpenSlot openSlot = JsonConvert.DeserializeObject<OpenSlot>(response0105);
bool isSucceed;
if (openSlot.code == 200) { isSucceed = true; } else { isSucceed = false; }
// 返回解析后的对象
return isSucceed;
}
}
//===========返回==================================
public class OpenSlot:Response
{
public string data;
}