128 lines
2.9 KiB
C#
128 lines
2.9 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using TMPro;
|
|
public class LotteryPanel : Base
|
|
{
|
|
public GameObject AniPanel;
|
|
public GameObject guizhe;
|
|
public GameObject toFirend;
|
|
|
|
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<Lottery532Data> lowList=new List<Lottery532Data>();//普通宝箱列表
|
|
public List<Lottery532Data> goodList = new List<Lottery532Data>();//高级宝箱列表
|
|
|
|
private void Start()
|
|
{
|
|
|
|
GetRewardInfo532();
|
|
|
|
}
|
|
public void ShowAni(int id)
|
|
{
|
|
if (id==1)
|
|
{
|
|
if (lowList.Count>0)
|
|
{
|
|
GetRewardInfo533(lowList[0].id,id);
|
|
|
|
}
|
|
else
|
|
{
|
|
addEventPopUp("没有宝箱");
|
|
}
|
|
|
|
|
|
}
|
|
else if (id == 2)
|
|
{
|
|
if (goodList.Count>0)
|
|
{
|
|
GetRewardInfo533(goodList[0].id,id);
|
|
|
|
}
|
|
else
|
|
{
|
|
addEventPopUp("没有宝箱");
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
public void Showguizhe()
|
|
{
|
|
Instantiate(guizhe, transform);
|
|
}
|
|
public void ShowToFriend()
|
|
{
|
|
Instantiate(toFirend, transform);
|
|
}
|
|
public async void GetRewardInfo532()
|
|
{
|
|
lottery532 = await MotherFuck532.Result();
|
|
SetMyBoxNum(lottery532.data);
|
|
}
|
|
public async void GetRewardInfo533(int id,int type)
|
|
{
|
|
bool Judge533=false;
|
|
Judge533 = await MotherFuck533.Result(id);
|
|
if (Judge533)
|
|
{
|
|
if (type == 1)
|
|
{
|
|
|
|
lowList.Remove(lowList[0]);
|
|
GameObject ani = Instantiate(AniPanel, transform);
|
|
ani.GetComponent<Anilottery>().OpenBox(type);
|
|
|
|
}
|
|
else if(type==2)
|
|
{
|
|
goodList.Remove(goodList[0]);
|
|
GameObject ani = Instantiate(AniPanel, transform);
|
|
ani.GetComponent<Anilottery>().OpenBox(type);
|
|
}
|
|
|
|
GetRewardInfo532();
|
|
}
|
|
|
|
|
|
}
|
|
|
|
public void SetMyBoxNum(List<Lottery532Data> 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();
|
|
}
|
|
|
|
}
|