private void RefreshItemList2(List <CommodityInfo> commodities) { ShoppingUIView.Instance.Show1ItemSR.get_gameObject().SetActive(false); ShoppingUIView.Instance.Show2ItemSR.get_gameObject().SetActive(true); for (int i = 0; i < this.ItemList2.Count; i++) { this.ItemList2[i].Items.Clear(); } this.ItemList2.Clear(); if (commodities == null) { return; } commodities.Sort(new Comparison <CommodityInfo>(ShoppingUIViewModel.CommoditySortCompare)); for (int j = 0; j < commodities.get_Count(); j++) { OOShoppingUnit2 shoppingUnit = this.GetShoppingUnit2(commodities.get_Item(j)); int i2 = j / 6; if (j % 6 == 0) { OOShoppingPage2 o = new OOShoppingPage2(); this.ItemList2.Add(o); } this.ItemList2[i2].Items.Add(shoppingUnit); } }
private OOShoppingUnit2 GetShoppingUnit2(CommodityInfo commodityInfo) { int itemId = commodityInfo.itemId; int commodityId = commodityInfo.commodityId; OOShoppingUnit2 oOShoppingUnit = new OOShoppingUnit2(); oOShoppingUnit.iId = commodityId; if (commodityInfo.sell) { oOShoppingUnit.EnableBtnBuy = false; oOShoppingUnit.ItemFlagIconBg = true; oOShoppingUnit.ItemFlagIcon = ResourceManager.GetIconSprite("font_yishouwan"); } else { oOShoppingUnit.EnableBtnBuy = true; oOShoppingUnit.ItemFlagIconBg = false; oOShoppingUnit.ItemFlagIcon = ResourceManagerBase.GetNullSprite(); } int num = commodityInfo.unitPrice * commodityInfo.itemNum; if ((long)num > MoneyType.GetNum(commodityInfo.moneyType)) { oOShoppingUnit.PriceNow = "x" + num; } else { oOShoppingUnit.PriceNow = "x" + num; } oOShoppingUnit.ItemFrame = GameDataUtils.GetItemFrame(itemId); oOShoppingUnit.ItemIcon = GameDataUtils.GetItemIcon(itemId); oOShoppingUnit.ItemName = GameDataUtils.GetEquipItemNameAndLV(itemId, false); oOShoppingUnit.ItemNum = string.Empty + commodityInfo.itemNum; oOShoppingUnit.CoinIcon = MoneyType.GetIcon(commodityInfo.moneyType); oOShoppingUnit.PriceOld = string.Empty; ShangPinBiao shangPinBiao = DataReader <ShangPinBiao> .Get(commodityInfo.commodityId); if (shangPinBiao != null) { if (shangPinBiao.pvpLevel > 0) { oOShoppingUnit.PVPIcon = ResourceManager.GetIconSprite(PVPManager.Instance.GetGetIntegralByLevel(shangPinBiao.pvpLevel, false)); JingJiChangFenDuan jingJiChangFenDuan = DataReader <JingJiChangFenDuan> .Get(shangPinBiao.pvpLevel); if (jingJiChangFenDuan != null) { oOShoppingUnit.PVPName = GameDataUtils.GetChineseContent(jingJiChangFenDuan.name, false); } oOShoppingUnit.TipShow = (shangPinBiao.pvpLevel > PVPManager.Instance.GetIntegralLevel().id); } else { oOShoppingUnit.PVPIcon = ResourceManagerBase.GetNullSprite(); oOShoppingUnit.PVPName = string.Empty; oOShoppingUnit.TipShow = false; } } return(oOShoppingUnit); }