This commit is contained in:
puxuan 2025-09-29 21:09:54 +08:00
parent 1bc3f1e9f2
commit bc3e832daa
9 changed files with 290 additions and 253 deletions

View File

@ -44,6 +44,7 @@ function DataManager:init()
-- 冲刺活动 -- 冲刺活动
self:initManager("ActTimeData", "app/userdata/activity/act_time_data") self:initManager("ActTimeData", "app/userdata/activity/act_time_data")
self:initManager("ActGiftData", "app/userdata/activity/act_gift_data")
self:initManager("ActSprintData", "app/userdata/activity/act_sprint/act_sprint_data") self:initManager("ActSprintData", "app/userdata/activity/act_sprint/act_sprint_data")
self:initManager("ActSprintSummonDataAll", "app/userdata/activity/act_sprint/act_sprint_summon_data_all") self:initManager("ActSprintSummonDataAll", "app/userdata/activity/act_sprint/act_sprint_summon_data_all")

View File

@ -88,8 +88,8 @@ function ActSprintManager:rspStandardReward(result)
-- bi -- bi
local biType = sprintData:getBIType() local biType = sprintData:getBIType()
local taskFinishNum, taskTotalNum = sprintData:getBISprintTaskNumInfo() local taskFinishNum, taskTotalNum = sprintData:getBISprintTaskNumInfo()
local sprintTaskRound = sprintData:getStandardTurn() local sprintTaskRound = DataManager.ActTaskData:getTurnScore(result.reqData.activity_id)
local sprintRewardRound = sprintData:getStandardClaimedTurn() local sprintRewardRound = DataManager.ActTaskData:getClaimedTurnScore(result.reqData.activity_id)
BIReport:postActSprintClaimSprintReward(result.reqData.activity_id, biType, taskFinishNum, taskTotalNum, sprintTaskRound, sprintRewardRound) BIReport:postActSprintClaimSprintReward(result.reqData.activity_id, biType, taskFinishNum, taskTotalNum, sprintTaskRound, sprintRewardRound)
end end

View File

