diff --git a/lua/app/common/data_manager.lua b/lua/app/common/data_manager.lua index d357a078..44f13d5c 100644 --- a/lua/app/common/data_manager.lua +++ b/lua/app/common/data_manager.lua @@ -44,6 +44,7 @@ function DataManager:init() -- 冲刺活动 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("ActSprintSummonDataAll", "app/userdata/activity/act_sprint/act_sprint_summon_data_all") diff --git a/lua/app/module/activity/act_sprint/act_sprint_manager.lua b/lua/app/module/activity/act_sprint/act_sprint_manager.lua index 8b867281..175042f9 100644 --- a/lua/app/module/activity/act_sprint/act_sprint_manager.lua +++ b/lua/app/module/activity/act_sprint/act_sprint_manager.lua @@ -88,8 +88,8 @@ function ActSprintManager:rspStandardReward(result) -- bi local biType = sprintData:getBIType() local taskFinishNum, taskTotalNum = sprintData:getBISprintTaskNumInfo() - local sprintTaskRound = sprintData:getStandardTurn() - local sprintRewardRound = sprintData:getStandardClaimedTurn() + local sprintTaskRound = DataManager.ActTaskData:getTurnScore(result.reqData.activity_id) + local sprintRewardRound = DataManager.ActTaskData:getClaimedTurnScore(result.reqData.activity_id) BIReport:postActSprintClaimSprintReward(result.reqData.activity_id, biType, taskFinishNum, taskTotalNum, sprintTaskRound, sprintRewardRound) end diff --git a/lua/app/ui/activity/act_sprint_summon_all/cell/gift_cell.lua b/lua/app/ui/activity/act_sprint_summon_all/cell/gift_cell.lua index 748e7f53..a8999cfc 100644 --- a/lua/app/ui/activity/act_sprint_summon_all/cell/gift_cell.lua +++ b/lua/app/ui/activity/act_sprint_summon_all/cell/gift_cell.lua @@ -7,113 +7,114 @@ local BG_NAME_2 = "act_common_bg_28" -- 正常 local BTN_NAME_1 = "common_btn_grey_5" local BTN_NAME_2 = "common_btn_yellow_5" -function GiftCell:refresh(actGiftId) - local uiMap = self:getUIMap() - local bg = uiMap["gift_cell.bg"] - local descTx = uiMap["gift_cell.bg.desc_tx"] - if not self.rewardList then - self.rewardList = {} - 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)) - end - end - local offBg = uiMap["gift_cell.bg.off_bg"] - local offTx = uiMap["gift_cell.bg.off_bg.desc_tx"] - local limitTx = uiMap["gift_cell.bg.limit_tx"] - local funcBtn = uiMap["gift_cell.bg.func_btn"] - local funcTx = uiMap["gift_cell.bg.func_btn.desc_tx"] - local funcAdIcon = uiMap["gift_cell.bg.func_btn.ad"] - local funcAdTx = uiMap["gift_cell.bg.func_btn.ad_tx"] - local func2AdTx = uiMap["gift_cell.bg.func_btn.ad_2_tx"] +function GiftCell:refresh(actId, actGiftId) + local uiMap = self:getUIMap() + local bg = uiMap["gift_cell.bg"] + local descTx = uiMap["gift_cell.bg.desc_tx"] + if not self.rewardList then + self.rewardList = {} + 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)) + end + end + local offBg = uiMap["gift_cell.bg.off_bg"] + local offTx = uiMap["gift_cell.bg.off_bg.desc_tx"] + local limitTx = uiMap["gift_cell.bg.limit_tx"] + local funcBtn = uiMap["gift_cell.bg.func_btn"] + local funcTx = uiMap["gift_cell.bg.func_btn.desc_tx"] + local funcAdIcon = uiMap["gift_cell.bg.func_btn.ad"] + local funcAdTx = uiMap["gift_cell.bg.func_btn.ad_tx"] + local func2AdTx = uiMap["gift_cell.bg.func_btn.ad_2_tx"] - local isFree = DataManager.ActSprintSummonDataAll:getActGiftIsFree(actGiftId) - local isAd = DataManager.ActSprintSummonDataAll:getActGiftIsAd(actGiftId) - local costItem = DataManager.ActSprintSummonDataAll:getActGiftCostItem(actGiftId) - local rechargeId = DataManager.ActSprintSummonDataAll:getActGiftRechargeId(actGiftId) - local buyCount = DataManager.ActSprintSummonDataAll:getActGiftBuyCount(actGiftId) - local limitCount = DataManager.ActSprintSummonDataAll:getActGiftLimit(actGiftId) - local value = DataManager.ActSprintSummonDataAll:getActGiftValue(actGiftId) -- 超值标识 - local rewards = DataManager.ActSprintSummonDataAll:getActGiftReward(actGiftId) - 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) - if soldOut then - funcTx:setText(I18N:getGlobalText(I18N.GlobalConst.ACT_GOGOGO_DESC_8)) - funcAdIcon:setVisible(false) - funcAdTx:setVisible(false) - func2AdTx:setVisible(false) - else - if rechargeId then - funcTx:setText(GFunc.getFormatPrice(rechargeId)) - funcAdIcon:setVisible(false) - funcAdTx:setVisible(false) - func2AdTx:setVisible(false) - else - if isFree then - funcTx:setText(I18N:getGlobalText(I18N.GlobalConst.FREE_DESC)) - funcAdIcon:setVisible(false) - funcAdTx:setVisible(false) - func2AdTx:setVisible(false) - elseif isAd then - funcTx:setText() - funcAdIcon:setVisible(true) - funcAdTx:setVisible(true) - func2AdTx:setVisible(false) - GFunc.setAdsSprite(funcAdIcon) - funcAdTx:setText(I18N:getGlobalText(I18N.GlobalConst.FREE_DESC)) - elseif costItem then - funcTx:setText() - funcAdIcon:setVisible(true) - funcAdIcon:setSprite(GFunc.getIconRes(costItem.id)) - if GFunc.checkCost(costItem.id, costItem.num, false) then - funcAdTx:setVisible(true) - func2AdTx:setVisible(false) - funcAdTx:setText(costItem.num) - else - funcAdTx:setVisible(true) - func2AdTx:setVisible(false) - funcAdTx:setText("" .. costItem.num .. "") - end - end - end - end - descTx:setText(DataManager.ActSprintSummonDataAll:getActGiftI18NName(actGiftId)) - for i = 1, REWARD_CELL_COUNT do - local reward = rewards and rewards[i] - if reward then - self.rewardList[i].baseObject:setActive(true) - self.rewardList[i]:refreshByConfig(reward) - else - self.rewardList[i].baseObject:setActive(false) - end - end - local limitStr = I18N:getGlobalText(I18N.GlobalConst.GIFT_ROUTINE_DESC_8) .. "(" .. (limitCount - buyCount) .. "/" .. limitCount .. ")" - limitTx:setText(soldOut and "" .. limitStr .. "" or "" .. limitStr .. "") - if value then - offBg:setVisible(true) - offTx:setText(value .. "%") - else - offBg:setVisible(false) - end - - funcBtn:addClickListener(function() - if not soldOut then - if isAd then - SDKManager:showFullScreenAds(BIReport.ADS_CLICK_TYPE.AD_ACT_SPRINT, function() - ModuleManager.ActSprintManager:reqGift(actGiftId) - end) - else - if costItem then - if GFunc.checkCost(costItem.id, costItem.num, true) then - ModuleManager.ActSprintManager:reqGift(actGiftId) - end - else - ModuleManager.ActSprintManager:reqGift(actGiftId) - end - end - end - end) + self.cfg = DataManager.ActGiftData:getGiftConfig(actId, actGiftId) + local isFree = DataManager.ActGiftData:isFreeGift(actId, actGiftId) + local isAd = DataManager.ActGiftData:isAdGift(actId, actGiftId) + local buyCount = DataManager.ActGiftData:getGiftBuyCount(actGiftId) + local costItem = self.cfg.item_cost and self.cfg.item_cost[1] + local rechargeId = self.cfg.recharge_id + local limitCount = self.cfg.limit + local value = self.cfg.value + 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) + if soldOut then + funcTx:setText(I18N:getGlobalText(I18N.GlobalConst.ACT_GOGOGO_DESC_8)) + funcAdIcon:setVisible(false) + funcAdTx:setVisible(false) + func2AdTx:setVisible(false) + else + if rechargeId then + funcTx:setText(GFunc.getFormatPrice(rechargeId)) + funcAdIcon:setVisible(false) + funcAdTx:setVisible(false) + func2AdTx:setVisible(false) + else + if isFree then + funcTx:setText(I18N:getGlobalText(I18N.GlobalConst.FREE_DESC)) + funcAdIcon:setVisible(false) + funcAdTx:setVisible(false) + func2AdTx:setVisible(false) + elseif isAd then + funcTx:setText() + funcAdIcon:setVisible(true) + funcAdTx:setVisible(true) + func2AdTx:setVisible(false) + GFunc.setAdsSprite(funcAdIcon) + funcAdTx:setText(I18N:getGlobalText(I18N.GlobalConst.FREE_DESC)) + elseif costItem then + funcTx:setText() + funcAdIcon:setVisible(true) + funcAdIcon:setSprite(GFunc.getIconRes(costItem.id)) + if GFunc.checkCost(costItem.id, costItem.num, false) then + funcAdTx:setVisible(true) + func2AdTx:setVisible(false) + funcAdTx:setText(costItem.num) + else + funcAdTx:setVisible(true) + func2AdTx:setVisible(false) + funcAdTx:setText("" .. costItem.num .. "") + end + end + end + end + descTx:setText(DataManager.ActGiftData:getActGiftI18NName(actGiftId)) + for i = 1, REWARD_CELL_COUNT do + local reward = rewards and rewards[i] + if reward then + self.rewardList[i].baseObject:setActive(true) + self.rewardList[i]:refreshByConfig(reward) + else + self.rewardList[i].baseObject:setActive(false) + end + end + local limitStr = I18N:getGlobalText(I18N.GlobalConst.GIFT_ROUTINE_DESC_8) .. "(" .. (limitCount - buyCount) .. "/" .. limitCount .. ")" + limitTx:setText(soldOut and "" .. limitStr .. "" or "" .. limitStr .. "") + if value then + offBg:setVisible(true) + offTx:setText(value .. "%") + else + offBg:setVisible(false) + end + + funcBtn:addClickListener(function() + if not soldOut then + if isAd then + SDKManager:showFullScreenAds(BIReport.ADS_CLICK_TYPE.AD_ACT_SPRINT, function() + ModuleManager.ActSprintManager:reqGift(actGiftId) + end) + else + if costItem then + if GFunc.checkCost(costItem.id, costItem.num, true) then + ModuleManager.ActSprintManager:reqGift(actGiftId) + end + else + ModuleManager.ActSprintManager:reqGift(actGiftId) + end + end + end + end) end return GiftCell \ No newline at end of file diff --git a/lua/app/ui/activity/act_sprint_summon_all/cell/login_cell.lua b/lua/app/ui/activity/act_sprint_summon_all/cell/login_cell.lua index cd19706e..eeb998e0 100644 --- a/lua/app/ui/activity/act_sprint_summon_all/cell/login_cell.lua +++ b/lua/app/ui/activity/act_sprint_summon_all/cell/login_cell.lua @@ -50,7 +50,7 @@ function SummonActCell:refresh(day, maxDay, info) GFunc.setGrey(self.dayIcon:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_IMAGE), false) else self.freeRewardCell:hideFrameAnimation() - -- self.freeRewardCell:setClickShowTips() + self.freeRewardCell:clearClickListener() self.dayTx:setVisible(freeGot) self.dayTxGrey:setVisible(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 self.proRewardCells[1]:hideFrameAnimation() self.proRewardCells[2]:hideFrameAnimation() - -- self.proRewardCells[1]:setClickShowTips() - -- self.proRewardCells[2]:setClickShowTips() + self.proRewardCells[1]:clearClickListener() + self.proRewardCells[2]:clearClickListener() end end function SummonActCell:onClickClaimRewards() 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 ModuleManager.ActSprintManager:reqSprintBountySign(actType, actId, grade) end diff --git a/lua/app/ui/activity/act_sprint_summon_all/comp/gift_comp.lua b/lua/app/ui/activity/act_sprint_summon_all/comp/gift_comp.lua index ea847316..fc5a9130 100644 --- a/lua/app/ui/activity/act_sprint_summon_all/comp/gift_comp.lua +++ b/lua/app/ui/activity/act_sprint_summon_all/comp/gift_comp.lua @@ -12,28 +12,7 @@ end function GiftComp:refresh(actId) self.txTitle:setText(I18N:getGlobalText(GConst.ActSprintConst.ACT_LIST_NAME[actId])) self.banner:setTexture(GConst.ActSprintConst.ACT_MAIN_BANNER[actId]) - local cfgList = DataManager.ActSprintSummonDataAll:getActGiftList(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) + self.giftList = DataManager.ActGiftData:getGiftIdsSort(actId) if self.scrollRect == nil then self.scrollRect = self.scrollrect:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE) @@ -41,7 +20,7 @@ function GiftComp:refresh(actId) return CELL end) self.scrollRect:addRefreshCallback(function(index, cell) - cell:refresh(self.giftList[index]) + cell:refresh(actId, self.giftList[index]) end) end if self.scrollRect:getTotalCount() == nil or self.scrollRect:getTotalCount() <= 0 then diff --git a/lua/app/ui/common/cell/reward_cell.lua b/lua/app/ui/common/cell/reward_cell.lua index e02da834..c082c93a 100644 --- a/lua/app/ui/common/cell/reward_cell.lua +++ b/lua/app/ui/common/cell/reward_cell.lua @@ -202,6 +202,10 @@ function RewardCell:addClickListener(callback) self.clickCallback = callback end +function RewardCell:clearClickListener() + self.clickCallback = nil +end + function RewardCell:setLocalScale(x, y, z) self.baseObject:setLocalScale(x, y, z) end diff --git a/lua/app/userdata/activity/act_gift_data.lua b/lua/app/userdata/activity/act_gift_data.lua new file mode 100644 index 00000000..d7cd28a5 --- /dev/null +++ b/lua/app/userdata/activity/act_gift_data.lua @@ -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 \ No newline at end of file diff --git a/lua/app/userdata/activity/act_gift_data.lua.meta b/lua/app/userdata/activity/act_gift_data.lua.meta new file mode 100644 index 00000000..4a0523ef --- /dev/null +++ b/lua/app/userdata/activity/act_gift_data.lua.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 0e116a7c164e043f4b4d9bb1b5d58c83 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3} diff --git a/lua/app/userdata/activity/act_sprint/act_sprint_summon_data_all.lua b/lua/app/userdata/activity/act_sprint/act_sprint_summon_data_all.lua index ea60cc57..a1ac99eb 100644 --- a/lua/app/userdata/activity/act_sprint/act_sprint_summon_data_all.lua +++ b/lua/app/userdata/activity/act_sprint/act_sprint_summon_data_all.lua @@ -63,6 +63,7 @@ function ActSprintSummonData:setActivityInfo(data) if self.bountyCurrDay then self.bountyCurrDay = self.bountyCurrDay + 1 end + self:tryResetGift() self:setDirty() end) @@ -246,7 +247,7 @@ function ActSprintSummonData:getIsOpen() end function ActSprintSummonData:getIsShow() - local funcOpen = self:getActFuncOpen(self:getActId()) + local funcOpen = DataManager.ActivityData:getActFuncOpen(self:getActId()) if funcOpen then local isFuncOpen = ModuleManager:getIsOpen(funcOpen, true) return isFuncOpen @@ -331,7 +332,9 @@ function ActSprintSummonData:getNormalRemainTime() return self:getEndTime() - nowTime end +--endregion +--region 红点 function ActSprintSummonData:hasRedPoint() if not self:syncedData() then return false @@ -370,118 +373,27 @@ function ActSprintSummonData:hasStandardRp(actId) end 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 function ActSprintSummonData:hasTaskRp() - return self:getCanAnyNormalTaskCanGetReward() -end ---endregion - ---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 + 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 --endregion @@ -503,16 +415,6 @@ function ActSprintSummonData:getBINormalTaskNumInfo() return num, totalNum 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() local num, totalNum = 0, 0