using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class CardUI : MonoBehaviour { public Text nameText; public Text typeText; public Text costText; public Image artImage; public Text effectText; public void Init(BaseCard card) { this.nameText.text = card.GetDisplayName(); this.typeText.text = card.GetDisplayType(); this.costText.text = "" + card.GetCost(); this.effectText.text = card.GetEffectText(); Sprite sprite = Resources.Load(GetCardArtResourcePath(card)); this.artImage.sprite = sprite; } public void InitHidden() { Color BROWN = new Color(0.14f, 0.09f, 0.04f); this.nameText.text = "????"; this.typeText.text = "????"; this.costText.text = "????"; this.effectText.text = "????"; this.GetComponent().color = BROWN; this.artImage.color = BROWN; } public string GetCardArtResourcePath(BaseCard card) { return "CardArt/" + (card.Owner.Team == TeamChoice.Heroes? "Hero" : "Monster") + card.StringId; } // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { } public bool Playable { set { this.GetComponent().color = value ? Color.white : Color.grey; this.artImage.color = value ? Color.white : Color.grey; } } }