岛主模块接口

This commit is contained in:
杨号敬 2025-01-04 15:08:32 +08:00
parent 63dde9174f
commit 11f8b4fa60
7 changed files with 178 additions and 0 deletions

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ff6b29309c45aaa4da821da053e0861c
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,45 @@
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
public class Auctioncertificate: MonoBehaviour
{
public Dictionary<string, string> CreateHeaders()
{
if (string.IsNullOrEmpty(MyGlobal.global.loginResponse.Data.access_token))
{
Debug.LogWarning("尝试创建请求头时token 未设置。");
return new Dictionary<string, string>();
}
return new Dictionary<string, string>
{
{ "Authorization","Bearer "+MyGlobal.global.loginResponse.Data.access_token },
{ "client-info", "{\"platform\":\"ios\",\"phone_product\":\"apple\",\"phone_model\":\"iPhone_8\",\"system_version\":\"12.0\",\"screen_size\":\"750*1334\",\"device_no\":\"e3e277810fff9d955ebdd7037eff51a8\",\"version\":\"1.0.0\"}" }
};
}
public async Task<certificateResponse> Island()
{
string response = await myWeb.SendRequest(myWeb.URL + "/api/island/cert_list", "GET", "{}", CreateHeaders());
Debug.Log("岛主证书" + response);
certificateResponse certificate = JsonConvert.DeserializeObject<certificateResponse>(response);
//Debug.Log(teamInfo.Data.Info.Nickname);
return certificate;
}
}
public class certificateResponse
{
public certificateData Data { get; set; }
}
public class certificateData
{
public string uid { get; set; }
public string nickname { get; set; }
public string serial_no { get; set; }
public int copies { get; set; }
public string island_name { get; set; }
public string issue_date { get; set; }
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: acd9ea8f9fcf28f41ac1fe76a6a7e0a4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,46 @@
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
public class Auctioninformation: MonoBehaviour
{
public Dictionary<string, string> CreateHeaders()
{
if (string.IsNullOrEmpty(MyGlobal.global.loginResponse.Data.access_token))
{
Debug.LogWarning("尝试创建请求头时token 未设置。");
return new Dictionary<string, string>();
}
return new Dictionary<string, string>
{
{ "Authorization","Bearer "+MyGlobal.global.loginResponse.Data.access_token },
{ "client-info", "{\"platform\":\"ios\",\"phone_product\":\"apple\",\"phone_model\":\"iPhone_8\",\"system_version\":\"12.0\",\"screen_size\":\"750*1334\",\"device_no\":\"e3e277810fff9d955ebdd7037eff51a8\",\"version\":\"1.0.0\"}" }
};
}
public async Task<AuctionResponse> Island(int count)
{
string response = await myWeb.SendRequest(myWeb.URL + "/api/island/submit", "GET", "{}", CreateHeaders());
Debug.Log("岛主信息" + response);
AuctionResponse Island = JsonConvert.DeserializeObject<AuctionResponse>(response);
//Debug.Log(teamInfo.Data.Info.Nickname);
return Island;
}
}
public class AuctionResponse
{
public AuctionData Data { get; set; }
}
public class AuctionData
{
public int gold { get; set; }
public string intro_text { get; set; }
public int countdown { get; set; }
public int island_id { get; set; }
public string island_name { get; set; }
public int invest_total { get; set; }
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 82907bb754fe74643be310ebe0654f63
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,46 @@
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
public class Islandownerbidding: MonoBehaviour
{
public Dictionary<string, string> CreateHeaders()
{
if (string.IsNullOrEmpty(MyGlobal.global.loginResponse.Data.access_token))
{
Debug.LogWarning("尝试创建请求头时token 未设置。");
return new Dictionary<string, string>();
}
return new Dictionary<string, string>
{
{ "Authorization","Bearer "+MyGlobal.global.loginResponse.Data.access_token },
{ "client-info", "{\"platform\":\"ios\",\"phone_product\":\"apple\",\"phone_model\":\"iPhone_8\",\"system_version\":\"12.0\",\"screen_size\":\"750*1334\",\"device_no\":\"e3e277810fff9d955ebdd7037eff51a8\",\"version\":\"1.0.0\"}" }
};
}
public async Task<IslandResponse> Island(Islandbody islandbody)
{
Debug.Log("岛主竞拍入参" + JsonConvert.SerializeObject(islandbody));
string response = await myWeb.SendRequest(myWeb.URL + "/api/island/info", "POST", JsonConvert.SerializeObject(islandbody), CreateHeaders());
Debug.Log("岛主竞拍" + response);
IslandResponse Island = JsonConvert.DeserializeObject<IslandResponse>(response);
//Debug.Log(teamInfo.Data.Info.Nickname);
return Island;
}
}
public class Islandbody
{
public int count;
}
public class IslandResponse
{
public IslandData Data { get; set; }
}
public class IslandData
{
public int balance { get; set; }
public int invest_total { get; set; }
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 70cf240f9a42b134181a608af77f0995
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: