c1_lua/lua/app/ui/fund/bounty_collection_comp.lua
2025-09-25 11:40:28 +08:00

163 lines
8.3 KiB
Lua
Executable File

local BountyCollectionComp = class("BountyCollectionComp", LuaComponent)
local CELL = "app/ui/privilege/cell/bounty_collection_cell"
function BountyCollectionComp:onClose()
end
function BountyCollectionComp:init()
local uiMap = self:getUIMap()
self.btnHelp = uiMap["bounty_collection_comp.top.tx_title.btn_help"]
self.timeBg = uiMap["bounty_collection_comp.top.time"]
self.txTime = uiMap["bounty_collection_comp.top.time.tx_time"]
self.txPro = uiMap["bounty_collection_comp.top.img_prog.tx_pro"]
self.txLv = uiMap["bounty_collection_comp.level_node.content.level.tx_lv"]
self.imgProg = uiMap["bounty_collection_comp.level_node.content.prog.img_prog"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER)
self.txProg = uiMap["bounty_collection_comp.level_node.content.prog.tx_prog"]
self.scrollrect = uiMap["bounty_collection_comp.scrollrect"]
self.btnGet = uiMap["bounty_collection_comp.btns.btn_get"]
self.txGet = uiMap["bounty_collection_comp.btns.btn_get.tx_desc"]
-- self.btnBuy1 = uiMap["bounty_collection_comp.btns.btn_buy_1"]
-- self.txBuy1 = uiMap["bounty_collection_comp.btns.btn_buy_1.tx_desc"]
-- self.pro1_Items = {}
-- self.pro1_TxCount = {}
-- self.pro1_ImgIcon = {}
-- for i = 1, 4 do
-- local item = uiMap["bounty_collection_comp.top.tips_1.groud.item_" .. i]
-- local txCount = uiMap["bounty_collection_comp.top.tips_1.groud.item_" .. i .. ".tx_count"]
-- local imgProg = uiMap["bounty_collection_comp.top.tips_1.groud.item_" .. i .. ".img_prog"]
-- table.insert(self.pro1_Items, item)
-- table.insert(self.pro1_TxCount, txCount)
-- table.insert(self.pro1_ImgIcon, imgProg)
-- end
-- self.btnBuy2 = uiMap["bounty_collection_comp.btns.btn_buy_2"]
-- self.txBuy2 = uiMap["bounty_collection_comp.btns.btn_buy_2.tx_desc"]
-- self.pro2_Items = {}
-- self.pro2_TxCount = {}
-- self.pro2_ImgIcon = {}
-- for i = 1, 4 do
-- local item = uiMap["bounty_collection_comp.top.tips_2.groud.item_" .. i]
-- local txCount = uiMap["bounty_collection_comp.top.tips_2.groud.item_" .. i .. ".tx_count"]
-- local imgProg = uiMap["bounty_collection_comp.top.tips_2.groud.item_" .. i .. ".img_prog"]
-- table.insert(self.pro2_Items, item)
-- table.insert(self.pro2_TxCount, txCount)
-- table.insert(self.pro2_ImgIcon, imgProg)
-- end
-- self.txTitle = uiMap["bounty_collection_comp.top.tx_title"]
-- self.txLevelTips = uiMap["bounty_collection_comp.top.level_node.content.tx_level_tips"]
-- self.txLevel = uiMap["bounty_collection_comp.scrollrect.title.tx_level"]
-- self.txCommon = uiMap["bounty_collection_comp.scrollrect.title.tx_common"]
-- self.txPro1 = uiMap["bounty_collection_comp.scrollrect.title.tx_pro_1"]
-- self.txPro2 = uiMap["bounty_collection_comp.scrollrect.title.tx_pro_2"]
-- self.txTips1 = uiMap["bounty_collection_comp.top.tips.tx_tips1"]
-- self.txTips2 = uiMap["bounty_collection_comp.top.btn_buy_2.tips_2.tx_tips"]
-- self.txDescInfo1 = uiMap["bounty_collection_comp.top.btn_buy_1.img.tx_desc_info"]
-- self.txDescInfo2 = uiMap["bounty_collection_comp.top.btn_buy_2.img.tx_desc_info"]
-- self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.FORCE_DESC_26))
-- self.txLevelTips:setText(I18N:getGlobalText(I18N.GlobalConst.FORCE_DESC_28))
-- self.txLevel:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_5))
-- self.txCommon:setText(I18N:getGlobalText(I18N.GlobalConst.BOUNTY_DESC_5))
-- self.txPro1:setText(I18N:getGlobalText(I18N.GlobalConst.BOUNTY_DESC_6))
-- self.txPro2:setText(I18N:getGlobalText(I18N.GlobalConst.BOUNTY_DESC_7))
-- self.txTips1:setText(I18N:getGlobalText(I18N.GlobalConst.FORCE_DESC_29))
-- self.txTips2:setText(I18N:getGlobalText(I18N.GlobalConst.FORCE_DESC_29))
-- self.txDescInfo1:setText(I18N:getGlobalText(I18N.GlobalConst.FORCE_DESC_30))
-- self.txDescInfo2:setText(I18N:getGlobalText(I18N.GlobalConst.FORCE_DESC_31))
-- local cfg = DataManager.BagData:getRecoveryCfg(GConst.ItemConst.ITEM_ID_CHALLENGE_TEAM)
-- local add = cfg and cfg.bounty or 0
-- self.btnBuy1:addClickListener(function()
-- ModuleManager.ShopManager:showFundRewardUI({
-- txTitle = "提升等级,领取超值豪礼",
-- giftIds = DataManager.BountyCollectionData:getProRewardGiftId(GConst.BountyCollectionConst.REWARD_GEAR.PRO_1),
-- rewards = DataManager.BountyCollectionData:getAllRewards(GConst.BountyCollectionConst.REWARD_GEAR.PRO_1),
-- func = function()
-- ModuleManager.CollectionManager:onUnlockPro(GConst.BountyCollectionConst.REWARD_GEAR.PRO_1)
-- end,
-- })
-- end)
-- self.btnBuy2:addClickListener(function()
-- ModuleManager.ShopManager:showFundRewardUI({
-- txTitle = "提升等级,领取超值豪礼",
-- giftIds = DataManager.BountyCollectionData:getProRewardGiftId(GConst.BountyCollectionConst.REWARD_GEAR.PRO_2),
-- rewards = DataManager.BountyCollectionData:getAllRewards(GConst.BountyCollectionConst.REWARD_GEAR.PRO_2),
-- func = function()
-- ModuleManager.CollectionManager:onUnlockPro(GConst.BountyCollectionConst.REWARD_GEAR.PRO_2)
-- end,
-- })
-- end)
-- self.btnGet:addClickListener(function()
-- ModuleManager.CollectionManager:reqGetAllRewards()
-- end)
-- self.btnHelp:addClickListener(function()
-- -- ModuleManager.TipsManager:showDescTips(I18N:getGlobalText(I18N.GlobalConst.BOUNTY_DESC_9), self.btnHelp)
-- end)
-- self:bind(DataManager.BountyCollectionData, "isDirty", function()
-- self:refresh()
-- end)
-- self:updateTime()
-- local meshProComp = self.txTime:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO).preferredWidth
-- self.timeBg:setSizeDeltaX(meshProComp + 55)
end
function BountyCollectionComp:updateTime()
-- self.txTime:setText(I18N:getGlobalText(I18N.GlobalConst.NEXT_REFRESH_DESC, Time:formatNumTimeStr(DataManager.BountyCollectionData:getRemainTime())))
end
function BountyCollectionComp:refresh()
-- local lv = DataManager.BountyCollectionData:getLevel()
-- local exp = DataManager.BountyCollectionData:getExp()
-- local maxLv = DataManager.BountyCollectionData:getMaxLv()
-- if lv >= maxLv then
-- exp = 0
-- lv = maxLv
-- end
-- self.txLv:setText(lv)
-- local curExp = exp
-- local fullExp = DataManager.BountyCollectionData:getLvUpExp()
-- self.txProg:setText(curExp .. "/" .. fullExp)
-- self.imgProg.value = curExp / fullExp
-- local gift1 = ConfigManager:getConfig("act_gift")[DataManager.BountyCollectionData:getProRewardGiftId(GConst.BountyCollectionConst.REWARD_GEAR.PRO_1)]
-- local gift2 = ConfigManager:getConfig("act_gift")[DataManager.BountyCollectionData:getProRewardGiftId(GConst.BountyCollectionConst.REWARD_GEAR.PRO_2)]
-- self.txBuy1:setText(GFunc.getFormatPrice(gift1.recharge_id))
-- self.txBuy2:setText(GFunc.getFormatPrice(gift2.recharge_id))
-- self.txPro:setText(gift2.value .. "%")
-- self.btnGet:setActive(DataManager.BountyCollectionData:canGetRewards())
-- self.btnBuy1:setActive(not DataManager.BountyCollectionData:isUnlockReward(GConst.BountyCollectionConst.REWARD_GEAR.PRO_1))
-- self.btnBuy2:setActive(not DataManager.BountyCollectionData:isUnlockReward(GConst.BountyCollectionConst.REWARD_GEAR.PRO_2))
-- if self.scrollRect == nil then
-- self.scrollRect = self.scrollrect:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
-- self.scrollRect:addInitCallback(function()
-- return CELL
-- end)
-- self.scrollRect:addRefreshCallback(function(index, cell)
-- cell:refresh(index)
-- end)
-- end
-- local count = DataManager.BountyCollectionData:getMaxLv()
-- if self.scrollRect:getTotalCount() == nil or self.scrollRect:getTotalCount() <= 0 then
-- self.scrollRect:refillCells(count)
-- elseif self.scrollRect:getTotalCount() ~= count then
-- self.scrollRect:clearCells()
-- self.scrollRect:refillCells(count)
-- else
-- self.scrollRect:updateAllCell()
-- end
-- self.scrollRect:moveToIndex(DataManager.BountyCollectionData:getMoveIdx())
-- BIReportV2:postOperation(BIReportV2.OPERATION_UI_NAME.BOUNTY_COLLECTION)
end
return BountyCollectionComp