@ -7,113 +7,114 @@ local BG_NAME_2 = "act_common_bg_28" -- 正常
local BTN_NAME_1 = "common_btn_grey_5" local BTN_NAME_1 = "common_btn_grey_5"
local BTN_NAME_2 = "common_btn_yellow_5" local BTN_NAME_2 = "common_btn_yellow_5"
function GiftCell:refresh(actGiftId) function GiftCell:refresh(actId, actGiftId)
local uiMap = self:getUIMap() local uiMap = self:getUIMap()
local bg = uiMap["gift_cell.bg"] local bg = uiMap["gift_cell.bg"]
local descTx = uiMap["gift_cell.bg.desc_tx"] local descTx = uiMap["gift_cell.bg.desc_tx"]
if not self.rewardList then if not self.rewardList then
self.rewardList = {} self.rewardList = {}
for i = 1, REWARD_CELL_COUNT do for i = 1, REWARD_CELL_COUNT do
table.insert(self.rewardList, CellManager:addCellComp(uiMap["gift_cell.bg.reward_cell_" .. i], GConst.TYPEOF_LUA_CLASS.REWARD_CELL)) table.insert(self.rewardList, CellManager:addCellComp(uiMap["gift_cell.bg.reward_cell_" .. i], GConst.TYPEOF_LUA_CLASS.REWARD_CELL))
end end
end end
local offBg = uiMap["gift_cell.bg.off_bg"] local offBg = uiMap["gift_cell.bg.off_bg"]
local offTx = uiMap["gift_cell.bg.off_bg.desc_tx"] local offTx = uiMap["gift_cell.bg.off_bg.desc_tx"]
local limitTx = uiMap["gift_cell.bg.limit_tx"] local limitTx = uiMap["gift_cell.bg.limit_tx"]
local funcBtn = uiMap["gift_cell.bg.func_btn"] local funcBtn = uiMap["gift_cell.bg.func_btn"]
local funcTx = uiMap["gift_cell.bg.func_btn.desc_tx"] local funcTx = uiMap["gift_cell.bg.func_btn.desc_tx"]
local funcAdIcon = uiMap["gift_cell.bg.func_btn.ad"] local funcAdIcon = uiMap["gift_cell.bg.func_btn.ad"]
local funcAdTx = uiMap["gift_cell.bg.func_btn.ad_tx"] local funcAdTx = uiMap["gift_cell.bg.func_btn.ad_tx"]
local func2AdTx = uiMap["gift_cell.bg.func_btn.ad_2_tx"] local func2AdTx = uiMap["gift_cell.bg.func_btn.ad_2_tx"]
local isFree = DataManager.ActSprintSummonDataAll:getActGiftIsFree(actGiftId) self.cfg = DataManager.ActGiftData:getGiftConfig(actId, actGiftId)
local isAd = DataManager.ActSprintSummonDataAll:getActGiftIsAd(actGiftId) local isFree = DataManager.ActGiftData:isFreeGift(actId, actGiftId)
local costItem = DataManager.ActSprintSummonDataAll:getActGiftCostItem(actGiftId) local isAd = DataManager.ActGiftData:isAdGift(actId, actGiftId)
local rechargeId = DataManager.ActSprintSummonDataAll:getActGiftRechargeId(actGiftId) local buyCount = DataManager.ActGiftData:getGiftBuyCount(actGiftId)
local buyCount = DataManager.ActSprintSummonDataAll:getActGiftBuyCount(actGiftId) local costItem = self.cfg.item_cost and self.cfg.item_cost[1]
local limitCount = DataManager.ActSprintSummonDataAll:getActGiftLimit(actGiftId) local rechargeId = self.cfg.recharge_id
local value = DataManager.ActSprintSummonDataAll:getActGiftValue(actGiftId) -- 超值标识 local limitCount = self.cfg.limit
local rewards = DataManager.ActSprintSummonDataAll:getActGiftReward(actGiftId) local value = self.cfg.value
local soldOut = buyCount >= limitCount local rewards = self.cfg.reward
local soldOut = buyCount >= limitCount
bg:setSprite(GConst.ATLAS_PATH.UI_ACT_COMMON, (isFree or isAd) and BG_NAME_1 or BG_NAME_2)
funcBtn:setSprite(GConst.ATLAS_PATH.COMMON, soldOut and BTN_NAME_1 or BTN_NAME_2) bg:setSprite(GConst.ATLAS_PATH.UI_ACT_COMMON, (isFree or isAd) and BG_NAME_1 or BG_NAME_2)
if soldOut then funcBtn:setSprite(GConst.ATLAS_PATH.COMMON, soldOut and BTN_NAME_1 or BTN_NAME_2)
funcTx:setText(I18N:getGlobalText(I18N.GlobalConst.ACT_GOGOGO_DESC_8)) if soldOut then
funcAdIcon:setVisible(false) funcTx:setText(I18N:getGlobalText(I18N.GlobalConst.ACT_GOGOGO_DESC_8))
funcAdTx:setVisible(false) funcAdIcon:setVisible(false)
func2AdTx:setVisible(false) funcAdTx:setVisible(false)
else func2AdTx:setVisible(false)
if rechargeId then else
funcTx:setText(GFunc.getFormatPrice(rechargeId)) if rechargeId then
funcAdIcon:setVisible(false) funcTx:setText(GFunc.getFormatPrice(rechargeId))
funcAdTx:setVisible(false) funcAdIcon:setVisible(false)
func2AdTx:setVisible(false) funcAdTx:setVisible(false)
else func2AdTx:setVisible(false)
if isFree then else
funcTx:setText(I18N:getGlobalText(I18N.GlobalConst.FREE_DESC)) if isFree then
funcAdIcon:setVisible(false) funcTx:setText(I18N:getGlobalText(I18N.GlobalConst.FREE_DESC))
funcAdTx:setVisible(false) funcAdIcon:setVisible(false)
func2AdTx:setVisible(false) funcAdTx:setVisible(false)
elseif isAd then func2AdTx:setVisible(false)
funcTx:setText() elseif isAd then
funcAdIcon:setVisible(true) funcTx:setText()
funcAdTx:setVisible(true) funcAdIcon:setVisible(true)
func2AdTx:setVisible(false) funcAdTx:setVisible(true)
GFunc.setAdsSprite(funcAdIcon) func2AdTx:setVisible(false)
funcAdTx:setText(I18N:getGlobalText(I18N.GlobalConst.FREE_DESC)) GFunc.setAdsSprite(funcAdIcon)
elseif costItem then funcAdTx:setText(I18N:getGlobalText(I18N.GlobalConst.FREE_DESC))
funcTx:setText() elseif costItem then
funcAdIcon:setVisible(true) funcTx:setText()
funcAdIcon:setSprite(GFunc.getIconRes(costItem.id)) funcAdIcon:setVisible(true)
if GFunc.checkCost(costItem.id, costItem.num, false) then funcAdIcon:setSprite(GFunc.getIconRes(costItem.id))
funcAdTx:setVisible(true) if GFunc.checkCost(costItem.id, costItem.num, false) then
func2AdTx:setVisible(false) funcAdTx:setVisible(true)
funcAdTx:setText(costItem.num) func2AdTx:setVisible(false)
else funcAdTx:setText(costItem.num)
funcAdTx:setVisible(true) else
func2AdTx:setVisible(false) funcAdTx:setVisible(true)
funcAdTx:setText("<color=#FF6C73>" .. costItem.num .. "</color>") func2AdTx:setVisible(false)
end funcAdTx:setText("<color=#FF6C73>" .. costItem.num .. "</color>")
end end
end end
end end
descTx:setText(DataManager.ActSprintSummonDataAll:getActGiftI18NName(actGiftId)) end
for i = 1, REWARD_CELL_COUNT do descTx:setText(DataManager.ActGiftData:getActGiftI18NName(actGiftId))
local reward = rewards and rewards[i] for i = 1, REWARD_CELL_COUNT do
if reward then local reward = rewards and rewards[i]
self.rewardList[i].baseObject:setActive(true) if reward then
self.rewardList[i]:refreshByConfig(reward) self.rewardList[i].baseObject:setActive(true)
else self.rewardList[i]:refreshByConfig(reward)
self.rewardList[i].baseObject:setActive(false) else
end self.rewardList[i].baseObject:setActive(false)
end end
local limitStr = I18N:getGlobalText(I18N.GlobalConst.GIFT_ROUTINE_DESC_8) .. "(" .. (limitCount - buyCount) .. "/" .. limitCount .. ")" end
limitTx:setText(soldOut and "<color=#2C6A65>" .. limitStr .. "</color>" or "<color=#6A482D>" .. limitStr .. "</color>") local limitStr = I18N:getGlobalText(I18N.GlobalConst.GIFT_ROUTINE_DESC_8) .. "(" .. (limitCount - buyCount) .. "/" .. limitCount .. ")"
if value then limitTx:setText(soldOut and "<color=#2C6A65>" .. limitStr .. "</color>" or "<color=#6A482D>" .. limitStr .. "</color>")
offBg:setVisible(true) if value then
offTx:setText(value .. "%") offBg:setVisible(true)
else offTx:setText(value .. "%")
offBg:setVisible(false) else
end offBg:setVisible(false)
end
funcBtn:addClickListener(function()
if not soldOut then funcBtn:addClickListener(function()
if isAd then if not soldOut then
SDKManager:showFullScreenAds(BIReport.ADS_CLICK_TYPE.AD_ACT_SPRINT, function() if isAd then
ModuleManager.ActSprintManager:reqGift(actGiftId) SDKManager:showFullScreenAds(BIReport.ADS_CLICK_TYPE.AD_ACT_SPRINT, function()
end) ModuleManager.ActSprintManager:reqGift(actGiftId)
else end)
if costItem then else
if GFunc.checkCost(costItem.id, costItem.num, true) then if costItem then
ModuleManager.ActSprintManager:reqGift(actGiftId) if GFunc.checkCost(costItem.id, costItem.num, true) then
end ModuleManager.ActSprintManager:reqGift(actGiftId)
else end
ModuleManager.ActSprintManager:reqGift(actGiftId) else
end ModuleManager.ActSprintManager:reqGift(actGiftId)
end end
end end
end) end
end)
end end
return GiftCell return GiftCell

