推进度!
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using Continentis.MainGame.Card;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
@@ -8,12 +9,13 @@ namespace Continentis.MainGame.UI
|
||||
public class PileBase : UIElementBase
|
||||
{
|
||||
public List<CardViewBase> cardViews;
|
||||
public TMP_Text cardCountText;
|
||||
|
||||
public virtual void AddCard(CardViewBase cardObject)
|
||||
{
|
||||
cardViews.Add(cardObject);
|
||||
cardObject.transform.SetParent(rectTransform);
|
||||
|
||||
UpdateCountText();
|
||||
}
|
||||
|
||||
public virtual void InsertCard(CardViewBase cardObject, int index)
|
||||
@@ -21,12 +23,22 @@ namespace Continentis.MainGame.UI
|
||||
cardViews.Insert(index, cardObject);
|
||||
cardObject.transform.SetParent(rectTransform);
|
||||
cardObject.transform.SetSiblingIndex(index);
|
||||
UpdateCountText();
|
||||
}
|
||||
|
||||
public virtual void RemoveCard(CardViewBase cardObject)
|
||||
{
|
||||
cardViews.Remove(cardObject);
|
||||
UpdateCountText();
|
||||
//Debug.Log($"Removed {cardObject.cardInstance.cardLogic.contentSubmodule.cardName} from {this.name}" );
|
||||
}
|
||||
|
||||
private void UpdateCountText()
|
||||
{
|
||||
if (cardCountText != null)
|
||||
{
|
||||
cardCountText.text = cardViews.Count.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user