public void UpdateData(SlgPB.ShopItem shopItem, int index) { if (shopItem != null) { _ShopItem = shopItem; _index = index; } }
void CreatePopsItem(List <SlgPB.ShopItem> shopItems) { _sellPropsItemList.Clear(); _grid.DestoryAllChildren(); int n = shopItems.Count; for (int i = 0; i < n; ++i) { SlgPB.ShopItem shopItem = shopItems[i]; GameObject prof = (GameObject)Resources.Load(AppConfig.FOLDER_PROFAB_UI + "pvp/propsItem"); GameObject item = NGUITools.AddChild(_grid.gameObject, prof); SellPropsItem sellitem = item.GetComponent <SellPropsItem>(); sellitem.UpdateData(shopItem, i); _sellPropsItemList.Add(sellitem); } _grid.Reposition(); }
void UpdateUI() { if (_index == null) { return; } List <SlgPB.ShopItem> shopItems = InstancePlayer.instance.model_User.model_shop.shopItems; _ShopItem = shopItems[_index]; // MultipleItem multipItem = UIHelper.GetMultipleItem(_ShopItem.itemID,_ShopItem.num,_ShopItem.itemType,1,_icon); SlgPB.PrizeItem prizeItem = new SlgPB.PrizeItem(); prizeItem.itemId = _ShopItem.itemID; prizeItem.type = _ShopItem.itemType; prizeItem.num = _ShopItem.num; UIDropItem dropitem = UIHelper.GetUIDropItemByPrizeItem(prizeItem); _icon.SetTexturePath(dropitem.icon); int quality = DataManager.instance.dataItemGroup.GetItem(_ShopItem.itemID).quality; switch (quality - 1) { case 0: _name.color = UICommon.UNIT_NAME_COLOR_0; break; case 1: _name.color = UICommon.UNIT_NAME_COLOR_1; break; case 2: _name.color = UICommon.UNIT_NAME_COLOR_2; break; case 3: _name.color = UICommon.UNIT_NAME_COLOR_3; break; case 4: _name.color = UICommon.UNIT_NAME_COLOR_4; break; case 5: _name.color = UICommon.UNIT_NAME_COLOR_5; break; default: _name.color = UICommon.UNIT_NAME_COLOR_0; break; } _name.text = DataManager.instance.dataItemGroup.GetItem(_ShopItem.itemID).name; _iconBg.spriteName = "pvp_itemBg_" + quality; _number.text = _ShopItem.num.ToString(); if (_ShopItem.isSold == 0) { _CashLabel.gameObject.SetActive(true); _Label_ed.gameObject.SetActive(false); _CashLabel.text = _ShopItem.price.ToString(); _bug_Btn.isEnabled = true; } else { _CashLabel.gameObject.SetActive(false); _Label_ed.gameObject.SetActive(true); _bug_Btn.isEnabled = false; } }