View File

@ -50,7 +50,7 @@ function SummonActCell:refresh(day, maxDay, info)
GFunc.setGrey(self.dayIcon:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_IMAGE), false) GFunc.setGrey(self.dayIcon:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_IMAGE), false)
else else
self.freeRewardCell:hideFrameAnimation() self.freeRewardCell:hideFrameAnimation()
-- self.freeRewardCell:setClickShowTips() self.freeRewardCell:clearClickListener()
self.dayTx:setVisible(freeGot) self.dayTx:setVisible(freeGot)
self.dayTxGrey:setVisible(not freeGot) self.dayTxGrey:setVisible(not freeGot)
GFunc.setGrey(self.bg:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_IMAGE), not freeGot) GFunc.setGrey(self.bg:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_IMAGE), not freeGot)
@ -78,14 +78,14 @@ function SummonActCell:refresh(day, maxDay, info)
else else
self.proRewardCells[1]:hideFrameAnimation() self.proRewardCells[1]:hideFrameAnimation()
self.proRewardCells[2]:hideFrameAnimation() self.proRewardCells[2]:hideFrameAnimation()
-- self.proRewardCells[1]:setClickShowTips() self.proRewardCells[1]:clearClickListener()
-- self.proRewardCells[2]:setClickShowTips() self.proRewardCells[2]:clearClickListener()
end end
end end
function SummonActCell:onClickClaimRewards() function SummonActCell:onClickClaimRewards()
local actId = DataManager.ActSprintSummonDataAll:getActId() local actId = DataManager.ActSprintSummonDataAll:getActId()
local actType = DataManager.ActSprintSummonDataAll:getActType(actId) local actType = DataManager.ActivityData:getActType(actId)
local grade = DataManager.ActSprintSummonDataAll:isUnlockBountyPro() and 1 or 0 local grade = DataManager.ActSprintSummonDataAll:isUnlockBountyPro() and 1 or 0
ModuleManager.ActSprintManager:reqSprintBountySign(actType, actId, grade) ModuleManager.ActSprintManager:reqSprintBountySign(actType, actId, grade)
end end

