local UIWarZoneAuctionMain = UIViewClass() local WarZoneAuctionFuncInfoID = 814 local WarZoneAuction_ShowPop_key = "WarZoneAuction_ShowPop_key" -- 是否显示确认出价弹窗 local WarZoneAuction_ShowFixedPricePop_key = "WarZoneAuction_ShowFixedPricePop_key" -- 是否显示确认出价弹窗 --[[ 大拍卖——主见面 ]] -------------------- function UIWarZoneAuctionMain:OnOpened(context) self:RegistSystemEvent(EventID.UI_WarZoneAuction_RefreshAuctionList, self.RefreshAuctionList) self.activityType = MDL.OperationActivity.ActivityType.WarZoneAuction self.auctionItemList = {} --所有拍品 self.auctionIngItemList = {} --正在竞价的拍品 self.auctionNotStartItemList = {} --未开启拍品 self.cacheItems = {} self.curSelectAuctionData = nil self.curPrice = 0 self.curActivityId = CTL.WarZoneAuction.GetCurOpenWarZoneAuctionActivityId() if GameAppInfo.IsJapanesePackage() then --日本拍卖需要特殊增加文字说明 self.costDragonSuffix = "\n" .. UIUtils.GetLocalizedTxt(Const_IDS.IDS_JP_MoneyConsumption_Pay) .. "\n" .. UIUtils.GetLocalizedTxt(Const_IDS.IDS_JP_MoneyConsumption_Time) .. "\n" .. UIUtils.GetLocalizedTxt(Const_IDS.IDS_JP_MoneyConsumption_CannotCancel) end self.selectToggleIndex = 0 self:InitPanel() end function UIWarZoneAuctionMain:OnClosed() if MDL.WarZoneAuction.AuctionShowRedPointDicIsEmpty() then CTL.RedPoint.RemoveRedPoint(CTL.RedPoint.RedPointKey.WarZoneAuction) end end function UIWarZoneAuctionMain:OnBackButtonPressed() self:OnButtonClicked(self.UITemplateTitlePanel.btn_close) end function UIWarZoneAuctionMain:OnButtonClicked(comp) if comp == self.UITemplateTitlePanel.btn_close then self:CloseView(true) elseif comp == self.UITemplateTitlePanel.btn_Home then CTL.HomeMain.CloseViewBackHomeMain() elseif comp == self.btn_Record then -- 交易记录 UIManager.OpenView(Const_UI_Lua.UIEnum.UIWarZoneAuctionPopUp) elseif comp == self.btn_Freshen then -- 价格刷新 self.curPrice = 0 -- 这里需要重置一下价格 MDL.WarZoneAuction.WarZoneAuctionRefreshRequest(true) elseif comp == self.event_Plus then -- 价格增加 self:SetPrice(true) elseif comp == self.event_Minus then -- 价格减少 self:SetPrice(false) elseif comp == self.bg_NumSelect then -- 调用输入框 self:OpenUIKeypad() elseif comp == self.btn_Auction then -- 竞价 self:OnAuctionBtn() elseif comp == self.group_FixedPrice.btn_FixedPrice then -- 一口价 self:OnFixedPrice() elseif comp == self.UITemplateTitlePanel.btn_Info then -- 玩法说明 local _, timeStr = UTL.Time.GetDateDescAndTime({[1] = 1}) UIManager.OpenView(Const_UI_Lua.UIEnum.UICommonNoteView, {id = LuaConst.NoteID.WarZoneAuction, params = {timeStr}}) end end function UIWarZoneAuctionMain:OnCellInit(scrollRect, index, cellTable, data) if scrollRect == self.loop_Item then local auctionData = MDL.OperationActivity.WarZoneAuction:GetDataByActivityID_AuctionID(self.curActivityId, data.AuctionID) if auctionData then local itemCfgData = DataSheetManager.ItemData:GetDataByID(auctionData.ItemID) -- 设置图标 UIUtils.SetActive(cellTable.img_GodBeastBg, itemCfgData.FirstType == LuaConst.ItemType.GodBeast) UIUtils.SetActive(cellTable.img_ItemIcon, itemCfgData.FirstType ~= LuaConst.ItemType.GodBeast) if itemCfgData.FirstType == LuaConst.ItemType.GodBeast then --神兽需要特殊处理 UIUtils.SetImageByAssetBundle(cellTable.img_GodBeast, auctionData.ShowPicture) else self:SetCacheItem(cellTable.img_ItemIcon, auctionData.ItemID) end -- 设置数量 UIUtils.SetLabel(cellTable.txt_Num, auctionData.ItemNum) -- 设置名字 local state, name = self:GetUIStateQuaAndItemName(auctionData.ItemID) cellTable.UIState_Qua:SetState(state) cellTable.txt_ItemName:SetText(name) cellTable.txt_ItemName:SetScrollSpeed(1.5) -- 设置已拥有状态 if itemCfgData.FirstType == LuaConst.ItemType.Frame then local itemCount = MDL.Bag.GetItemCountInOneCell(auctionData.ItemID) if itemCount > 0 then UIUtils.SetActive(cellTable.group_Owned, true) else local frameData = MDL.Character.GetFrameDataByItemId(auctionData.ItemID) if frameData then UIUtils.SetActive(cellTable.group_Owned, MDL.Character.IsActiveByInfo(frameData)) else UIUtils.SetActive(cellTable.group_Owned, false) end end elseif itemCfgData.FirstType == LuaConst.ItemType.Title then local itemCount = MDL.Bag.GetItemCountInOneCell(auctionData.ItemID) if itemCount > 0 then UIUtils.SetActive(cellTable.group_Owned, true) else local titleData = CTL.Title.GetTitleDataByItemId(auctionData.ItemID) if titleData then UIUtils.SetActive(cellTable.group_Owned, MDL.Title.HasTitleByGeneralTitleID(titleData.ID)) else UIUtils.SetActive(cellTable.group_Owned, false) end end else UIUtils.SetActive(cellTable.group_Owned, false) end -- 设置选中特效 if self.curSelectAuctionData and auctionData.AuctionID == self.curSelectAuctionData.AuctionID then UIUtils.SetActive(cellTable.effect_Selected, true) else UIUtils.SetActive(cellTable.effect_Selected, false) end if data.AuctionState == MDL.WarZoneAuction.AuctionState.AuctionIng or data.AuctionState == MDL.WarZoneAuction.AuctionState.FixedPrice then cellTable.obj_AuctionState:SetState(2) if CTL.WarZoneAuction.AuctionIncludeSelf(data.AuctionAcidList) then if data.AuctionState == MDL.WarZoneAuction.AuctionState.AuctionIng then cellTable.state_Sign:SetState(0) else cellTable.state_Sign:SetState(1) end else cellTable.state_Sign:SetState(2) end elseif data.AuctionState == MDL.WarZoneAuction.AuctionState.NotStart then cellTable.state_Sign:SetState(2) cellTable.obj_AuctionState:SetState(0) local serverTime = UTL.Time.GetServerTimestamp() cellTable.obj_Timer:ResetAndBeginCustomTimer(false, data.AuctionStartTime - serverTime, 0, UIUtils.GetLocalizedTxt(Const_IDS.IDS_WarZoneAuction_10)) UIUtils.SetActive(cellTable.group_Sign, false) else cellTable.obj_AuctionState:SetState(1) cellTable.state_Sign:SetState(2) UIUtils.SetActive(cellTable.group_Sign, false) end if MDL.WarZoneAuction.HasAuctionShowRedPointDic(data.AuctionID) then UIUtils.SetActive(cellTable.obj_redpoint, true) else UIUtils.SetActive(cellTable.obj_redpoint, false) end local sourceId = self:GetItemSourceIdAndId(auctionData.ItemID) UIUtils.SetActive(cellTable.group_itemInfo, sourceId and sourceId > 0 or false) else logging.error(LTAG.ERROR, "大拍卖 : [OnCellInit]没有找到,ActivityId = ", self.curActivityId, " AuctionID = ", data.AuctionID, " 的ams拍卖数据") end end end function UIWarZoneAuctionMain:OnCellClicked(scrollRect, index, cellTable, target, data) if scrollRect == self.loop_Item then local auctionData = MDL.OperationActivity.WarZoneAuction:GetDataByActivityID_AuctionID(self.curActivityId, data.AuctionID) if target == cellTable.group_itemInfo then local sourceId, id = self:GetItemSourceIdAndId(auctionData.ItemID) CTL.ItemSources.ExecuteSourceFunctionById(sourceId, id) return end if self.curSelectAuctionData and self.curSelectAuctionData.AuctionID == data.AuctionID then return end if auctionData then UIUtils.SetActive(cellTable.effect_Selected, true) self.curPrice = 0 -- 这里需要重置一下价格 local oldSelectAuctionID = -1 if self.curSelectAuctionData then oldSelectAuctionID = self.curSelectAuctionData.AuctionID end self.curSelectAuctionData = auctionData self:ShowAuctionDetails() self:RefreshSelectAuctionData() -- 消除一下红点 UIUtils.SetActive(cellTable.obj_redpoint, false) MDL.WarZoneAuction.RemoveAuctionShowRedPointDic(data.AuctionID) -- 切换一下特效 if oldSelectAuctionID > 0 then local list = self:GetCurAuctionItemList() for index, v in ipairs(list) do if v.AuctionID == oldSelectAuctionID then self.loop_Item:UpdateIndex(index - 1) -- c# 中index从0开始 break end end end else logging.error(LTAG.ERROR, "大拍卖 : [OnCellClicked]没有找到,ActivityId = ", self.curActivityId, " AuctionID = ", data.AuctionID, " 的ams拍卖数据") end end end function UIWarZoneAuctionMain:GetItemSourceIdAndId(itemID) local itemData = DataSheetManager.ItemData:GetDataByID(itemID) local id, sourceId if itemData.FirstType == LuaConst.ItemType.GodBeast then id = MDL.GodBeast.GetGodBeastDataByItemId(itemID).ID sourceId = MDL.ItemSources.SourceType.GodBeast elseif itemData.FirstType == LuaConst.ItemType.Stratagem and itemData.SecondType == LuaConst.ItemStratagemType.Fragment then id = DataSheetManager.ItemData:GetDataByID(itemID).BelongerID sourceId = MDL.ItemSources.SourceType.StratagemDetail elseif itemData.FirstType == LuaConst.ItemType.Appearance then if itemData.SecondType == MDL.Appearance.AppearanceType.Hero then id = MDL.Appearance.GetAppearanceCfgIdByItemId(itemID) sourceId = MDL.ItemSources.SourceType.HeroAppearance elseif itemData.SecondType == MDL.Appearance.AppearanceType.Weapon then id = MDL.Appearance.GetAppearanceCfgIdByItemId(itemID) sourceId = MDL.ItemSources.SourceType.MagicWeaponFashion end elseif itemData.FirstType == LuaConst.ItemType.GiftBag then id = itemID sourceId = MDL.ItemSources.SourceType.ItemTips elseif itemData.FirstType == LuaConst.ItemType.Materials and itemData.SecondType == LuaConst.ItemMaterialsType.HeroLightEffect then id = DataSheetManager.ItemData:GetDataByID(itemID).BelongerID sourceId = MDL.ItemSources.SourceType.HeroLightEffect elseif itemData.FirstType == LuaConst.ItemType.Pet then id = DataSheetManager.ItemData:GetDataByID(itemID).ThirdType sourceId = MDL.ItemSources.SourceType.PetIllustratedHandbook end return sourceId, id end ------------------- function UIWarZoneAuctionMain:InitPanel() -- 设置标题 UIUtils.SetLabelText(self.UITemplateTitlePanel.lab_Title, Const_IDS.IDS_ActivityName_WarZoneAuction) -- 设置活动结束时间 local residueTime = CTL.OperationActivity.GetActivityResidueTime(self.activityType) if residueTime <= 0 then self.obj_AllAuctionTimeState:SetState(0) else self.obj_AllAuctionTimeState:SetState(1) self.obj_AllActivityTime:ResetAndBeginCustomTimer(false, residueTime, 0, UIUtils.GetLocalizedTxt(Const_IDS.IDS_WarZoneAuction_1)) self:StartRepeatFunc(self.ActivityEnd, residueTime, 1) end -- 刷新全部竞拍状态 MDL.WarZoneAuction.WarZoneAuctionRefreshRequest() end -- 点击拍卖物品后在右侧展示详细信息 function UIWarZoneAuctionMain:ShowAuctionDetails() -- 设置图标 对所有拍卖品进行统一的单元格初始化 UTL.Item.SetItemCell(self.item,self.curSelectAuctionData.ItemID,self.curSelectAuctionData.ItemNum) -- 设置数量 UIUtils.SetLabel(self.txt_Num, self.curSelectAuctionData.ItemNum) -- 设置名字 local name = UTL.Item.GetItemColorName(self.curSelectAuctionData.ItemID) self.txt_ItemName.text = name -- 设置描述 local dataSplice = UTL.Item.GetItemDataSpliceByType(self.curSelectAuctionData.ItemID) UIUtils.SetLabel(self.labLocal_TaskDescribe, dataSplice.Des) UIUtils.SetLocalPosition(self.content, 0, 0, 0) end -- 刷新选中道具竞价信息 function UIWarZoneAuctionMain:RefreshSelectAuctionData() if not self.curSelectAuctionData then return end local auctionItemData = MDL.WarZoneAuction.GetAuctionDataByAuctionID(self.curSelectAuctionData.AuctionID) if auctionItemData then -- 设置当前出价 and 单次加价步长(已经有竞拍者的时候 才需要显示) UTL.Item.SetItemIcon(self.img_CostIcon, self.curSelectAuctionData.AuctionCoin) if next(auctionItemData.AuctionAcidList) then UIUtils.SetLabel(self.txt_Cost, auctionItemData.AuctionCurrPrice) -- 单次加价步长(已经有竞拍者的时候 才需要显示) UIUtils.SetActive(self.lab_NumCost, true) UTL.Item.SetItemIcon(self.DetailMoneyIcon, self.curSelectAuctionData.AuctionCoin) UIUtils.SetLabel(self.txt_NumCost, self.curSelectAuctionData.PerPrice) else UIUtils.SetLabel(self.txt_Cost, self.curSelectAuctionData.StartPrice) UIUtils.SetActive(self.lab_NumCost, false) end local serverTime = UTL.Time.GetServerTimestamp() -- 设置当前竞拍状态 UIUtils.SetActive(self.group_FixedPrice.gameObject, self.curSelectAuctionData.HighestPrice and self.curSelectAuctionData.HighestPrice > 0) -- 是否配置了一口价 UTL.Item.SetItemIcon(self.group_FixedPrice.DetailMoneyIcon, self.curSelectAuctionData.AuctionCoin) UIUtils.SetLabel(self.group_FixedPrice.txt_NumCost, self.curSelectAuctionData.HighestPrice) if auctionItemData.AuctionState == MDL.WarZoneAuction.AuctionState.FixedPrice then -- 一口价进行中 self.obj_AuctionTimeState:SetState(0) self.obj_AuctionTime:ResetAndBeginCustomTimer(false, auctionItemData.AuctionEndTime - serverTime, 0, UIUtils.GetLocalizedTxt(Const_IDS.IDS_WarZoneAuction_Roll1)) UIUtils.SetActive(self.group_AuctionBid, false) self.group_FixedPrice.obj_FixedPriceState:SetState(CTL.WarZoneAuction.AuctionIncludeSelf(auctionItemData.AuctionAcidList) and 3 or 2) UIUtils.SetLabel(self.group_FixedPrice.txt_FixedPriceJoin, string.FormatByIdsId(Const_IDS.IDS_Auction_BiddingDesc2, #auctionItemData.AuctionAcidList)) else UIUtils.SetActive(self.group_AuctionBid, true) if auctionItemData.AuctionState ~= MDL.WarZoneAuction.AuctionState.AuctionIng then -- 如果不是运行中 需要先设置竞价 -- 设置当前竞价 self:SetPrice(false) -- 是否已经是当前的竞价者 UIUtils.SetActive(self.img_AuctionLock, CTL.WarZoneAuction.AuctionIncludeSelf(auctionItemData.AuctionAcidList)) self.obj_RemindState:SetState(1) end if auctionItemData.AuctionState == MDL.WarZoneAuction.AuctionState.AuctionIng then -- 竞拍中 self.obj_AuctionState:SetState(1) self.obj_AuctionTimeState:SetState(0) if auctionItemData.AuctionEndTime <= 0 then self.obj_AuctionTime:EndTimer() UIUtils.SetActive(self.obj_AuctionTime, false) else self.obj_AuctionTime:ResetAndBeginCustomTimer(false, auctionItemData.AuctionEndTime - serverTime, 0, UIUtils.GetLocalizedTxt(Const_IDS.IDS_WarZoneAuction_11)) end self.group_FixedPrice.obj_FixedPriceState:SetState(0) elseif auctionItemData.AuctionState == MDL.WarZoneAuction.AuctionState.NotStart then -- 未开启 self.obj_AuctionTimeState:SetState(0) self.obj_AuctionTime:ResetAndBeginCustomTimer(false, auctionItemData.AuctionStartTime - serverTime, 0, UIUtils.GetLocalizedTxt(Const_IDS.IDS_WarZoneAuction_8)) self.group_FixedPrice.obj_FixedPriceState:SetState(1) self.obj_AuctionState:SetState(0) elseif auctionItemData.AuctionState == MDL.WarZoneAuction.AuctionState.End then -- 已结束 self.obj_AuctionTime:EndTimer() self.obj_AuctionTimeState:SetState(1) self.obj_AuctionState:SetState(2) self.group_FixedPrice.obj_FixedPriceState:SetState(1) end if auctionItemData.AuctionState == MDL.WarZoneAuction.AuctionState.AuctionIng then -- 如果是运行中 需要后设置竞价 -- 设置当前竞价 self:SetPrice(false) -- 是否已经是当前的竞价者 if CTL.WarZoneAuction.AuctionIncludeSelf(auctionItemData.AuctionAcidList) then UIUtils.SetActive(self.img_AuctionLock, true) self.obj_RemindState:SetState(0) else UIUtils.SetActive(self.img_AuctionLock, false) self.obj_RemindState:SetState(1) end end end else logging.error(LTAG.ERROR, "大拍卖 : [RefreshSelectAuctionData]没有找到,AuctionID = ", self.curSelectAuctionData.AuctionID, " 的拍卖数据") end end function UIWarZoneAuctionMain:RefreshBuyCount(minCount, maxCount) if minCount then UIUtils.SetActive(self.img_MinusLock, self.curPrice <= minCount) end if maxCount then UIUtils.SetActive(self.img_PlusLock, self.curPrice >= maxCount) end UIUtils.SetLabel(self.txt_NumSelect, self.curPrice) end function UIWarZoneAuctionMain:RefreshAuctionList(auctionID) self:RefreshData() if auctionID ~= nil then local list = self:GetCurAuctionItemList() for i, v in ipairs(list) do if v.AuctionID == auctionID then self.loop_Item:UpdateIndex(i - 1) -- c# 中index从0开始 break end end if self.curSelectAuctionData and auctionID == self.curSelectAuctionData.AuctionID then self:RefreshSelectAuctionData() end else local list = self:GetCurAuctionItemList() self.loop_Item:ReloadAll(list) -- 如果是第一次加载 or 当前数据被删除了,需要选中第一个 if #list > 0 then if self:ListIncludeCurSelect() then self:RefreshSelectAuctionData() else self.loop_Item:SelectIndex(0) end end end -- 开启计时器处理下次刷新 self:StartRefreshTiming() end function UIWarZoneAuctionMain:RefreshData() -- 设置数据 table.clear(self.auctionItemList) table.clear(self.auctionIngItemList) table.clear(self.auctionNotStartItemList) local auctionDataList = MDL.WarZoneAuction.GetAuctionDataList() for i, v in ipairs(auctionDataList) do table.insert(self.auctionItemList, v) if v.AuctionState == MDL.WarZoneAuction.AuctionState.AuctionIng or v.AuctionState == MDL.WarZoneAuction.AuctionState.FixedPrice then if CTL.WarZoneAuction.AuctionIncludeSelf(v.AuctionAcidList) then table.insert(self.auctionIngItemList, v) end elseif v.AuctionState == MDL.WarZoneAuction.AuctionState.NotStart then table.insert(self.auctionNotStartItemList, v) end end end --当前拍卖列表 function UIWarZoneAuctionMain:GetCurAuctionItemList() if self.selectToggleIndex == 0 then return self.auctionItemList elseif self.selectToggleIndex == 1 then return self.auctionIngItemList elseif self.selectToggleIndex == 2 then return self.auctionNotStartItemList end end function UIWarZoneAuctionMain:OnValueChanged(comp,value) if comp == self.group_Toggle then self.selectToggleIndex = value local list = self:GetCurAuctionItemList() self.loop_Item:ReloadAll(list) if #list > 0 then self.loop_Item:SelectIndex(0, true) end end end function UIWarZoneAuctionMain:SetCacheItem(item, id) if self.cacheItems[item] ~= id then UTL.Item.ItemIconWithoutBg(item, id) self.cacheItems[item] = id end end function UIWarZoneAuctionMain:ListIncludeCurSelect() if not self.curSelectAuctionData then return false end local list = self:GetCurAuctionItemList() for _, v in ipairs(list) do if v.AuctionID == self.curSelectAuctionData.AuctionID then return true end end return false end function UIWarZoneAuctionMain:GetUIStateQuaAndItemName(itemId) local itemCfgData = DataSheetManager.ItemData:GetDataByID(itemId) local itemNameAndDesc = UTL.Item.GetItemDataSpliceByType(itemId) local quaState = 2 if itemCfgData.Color == LuaConst.QualityColor.DarkGold then quaState = 0 elseif itemCfgData.Color == LuaConst.QualityColor.Gold then quaState = 1 end return quaState, itemNameAndDesc.Name end --- Start 小键盘相关 Start --- function UIWarZoneAuctionMain:OpenUIKeypad() if self.curSelectAuctionData then if not self.keyBoardView then local auctionItemData = MDL.WarZoneAuction.GetAuctionDataByAuctionID(self.curSelectAuctionData.AuctionID) if auctionItemData then local minCount if next(auctionItemData.AuctionAcidList) then minCount = auctionItemData.AuctionCurrPrice + self.curSelectAuctionData.PerPrice -- 如果已经有人竞拍,最小出价等于当前竞价 + 单次加价步长 else minCount = self.curSelectAuctionData.StartPrice -- 如果无人竞拍,最小出价等于起始价格 end local maxCount = UTL.Item.GetItemStockCount(self.curSelectAuctionData.AuctionCoin) if self.curSelectAuctionData.HighestPrice > 0 then -- 如果一口价>0 即配置了一口价 maxCount = math.min(maxCount, self.curSelectAuctionData.HighestPrice) -- 最大加价数量等于自身拥有货币 或者 一口价取更小的 end maxCount = math.max(maxCount, minCount) -- 最大金额不能比最小金额小 self.keyBoardView = self.subView:OpenView(GetViewClass(Const_UI_Lua.UIEnum.UIKeypad), {parentView = self, x = -40, y = -55, maxNum = maxCount}, nil, nil) end end end end function UIWarZoneAuctionMain:ExcuteKeyBoardBack(count, param) self.curPrice = count self:RefreshBuyCount() end function UIWarZoneAuctionMain:CloseKeyBoardView() self.keyBoardView:CloseView() self.keyBoardView = nil -- 关闭时需要规整一下显示 if not self.curSelectAuctionData then return end local auctionItemData = MDL.WarZoneAuction.GetAuctionDataByAuctionID(self.curSelectAuctionData.AuctionID) if auctionItemData then local maxCount = UTL.Item.GetItemStockCount(self.curSelectAuctionData.AuctionCoin) if self.curSelectAuctionData.HighestPrice > 0 then -- 如果一口价>0 即配置了一口价 maxCount = math.min(maxCount, self.curSelectAuctionData.HighestPrice) -- 最大加价数量等于自身拥有货币 或者 一口价取更小的 end if self.curPrice > maxCount then self.curPrice = maxCount end local minCount if next(auctionItemData.AuctionAcidList) then minCount = auctionItemData.AuctionCurrPrice + self.curSelectAuctionData.PerPrice -- 如果已经有人竞拍,最小出价等于当前竞价 + 单次加价步长 else minCount = self.curSelectAuctionData.StartPrice -- 如果无人竞拍,最小出价等于起始价格 end if self.curPrice < minCount then self.curPrice = minCount end self:RefreshBuyCount(minCount, maxCount) else logging.error(LTAG.ERROR, "大拍卖 : [CloseKeyBoardView]没有找到,AuctionID = ", self.curSelectAuctionData.AuctionID, " 的拍卖数据") end end --- End 小键盘相关 End --- -- plus 传 true 是增加资金、传 false 是减少资金 function UIWarZoneAuctionMain:SetPrice(plus) if not self.curSelectAuctionData then return end local auctionItemData = MDL.WarZoneAuction.GetAuctionDataByAuctionID(self.curSelectAuctionData.AuctionID) if auctionItemData then local minCount if next(auctionItemData.AuctionAcidList) then minCount = auctionItemData.AuctionCurrPrice + self.curSelectAuctionData.PerPrice -- 如果已经有人竞拍,最小出价等于当前竞价 + 单次加价步长 else minCount = self.curSelectAuctionData.StartPrice -- 如果无人竞拍,最小出价等于起始价格 end local maxCount = UTL.Item.GetItemStockCount(self.curSelectAuctionData.AuctionCoin) if self.curSelectAuctionData.HighestPrice > 0 then -- 如果一口价>0 即配置了一口价 maxCount = math.min(maxCount, self.curSelectAuctionData.HighestPrice) -- 最大出价数量等于自身拥有货币 或者 一口价取更小的 end maxCount = math.max(maxCount, minCount) -- 最大出价不能比最小出价低 local nextPrice if plus then nextPrice = self.curPrice + self.curSelectAuctionData.PerPrice if nextPrice > maxCount then self.curPrice = maxCount else self.curPrice = nextPrice end else nextPrice = self.curPrice - self.curSelectAuctionData.PerPrice if nextPrice < minCount then self.curPrice = minCount else self.curPrice = nextPrice end end self:RefreshBuyCount(minCount, maxCount) else logging.error(LTAG.ERROR, "大拍卖 : [SetPrice]没有找到,AuctionID = ", self.curSelectAuctionData.AuctionID, " 的拍卖数据") end end function UIWarZoneAuctionMain:OnAuctionBtn() if not self.curSelectAuctionData then return end local auctionItemData = MDL.WarZoneAuction.GetAuctionDataByAuctionID(self.curSelectAuctionData.AuctionID) if auctionItemData then local nextMinCount if next(auctionItemData.AuctionAcidList) then nextMinCount = auctionItemData.AuctionCurrPrice + self.curSelectAuctionData.PerPrice -- 如果已经有人竞拍,最小出价等于当前竞价 + 单次加价步长 else nextMinCount = self.curSelectAuctionData.StartPrice -- 如果无人竞拍,最小出价等于起始价格 end if self.curPrice < nextMinCount then CTL.Tips.AddTipsMsg(string.FormatByIdsId(Const_IDS.IDS_WarZoneAuction_7, self.curSelectAuctionData.PerPrice)) else local itemName = UIUtils.GetLocalizedTxt(Const_IDS[DataSheetManager.ItemData:GetDataByID(self.curSelectAuctionData.ItemID).Name]) -- 拍卖道具 local currencyName = UIUtils.GetLocalizedTxt(Const_IDS[DataSheetManager.ItemData:GetDataByID(self.curSelectAuctionData.AuctionCoin).Name]) -- 货币 if self.curSelectAuctionData.HighestPrice > 0 and self.curPrice >= self.curSelectAuctionData.HighestPrice then -- 当前价格超过了一口价 提示是否使用一口价 local desc = string.FormatByIdsId(Const_IDS.IDS_Auction_BiddingToBuyOutPriceConfirm, self.curSelectAuctionData.HighestPrice, currencyName, itemName) UTL.MessageBox.ShowOKCancelBox(Const_IDS.IDS_Auction_BuyOutPrice, desc, function() MDL.WarZoneAuction.WarZoneAuctionRequest(auctionItemData.AuctionID, self.curSelectAuctionData.HighestPrice) end) else -- 没超过一口价 if PersistentData.PlayerData:Get(WarZoneAuction_ShowPop_key, 0) > 0 and UTL.Time.IsTimestampCrossDay(PersistentData.PlayerData:Get(WarZoneAuction_ShowPop_key, 0)) then PersistentData.PlayerData:Remove(WarZoneAuction_ShowPop_key) end if PersistentData.PlayerData:Get(WarZoneAuction_ShowPop_key, 0) <= 0 then local desc = string.FormatByIdsId(Const_IDS.IDS_WarZoneAuction_26, self.curPrice, currencyName, itemName) --日服龙玉的弹窗,不要勾选提示,每次都要提示 if CTL.Currency.IsDragonJadeUsedInJapan(self.curSelectAuctionData.AuctionCoin) then UTL.MessageBox.ShowOKCancelBox(Const_IDS.IDS_WarZoneAuction_25, desc..self.costDragonSuffix, function() MDL.WarZoneAuction.WarZoneAuctionRequest(auctionItemData.AuctionID, self.curPrice) end) else UTL.MessageBox.ShowOKCancelToggleBox(Const_IDS.IDS_WarZoneAuction_25, desc, UIUtils.GetLocalizedTxt(Const_IDS.IDS_WarZoneAuction_27), -- 确认按钮回调 function() MDL.WarZoneAuction.WarZoneAuctionRequest(auctionItemData.AuctionID, self.curPrice) end, -- 勾选框回调 function(isOn) if isOn then PersistentData.PlayerData:Set(WarZoneAuction_ShowPop_key, UTL.Time.GetServerTimestamp(), true) else PersistentData.PlayerData:Remove(WarZoneAuction_ShowPop_key) end end) end else MDL.WarZoneAuction.WarZoneAuctionRequest(auctionItemData.AuctionID, self.curPrice) end end end else logging.error(LTAG.ERROR, "大拍卖 : [SetPrice]没有找到,AuctionID = ", self.curSelectAuctionData.AuctionID, " 的拍卖数据") end end function UIWarZoneAuctionMain:OnFixedPrice() if not self.curSelectAuctionData then return end local itemName = UIUtils.GetLocalizedTxt(Const_IDS[DataSheetManager.ItemData:GetDataByID(self.curSelectAuctionData.ItemID).Name]) -- 拍卖道具 local currencyName = UIUtils.GetLocalizedTxt(Const_IDS[DataSheetManager.ItemData:GetDataByID(self.curSelectAuctionData.AuctionCoin).Name]) -- 货币 local auctionItemData = MDL.WarZoneAuction.GetAuctionDataByAuctionID(self.curSelectAuctionData.AuctionID) if not auctionItemData then return end if PersistentData.PlayerData:Get(WarZoneAuction_ShowFixedPricePop_key, 0) > 0 and UTL.Time.IsTimestampCrossDay(PersistentData.PlayerData:Get(WarZoneAuction_ShowFixedPricePop_key, 0)) then PersistentData.PlayerData:Remove(WarZoneAuction_ShowFixedPricePop_key) end if PersistentData.PlayerData:Get(WarZoneAuction_ShowFixedPricePop_key, 0) <= 0 then local desc = string.FormatByIdsId(Const_IDS.IDS_Auction_BuyConfirm, self.curSelectAuctionData.HighestPrice, currencyName, itemName) --日服龙玉的弹窗,不要勾选提示,每次都要提示 if CTL.Currency.IsDragonJadeUsedInJapan(self.curSelectAuctionData.AuctionCoin) then UTL.MessageBox.ShowOKCancelBox(Const_IDS.IDS_Auction_BuyOutPrice, desc..self.costDragonSuffix, function() MDL.WarZoneAuction.WarZoneAuctionRequest(auctionItemData.AuctionID, self.curSelectAuctionData.HighestPrice) end) else UTL.MessageBox.ShowOKCancelToggleBox(Const_IDS.IDS_Auction_BuyOutPrice, desc, UIUtils.GetLocalizedTxt(Const_IDS.IDS_WarZoneAuction_27), -- 确认按钮回调 function() MDL.WarZoneAuction.WarZoneAuctionRequest(auctionItemData.AuctionID, self.curSelectAuctionData.HighestPrice) end, -- 勾选框回调 function(isOn) if isOn then PersistentData.PlayerData:Set(WarZoneAuction_ShowFixedPricePop_key, UTL.Time.GetServerTimestamp(), true) else PersistentData.PlayerData:Remove(WarZoneAuction_ShowFixedPricePop_key) end end) end else MDL.WarZoneAuction.WarZoneAuctionRequest(auctionItemData.AuctionID, self.curSelectAuctionData.HighestPrice) end end --- Start 计时器相关 Start --- function UIWarZoneAuctionMain:StartRefreshTiming() -- 需要先把上一次计时器停掉 self:StopRepeatFunc(self.StopRefreshTiming) local interval = MDL.WarZoneAuction.GetNextRefreshTime() self:StartRepeatFunc(self.StopRefreshTiming, interval, 1) end function UIWarZoneAuctionMain:StopRefreshTiming() self:StopRepeatFunc(self.StopRefreshTiming) MDL.WarZoneAuction.WarZoneAuctionRefreshRequest() end -- 整体活动计时 function UIWarZoneAuctionMain:ActivityEnd() self:StopRepeatFunc(self.ActivityEnd) self.obj_AllAuctionTimeState:SetState(0) end --- End 计时器相关 End --- return UIWarZoneAuctionMain