local UIOperationActivityShopBase = UIViewClass() function UIOperationActivityShopBase:OnOpened(context) self.activityId = context.activityId self.storeType = context.storeType CTL.Currency.OpenCurrencyPanel(nil, self.currency_Info, MDL.OperationActivity.StoreTypeData:GetDataByTabID(self.storeType).MoneyTypeHUD) self:RegistSystemEvent(EventID.UI_Shop_RefreshShopInfo, self.RefreshTabGoods) self:RegistSystemEvent(EventID.UI_OperationActivity_DataChanged, self.RefreshTabGoods) self:InitGoods() end function UIOperationActivityShopBase:InitGoods() if self.loop_Goods.Count > 0 then self.loop_Goods:ClearCells() end local goods = MDL.Shop.GetShopGoodsCfgByTypeID(self.storeType) for i, v in ipairs(goods) do self.loop_Goods:AddData(v, 0) end end function UIOperationActivityShopBase:RefreshTabGoods() local goods = MDL.Shop.GetShopGoodsCfgByTypeID(self.storeType) self.loop_Goods:ReloadAll(goods) end --region ****************************** Loop ******************************** function UIOperationActivityShopBase:OnCellInit(scrollRect, index, cellTable, data) self:ShowCellItem(cellTable, data) end function UIOperationActivityShopBase:OnCellClicked(scrollRect, index, cellTable, target, data) self:CellClicked(cellTable, target, data) end --endregion ****************************** Loop ******************************** function UIOperationActivityShopBase:ShowCellItem(cellTable, data) local goodData = data.OriData cellTable.txt_Name:SetText(UTL.Item.GetItemDataSpliceByType(goodData.ItemID).Name) cellTable.txt_Name:SetScrollSpeed(1.5) --滚动速度 local moneyId = goodData.MoneyID local buyPrice = goodData.BuyPrice if MDL.Currency.GetMoneyCount(moneyId) < buyPrice then cellTable.txt_Cost.text = UTL.Color.FormatRedColor(buyPrice) else cellTable.txt_Cost.text = buyPrice end UTL.Item.MoneyIcon(cellTable.icon_Cost, moneyId) UTL.Item.SetItemCell(cellTable.item, goodData.ItemID, goodData.ItemNum) local itemData = DataSheetManager.ItemData:GetDataByID(goodData.ItemID) UIUtils.SetImageByAssetBundle(cellTable.img_NameBG, DataSheetManager.QualityColor:GetDataByID(itemData.Color).StoreGoodsNameBase2) local canBuy = not CTL.PayMall.IsSoldOut(goodData) cellTable.state_CanBuy:SetState(canBuy and 0 or 1) local isLimit, limitStr = CTL.PayMall.IsLimitedGood(goodData) UIUtils.SetActive(cellTable.group_Limit, isLimit) if isLimit then UIUtils.SetLabel(cellTable.lab_Limit, CTL.PayMall.GetLimitedTitle(goodData)) UIUtils.SetLabel(cellTable.txt_LimitNum, limitStr) end end return UIOperationActivityShopBase