--[[ 自选礼包确认 ]] local UIBagSelectionConfirm = UIViewClass() function UIBagSelectionConfirm:OnCreated() self.confirmData = nil; UIUtils.SetLabelText(self.UICommonPopUp.txt_Title, Const_IDS.IDS_COMMON_PROMPT) end function UIBagSelectionConfirm:OnOpened(context) self.confirmData = context; for index, selectData in pairs(self.confirmData.data) do self.scroll_Reward:AddData(selectData, 0); end end function UIBagSelectionConfirm:OnBackButtonPressed() self:OnButtonClicked(self.UICommonPopUp.btn_Close) end function UIBagSelectionConfirm:OnButtonClicked(comp) if comp == self.UICommonPopUp.btn_Close or comp == self.btn_Cannel then self:CloseView(); elseif comp == self.btn_Confirm then local selectDataArr = {}; for index, selectData in pairs(self.confirmData.data) do table.insert(selectDataArr, { place = index, count = selectData.selectCount }); end MDL.Bag.UseItemByCfgIdReq(self.confirmData.giftItemId, self.confirmData.useCount, selectDataArr); UIManager.CloseView(Const_UI_Lua.UIEnum.UISelectReward); self:CloseView(); end end function UIBagSelectionConfirm:OnCellInit(scrollRect, index, cellTable, data) UTL.Item.SetItemCell(cellTable.item, data.itemId, data.selectCount * data.itemCount); end return UIBagSelectionConfirm