_TheStrongestSnail/TheStrongestSnail/Assets/Scripts/kuangChang10/NewkuangchangItem.cs

63 lines
2.1 KiB
C#
Raw Normal View History

2024-12-05 15:49:54 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
using UnityEngine.UI;
2024-12-05 21:23:44 +08:00
using static UnityEditor.Progress;
2024-12-05 15:49:54 +08:00
2024-12-06 16:14:45 +08:00
public class NewkuangchangItem : Base
2024-12-05 15:49:54 +08:00
{
// Start is called before the first frame update
public MiningContract miningContract;
2024-12-06 16:14:45 +08:00
[Header("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD>۸<EFBFBD>")] public TextMeshProUGUI count;
[Header("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><D4BC>ť")] public Button BuyButton;
2024-12-05 21:23:44 +08:00
async void Start()
2024-12-05 15:49:54 +08:00
{
BuyButton.onClick.AddListener(BuyItem);
}
async void BuyItem()
{
2024-12-05 21:23:44 +08:00
queryUserMiningSlot104 queryUserMiningSlot = new queryUserMiningSlot104();
UserMiningSlotResponse userMiningSlotResponse = await queryUserMiningSlot.QueryUserMiningSlot();
bool IsNull = true;
int NullContractID = 0;
for (; NullContractID < userMiningSlotResponse.data.dataList.Count; NullContractID++)
{
var contract = userMiningSlotResponse.data.dataList[NullContractID];
if (contract.contractId < 3 || contract.contractId > 6)
{
IsNull = false;
break;
}
}
if (IsNull)
{
Debug.Log("<22><><EFBFBD>۲<EFBFBD>Ϊ<EFBFBD><CEAA>");
2024-12-06 16:14:45 +08:00
Debug.Log("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2024-12-05 21:23:44 +08:00
openSlot105 openSlot5 = new openSlot105();
openSlot5.OpenSlot();
2024-12-06 16:14:45 +08:00
string strIS= await openSlot5.OpenSlotstr();
addEventPopUp(strIS);
KuangChang.Instance.onSetActive(false);
2024-12-05 21:23:44 +08:00
}
Debug.Log("<22><><EFBFBD><EFBFBD>ID"+ userMiningSlotResponse.data.dataList[NullContractID].id);
//10.3<EFBFBD><EFBFBD><EFBFBD>غ<EFBFBD>ԼID
2024-12-05 15:49:54 +08:00
buyMiningContract103 buyMiningContract = new buyMiningContract103();
2024-12-05 21:23:44 +08:00
BuyMiningResponse buyMiningResponse = await buyMiningContract.BuyMiningContract(miningContract.id);
Debug.Log("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><D4BC>id" + buyMiningResponse.data);
//10.7
bindSlot107 bindSlot = new bindSlot107();
bindSlot.BindSlot(buyMiningResponse.data, userMiningSlotResponse.data.dataList[NullContractID].id);
2024-12-06 16:14:45 +08:00
KuangChang.Instance.UpdateUserdata();
KuangChang.Instance.IninItem();
KuangChang.Instance.onSetActive(false);
2024-12-05 15:49:54 +08:00
}
}