73 lines
2.1 KiB
C#
73 lines
2.1 KiB
C#
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class BuffADCard : CardBase
|
|
{
|
|
public Image[] images; // 0 버프 아이콘
|
|
public TextMeshProUGUI[] texts; // 0 버프 스탯, 1 버프량, 2 레벨, 3 오늘 횟수, 4 남은 시간
|
|
public GameObject[] gos; // 0 광고 버튼
|
|
|
|
static List<string> list_spritename = new List<string> { "skill-image-1", "skill-image-2", "skill-image-3" };
|
|
static List<string> list_statval = new List<string> { "+50%", "+50%", "+50%" };
|
|
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);
|
|
texts[1].text = list_statval[m_Index];
|
|
Set_UI();
|
|
}
|
|
|
|
public override void Set_UI()
|
|
{
|
|
var sdata = ServerInfo.Ins.m_ServerData;
|
|
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 ts = ServerInfo.Ins.m_ServerData.Buff.Get_RemainTime(m_Index);
|
|
texts[4].text = DSUtil.Get_TimeText_MS(ts);
|
|
if (ts.TotalSeconds > 0)
|
|
{
|
|
gos[0].SetActive(false);
|
|
if (DSUtil.CheckNull(m_Co_for1Sec))
|
|
Set_Repeat_for1sec(Set_Time);
|
|
}
|
|
else
|
|
{
|
|
texts[4].text = "00:00:00";
|
|
}
|
|
}
|
|
}
|
|
|
|
public void OnClick_AD()
|
|
{
|
|
var sdata = ServerInfo.Ins.m_ServerData;
|
|
if (sdata.Buff.Get_RemainTime(m_Index).TotalSeconds > 0) return;
|
|
|
|
ADInfo.Ins.Show_AD(() =>
|
|
{
|
|
ServerInfo.Ins.Save_Buff(m_Index, () =>
|
|
{
|
|
sdata.Buff.Set_Time(m_Index, 600);
|
|
Set_UI();
|
|
MyInfoUI.Ins.Set_Buff();
|
|
});
|
|
});
|
|
}
|
|
} |