靓号获取与购买接口的完成
This commit is contained in:
parent
14d1eb5979
commit
f713d60e13
@ -394,7 +394,7 @@ GameObject:
|
||||
- component: {fileID: 1939568758}
|
||||
- component: {fileID: 1939568757}
|
||||
m_Layer: 5
|
||||
m_Name: Canvas
|
||||
m_Name: lianghaoCanvas
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
|
38
TheStrongestSnail/Assets/Scripts/GoodId/BuyGoodId42.cs
Normal file
38
TheStrongestSnail/Assets/Scripts/GoodId/BuyGoodId42.cs
Normal file
@ -0,0 +1,38 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
public class BuyGoodId42 : MonoBehaviour
|
||||
{
|
||||
public async Task<BuyGoodIdResponse> buyGoodId(int cutePoolId) // 4.2
|
||||
{
|
||||
// 准备请求的头部信息,包含授权令牌
|
||||
Dictionary<string, string> head41 = new Dictionary<string, string>
|
||||
{
|
||||
{ "Authorization", Global.global.serverResponse.data.token }
|
||||
};
|
||||
|
||||
// 请求体
|
||||
BuyGoodIdBody buyGoodIdBody = new BuyGoodIdBody
|
||||
{
|
||||
userId = Global.global.serverResponse.data.userId,
|
||||
cutePoolId = cutePoolId
|
||||
};
|
||||
|
||||
// 异步发送请求
|
||||
Debug.Log("======入参======" + JsonConvert.SerializeObject(buyGoodIdBody));
|
||||
string response42 = await web.SendRequest(web.URL + "/snail/cutePool/buy", "POST", JsonConvert.SerializeObject(buyGoodIdBody), head41);
|
||||
|
||||
// 调试输出接收到的响应
|
||||
Debug.Log("4.2购买靓号==" + response42);
|
||||
|
||||
// 将响应反序列化为对象
|
||||
BuyGoodIdResponse buyGoodIdResponse = JsonConvert.DeserializeObject<BuyGoodIdResponse>(response42);
|
||||
Debug.Log("8==================================D" + buyGoodIdResponse.Data.TotalCount);
|
||||
return buyGoodIdResponse;
|
||||
|
||||
}
|
||||
}
|
||||
|
11
TheStrongestSnail/Assets/Scripts/GoodId/BuyGoodId42.cs.meta
Normal file
11
TheStrongestSnail/Assets/Scripts/GoodId/BuyGoodId42.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e55a4e0a058739742a83e8d77ae91065
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -628,7 +628,7 @@ public class GoodIdItem
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string CuteNo { get; set; }
|
||||
public float BeansCoin { get; set; }
|
||||
public decimal BeansCoin { get; set; }
|
||||
public int UserId { get; set; }
|
||||
public int Type { get; set; }
|
||||
public int Status { get; set; }
|
||||
@ -639,3 +639,31 @@ public class GoodIdPageBody
|
||||
{
|
||||
public int orderByDesc { get; set; }
|
||||
}
|
||||
//====4.2购买靓号=========================================================
|
||||
//请求体
|
||||
public class BuyGoodIdBody
|
||||
{
|
||||
public int userId { get; set; }
|
||||
public int cutePoolId { get; set; }
|
||||
}
|
||||
//返回值
|
||||
|
||||
public class BuyGoodIdResponse : Response
|
||||
{
|
||||
public BuyGoodIdData Data { get; set; }
|
||||
}
|
||||
|
||||
public class BuyGoodIdData
|
||||
{
|
||||
public int PageNo { get; set; }
|
||||
public int PageSize { get; set; }
|
||||
public int TotalCount { get; set; }
|
||||
public List<object> DataList { get; set; } // 你可以根据需要将List<object>替换为List<YourDataType>===========================================================
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -17,12 +17,13 @@ public class LoginItem :MonoBehaviour
|
||||
|
||||
public async void Init()
|
||||
{
|
||||
idResponse=await goodId.queryUnionPage();
|
||||
idResponse = await goodId.queryUnionPage();
|
||||
for (int i = 0; i < idResponse.Data.DataList.Count; i++)
|
||||
{
|
||||
GameObject Lhitem = (GameObject)Instantiate(Resources.Load("LLPrefabs/Beautiful_numberttem"),contentItem);
|
||||
GameObject Lhitem = (GameObject)Instantiate(Resources.Load("LLPrefabs/Beautiful_numberttem"), contentItem);
|
||||
Lhitem.GetComponent<NumberTc>().BeautifulNumber.text = idResponse.Data.DataList[i].CuteNo;
|
||||
Lhitem.GetComponent<NumberTc>().price.text = idResponse.Data.DataList[i].BeansCoin.ToString();
|
||||
Lhitem.GetComponent<NumberTc>().id = idResponse.Data.DataList[i].Id;
|
||||
if (idResponse.Data.DataList[i].Type == 1)
|
||||
{
|
||||
Lhitem.GetComponent<NumberTc>().musk_show();
|
||||
|
@ -7,6 +7,8 @@ public class Nice_numPanel : MonoBehaviour
|
||||
public Button CancleBtn;
|
||||
public Button ConfirmBtn;
|
||||
public NumberTc numberTc;
|
||||
BuyGoodIdResponse buyGoodIdResponse = new BuyGoodIdResponse();
|
||||
BuyGoodId42 buyGoodId42 = new BuyGoodId42();
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
@ -16,23 +18,17 @@ public class Nice_numPanel : MonoBehaviour
|
||||
|
||||
void CanclePanel()
|
||||
{
|
||||
Destroy(this.gameObject);
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
|
||||
void ConfirmBuy()
|
||||
async void ConfirmBuy()
|
||||
{
|
||||
string pricetext = numberTc.price.text;
|
||||
if ((PlayerInfo.instance.Money - float.Parse(pricetext)) >= 0)
|
||||
{
|
||||
|
||||
numberTc.musk_show();
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("弹出蜗壳不足的弹窗");
|
||||
}
|
||||
|
||||
//string pricetext = numberTc.price.text;
|
||||
buyGoodIdResponse = await buyGoodId42.buyGoodId(numberTc.id);
|
||||
Debug.Log(buyGoodIdResponse);
|
||||
numberTc.musk_show();
|
||||
Destroy(this.gameObject);
|
||||
//Debug.Log("弹出蜗壳不足的弹窗");
|
||||
}
|
||||
|
||||
|
||||
|
@ -7,13 +7,14 @@ public class NumberTc : MonoBehaviour
|
||||
{
|
||||
public TextMeshProUGUI BeautifulNumber;
|
||||
public TextMeshProUGUI price;
|
||||
public int id;
|
||||
public Button Show_buy;
|
||||
public Canvas jiemianCanvas;
|
||||
public GameObject musk;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
jiemianCanvas = GameObject.Find("Canvas").GetComponent<Canvas>();
|
||||
jiemianCanvas = GameObject.Find("lianghaoCanvas").GetComponent<Canvas>();
|
||||
Show_buy.onClick.AddListener(ShowBuy_TanChuang);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user