_TheStrongestSnail/TheStrongestSnail/Assets/Scripts/lianghaoLL/WalletPanel.cs
2024-12-11 16:59:08 +08:00

211 lines
6.5 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
public class WalletPanel : MonoBehaviour
{
public GameObject zhuanzengConnect;
public GameObject zhuanhuanConnect;
public GameObject woniuSc;
public GameObject wokeSc;
public Button woniuBtn;
public Button wokeBtn;
public GameObject Musk;
public GameObject ConvertGameObject;
public GameObject TransferGameObject;
public WalletconvertResponse Walletconvert;
public WallettransferResponse Wallettransfer;
// Start is called before the first frame update
async void Start()
{
woniuBtn.onClick.AddListener(WoniuClick);
wokeBtn.onClick.AddListener(WokeClick);
Walletconvert =await QueryUserMiningSlot();
Wallettransfer = await QueryUserMiningSlotT();
Init();
}
void Init()
{
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 trams 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 = trams;
tramsfers.Init();
}
wokeSc.gameObject.SetActive(false);
}
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()
{
}
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;
}
}
//<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; }
}