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

59 lines
1.5 KiB
C#
Raw Normal View History

2024-12-15 01:39:39 +00:00
using System.Collections;
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;
private void Awake()
{
Act_Repeat_for1sec = Set_Time;
}
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())
{
Act_Repeat_for1sec = null;
label_time.text = "";
}
else
{
var time = ServerInfo.Ins.m_ServerData.Buff.Get_RemainTime(m_Index);
label_time.text = DSUtil.Get_TimeText_MS(time);
if (time > 0)
{
if (!go_on.activeInHierarchy) go_on.SetActive(true);
}
else
{
if (go_on.activeInHierarchy)
{
label_time.text = "";
go_on.SetActive(false);
MyValue.Get_ActorStatInfoorNull(eRole.PC);
}
}
}
}
}