using CodeJay.Classes; using TMPro; using UnityEngine; using UnityEngine.UI; public class CollectionCard : CardBase { public Image i_face; public TextMeshProUGUI t_price; public GameObject go_lock, go_buybtn, go_pricedia, go_priceheart; public Material mat_blur; HuntingData m_Data; public override void Set(T _base, int iLoop = -1, int idata = -1) { base.Set(_base, iLoop, idata); m_Data = _base as HuntingData; i_face.sprite = m_Data.UnlockImage(); var left = m_Data.Index % 2 == 0; t_price.text = left ? m_Data.NeedKey.ToString() : m_Data.NeedHeart.ToString(); if (left) { go_pricedia.SetActive(true); go_priceheart.SetActive(false); } else { go_pricedia.SetActive(false); go_priceheart.SetActive(true); } var unlockTargetIndex = GameManager.DB.GetUnlockTargetIndex(left); i_face.color = Color.white; i_face.material = null; go_buybtn.SetActive(false); if (m_Data.n_Group == unlockTargetIndex) { // 구매 가능 go_buybtn.SetActive(true); i_face.material = mat_blur; go_lock.SetActive(true); } else if (m_Data.n_Group > unlockTargetIndex) { // 잠김 go_lock.SetActive(true); i_face.color = Color.black; } else { // 열림 go_lock.SetActive(false); } } public void OnClick_Buy() { var bCondition = false; var left = m_Data.Index % 2 == 0; if (left) { if (GameManager.DB.Key >= m_Data.NeedKey) { GameManager.DB.SubKey(m_Data.NeedKey, this.name); bCondition = true; } else { GameManager.UI.ShowNStackPopup(EPopupType.KeyChargePopup); } } else { if (GameManager.DB.Heart >= m_Data.NeedHeart) { GameManager.DB.SubHeart(m_Data.NeedHeart, this.name); bCondition = true; } else { GameManager.UI.ShowNStackPopup(EPopupType.HeartChargePopup); } } if (bCondition) { GameManager.DB.UnlockLastAIImage(left); GameManager.DB.SaveDatas(); GameManager.Event.InvokeEvent(EEventType.OnSynchronizeAIChllengeModeAIData); GameObject.Find("CollectionPanel").GetComponent().Set_UI(); } } public void OnClick_CollectionCard() { if (!go_lock.activeInHierarchy && !go_buybtn.activeInHierarchy) GameObject.Find("CollectionPanel").GetComponent().ShowPanel(m_Data); } }