using System.Collections; using System.Collections.Generic; using UnityEngine; using TMPro; public class LotteryPanel : Base { public GameObject AniPanel; public MotherFuck532 MotherFuck532; public Lottery532 lottery532; public MotherFuck533 MotherFuck533; public bool Judge533; public TextMeshProUGUI lowNumText;//普通宝箱 public int lowNum; public int goodNum; public TextMeshProUGUI goodNumText;//高级宝箱 public List lowList=new List();//普通宝箱列表 public List goodList = new List();//高级宝箱列表 private void Start() { GetRewardInfo532(); } public void ShowAni(int id) { if (id==1) { if (lowList.Count>0) { GetRewardInfo533(lowList[0].id); if (true) { lowList.Remove(lowList[0]); GameObject ani = Instantiate(AniPanel, transform); ani.GetComponent().OpenBox(id); } } else { addEventPopUp("没有宝箱"); } } else if (id == 2) { if (goodList.Count>0) { GetRewardInfo533(goodList[0].id); if (Judge533) { goodList.Remove(goodList[0]); GameObject ani = Instantiate(AniPanel, transform); ani.GetComponent().OpenBox(id); } } else { addEventPopUp("没有宝箱"); } } } public async void GetRewardInfo532() { lottery532 = await MotherFuck532.Result(); SetMyBoxNum(lottery532.data); } public async void GetRewardInfo533(int id) { Judge533 = await MotherFuck533.Result(id); if (Judge533) { GetRewardInfo532(); } } public void SetMyBoxNum(List data)//设置我的宝箱 { lowList.Clear(); goodList.Clear(); foreach (Lottery532Data item in data) { if (item.lotteryId==1) { lowList.Add(item); } else if (item.lotteryId == 2) { goodList.Add(item); } } lowNumText.text = lowList.Count.ToString(); goodNumText.text = goodList.Count.ToString(); } }