_TheStrongestSnail/TheStrongestSnail/Assets/Scripts/Conversion/DonatePanelItem.cs

79 lines
2.3 KiB
C#
Raw Normal View History

2024-11-26 18:14:09 +08:00
using Newtonsoft.Json;
2024-11-26 15:50:49 +08:00
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;
2024-11-26 21:53:31 +08:00
public GameObject voluteCoinObj;
2024-11-26 15:50:49 +08:00
public Text Fees;
public Text Total;
2024-11-26 16:40:57 +08:00
public Button Button;
2024-11-26 15:50:49 +08:00
void Start()
{
GiftQuantity.onValueChanged.AddListener(GiftQuantityData);
2024-11-26 16:40:57 +08:00
Button.onClick.AddListener(buttonOnClick);
2024-11-26 21:53:31 +08:00
//testLogo();
2024-11-26 15:50:49 +08:00
}
2024-11-26 16:54:06 +08:00
public class voluteCoinItem
2024-11-26 15:50:49 +08:00
{
2024-11-26 16:54:06 +08:00
public string toCuteNo;
public int voluteCoin;
}
2024-11-26 21:53:31 +08:00
public mode mymode = mode.voluteCoin;
public enum mode{
voluteCoin = 0,//<2F><><EFBFBD><EFBFBD><EFBFBD>Ͽ<EFBFBD>
slot = 1//<2F><><EFBFBD><EFBFBD>
}
private void FixedUpdate()
{
if (mymode == mode.voluteCoin)
{
voluteCoinObj.SetActive(true);
}
else
{
voluteCoinObj.SetActive(false);
}
}
2024-11-26 16:54:06 +08:00
async void buttonOnClick()
{
2024-11-27 01:13:52 +08:00
Canvas canvas = GetComponentInParent<Canvas>();
GameObject donateTc = (GameObject)Instantiate(Resources.Load("LLPrefabs/Donate3Panel"),canvas.transform);
donateTc.GetComponent<DonateTc>().donatePanelItem = this;
2024-11-26 21:53:31 +08:00
if (mymode == mode.voluteCoin)
{
2024-11-27 01:13:52 +08:00
donateTc.GetComponent<DonateTc>().ConfirmText.text = "<22><><EFBFBD>ϡ<EFBFBD><CFA1>Ͽǡ<CFBF><C7A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" + GiftQuantity.text + "<22><><EFBFBD><EFBFBD>ID<49><44>" + Recipient.text + "<22><>";
2024-11-26 21:53:31 +08:00
}
else
{
2024-11-27 01:13:52 +08:00
donateTc.GetComponent<DonateTc>().ConfirmText.text = "<22><><EFBFBD>ϡ<EFBFBD><CFA1><EFBFBD><EFBFBD>ۡ<EFBFBD><DBA1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" + GiftQuantity.text + "<22><><EFBFBD><EFBFBD>ID<49><44>" + Recipient.text + "<22><>";
2024-11-26 21:53:31 +08:00
}
2024-11-26 15:50:49 +08:00
}
async void GiftQuantityData(string userInput)
{
2024-11-26 21:53:31 +08:00
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);
2024-11-27 01:13:52 +08:00
}
2024-11-26 15:50:49 +08:00
}
2024-11-27 01:13:52 +08:00
2024-11-26 15:50:49 +08:00
}