切换牌组封面

This commit is contained in:
YiHan0621
2025-10-13 18:30:07 +08:00
parent f14b8d6ac6
commit e84768d8fb
8 changed files with 230 additions and 35 deletions

View File

@@ -9,10 +9,12 @@ namespace TcgEngine
public class ChangeCoverLine : MonoBehaviour
{
public Image cover;
public Image currentCover;
public string coverName;
private Button cover_settings_btn;
public UnityAction<ChangeCoverLine> OnChangeCover;
/// <summary>
/// 初始化封面显示
/// </summary>
@@ -20,15 +22,33 @@ namespace TcgEngine
{
if (cover != null)
cover.sprite = coverSprite;
coverName = name;
cover_settings_btn = cover.GetComponent<Button>();
cover_settings_btn.onClick.AddListener(OnClickCover);
}
public void RefreshCurrentCover(string coverName)
{
if (currentCover != null)
{
Debug.Log(coverName);
if (this.coverName == coverName)
{
currentCover.color = Color.yellow;
}
else
{
currentCover.color = Color.white;
}
}
}
/// <summary>
/// 点击选择封面
/// </summary>
public void OnClickCover()
private void OnClickCover()
{
Debug.Log(coverName);
OnChangeCover?.Invoke(this);
}
}