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

56 lines
1.7 KiB
C#

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 = "";//²âÊÔ
if (donatePanelItem.mymode == DonatePanelItem.mode.voluteCoin)
{
string body = "{\"toCuteNo\":\"" + (int.Parse(donatePanelItem.Recipient.text)).ToString() + "\",\"voluteCoin\":" + int.Parse(donatePanelItem.GiftQuantity.text) + "}";
Debug.Log(body);
response = await web.SendRequest(web.URL + "/snail/transfer/voluteCoin", "POST", body, Global.global.CreateHeaders());
}
else
{
string body = "{\"toCuteNo\":\"" + (int.Parse(donatePanelItem.Recipient.text)).ToString() + "\",\"slotId\":" + int.Parse(donatePanelItem.GiftQuantity.text) + "}";
Debug.Log(body);
response = await web.SendRequest(web.URL + "/snail/transfer/slot", "POST", body, Global.global.CreateHeaders());
}
ServerResponse18 serverResponse = JsonConvert.DeserializeObject<ServerResponse18>(response);
if (serverResponse.code != 200)
{
addEventPopUp(serverResponse.message);
}
// Destroy(gameObject);
}
// Update is called once per frame
void Update()
{
}
}