横竖版展示逻辑
This commit is contained in:
@@ -74,8 +74,11 @@ namespace TcgEngine.UI
|
||||
|
||||
if (!isSameCard)
|
||||
{
|
||||
if(card_image != null)
|
||||
if (card_image != null)
|
||||
{
|
||||
card_image.enabled = true;
|
||||
card_image.sprite = card.GetFullArt(variant);
|
||||
}
|
||||
if (frame_image != null)
|
||||
frame_image.sprite = (variant != null) ? variant.frame : frame_image.sprite;
|
||||
if (card_title != null)
|
||||
@@ -139,6 +142,31 @@ namespace TcgEngine.UI
|
||||
gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
public void SetCard(CardData card)
|
||||
{
|
||||
if (card == null)
|
||||
return;
|
||||
|
||||
bool isSameCard = (this.card == card);
|
||||
|
||||
this.card = card;
|
||||
|
||||
if (!isSameCard)
|
||||
{
|
||||
if (card_image != null)
|
||||
{
|
||||
card_image.enabled = true;
|
||||
card_image.sprite = card.GetVerticalArt();
|
||||
}
|
||||
if (team_icon != null)
|
||||
{
|
||||
Sprite teamSprite = (card.team != null) ? card.team.icon : null;
|
||||
team_icon.sprite = teamSprite;
|
||||
team_icon.enabled = teamSprite != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SetHP(int hp_value)
|
||||
{
|
||||
if (hp != null)
|
||||
@@ -190,7 +218,31 @@ namespace TcgEngine.UI
|
||||
if (card_text != null)
|
||||
card_text.color = new Color(card_text.color.r, card_text.color.g, card_text.color.b, opacity);
|
||||
}
|
||||
#region ================== 对象池友好接口 ==================
|
||||
|
||||
/// <summary>
|
||||
/// 重置数据并隐藏
|
||||
/// </summary>
|
||||
public void ResetLine()
|
||||
{
|
||||
card = null;
|
||||
variant = null;
|
||||
|
||||
if (card_image) card_image.enabled = false;
|
||||
if (frame_image) frame_image.enabled = false;
|
||||
if (team_icon) team_icon.enabled = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 展开用户卡组信息
|
||||
/// </summary>
|
||||
public void Refresh(CardData card, VariantData variant)
|
||||
{
|
||||
SetCard(card);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
public void Hide()
|
||||
{
|
||||
if (gameObject.activeSelf)
|
||||
|
||||
Reference in New Issue
Block a user