79 lines
2.3 KiB
C#
79 lines
2.3 KiB
C#
using Newtonsoft.Json;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class DonatePanelItem : BaseUIPanel
|
|
{
|
|
public TMP_InputField Recipient;
|
|
public TMP_InputField GiftQuantity;
|
|
public Text NumberOfFreeSnailShells;
|
|
public GameObject voluteCoinObj;
|
|
public Text Fees;
|
|
public Text Total;
|
|
public Button Button;
|
|
void Start()
|
|
{
|
|
GiftQuantity.onValueChanged.AddListener(GiftQuantityData);
|
|
Button.onClick.AddListener(buttonOnClick);
|
|
|
|
//testLogo();
|
|
}
|
|
public class voluteCoinItem
|
|
{
|
|
public string toCuteNo;
|
|
public int voluteCoin;
|
|
}
|
|
public mode mymode = mode.voluteCoin;
|
|
public enum mode{
|
|
voluteCoin = 0,//赠送蜗壳
|
|
slot = 1//赠送
|
|
}
|
|
private void FixedUpdate()
|
|
{
|
|
if (mymode == mode.voluteCoin)
|
|
{
|
|
voluteCoinObj.SetActive(true);
|
|
}
|
|
else
|
|
{
|
|
voluteCoinObj.SetActive(false);
|
|
}
|
|
}
|
|
async void buttonOnClick()
|
|
{
|
|
Canvas canvas = GetComponentInParent<Canvas>();
|
|
GameObject donateTc = (GameObject)Instantiate(Resources.Load("LLPrefabs/Donate3Panel"),canvas.transform);
|
|
donateTc.GetComponent<DonateTc>().donatePanelItem = this;
|
|
if (mymode == mode.voluteCoin)
|
|
{
|
|
donateTc.GetComponent<DonateTc>().ConfirmText.text = "材料【蜗壳】数量【" + GiftQuantity.text + "】至ID【" + Recipient.text + "】";
|
|
}
|
|
else
|
|
{
|
|
donateTc.GetComponent<DonateTc>().ConfirmText.text = "材料【卡槽】数量【" + GiftQuantity.text + "】至ID【" + Recipient.text + "】";
|
|
}
|
|
}
|
|
async void GiftQuantityData(string userInput)
|
|
{
|
|
if (mymode == mode.voluteCoin)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(userInput))
|
|
{
|
|
userInput = "0";
|
|
}
|
|
NumberOfFreeSnailShells.text = userInput;
|
|
await ButtonClickAnimationAsync(NumberOfFreeSnailShells.gameObject, 1.05f);
|
|
Fees.text = (int.Parse(userInput) * 0.08).ToString();
|
|
await ButtonClickAnimationAsync(Fees.gameObject, 1.05f);
|
|
Total.text = (int.Parse(userInput) + (int.Parse(userInput) * 0.08)).ToString();
|
|
await ButtonClickAnimationAsync(Total.gameObject, 1.05f);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|