local UISlgGvEAuctionBase = UIViewClass() local EventSystem = require('Event/EventSystem') function UISlgGvEAuctionBase:OnOpened(context) self:RegistSystemEvent(EventID.UI_GuildAuctionBase_RefreshPanel, self.RefreshPanel) self:RegistSystemEvent(EventID.UI_Guild_AuctionShareBonusRefresh, self.UpdateAllTabCells) UIUtils.SetActive(self.group_Bonus, false) self.curTabIndex = 0 self.loop_Auction:AddData({pageType = MDL.GuildAuction.AllAuctionType.SlgGvE, showNameIDS = Const_IDS.IDS_SlgGve_Main_Hint_24}, 0) self.loop_Auction:AddData({pageType = MDL.GuildAuction.AllAuctionType.GuildAuctionShare, showNameIDS = Const_IDS.IDS_GuildAuction_BenefitTab}, 0) self.loop_Auction:SelectIndex(0) UIUtils.SetLabelText(self.lab_Title, Const_IDS["IDS_SlgGve_Auction_Hint_1"]) end function UISlgGvEAuctionBase:OnBackButtonPressed() self:OnButtonClicked(self.btn_Close) end function UISlgGvEAuctionBase:OnButtonClicked(comp) if comp == self.btn_Close then self:CloseView(true) elseif comp == self.btn_myAuction then UIManager.OpenAndPushAll(Const_UI_Lua.UIEnum.UIGuildAuctionMy, {auctionHouseType = MDL.GuildAuction.AllAuctionType.SlgGvE}) elseif comp == self.btn_AuctionRecord then UIManager.OpenAndPushAll(Const_UI_Lua.UIEnum.UIGuildAuctionRecord,{recordReqTyp = MDL.GuildAuction.GetAuctionRecordReqTyp.SlgGvE}) elseif comp == self.btn_Info then UIManager.OpenView(Const_UI_Lua.UIEnum.UICommonNoteView, {id = LuaConst.NoteID.SlgGvEAuction}) end end function UISlgGvEAuctionBase:UpdateAllTabCells() self.loop_Auction:RefreshCells(false) end function UISlgGvEAuctionBase:OnCellInit(scrollRect, index, cellTable, data) if scrollRect == self.loop_Auction then UIUtils.SetActive(cellTable.UnCheck, self.curTabIndex ~= index) UIUtils.SetActive(cellTable.Check, self.curTabIndex == index) UIUtils.SetLabelText(cellTable.lab_UnCheck, data.showNameIDS) UIUtils.SetLabelText(cellTable.lab_Check, data.showNameIDS) cellTable.event_Main:SetRedPoint(index == 1 and CTL.SlgGvE.GetAcutionShareBonusRedPoint()) end end function UISlgGvEAuctionBase:OnCellSelect(scrollRect, index, cellTable, data) self.curTabIndex = index self.curPageType = data.pageType self:RefreshPanel() end function UISlgGvEAuctionBase:RefreshPanel() UIUtils.SetActive(self.group_Bottom, true) if MDL.GuildAuction.IsOpenAuctionByType(self.curPageType) then self.group_Details:CloseView(Const_UI_Lua.UIEnum.UISlgGvEAuctionInfo) self.group_Details:CloseView(Const_UI_Lua.UIEnum.UISlgGvEAuctionShareOutBonus) if not self.group_Details:IsViewOpened(Const_UI_Lua.UIEnum.UIGuildAuctionList) then self.group_Details:OpenView(GetViewClass(Const_UI_Lua.UIEnum.UIGuildAuctionList), {auctionType = MDL.GuildAuction.AllAuctionType.SlgGvE}) else EventSystem.Dispatch(EventID.UI_GuildAuctionList_RefreshPanel, {auctionType = MDL.GuildAuction.AllAuctionType.SlgGvE}) end else self.group_Details:CloseAll() if self.curPageType == MDL.GuildAuction.AllAuctionType.GuildAuctionShare then self.group_Details:OpenView(GetViewClass(Const_UI_Lua.UIEnum.UISlgGvEAuctionShareOutBonus), nil, Const_UI_Lua.UIEnum.UIGuildAuctionShareOutBonus) UIUtils.SetActive(self.group_Bottom, false) else self.group_Details:OpenView(GetViewClass(Const_UI_Lua.UIEnum.UISlgGvEAuctionInfo)) end end self:RefreshBonus() end function UISlgGvEAuctionBase:RefreshBonus() if self.curPageType == MDL.GuildAuction.AllAuctionType.GuildAuctionShare then UIUtils.SetActive(self.group_Bonus, true) UIUtils.SetActive(self.group_Bonus1, false) UIUtils.SetActive(self.group_Bonus2, true) UIUtils.SetActive(self.group_Forbid, false) UIUtils.SetLabel(self.txt_Bonus2, UIUtils.GetLocalizedTxt(Const_IDS["IDS_SlgGve_Auction_Hint_8"])) return end if not MDL.GuildAuction.IsOpenAuctionByType(self.curPageType) then UIUtils.SetActive(self.group_Bonus, false) UIUtils.SetActive(self.group_Forbid, false) return end self:RefreshBonusInfo() end function UISlgGvEAuctionBase:RefreshBonusInfo() local isForbid, isJoin = MDL.GuildAuction.GetAuctionLimit() UIUtils.SetActive(self.group_Bonus, isForbid == false) UIUtils.SetActive(self.group_Forbid, isForbid == true) if not isForbid then local bonusList = MDL.GuildAuction.GetBonus() if bonusList == nil or #bonusList == 0 then UIUtils.SetActive(self.group_Bonus1, false) UIUtils.SetActive(self.group_Bonus2, true) UIUtils.SetLabel(self.txt_Bonus2, UIUtils.GetLocalizedTxt(Const_IDS["IDS_Auction_NoOneBidding"])) else UIUtils.SetActive(self.group_Bonus1, true) UIUtils.SetActive(self.group_Bonus2, false) if isJoin then for i, v in ipairs(self.bonus_Layout) do local info = bonusList[i] if info then UIUtils.SetActive(v.gameObject, true) UTL.Item.MoneyIcon(v.icon_Currency, info.itemType) UIUtils.SetLabel(v.txt_Number, info.itemCount) else UIUtils.SetActive(v.gameObject, false) end end else UIUtils.SetActive(self.group_Bonus2, true) for i, v in ipairs(self.bonus_Layout) do local info = bonusList[i] if info then UIUtils.SetActive(v.gameObject, true) UTL.Item.MoneyIcon(v.icon_Currency, info.itemType) local redStr = UTL.Color.FormatRedColor(info.itemCount) UIUtils.SetLabel(v.txt_Number, redStr) else UIUtils.SetActive(v.gameObject, false) end end local addPer = 100 * FP.tonumberV1(DataSheetManager.ConstData:GetDataByID("GuildAuctionBonusNormalPlayerRatio").FloatValue) local BonusTipStr = string.FormatByIdsKey("IDS_Auction_LowBonusIntro", addPer) UIUtils.SetLabel(self.txt_Bonus2, BonusTipStr) end end end end return UISlgGvEAuctionBase