64 lines
1.8 KiB
C#
64 lines
1.8 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 async Task<string> OpenSlotstr()
|
|
{
|
|
// 准备请求的头部信息,包含授权令牌
|
|
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);
|
|
string isSucceed = openSlot.message;
|
|
|
|
|
|
// 返回解析后的对象
|
|
return isSucceed;
|
|
}
|
|
}
|
|
//===========返回==================================
|
|
public class OpenSlot:Response
|
|
{
|
|
public string data;
|
|
}
|
|
|