_TheStrongestSnail/TheStrongestSnail/Assets/Scripts/lianghaoLL/WalletPanel.cs

209 lines
6.4 KiB
C#
Raw Normal View History

2024-12-11 16:17:18 +08:00
using System;
using Newtonsoft.Json;
2024-12-10 18:03:33 +08:00
using System.Collections;
using System.Collections.Generic;
2024-12-11 16:17:18 +08:00
using System.Threading.Tasks;
2024-12-10 18:03:33 +08:00
using UnityEngine;
using UnityEngine.UI;
public class WalletPanel : MonoBehaviour
{
2024-12-11 16:17:18 +08:00
public GameObject zhuanzengConnect;
public GameObject zhuanhuanConnect;
2024-12-10 18:03:33 +08:00
public GameObject woniuSc;
public GameObject wokeSc;
public Button woniuBtn;
public Button wokeBtn;
public GameObject Musk;
2024-12-11 16:17:18 +08:00
public GameObject ConvertGameObject;
public GameObject TransferGameObject;
public WalletconvertResponse Walletconvert;
public WallettransferResponse Wallettransfer;
2024-12-10 18:03:33 +08:00
// Start is called before the first frame update
2024-12-11 16:17:18 +08:00
async void Start()
2024-12-10 18:03:33 +08:00
{
woniuBtn.onClick.AddListener(WoniuClick);
wokeBtn.onClick.AddListener(WokeClick);
2024-12-11 16:17:18 +08:00
Walletconvert =await QueryUserMiningSlot();
Wallettransfer = await QueryUserMiningSlotT();
Init();
2024-12-10 18:03:33 +08:00
}
void Init()
{
2024-12-11 16:17:18 +08:00
foreach (var convert in Walletconvert.data.dataList)
{
GameObject ob = Instantiate(ConvertGameObject);
ob.transform.parent = zhuanzengConnect.transform;
ob.transform.localScale = new Vector3(1, 1, 1);
ConvertPre convertPre = ob.gameObject.GetComponent<ConvertPre>();
convertPre.Convert = convert;
}
foreach (var tramsfer in Wallettransfer.data.dataList)
{
GameObject ob = Instantiate(TransferGameObject);
ob.transform.parent = zhuanhuanConnect.transform;
ob.transform.localScale = new Vector3(1, 1, 1);
TransferPre tramsfers = ob.gameObject.GetComponent<TransferPre>();
tramsfers.tramsfer = tramsfer;
}
2024-12-10 18:03:33 +08:00
}
void WoniuClick()
{
woniuBtn.transform.SetParent(this.transform);
wokeBtn.transform.SetParent(Musk.transform);
woniuSc.gameObject.SetActive(true);
wokeSc.gameObject.SetActive(false);
}
void WokeClick()
{
woniuBtn.transform.SetParent(Musk.transform);
wokeBtn.transform.SetParent(this.transform);
woniuSc.gameObject.SetActive(false);
wokeSc.gameObject.SetActive(true);
}
// Update is called once per frame
void Update()
{
2024-12-11 16:17:18 +08:00
}
public async Task<WalletconvertResponse> QueryUserMiningSlot()
{
// ׼<><D7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><C8A8><EFBFBD><EFBFBD>
Dictionary<string, string> head = new Dictionary<string, string>
{
{ "Authorization", Global.global.serverResponse.data.token }
};
queryPlayerInfo queryPlayerInfo = new queryPlayerInfo();
RealPlayerInfo realPlayerInfo = await queryPlayerInfo.QueryPlayerInfoPro();
WalletConvert body = new WalletConvert();
body.userId = realPlayerInfo.data.userId;
// <20><EFBFBD><ECB2BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ի<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD>µ<EFBFBD><C2B5><EFBFBD>ţ<EFBFBD><C5A3>ʿ<EFBFBD><CABF>Ϣ
string response0104 = await web.SendRequest(web.URL + "/snail/transfer/queryTransferRecord", "POST", JsonConvert.SerializeObject(body), head);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD><D5B5><EFBFBD><EFBFBD><EFBFBD>Ӧ
Debug.Log("1.20<EFBFBD><EFBFBD>ѯ<EFBFBD>Ͽ<EFBFBD>ת<EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼" + response0104);
// <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>
WalletconvertResponse Response = JsonConvert.DeserializeObject<WalletconvertResponse>(response0104);
//foreach (var convert in Response.data.dataList)
//{
// Debug.Log(convert.id);
// Debug.Log(convert.fromUserId);
// Debug.Log(convert.toUserId);
// Debug.Log(convert.type);
// Debug.Log(convert.voluteCoin);
// Debug.Log(convert.slotId);
// Debug.Log(convert.slotCount);
// Debug.Log(convert.createTime);
//}
// <20><><EFBFBD>ؽ<EFBFBD><D8BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ķ<EFBFBD><C4B6><EFBFBD>
return Response;
}
public async Task<WallettransferResponse> QueryUserMiningSlotT()
{
// ׼<><D7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><C8A8><EFBFBD><EFBFBD>
Dictionary<string, string> head = new Dictionary<string, string>
{
{ "Authorization", Global.global.serverResponse.data.token }
};
queryPlayerInfo queryPlayerInfo = new queryPlayerInfo();
RealPlayerInfo realPlayerInfo = await queryPlayerInfo.QueryPlayerInfoPro();
WalletTransfer body = new WalletTransfer();
body.userId = realPlayerInfo.data.userId;
// <20><EFBFBD><ECB2BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ի<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD>µ<EFBFBD><C2B5><EFBFBD>ţ<EFBFBD><C5A3>ʿ<EFBFBD><CABF>Ϣ
string response0104 = await web.SendRequest(web.URL + "/snail/transfer/queryConvertRecord", "POST", JsonConvert.SerializeObject(body), head);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD><D5B5><EFBFBD><EFBFBD><EFBFBD>Ӧ
Debug.Log("1.21<EFBFBD><EFBFBD>ѯ<EFBFBD>ϿǶһ<EFBFBD><EFBFBD><EFBFBD>¼" + response0104);
// <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>
WallettransferResponse Response = JsonConvert.DeserializeObject<WallettransferResponse>(response0104);
//foreach (var convert in Response.data.dataList)
//{
// Debug.Log(convert.id);
// Debug.Log(convert.userId);
// Debug.Log(convert.convertType);
// Debug.Log(convert.voluteCoin);
// Debug.Log(convert.beansCoin);
// Debug.Log(convert.createTime);
//}
// <20><><EFBFBD>ؽ<EFBFBD><D8BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ķ<EFBFBD><C4B6><EFBFBD>
return Response;
2024-12-10 18:03:33 +08:00
}
}
2024-12-11 16:17:18 +08:00
//<2F><><EFBFBD><EFBFBD>
public class WalletConvert
{
public long userId;
}
public class WalletTransfer
{
public long userId;
}
//Transfer
//<2F><><EFBFBD><EFBFBD>
/// <summary>
/// ת<><D7AA><EFBFBD><EFBFBD>¼
/// </summary>
public class WalletconvertResponse : Response
{
public UserconvertData data { get; set; }
}
public class WallettransferResponse : Response
{
public UsertransferData data { get; set; }
}
public class UserconvertData
{
public int pageNo { get; set; }
public int pageSize { get; set; }
public int totalCount { get; set; }
public List<Convert> dataList { get; set; }
}
public class UsertransferData
{
public int pageNo { get; set; }
public int pageSize { get; set; }
public int totalCount { get; set; }
public List<Tramsfer> dataList { get; set; }
}
public class Convert
{
public long id { get; set; }
public long fromUserId { get; set; }
public long toUserId { get; set; }
public int type { get; set; }
public Decimal voluteCoin { get; set; }
public long slotId { get; set; }
public long slotCount { get; set; }
public String createTime { get; set; }
public String updateTime { get; set; }
}
public class Tramsfer
{
public long id { get; set; }
public long userId { get; set; }
public int convertType { get; set; }
public Decimal voluteCoin { get; set; }
public Decimal beansCoin { get; set; }
public String createTime { get; set; }
public String updateTime { get; set; }
}