This commit is contained in:
yaoyanwei
2025-08-04 16:45:48 +08:00
parent 565aa16389
commit 2f2a601227
2296 changed files with 522745 additions and 93 deletions

View File

@@ -0,0 +1,65 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace TcgEngine.UI
{
/// <summary>
/// In the CardPreviewUI, a list of current status appear
/// This is one of those
/// </summary>
public class StatusLine : MonoBehaviour
{
public Text title;
public Text desc;
private float timer = 0f;
private void Start()
{
gameObject.SetActive(false);
}
void Update()
{
timer += Time.deltaTime;
}
public void SetLine(CardData icard, AbilityData ability)
{
if (!string.IsNullOrWhiteSpace(ability.desc))
{
title.text = ability.GetTitle();
desc.text = ability.GetDesc(icard);
gameObject.SetActive(true);
timer = 0f;
}
}
public void SetLine(StatusType effect, int value)
{
StatusData sdata = StatusData.Get(effect);
if (sdata != null)
SetLine(sdata, value);
}
public void SetLine(StatusData effect, int value)
{
if (!string.IsNullOrWhiteSpace(effect.desc))
{
title.text = effect.GetTitle();
desc.text = effect.GetDesc(value);
gameObject.SetActive(true);
timer = 0f;
}
}
public void Hide()
{
if (timer > 0.05f)
gameObject.SetActive(false);
}
}
}