void SetFrame(ItemInstance item) { m_Frame.sprite = m_FrameSprite[(int)item.GetRare()]; }
public void Bind(ItemInstance item, int count, Action callback, Func <ItemInstance, bool> isActiveCallback = null, int price = -1) { m_Item = item; Count = count; m_Callback = callback; m_IsActiveCallback = isActiveCallback; m_Price = price; if (m_TagText != null) { m_TagText.gameObject.SetActive(false); } if (isActiveCallback != null) { if (!isActiveCallback(item)) { m_DisableSignObj.SetActive(true); m_IsInteractive = false; } else { m_DisableSignObj.SetActive(false); m_IsInteractive = true; } } else { if (m_DisableSignObj != null) { m_DisableSignObj.SetActive(false); } } // 物品名字 string nameText = item.ItemData.Name; m_NameText.text = nameText; if (IsShopItem) { if (Count == 1 || Count == -1) { m_CountText.text = ""; m_CountText.gameObject.SetActive(false); } else { m_CountText.text = string.Format("限购 {0}", Count.ToString()); m_CountText.gameObject.SetActive(true); } } else { m_NameText.GetComponent <Outline>().effectColor = _colorMapping[(int)item.GetRare()]; if (Count == 1 || Count == -1) { m_CountText.text = ""; m_CountText.gameObject.SetActive(false); } else { m_CountText.text = $"×{Count}"; m_CountText.gameObject.SetActive(true); } } if (callback == null) { m_SelfButton.enabled = false; } else { m_SelfButton.enabled = true; BindListener(m_SelfButton, delegate { callback(); }); } SetFrame(item); m_Icon.gameObject.SetActive(true); if (m_PriceText != null) { if (price <= 0) { m_PriceText.text = ""; } else { m_PriceText.text = string.Format("{0}", price.ToString()); } } //if (item.isNew == true) //{ // m_NewSignObj.SetActive(true); //} //else //{ // m_NewSignObj.SetActive(false); //} //if (item.IsLocked()) //{ // m_LockSignObj.SetActive(true); //} //else //{ // m_LockSignObj.SetActive(false); //} }