_TheStrongestSnail/TheStrongestSnail/Assets/Scripts/GLScripts/LotteryPanel.cs

113 lines
2.6 KiB
C#
Raw Normal View History

2024-12-12 21:02:09 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
2024-12-13 19:37:33 +08:00
using TMPro;
2024-12-12 21:02:09 +08:00
public class LotteryPanel : Base
{
public GameObject AniPanel;
2024-12-13 15:35:22 +08:00
2024-12-12 21:02:09 +08:00
2024-12-13 15:35:22 +08:00
public MotherFuck532 MotherFuck532;
public Lottery532 lottery532;
2024-12-13 16:41:55 +08:00
public MotherFuck533 MotherFuck533;
public bool Judge533;
2024-12-13 19:37:33 +08:00
public TextMeshProUGUI lowNumText;//<2F><>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD>
public int lowNum;
public int goodNum;
public TextMeshProUGUI goodNumText;//<2F>߼<EFBFBD><DFBC><EFBFBD><EFBFBD><EFBFBD>
public List<Lottery532Data> lowList=new List<Lottery532Data>();//<2F><>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
public List<Lottery532Data> goodList = new List<Lottery532Data>();//<2F>߼<EFBFBD><DFBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
2024-12-13 15:35:22 +08:00
private void Start()
{
GetRewardInfo532();
2024-12-13 16:41:55 +08:00
2024-12-13 15:35:22 +08:00
}
2024-12-12 21:02:09 +08:00
public void ShowAni(int id)
{
2024-12-13 19:37:33 +08:00
if (id==1)
2024-12-13 16:41:55 +08:00
{
2024-12-13 19:37:33 +08:00
if (lowList.Count>0)
{
GetRewardInfo533(lowList[0].id);
if (true)
{
lowList.Remove(lowList[0]);
GameObject ani = Instantiate(AniPanel, transform);
ani.GetComponent<Anilottery>().OpenBox(id);
}
}
else
{
addEventPopUp(<>б<EFBFBD><D0B1><EFBFBD>");
}
2024-12-13 16:41:55 +08:00
}
2024-12-13 19:37:33 +08:00
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<Anilottery>().OpenBox(id);
}
}
else
{
addEventPopUp(<>б<EFBFBD><D0B1><EFBFBD>");
}
}
2024-12-13 16:41:55 +08:00
2024-12-12 21:02:09 +08:00
}
2024-12-13 15:35:22 +08:00
public async void GetRewardInfo532()
{
lottery532 = await MotherFuck532.Result();
2024-12-13 19:37:33 +08:00
SetMyBoxNum(lottery532.data);
2024-12-13 15:35:22 +08:00
}
2024-12-13 16:41:55 +08:00
public async void GetRewardInfo533(int id)
{
Judge533 = await MotherFuck533.Result(id);
2024-12-13 19:37:33 +08:00
if (Judge533)
{
GetRewardInfo532();
}
}
public void SetMyBoxNum(List<Lottery532Data> data)//<2F><><EFBFBD><EFBFBD><EFBFBD>ҵı<D2B5><C4B1><EFBFBD>
{
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();
2024-12-13 16:41:55 +08:00
}
2024-12-13 15:35:22 +08:00
2024-12-12 21:02:09 +08:00
}