public void Init(Tab_MasterShop tabMasterShop) { if (null == tabMasterShop) { return; } if (GameManager.gameManager.PlayerDataPool.IsHaveMaster() == false || GameManager.gameManager.PlayerDataPool.IsMasterReserveMember() == true) { m_BuyItemBtn.disabledSprite = "daanniuhuihua"; m_BuyItemBtn.hoverSprite = "daanniuhuihua"; m_BuyItemBtn.normalSprite = "daanniuhuihua"; m_BuyItemBtn.pressedSprite = "daanniuhuihua"; m_BuyItemBtn.enabled = false; m_BuyItemBtn.enabled = true; // 先置false再置true是为了刷新sprite m_nIsItemCanBuy = false; } else { m_nIsItemCanBuy = true; } m_ItemID = tabMasterShop.ItemID; m_nPrice = tabMasterShop.Price; m_nConsumItemID = tabMasterShop.ConsumItemID; Tab_CommonItem tabCommonItem = TableManager.GetCommonItemByID(m_ItemID, 0); if (tabCommonItem == null) { return; } m_Name = tabCommonItem.Name; m_ItemSlot.InitInfo(ItemSlotLogic.SLOT_TYPE.TYPE_ITEM, m_ItemID, GoodsOnClick); if (null != m_NameLabel) { m_NameLabel.text = m_Name; } if (null != m_PriceContent) { m_PriceContent.text = tabMasterShop.Price.ToString(); } m_nShopItemChangeMax = tabMasterShop.MaxChangeNum; }
void UpdateMasterShopGoodsInfo() { Utils.CleanGrid(m_MasterShopGrid); if (null == m_MasterShopItem) { return; } for (int i = 0; i < TableManager.GetMasterShop().Count; i++) { Tab_MasterShop tabMasterShop = TableManager.GetMasterShopByID(i, 0); if (tabMasterShop == null || tabMasterShop.ConsumItemID <= 0 || tabMasterShop.Price <= 0) { continue; } if (m_nQingYiItemID <= 0) { m_nQingYiItemID = tabMasterShop.ConsumItemID; } // 加载对应商品 GameObject MasterShopItem = Utils.BindObjToParent(m_MasterShopItem, m_MasterShopGrid, i.ToString()); if (MasterShopItem == null) { continue; } if (null != MasterShopItem.GetComponent <MasterShopItemLogic>()) { MasterShopItem.GetComponent <MasterShopItemLogic>().Init(tabMasterShop); } } m_MasterShopGrid.GetComponent <UIGrid>().Reposition(); m_MasterShopGrid.GetComponent <UITopGrid>().Recenter(true); }