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

64 lines
2.0 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
public class NewkuangchangItem : MonoBehaviour
{
// Start is called before the first frame update
public MiningContract miningContract;
public TextMeshProUGUI count;
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>");
openSlot105 openSlot5 = new openSlot105();
openSlot5.OpenSlot();
//Debug.Log("<22><><EFBFBD><EFBFBD>ID" + userMiningSlotResponse.data.dataList[NullContractID+1].id);
return;
}
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);
//queryUserMiningSlot.QueryUserMiningSlot();
2024-12-05 15:49:54 +08:00
}
2024-12-05 21:23:44 +08:00
// Update is called once
// per frame
2024-12-05 15:49:54 +08:00
void Update()
{
}
}