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

51 lines
1.4 KiB
C#
Raw Permalink Normal View History

2024-12-15 01:39:39 +00:00
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class BuffCard : CardBase
{
public Image sprite_buff;
public TextMeshProUGUI label_time;
public GameObject go_on;
2025-01-04 00:06:47 +00:00
static List<string> list_spritename = new List<string> { "skill-image-1", "skill-image-2", "skill-image-3" };
2024-12-15 01:39:39 +00:00
int m_Index;
public override void Set<T>(T _base)
{
base.Set(_base);
m_Index = int.Parse(_base.ToString());
sprite_buff.sprite = UIAtlasMgr.Ins.Get_Sprite(list_spritename[m_Index]);
go_on.SetActive(ServerInfo.Ins.m_ServerData.Buff.isInfinity());
Set_Time();
}
void Set_Time()
{
var sdata = ServerInfo.Ins.m_ServerData;
if (sdata.Buff.isInfinity())
{
Cancel_Repeat_forsec();
2024-12-15 01:39:39 +00:00
label_time.text = "";
}
else
{
var ts = ServerInfo.Ins.m_ServerData.Buff.Get_RemainTime(m_Index);
label_time.text = DSUtil.Get_TimeText_MS(ts);
if (ts.TotalSeconds > 0)
2024-12-15 01:39:39 +00:00
{
if (!go_on.activeInHierarchy) go_on.SetActive(true);
2025-03-26 00:49:56 +00:00
if (DSUtil.CheckNull(m_Co_for1Sec))
Set_Repeat_for1sec(Set_Time);
2024-12-15 01:39:39 +00:00
}
else
{
2025-03-26 00:49:56 +00:00
label_time.text = "off";
go_on.SetActive(false);
2024-12-15 01:39:39 +00:00
}
}
}
}