View File

@ -12,28 +12,7 @@ end
function GiftComp:refresh(actId) function GiftComp:refresh(actId)
self.txTitle:setText(I18N:getGlobalText(GConst.ActSprintConst.ACT_LIST_NAME[actId])) self.txTitle:setText(I18N:getGlobalText(GConst.ActSprintConst.ACT_LIST_NAME[actId]))
self.banner:setTexture(GConst.ActSprintConst.ACT_MAIN_BANNER[actId]) self.banner:setTexture(GConst.ActSprintConst.ACT_MAIN_BANNER[actId])
local cfgList = DataManager.ActSprintSummonDataAll:getActGiftList(actId) self.giftList = DataManager.ActGiftData:getGiftIdsSort(actId)
self.giftList = table.clearOrCreate(self.giftList)
for _, id in ipairs(cfgList) do
table.insert(self.giftList, id)
end
-- 排序
table.sort(self.giftList, function(a, b)
-- 免费 > 可购买 > 已售罄 > id
local isFreeA = DataManager.ActSprintSummonDataAll:getActGiftIsFree(a) or DataManager.ActSprintSummonDataAll:getActGiftIsAd(a)
local isFreeB = DataManager.ActSprintSummonDataAll:getActGiftIsFree(b) or DataManager.ActSprintSummonDataAll:getActGiftIsAd(b)
if isFreeA == isFreeB then
local canBuyA = DataManager.ActSprintSummonDataAll:getActGiftRemainCount(a) > 0
local canBuyB = DataManager.ActSprintSummonDataAll:getActGiftRemainCount(b) > 0
if canBuyA == canBuyB then
return a < b
else
return canBuyA
end
else
return isFreeA
end
end)
if self.scrollRect == nil then if self.scrollRect == nil then
self.scrollRect = self.scrollrect:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE) self.scrollRect = self.scrollrect:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
@ -41,7 +20,7 @@ function GiftComp:refresh(actId)
return CELL return CELL
end) end)
self.scrollRect:addRefreshCallback(function(index, cell) self.scrollRect:addRefreshCallback(function(index, cell)
cell:refresh(self.giftList[index]) cell:refresh(actId, self.giftList[index])
end) end)
end end
if self.scrollRect:getTotalCount() == nil or self.scrollRect:getTotalCount() <= 0 then if self.scrollRect:getTotalCount() == nil or self.scrollRect:getTotalCount() <= 0 then

