37 lines
1.2 KiB
C#
37 lines
1.2 KiB
C#
|
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 Text Fees;
|
||
|
public Text Total;
|
||
|
|
||
|
void Start()
|
||
|
{
|
||
|
Recipient.onValueChanged.AddListener((userInput) => GetInputData(userInput, Recipient));
|
||
|
GiftQuantity.onValueChanged.AddListener((userInput) => GetInputData(userInput, GiftQuantity));
|
||
|
GiftQuantity.onValueChanged.AddListener(GiftQuantityData);
|
||
|
|
||
|
}
|
||
|
void GetInputData(string userInput, TMP_InputField tmp)
|
||
|
{
|
||
|
//ButtonClickAnimationAsync(tmp.gameObject,1.01f);
|
||
|
}
|
||
|
async void GiftQuantityData(string userInput)
|
||
|
{
|
||
|
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);
|
||
|
|
||
|
}
|
||
|
}
|