切换牌组封面
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user