local UIOACommonStoreBase = require("View/OperationActivity/OACommonBase/UIOACommonStoreBase") local UIHeroMatch1v1Store = UIViewClass(UIOACommonStoreBase) function UIHeroMatch1v1Store:RefreshPanel() if self.loop_Goods.Count > 0 then self.loop_Goods:ClearCells() end for i, v in MDL.HeroMatch1v1.GetStoreGoodsEnumerator() do self.loop_Goods:AddData(v, 0) end end function UIHeroMatch1v1Store:ShowGoodCell(cellTable, data) UTL.Item.SetItemCell(cellTable.UIItemBase, data.ItemID, data.ItemNum) local itemData = DataSheetManager.ItemData:GetDataByID(data.ItemID) cellTable.txt_ItemName:SetText(UIUtils.GetLocalizedTxt(Const_IDS[itemData.Name])) UTL.Item.MoneyIcon(cellTable.img_MoneyIcon, data.MoneyID) UIUtils.SetLabel(cellTable.txt_SumNum, UTL.Item.GetItemStockCount(data.MoneyID) >= data.BuyPrice and data.BuyPrice or UTL.Color.FormatRedColor(data.BuyPrice)) -- 火爆 cellTable.UIState_Hot:SetState(data.IsRareItem and 1 or 0) -- 商品状态 local isUnlock, des = CTL.PayMall.IsUnlockPurchase(data) if CTL.PayMall.IsSoldOut(data) then cellTable.UIState_Type:SetState(2) UIUtils.SetLabel(cellTable.txt_RemainNum, 0) elseif not isUnlock then cellTable.UIState_Type:SetState(1) UIUtils.SetLabel(cellTable.txt_Lock, des) else local isLimit, limitStr = CTL.PayMall.IsLimitedGood(data, true) cellTable.UIState_Type:SetState(0) UIUtils.SetActive(cellTable.group_Remain, isLimit) UIUtils.SetLabel(cellTable.txt_RemainNum, limitStr) end end function UIHeroMatch1v1Store:GoodCellClicked(cellTable, target, data) if target == cellTable.btn_Buy then local curStackCount = UTL.Item.GetItemStockCount(data.MoneyID) if curStackCount >= data.BuyPrice and not CTL.PayMall.IsSoldOut(data) then local goodData = MDL.OperationActivity.StoreGoodsData:GetDataByID(data.ID) UIManager.OpenView(Const_UI_Lua.UIEnum.UIPayMallPopUp, {goodData = goodData}) else if curStackCount < data.BuyPrice then CTL.Tips.AddTipsMsg(Const_IDS["IDS_GoldHeroActivity_Store_WrongHint2"]) end end elseif target == cellTable.UIItemBase.event_Click then UTL.ItemTips.ShowCommonTipsById(data.ItemID) end end return UIHeroMatch1v1Store