Project_WL/Assets/Script/UI/Buff/BuffADCard.cs

70 lines
2.0 KiB
C#
Raw Normal View History

2025-03-26 00:49:56 +00:00
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class BuffADCard : CardBase
{
public Image[] images; // 0 버프 아이콘
2025-07-16 03:18:13 +00:00
public TextMeshProUGUI[] texts; // 0 버프 스탯, 1 버프량, 2 레벨, 3 오늘 횟수, 4 남은 시간
public GameObject[] gos; // 0 광고 버튼
2025-03-26 00:49:56 +00:00
static List<string> list_spritename = new List<string> { "skill-image-1", "skill-image-2", "skill-image-3" };
2025-07-16 03:18:13 +00:00
static List<string> list_statval = new List<string> { "+50%", "+50%", "+50%" };
2025-03-26 00:49:56 +00:00
int m_Index;
public override void Set<T>(T _base)
{
base.Set(_base);
m_Index = int.Parse(_base.ToString());
images[0].sprite = UIAtlasMgr.Ins.Get_Sprite(list_spritename[m_Index]);
texts[0].text = table_localtext.Ins.Get_Text(m_Index + 370);
2025-07-16 03:18:13 +00:00
texts[1].text = list_statval[m_Index];
2025-03-26 00:49:56 +00:00
Set_UI();
}
public override void Set_UI()
{
var sdata = ServerInfo.Ins.m_ServerData;
2025-07-16 03:18:13 +00:00
Set_Time();
}
void Set_Time()
{
var sdata = ServerInfo.Ins.m_ServerData;
if (sdata.Buff.isInfinity())
{
gos[0].SetActive(false);
Cancel_Repeat_forsec();
texts[4].text = table_localtext.Ins.Get_Text(411);
}
else
{
var time = ServerInfo.Ins.m_ServerData.Buff.Get_RemainTime(m_Index);
texts[4].text = DSUtil.Get_TimeText_MS(time);
if (time > 0)
{
gos[0].SetActive(false);
if (DSUtil.CheckNull(m_Co_for1Sec))
Set_Repeat_for1sec(Set_Time);
}
else
{
texts[4].text = "00:00:00";
}
}
2025-03-26 00:49:56 +00:00
}
public void OnClick_AD()
{
var sdata = ServerInfo.Ins.m_ServerData;
if (sdata.Buff.Get_RemainTime(m_Index) > 0) return;
ADInfo.Ins.Show_AD(() =>
{
sdata.Buff.Set_Time(m_Index, 600);
Set_UI();
MyInfoUI.Ins.Set_Buff();
});
}
}