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

57 lines
1.8 KiB
C#
Raw Normal View History

2024-11-27 01:13:52 +08:00
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class DonateTc : BaseUIPanel
{
public Text ConfirmText;
public Button ConfirmBtn;
public Button CancelBtn;
public DonatePanelItem donatePanelItem;
// Start is called before the first frame update
void Start()
{
ConfirmBtn.onClick.AddListener(ConfrimPanel);
CancelBtn.onClick.AddListener(CancelPanel);
}
void CancelPanel()
{
Destroy(this.gameObject);
}
async void ConfrimPanel()
{
string response = "";//<2F><><EFBFBD><EFBFBD>
if (donatePanelItem.mymode == DonatePanelItem.mode.voluteCoin)
{
2024-12-09 19:52:33 +08:00
string body = "{\"toCuteNo\":\"" + (long.Parse(donatePanelItem.Recipient.text)).ToString() + "\",\"voluteCoin\":" + int.Parse(donatePanelItem.GiftQuantity.text) + "}";
2024-11-27 01:13:52 +08:00
Debug.Log(body);
response = await web.SendRequest(web.URL + "/snail/transfer/voluteCoin", "POST", body, Global.global.CreateHeaders());
}
else
{
2024-12-09 19:52:33 +08:00
string body = "{\"toCuteNo\":\"" + (long.Parse(donatePanelItem.Recipient.text)).ToString() + "\",\"slotCount\":" + int.Parse(donatePanelItem.GiftQuantity.text) + "}";
2024-11-27 01:13:52 +08:00
Debug.Log(body);
response = await web.SendRequest(web.URL + "/snail/transfer/slot", "POST", body, Global.global.CreateHeaders());
}
ServerResponse18 serverResponse = JsonConvert.DeserializeObject<ServerResponse18>(response);
2024-12-09 19:52:33 +08:00
Debug.Log(serverResponse.message);
2024-11-27 01:13:52 +08:00
if (serverResponse.code != 200)
{
addEventPopUp(serverResponse.message);
}
// Destroy(gameObject);
}
// Update is called once per frame
void Update()
{
}
}