local UIWarZoneAuctionPopUp = UIViewClass() --[[ 大拍卖——拍卖记录界面 ]] local WarZoneAuctionLoopTabName = { [MDL.WarZoneAuction.AuctionHistoryType.AllAuction] = Const_IDS.IDS_WarZoneAuction_13, [MDL.WarZoneAuction.AuctionHistoryType.MyAuction] = Const_IDS.IDS_WarZoneAuction_14, } -------------------- function UIWarZoneAuctionPopUp:OnCreated() self.auctionLoopTab = MDL.WarZoneAuction.AuctionHistoryType.AllAuction end function UIWarZoneAuctionPopUp:OnOpened(context) self:RegistSystemEvent(EventID.UI_WarZoneAuction_RefreshHistory, self.RefreshGroupByTab) self.historyDataList = {} UIUtils.SetActive(self.group_Empty, true) self:InitPanel() end function UIWarZoneAuctionPopUp:OnBackButtonPressed() self:OnButtonClicked(self.UICommonPopUpTab.btn_Close) end function UIWarZoneAuctionPopUp:OnButtonClicked(comp) if comp == self.UICommonPopUpTab.btn_Close then self:CloseView() end end function UIWarZoneAuctionPopUp:OnCellInit(scrollRect, index, cellTable, data) if scrollRect == self.UICommonPopUpTab.loop_Tab then UIUtils.SetActive(cellTable.img_Arrow, false) UIUtils.SetActive(cellTable.img_ArrowS, false) UIUtils.SetLabelText(cellTable.txt_Name_Nomal, WarZoneAuctionLoopTabName[data]) UIUtils.SetLabelText(cellTable.txt_Name_Selected, WarZoneAuctionLoopTabName[data]) elseif scrollRect == self.loop_My or scrollRect == self.loop_All then -- 设置背景 cellTable.obj_bgState:SetState(index % 2) UTL.Item.SetItemCell(cellTable.item, data.AuctionItem) UTL.Item.MoneyIcon(cellTable.img_Cost, data.AuctionCoin) UIUtils.SetLabel(cellTable.txt_Price, data.AuctionPrice) if scrollRect == self.loop_My then UIUtils.SetLabel(cellTable.txt_Time, UTL.Time.FormatTimeCompletely(data.AuctionTime)) else string.FormatByIdsId(Const_IDS.IDS_Rank_ServerIDS, MDL.Login.GetServerShowId()) UIUtils.SetLabel(cellTable.txt_Name, data.AuctionName) UIUtils.SetLabel(cellTable.txt_Server, string.FormatByIdsId(Const_IDS.IDS_Rank_ServerIDS, data.AuctionServer)) end end end function UIWarZoneAuctionPopUp:OnCellClicked(scrollRect, index, cellTable, target, data) if scrollRect == self.UICommonPopUpTab.loop_Tab then self.auctionLoopTab = data self.obj_groupState:SetState(self.auctionLoopTab) MDL.WarZoneAuction.WarZoneAuctionHistoryRequest(self.auctionLoopTab) elseif scrollRect == self.loop_My or scrollRect == self.loop_All then if target == cellTable.item.event_Click then UTL.ItemTips.ShowCommonTipsById(data.AuctionItem) end end end -------------------- function UIWarZoneAuctionPopUp:InitPanel() UIUtils.SetLabelText(self.UICommonPopUpTab.txt_Title, Const_IDS.IDS_WarZoneAuction_2) -- 初始化选项列表(我的竞拍、全部竞拍) for _, v in pairs(MDL.WarZoneAuction.AuctionHistoryType) do self.UICommonPopUpTab.loop_Tab:AddData(v, 0) end -- 默认选中第一个页签 self.UICommonPopUpTab.loop_Tab:SelectIndex(0) end -- 刷新右侧记录界面 function UIWarZoneAuctionPopUp:RefreshGroupByTab() if self.auctionLoopTab == MDL.WarZoneAuction.AuctionHistoryType.AllAuction then local index = 1 for _, v in MDL.WarZoneAuction.GetAllAuctionHistoryIterator() do self.historyDataList[index] = v index = index + 1 end for i = #self.historyDataList, index, -1 do table.remove(self.historyDataList, i) end self.loop_All:ReloadAll(self.historyDataList) elseif self.auctionLoopTab == MDL.WarZoneAuction.AuctionHistoryType.MyAuction then local index = 1 for _, v in MDL.WarZoneAuction.GetMyAuctionHistoryIterator() do self.historyDataList[index] = v index = index + 1 end for i = #self.historyDataList, index, -1 do table.remove(self.historyDataList, i) end self.loop_My:ReloadAll(self.historyDataList) end UIUtils.SetActive(self.group_Empty, #self.historyDataList <= 0) end return UIWarZoneAuctionPopUp