View File

@ -202,6 +202,10 @@ function RewardCell:addClickListener(callback)
self.clickCallback = callback self.clickCallback = callback
end end
function RewardCell:clearClickListener()
self.clickCallback = nil
end
function RewardCell:setLocalScale(x, y, z) function RewardCell:setLocalScale(x, y, z)
self.baseObject:setLocalScale(x, y, z) self.baseObject:setLocalScale(x, y, z)
end end

View File

@ -0,0 +1,140 @@
local ActGiftData = class("ActGiftData", BaseData)
local ActGift = ConfigManager:getConfig("act_gift")
function ActGiftData:ctor()
end
function ActGiftData:clear()
self.giftConfig = nil
end
--@region 礼包
function ActGiftData:getActGiftsByActId(actId)
local cfg = ConfigManager:getConfig("activity")[actId]
if not cfg then
return {}
end
return cfg.act_gift
end
function ActGiftData:getGiftConfig(actId, id)
self.giftConfig = self.giftConfig or {}
if self.giftConfig[actId] == nil then
self.giftConfig[actId] = {}
local ids = self:getActGiftsByActId(actId)
for i, id in ipairs(ids) do
local info = ConfigManager:getConfig("act_gift")[id]
info.id = id
self.giftConfig[actId][id] = info
end
end
if id then
return self.giftConfig[actId][id]
else
return self.giftConfig[actId]
end
end
function ActGiftData:getGiftIdsSort(actId)
local tempList = {}
for id, info in pairs(self:getGiftConfig(actId)) do
local temp = {id = info.id, _sort = info.id}
-- if self:isFreeGift(actId, info.id) then
-- temp._sort = temp._sort - 100000
-- end
if self:getGiftCanBuyCount(actId, info.id) <= 0 then
temp._sort = temp._sort + 100000000000
end
table.insert(tempList, temp)
end
table.sort(tempList, function(a, b) return a._sort < b._sort end)
local ids = {}
for i, data in ipairs(tempList) do
table.insert(ids, data.id)
end
return ids
end
-- 是否是广告礼包
function ActGiftData:isAdGift(actId, id)
local cfg = self:getGiftConfig(actId, id)
if cfg.item_cost == nil and cfg.recharge_id == nil and cfg.parameter_pro == nil then
return true
end
return false
end
-- 是否是免费礼包
function ActGiftData:isFreeGift(actId, id)
local cfg = self:getGiftConfig(actId, id)
if cfg.parameter_pro and cfg.parameter_pro[1] and cfg.parameter_pro[1] == 1 then
return true
end
return false
end
-- 是否是每日刷新礼包
function ActGiftData:isDailyGift(actId, id)
local cfg = self:getGiftConfig(actId, id)
if cfg.limit_type ~= nil and cfg.limit_type == 1 then
return true
end
return false
end
-- 是否是每周刷新礼包
function ActGiftData:isWeekGift(actId, id)
local cfg = self:getGiftConfig(actId, id)
if cfg.limit_type ~= nil and cfg.limit_type == 2 then
return true
end
return false
end
-- 获取礼包购买次数
function ActGiftData:getGiftBuyCount(id)
return DataManager.PaymentData:getGiftBoughtNum(PayManager.PURCHARSE_TYPE.ACT_GIFT, id)
end
-- 获取礼包剩余可购买次数
function ActGiftData:getGiftCanBuyCount(actId, id)
local cfg = self:getGiftConfig(actId, id)
if cfg then
return cfg.limit - self:getGiftBuyCount(id)
end
return 0
end
function ActGiftData:tryResetGift(actId, force)
local ids = self:getActGiftsByActId(actId)
if ids == nil then
return
end
for index, id in ipairs(ids) do
local config = ActGift[id]
if config then
if force or self:isDailyGift(actId, id) then
DataManager.PaymentData:resetGiftBoughtNum(PayManager.PURCHARSE_TYPE.ACT_GIFT, id)
elseif self:isWeekGift(actId, id) then
local isCrossWeek = Time:getDayofWeek() == 1
if isCrossWeek then
DataManager.PaymentData:resetGiftBoughtNum(PayManager.PURCHARSE_TYPE.ACT_GIFT, id)
end
end
end
end
end
-- 礼包名
function ActGiftData:getActGiftI18NName(actGiftId)
return I18N:getConfig("act_gift")[actGiftId] and I18N:getConfig("act_gift")[actGiftId].value
end
--@endregion
return ActGiftData

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 0e116a7c164e043f4b4d9bb1b5d58c83
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

