public void ShowInfo(int table, int number) { m_TableId = table; int num = GetIdInBagNum(table); m_Text.text = num + "/" + number.ToString(); m_Icon.sprite = DynamicItem.GetSprite(table); m_AddImage.gameObject.SetActive(!(num > 0)); }
/// <summary> /// 使用物品ID初始化,参数2为物品数量。当ID为英雄、符文,或者数量不大于0时会隐藏数量面板 /// </summary> /// <param name="itemID"></param> /// <param name="count"></param> public void InitByID(int itemID, int count = 0) { m_ItemID = itemID; m_Type = GameUtils.GetObjectClassById(itemID); switch (m_Type) { case EM_OBJECT_CLASS.EM_OBJECT_CLASS_RUNE: ItemTemplate _itemTable = DataTemplate.GetInstance().m_ItemTable.getTableData(itemID) as ItemTemplate; if (_itemTable != null) { ItemTypeProcess(_itemTable); m_ItemImage.gameObject.SetActive(false); m_HeroImage.gameObject.SetActive(false); LoadStar(_itemTable.getRune_quality(), _itemTable.getRune_quality(), false); } m_ItemCountImage.gameObject.SetActive(false); break; case EM_OBJECT_CLASS.EM_OBJECT_CLASS_HERO: HeroTemplate _heroTable = DataTemplate.GetInstance().m_HeroTable.getTableData(itemID) as HeroTemplate; if (_heroTable != null) { m_HeroImage.sprite = DynamicItem.GetSprite(itemID); m_HeroImage.gameObject.SetActive(true); //m_HeroImage.SetNativeSize(); m_ItemImage.gameObject.SetActive(false); LoadStar(_heroTable.getQuality(), _heroTable.getMaxQuality()); } m_ItemCountImage.gameObject.SetActive(false); break; case EM_OBJECT_CLASS.EM_OBJECT_CLASS_MONSTER: MonsterTemplate _monsterTable = DataTemplate.GetInstance().m_MonsterTable.getTableData(itemID) as MonsterTemplate; if (_monsterTable != null) { m_HeroImage.sprite = DynamicItem.GetSprite(itemID); m_HeroImage.gameObject.SetActive(true); //m_HeroImage.SetNativeSize(); m_ItemImage.gameObject.SetActive(false); m_StarPanel.SetActive(false); } break; default: m_ItemImage.sprite = DynamicItem.GetSprite(itemID); m_ItemImage.gameObject.SetActive(true); m_HeroImage.gameObject.SetActive(false); m_ItemCountImage.gameObject.SetActive(count > 0); m_ItemCountText.text = string.Format("X{0}", count); break; } }
public void SetInfo(int id, int havenum, int needNum) { Clean(); m_id = id; m_HaveNum = havenum; if (havenum < 1) { //addIcon.SetActive(true); icon.gameObject.SetActive(true); number.text = "<color=#ff0000>" + havenum.ToString() + "</color>" + "/" + needNum.ToString(); if (id == 1400000003)//圣灵之泉 不是道具 { icon.sprite = GameUtils.GetSpriteByResourceType(id); } else { if (DynamicItem.GetSprite(id) != null) { icon.sprite = DynamicItem.GetSprite(id); } bgImg.sprite = GameUtils.GetItemQualitySprite(id); } } else { if (id == 1400000003)//圣灵之泉 不是道具 { icon.sprite = GameUtils.GetSpriteByResourceType(id); } else { if (DynamicItem.GetSprite(id) != null) { icon.sprite = DynamicItem.GetSprite(id); } bgImg.sprite = GameUtils.GetItemQualitySprite(id); } addIcon.SetActive(false); icon.gameObject.SetActive(true); number.text = havenum.ToString() + "/" + needNum.ToString(); } }