View File

@ -63,6 +63,7 @@ function ActSprintSummonData:setActivityInfo(data)
if self.bountyCurrDay then if self.bountyCurrDay then
self.bountyCurrDay = self.bountyCurrDay + 1 self.bountyCurrDay = self.bountyCurrDay + 1
end end
self:tryResetGift()
self:setDirty() self:setDirty()
end) end)
@ -246,7 +247,7 @@ function ActSprintSummonData:getIsOpen()
end end
function ActSprintSummonData:getIsShow() function ActSprintSummonData:getIsShow()
local funcOpen = self:getActFuncOpen(self:getActId()) local funcOpen = DataManager.ActivityData:getActFuncOpen(self:getActId())
if funcOpen then if funcOpen then
local isFuncOpen = ModuleManager:getIsOpen(funcOpen, true) local isFuncOpen = ModuleManager:getIsOpen(funcOpen, true)
return isFuncOpen return isFuncOpen
@ -331,7 +332,9 @@ function ActSprintSummonData:getNormalRemainTime()
return self:getEndTime() - nowTime return self:getEndTime() - nowTime
end end
--endregion
--region 红点
function ActSprintSummonData:hasRedPoint() function ActSprintSummonData:hasRedPoint()
if not self:syncedData() then if not self:syncedData() then
return false return false
@ -370,118 +373,27 @@ function ActSprintSummonData:hasStandardRp(actId)
end end
function ActSprintSummonData:hasGiftRp() function ActSprintSummonData:hasGiftRp()
return self:getHasFreeGiftCanBuy() if self.giftIds == nil then
self.giftIds = DataManager.ActGiftData:getGiftIdsSort(self:getActId())
end
for i, id in ipairs(self.giftIds) do
if DataManager.ActGiftData:isFreeGift(self:getActId(), id) and DataManager.ActGiftData:getGiftCanBuyCount(self:getActId(), id) > 0 then
if DataManager.PaymentData:getIsSkipAd() then
return true
end
return not self.fitstGift
end
end
end end
function ActSprintSummonData:hasTaskRp() function ActSprintSummonData:hasTaskRp()
return self:getCanAnyNormalTaskCanGetReward() local taskList = DataManager.ActTaskData:getTaskIdList(self.actId)
end for _, actTaskId in ipairs(taskList) do
--endregion if DataManager.ActTaskData:canClaimTask(self.actId, actTaskId) then
return true
--region 配置
function ActSprintSummonData:getActConfig(id)
if id then
return ConfigManager:getConfig("activity")[id]
else
return ConfigManager:getConfig("activity")
end
end
function ActSprintSummonData:getActType(id)
return self:getActConfig(id).act_type
end
function ActSprintSummonData:getActGiftList(id)
return self:getActConfig(id).act_gift
end
function ActSprintSummonData:getActShowReward(id)
return self:getActConfig(id).show_reward
end
function ActSprintSummonData:getActFuncOpen(id)
return self:getActConfig(id).func_open
end
--endregion
--region 礼包
function ActSprintSummonData:getActGiftBuyCount(actGiftId)
return DataManager.PaymentData:getGiftBoughtNum(PayManager.PURCHARSE_TYPE.ACT_GIFT, actGiftId)
end
function ActSprintSummonData:getActGiftIsFree(actGiftId)
local rechargeId = self:getActGiftRechargeId(actGiftId)
local value = self:getActGiftParameterPro(actGiftId)
local cost = self:getActGiftCostItem(actGiftId)
return not rechargeId and (value and value[1] == 1) and not cost
end
function ActSprintSummonData:getActGiftIsAd(actGiftId)
local rechargeId = self:getActGiftRechargeId(actGiftId)
local value = self:getActGiftParameterPro(actGiftId)
local cost = self:getActGiftCostItem(actGiftId)
return not rechargeId and not value and not cost
end
function ActSprintSummonData:onGiftBuySuccess(actGiftId)
self:setDirty()
end
function ActSprintSummonData:getActGiftConfig(id)
if id then
return ConfigManager:getConfig("act_gift")[id]
else
return ConfigManager:getConfig("act_gift")
end
end
function ActSprintSummonData:getActGiftRechargeId(actGiftId)
return self:getActGiftConfig(actGiftId).recharge_id
end
function ActSprintSummonData:getActGiftParameterPro(actGiftId)
return self:getActGiftConfig(actGiftId).parameter_pro
end
function ActSprintSummonData:getActGiftCostItem(actGiftId)
return self:getActGiftConfig(actGiftId).item_cost and self:getActGiftConfig(actGiftId).item_cost[1]
end
function ActSprintSummonData:getActGiftReward(actGiftId)
return self:getActGiftConfig(actGiftId).reward
end
function ActSprintSummonData:getActGiftLimitType(actGiftId)
return self:getActGiftConfig(actGiftId).limit_type
end
function ActSprintSummonData:getActGiftLimit(actGiftId)
return self:getActGiftConfig(actGiftId).limit
end
-- 超值标识
function ActSprintSummonData:getActGiftValue(actGiftId)
return self:getActGiftConfig(actGiftId).value
end
-- 礼包名
function ActSprintSummonData:getActGiftI18NName(actGiftId)
return I18N:getConfig("act_gift")[actGiftId] and I18N:getConfig("act_gift")[actGiftId].value
end
function ActSprintSummonData:getActGiftRemainCount(actGiftId)
return self:getActGiftLimit(actGiftId) - self:getActGiftBuyCount(actGiftId)
end
function ActSprintSummonData:getHasFreeGiftCanBuy()
local cfgList = self:getActGiftList(self:getActId())
if cfgList then
for _, giftId in ipairs(cfgList) do
if self:getActGiftIsFree(giftId) and self:getActGiftRemainCount(giftId) > 0 then
return true
end
end end
end end
return false
end end
--endregion --endregion
@ -503,16 +415,6 @@ function ActSprintSummonData:getBINormalTaskNumInfo()
return num, totalNum return num, totalNum
end end
function ActSprintSummonData:getCanAnyNormalTaskCanGetReward()
local taskList = DataManager.ActTaskData:getTaskIdList(self.actId)
for _, actTaskId in ipairs(taskList) do
if DataManager.ActTaskData:canClaimTask(self.actId, actTaskId) then
return true
end
end
return false
end
-- 达标任务 -- 达标任务
function ActSprintSummonData:getBISprintTaskNumInfo() function ActSprintSummonData:getBISprintTaskNumInfo()
local num, totalNum = 0, 0 local num, totalNum = 0, 0