This commit is contained in:
puxuan 2025-09-29 15:37:24 +08:00
parent bebca42546
commit 218a75adfe
16 changed files with 439 additions and 150 deletions

View File

@ -444,6 +444,7 @@ local EVENT_BOX_OPEN = "client_box_open"
local EVENT_ACT_OPT = "client_act_opt" local EVENT_ACT_OPT = "client_act_opt"
local EVENT_NAME_RUNES = "client_runes" local EVENT_NAME_RUNES = "client_runes"
local EVENT_NAME_PAY_ORDER_REPEAT = "client_pay_order_repeat" local EVENT_NAME_PAY_ORDER_REPEAT = "client_pay_order_repeat"
local EVENT_NAME_VIDEO_AD_OPT = "client_ad_opt"
BIReport.TASK_OPT = { BIReport.TASK_OPT = {
TASK_REWARD = "TaskReward", TASK_REWARD = "TaskReward",
@ -2063,4 +2064,17 @@ function BIReport:postRunes(event_type, runes)
self:report(EVENT_NAME_RUNES, args) self:report(EVENT_NAME_RUNES, args)
end end
-- 视频广告相关
function BIReport:postVideoAdOpt(optType, adName, result)
if optType == nil or adName == nil then
Logger.logFatal("视频广告上报为空 optType:" .. tostring(optType) .. " adName:" .. tostring(adName))
end
local args = {
opt_type = optType,
ad_name = adName,
}
self:report(EVENT_NAME_VIDEO_AD_OPT, args)
end
return BIReport return BIReport

View File

@ -170,7 +170,7 @@ function DataManager:initWithServerData(data)
-- 活动要在礼包后初始化 -- 活动要在礼包后初始化
self.ActTimeData:init(data.activities) -- 全活动时间, after PlayerData self.ActTimeData:init(data.activities) -- 全活动时间, after PlayerData
self.ActivityData:initExchangeData(data.activity_exchange) self.ActivityData:initExchangeData(data.activity_exchange)
self.ActivityData:initTaskData(data.activity_task) self.ActivityData:initTaskData(data.activity_score_task, data.activity_task)
self.ActSprintData:init(data.activity_rush_exchange) self.ActSprintData:init(data.activity_rush_exchange)
self.ActSevenDayData:initData(data.seven_days, true) self.ActSevenDayData:initData(data.seven_days, true)
-- self.ActSprintSummonDataAll:initTaskData(data.activity_score_task, data.activity_task) -- self.ActSprintSummonDataAll:initTaskData(data.activity_score_task, data.activity_task)

View File

@ -522,6 +522,14 @@ function GFunc.getConstCost(key, isGetList)
return isGetList and ConstCfg[key].cost or ConstCfg[key].cost[1] return isGetList and ConstCfg[key].cost or ConstCfg[key].cost[1]
end end
function GFunc.getConstReward2(key)
local ConstCfg = ConfigManager:getConfig("const")
if not ConstCfg[key] or not ConstCfg[key].reward then
return
end
return ConstCfg[key].reward
end
function GFunc.getTargetAnchoredPosition(targetGo, parent) function GFunc.getTargetAnchoredPosition(targetGo, parent)
local rectTransform = targetGo:getComponent(GConst.TYPEOF_UNITY_CLASS.RECTTRANSFORM) local rectTransform = targetGo:getComponent(GConst.TYPEOF_UNITY_CLASS.RECTTRANSFORM)
local rect = rectTransform.rect local rect = rectTransform.rect

View File

@ -90,7 +90,7 @@ ActSprintConst.ACT_ROUND_REWARD = {
-- [ActSprintConst.ACT_ID.SUMMON_V2] = GFunc.getConstCost("act_gogogo_round_reward_3", true), -- [ActSprintConst.ACT_ID.SUMMON_V2] = GFunc.getConstCost("act_gogogo_round_reward_3", true),
-- [ActSprintConst.ACT_ID.CORE_SOUL_BOX_V2] = GFunc.getConstCost("act_gogogo_round_reward_4", true), -- [ActSprintConst.ACT_ID.CORE_SOUL_BOX_V2] = GFunc.getConstCost("act_gogogo_round_reward_4", true),
[ActSprintConst.ACT_ID.SUMMON_ALL] = GFunc.getConstCost("act_gogogo_round_reward_1", true), [ActSprintConst.ACT_ID.SUMMON_ALL] = GFunc.getConstReward2("act_gogogo_round_reward_1", true),
-- [ActSprintConst.ACT_ID.CORE_SOUL_BOX_ALL] = GFunc.getConstCost("act_gogogo_round_reward_6", true), -- [ActSprintConst.ACT_ID.CORE_SOUL_BOX_ALL] = GFunc.getConstCost("act_gogogo_round_reward_6", true),
-- [ActSprintConst.ACT_ID.SUMMON_LOOP] = GFunc.getConstCost("act_gogogo_round_reward_7", true), -- [ActSprintConst.ACT_ID.SUMMON_LOOP] = GFunc.getConstCost("act_gogogo_round_reward_7", true),
-- [ActSprintConst.ACT_ID.CORE_SOUL_BOX_LOOP] = GFunc.getConstCost("act_gogogo_round_reward_8", true), -- [ActSprintConst.ACT_ID.CORE_SOUL_BOX_LOOP] = GFunc.getConstCost("act_gogogo_round_reward_8", true),

View File

@ -80,7 +80,8 @@ function ActSprintManager:rspStandardReward(result)
end end
local sprintData = DataManager.ActSprintData:getSprintDetailData(result.reqData.activity_id) local sprintData = DataManager.ActSprintData:getSprintDetailData(result.reqData.activity_id)
sprintData:onGetStandardTurnReward(result.reqData.id) -- sprintData:onGetStandardTurnReward(result.reqData.id)
DataManager.ActivityData:onGetTurnRewardScore(result.reqData.activity_id)
if result.rewards then if result.rewards then
GFunc.showRewardBox(result.rewards) GFunc.showRewardBox(result.rewards)
end end
@ -108,7 +109,7 @@ function ActSprintManager:reqGift(id)
end end
-- 冲刺活动 达标/任务奖励 -- 冲刺活动 达标/任务奖励
function ActSprintManager:reqTask(actId, id, isStandard) function ActSprintManager:reqTask(actId, id)
self:sendMessage(ProtoMsgType.FromMsgEnum.ActivityTaskClaimReq, {activity_id = actId, task_id = id}, self.rspTask, BIReport.ITEM_GET_TYPE.ACT_SPRINT_TASK) self:sendMessage(ProtoMsgType.FromMsgEnum.ActivityTaskClaimReq, {activity_id = actId, task_id = id}, self.rspTask, BIReport.ITEM_GET_TYPE.ACT_SPRINT_TASK)
end end
@ -120,15 +121,15 @@ function ActSprintManager:rspTask(result)
if result.rewards then if result.rewards then
GFunc.showRewardBox(result.rewards) GFunc.showRewardBox(result.rewards)
end end
DataManager.ActSprintData:getSprintDetailData(result.reqData.activity_id):onNormalTaskSuccess(result.reqData.task_id) DataManager.ActivityData:onTaskClaimed(result.reqData.activity_id, result.reqData.task_id)
-- bi -- bi
local sprintData = DataManager.ActSprintData:getSprintDetailData(result.reqData.activity_id) local sprintData = DataManager.ActSprintData:getSprintDetailData(result.reqData.activity_id)
local biType = sprintData:getBIType() local biType = sprintData:getBIType()
local taskFinishNum, taskTotalNum = sprintData:getBINormalTaskNumInfo() local taskFinishNum, taskTotalNum = sprintData:getBINormalTaskNumInfo()
local sprintTaskRound = sprintData:getStandardTurn() local sprintTaskRound = DataManager.ActivityData:getTurnScore(result.reqData.activity_id)
local sprintRewardRound = sprintData:getStandardClaimedTurn() local sprintRewardRound = DataManager.ActivityData:getClaimedTurnScore(result.reqData.activity_id)
BIReport:postActSprintClaimNormalTask(result.reqData.activity_id, biType, result.reqData.task_id, taskFinishNum, taskTotalNum, sprintTaskRound, sprintRewardRound) BIReport:postActSprintClaimNormalTask(result.reqData.activity_id, biType, result.reqData.task_id, taskFinishNum, taskTotalNum, sprintTaskRound, sprintRewardRound)
end end
@ -144,15 +145,15 @@ function ActSprintManager:rspStandardTask(result)
if result.rewards then if result.rewards then
GFunc.showRewardBox(result.rewards) GFunc.showRewardBox(result.rewards)
end end
DataManager.ActivityData:onTaskSuccessScore(result.reqData.activity_id)
local sprintData = DataManager.ActSprintData:getSprintDetailData(result.reqData.activity_id) local sprintData = DataManager.ActSprintData:getSprintDetailData(result.reqData.activity_id)
local canGetRewardStandardTaskList = sprintData:getCanGetRewardStandardTaskList() local canGetRewardStandardTaskList = sprintData:getCanGetRewardStandardTaskList()
sprintData:onStandardTaskSuccess(result.reqData.task_id)
-- 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.ActivityData:getTurnScore(result.reqData.activity_id)
local sprintRewardRound = sprintData:getStandardClaimedTurn() local sprintRewardRound = DataManager.ActivityData:getClaimedTurnScore(result.reqData.activity_id)
BIReport:postActSprintClaimSprintTask(result.reqData.activity_id, biType, canGetRewardStandardTaskList, taskFinishNum, taskTotalNum, sprintTaskRound, sprintRewardRound) BIReport:postActSprintClaimSprintTask(result.reqData.activity_id, biType, canGetRewardStandardTaskList, taskFinishNum, taskTotalNum, sprintTaskRound, sprintRewardRound)
end end

View File

@ -68,7 +68,7 @@ function SummonManager:onForceSummonRsp(result)
-- rewards = result.rewards, -- rewards = result.rewards,
-- } -- }
-- 累计召唤英雄x次 -- 累计召唤英雄x次
-- ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.SUMMON_NUM, params) ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.X_SUMMON_HERO, result.reqData.times)
-- if result.first then -- if result.first then
-- DataManager.GameSettingData:showRateUIByForceSummon() -- DataManager.GameSettingData:showRateUIByForceSummon()

View File

@ -57,4 +57,8 @@ TaskConst.TASK_TYPE = {
X_STAR_HERO_5 = 48, -- 传说英雄(橙色)最高星达X 历史最高记录,从建号起记录 X_STAR_HERO_5 = 48, -- 传说英雄(橙色)最高星达X 历史最高记录,从建号起记录
} }
TaskConst.RELPACE_TASK_TYPE = {
TaskConst.TASK_TYPE.X_HERO_MAX_LV_REACH,
}
return TaskConst return TaskConst

View File

@ -211,7 +211,7 @@ function TaskManager:xHeroLvUp(level)
local maxLv = DataManager.TaskData:getMaxHeroLv() local maxLv = DataManager.TaskData:getMaxHeroLv()
if maxLv < level then if maxLv < level then
DataManager.TaskData:setMaxHeroLv(level) DataManager.TaskData:setMaxHeroLv(level)
self:dispatchTask(GConst.TaskConst.TASK_TYPE.X_HERO_MAX_LV_REACH, level - maxLv) self:dispatchTask(GConst.TaskConst.TASK_TYPE.X_HERO_MAX_LV_REACH, level)
end end
end end
@ -346,6 +346,26 @@ function TaskManager:xRunesQuenching(count)
self:dispatchTask(GConst.TaskConst.TASK_TYPE.X_RUNES_QUENCHING, count) self:dispatchTask(GConst.TaskConst.TASK_TYPE.X_RUNES_QUENCHING, count)
end end
function TaskManager:xSummonHero6(count)
self:dispatchTask(GConst.TaskConst.TASK_TYPE.X_SUMMON_HERO_6, count)
end
function TaskManager:xSummonHero5(count)
self:dispatchTask(GConst.TaskConst.TASK_TYPE.X_SUMMON_HERO_5, count)
end
function TaskManager:xSummonHero4(count)
self:dispatchTask(GConst.TaskConst.TASK_TYPE.X_SUMMON_HERO_4, count)
end
function TaskManager:xSummonHero3(count)
self:dispatchTask(GConst.TaskConst.TASK_TYPE.X_SUMMON_HERO_3, count)
end
function TaskManager:xSummonHero(count)
self:dispatchTask(GConst.TaskConst.TASK_TYPE.X_SUMMON_HERO, count)
end
function TaskManager:xStarHero5(count) function TaskManager:xStarHero5(count)
self:dispatchTask(GConst.TaskConst.TASK_TYPE.X_STAR_HERO_5, count) self:dispatchTask(GConst.TaskConst.TASK_TYPE.X_STAR_HERO_5, count)
end end
@ -392,6 +412,11 @@ TaskManager.TYPE_DEAL_FUNC = {
[GConst.TaskConst.TASK_TYPE.X_BUY_ANYONE] = TaskManager.xBuyAnyone, [GConst.TaskConst.TASK_TYPE.X_BUY_ANYONE] = TaskManager.xBuyAnyone,
[GConst.TaskConst.TASK_TYPE.X_RUNES_GETED_MATERIALS] = TaskManager.xRunesGetedMaterials, [GConst.TaskConst.TASK_TYPE.X_RUNES_GETED_MATERIALS] = TaskManager.xRunesGetedMaterials,
[GConst.TaskConst.TASK_TYPE.X_RUNES_QUENCHING] = TaskManager.xRunesQuenching, [GConst.TaskConst.TASK_TYPE.X_RUNES_QUENCHING] = TaskManager.xRunesQuenching,
[GConst.TaskConst.TASK_TYPE.X_SUMMON_HERO_6] = TaskManager.xSummonHero6,
[GConst.TaskConst.TASK_TYPE.X_SUMMON_HERO_5] = TaskManager.xSummonHero5,
[GConst.TaskConst.TASK_TYPE.X_SUMMON_HERO_4] = TaskManager.xSummonHero4,
[GConst.TaskConst.TASK_TYPE.X_SUMMON_HERO_3] = TaskManager.xSummonHero3,
[GConst.TaskConst.TASK_TYPE.X_SUMMON_HERO] = TaskManager.xSummonHero,
[GConst.TaskConst.TASK_TYPE.X_STAR_HERO_5] = TaskManager.xStarHero5, [GConst.TaskConst.TASK_TYPE.X_STAR_HERO_5] = TaskManager.xStarHero5,
} }

View File

@ -55,6 +55,8 @@ local ProtoMsgType = {
[1433354371] = "ChapterDailyChallengeResetRsp", [1433354371] = "ChapterDailyChallengeResetRsp",
[1471116409] = "BindReq", [1471116409] = "BindReq",
[1471118242] = "BindRsp", [1471118242] = "BindRsp",
[1499280420] = "ActivityScoreTaskRoundClaimReq",
[1499282253] = "ActivityScoreTaskRoundClaimRsp",
[1515380214] = "CardDailyRewardReq", [1515380214] = "CardDailyRewardReq",
[1515382047] = "CardDailyRewardRsp", [1515382047] = "CardDailyRewardRsp",
[1552772605] = "MallDailyBuyReq", [1552772605] = "MallDailyBuyReq",
@ -76,6 +78,8 @@ local ProtoMsgType = {
[1746319121] = "IdleInfoRsp", [1746319121] = "IdleInfoRsp",
[1751460231] = "PVPHeroesArrayReq", [1751460231] = "PVPHeroesArrayReq",
[1751462064] = "PVPHeroesArrayRsp", [1751462064] = "PVPHeroesArrayRsp",
[1860795446] = "ActivityTaskClaimReq",
[1860797279] = "ActivityTaskClaimRsp",
[1877100820] = "MallGoldBuyReq", [1877100820] = "MallGoldBuyReq",
[1877102653] = "MallGoldBuyRsp", [1877102653] = "MallGoldBuyRsp",
[1901321540] = "PipedReq", [1901321540] = "PipedReq",
@ -129,6 +133,8 @@ local ProtoMsgType = {
[2772588645] = "DebugPowerRsp", [2772588645] = "DebugPowerRsp",
[2806041093] = "ChapterDoubleRewardReq", [2806041093] = "ChapterDoubleRewardReq",
[2806042926] = "ChapterDoubleRewardRsp", [2806042926] = "ChapterDoubleRewardRsp",
[2814594210] = "ActivityScoreTaskClaimReq",
[2814596043] = "ActivityScoreTaskClaimRsp",
[2849800229] = "MailReadReq", [2849800229] = "MailReadReq",
[2849802062] = "MailReadRsp", [2849802062] = "MailReadRsp",
[2909026364] = "AIHelpUnreadNtf", [2909026364] = "AIHelpUnreadNtf",
@ -274,6 +280,8 @@ local ProtoMsgType = {
ChapterDailyChallengeResetRsp = 1433354371, ChapterDailyChallengeResetRsp = 1433354371,
BindReq = 1471116409, BindReq = 1471116409,
BindRsp = 1471118242, BindRsp = 1471118242,
ActivityScoreTaskRoundClaimReq = 1499280420,
ActivityScoreTaskRoundClaimRsp = 1499282253,
CardDailyRewardReq = 1515380214, CardDailyRewardReq = 1515380214,
CardDailyRewardRsp = 1515382047, CardDailyRewardRsp = 1515382047,
MallDailyBuyReq = 1552772605, MallDailyBuyReq = 1552772605,
@ -295,6 +303,8 @@ local ProtoMsgType = {
IdleInfoRsp = 1746319121, IdleInfoRsp = 1746319121,
PVPHeroesArrayReq = 1751460231, PVPHeroesArrayReq = 1751460231,
PVPHeroesArrayRsp = 1751462064, PVPHeroesArrayRsp = 1751462064,
ActivityTaskClaimReq = 1860795446,
ActivityTaskClaimRsp = 1860797279,
MallGoldBuyReq = 1877100820, MallGoldBuyReq = 1877100820,
MallGoldBuyRsp = 1877102653, MallGoldBuyRsp = 1877102653,
PipedReq = 1901321540, PipedReq = 1901321540,
@ -348,6 +358,8 @@ local ProtoMsgType = {
DebugPowerRsp = 2772588645, DebugPowerRsp = 2772588645,
ChapterDoubleRewardReq = 2806041093, ChapterDoubleRewardReq = 2806041093,
ChapterDoubleRewardRsp = 2806042926, ChapterDoubleRewardRsp = 2806042926,
ActivityScoreTaskClaimReq = 2814594210,
ActivityScoreTaskClaimRsp = 2814596043,
MailReadReq = 2849800229, MailReadReq = 2849800229,
MailReadRsp = 2849802062, MailReadRsp = 2849802062,
AIHelpUnreadNtf = 2909026364, AIHelpUnreadNtf = 2909026364,
@ -493,6 +505,8 @@ local ProtoMsgType = {
ChapterDailyChallengeResetRsp = "ChapterDailyChallengeResetRsp", ChapterDailyChallengeResetRsp = "ChapterDailyChallengeResetRsp",
BindReq = "BindReq", BindReq = "BindReq",
BindRsp = "BindRsp", BindRsp = "BindRsp",
ActivityScoreTaskRoundClaimReq = "ActivityScoreTaskRoundClaimReq",
ActivityScoreTaskRoundClaimRsp = "ActivityScoreTaskRoundClaimRsp",
CardDailyRewardReq = "CardDailyRewardReq", CardDailyRewardReq = "CardDailyRewardReq",
CardDailyRewardRsp = "CardDailyRewardRsp", CardDailyRewardRsp = "CardDailyRewardRsp",
MallDailyBuyReq = "MallDailyBuyReq", MallDailyBuyReq = "MallDailyBuyReq",
@ -514,6 +528,8 @@ local ProtoMsgType = {
IdleInfoRsp = "IdleInfoRsp", IdleInfoRsp = "IdleInfoRsp",
PVPHeroesArrayReq = "PVPHeroesArrayReq", PVPHeroesArrayReq = "PVPHeroesArrayReq",
PVPHeroesArrayRsp = "PVPHeroesArrayRsp", PVPHeroesArrayRsp = "PVPHeroesArrayRsp",
ActivityTaskClaimReq = "ActivityTaskClaimReq",
ActivityTaskClaimRsp = "ActivityTaskClaimRsp",
MallGoldBuyReq = "MallGoldBuyReq", MallGoldBuyReq = "MallGoldBuyReq",
MallGoldBuyRsp = "MallGoldBuyRsp", MallGoldBuyRsp = "MallGoldBuyRsp",
PipedReq = "PipedReq", PipedReq = "PipedReq",
@ -567,6 +583,8 @@ local ProtoMsgType = {
DebugPowerRsp = "DebugPowerRsp", DebugPowerRsp = "DebugPowerRsp",
ChapterDoubleRewardReq = "ChapterDoubleRewardReq", ChapterDoubleRewardReq = "ChapterDoubleRewardReq",
ChapterDoubleRewardRsp = "ChapterDoubleRewardRsp", ChapterDoubleRewardRsp = "ChapterDoubleRewardRsp",
ActivityScoreTaskClaimReq = "ActivityScoreTaskClaimReq",
ActivityScoreTaskClaimRsp = "ActivityScoreTaskClaimRsp",
MailReadReq = "MailReadReq", MailReadReq = "MailReadReq",
MailReadRsp = "MailReadRsp", MailReadRsp = "MailReadRsp",
AIHelpUnreadNtf = "AIHelpUnreadNtf", AIHelpUnreadNtf = "AIHelpUnreadNtf",

View File

@ -92,6 +92,10 @@ function ActSprintMainUI:onLoadRootComplete()
self:refreshRedPoint() self:refreshRedPoint()
self:onRefresh() self:onRefresh()
end) end)
self:bind(DataManager.ActivityData, "isDirty", function()
self:refreshRedPoint()
self:onRefresh()
end)
self:bind(DataManager.PaymentData, "isDirty", function() self:bind(DataManager.PaymentData, "isDirty", function()
self:refreshRedPoint() self:refreshRedPoint()
self:onRefresh() self:onRefresh()

View File

@ -1,57 +1,57 @@
local StandardCell = class("StandardCell", BaseCell) local StandardCell = class("StandardCell", BaseCell)
local REWARD_CELL_COUNT = 3 local REWARD_CELL_COUNT = 3
function StandardCell:refresh(actTaskId) function StandardCell:refresh(actId, actTaskId)
local uiMap = self:getUIMap() local uiMap = self:getUIMap()
local bg = uiMap["standard_cell.bg"] local bg = uiMap["standard_cell.bg"]
local descTx = uiMap["standard_cell.bg.desc_tx"] local descTx = uiMap["standard_cell.bg.desc_tx"]
if not self.slider then if not self.slider then
self.slider = uiMap["standard_cell.bg.slider_bg.slider"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER) self.slider = uiMap["standard_cell.bg.slider_bg.slider"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER)
end end
local sliderTx = uiMap["standard_cell.bg.slider_bg.tx"] local sliderTx = uiMap["standard_cell.bg.slider_bg.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["standard_cell.bg.reward_cell_" .. i], GConst.TYPEOF_LUA_CLASS.REWARD_CELL)) table.insert(self.rewardList, CellManager:addCellComp(uiMap["standard_cell.bg.reward_cell_" .. i], GConst.TYPEOF_LUA_CLASS.REWARD_CELL))
end end
end end
local rewardLayout = uiMap["standard_cell.bg.rewards"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_HORIZONTAL_OR_VERTICAL_LAYOUT) local rewardLayout = uiMap["standard_cell.bg.rewards"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_HORIZONTAL_OR_VERTICAL_LAYOUT)
local num = DataManager.ActSprintSummonDataAll:getActTaskNum(actTaskId) local num = DataManager.ActivityData:getTaskNumScore(actId, actTaskId)
local type = DataManager.ActSprintSummonDataAll:getActTaskType(actTaskId) local type = DataManager.ActivityData:getTaskType(actTaskId)
local limit = DataManager.ActSprintSummonDataAll:getActTaskNumber1(actTaskId) local limit = DataManager.ActivityData:getTaskTarget(actTaskId)
local rewards = DataManager.ActSprintSummonDataAll:getActTaskReward(actTaskId) local rewards = DataManager.ActivityData:getTaskReward(actTaskId)
local hasGot = DataManager.ActSprintSummonDataAll:getHasGotTaskReward(actTaskId) local hasGot = DataManager.ActivityData:getHasGotTaskRewardScore(actId, actTaskId)
local canGet = num >= limit and not hasGot local canGet = num >= limit and not hasGot
-- 修订 -- 修订
if num > limit then if num > limit then
num = limit num = limit
end end
if hasGot then if hasGot then
num = limit num = limit
end end
descTx:setText(GFunc.getTaskDesc(type, limit)) descTx:setText(GFunc.getTaskDesc(type, limit))
self.slider.value = num / limit self.slider.value = num / limit
sliderTx:setText(num .. "/" .. limit) sliderTx:setText(num .. "/" .. limit)
for i = 1, REWARD_CELL_COUNT do for i = 1, REWARD_CELL_COUNT do
local reward = rewards and rewards[i] local reward = rewards and rewards[i]
if reward then if reward then
self.rewardList[i].baseObject:setActive(true) self.rewardList[i].baseObject:setActive(true)
self.rewardList[i]:refreshByConfig(reward, hasGot, hasGot) self.rewardList[i]:refreshByConfig(reward, hasGot, hasGot)
if canGet then if canGet then
self.rewardList[i]:showFrameAnimation() self.rewardList[i]:showFrameAnimation()
self.rewardList[i]:addClickListener(function() self.rewardList[i]:addClickListener(function()
ModuleManager.ActSprintManager:reqStandardTask(DataManager.ActSprintSummonDataAll:getActId(), 0) ModuleManager.ActSprintManager:reqStandardTask(actId, 0)
end) end)
else else
self.rewardList[i]:hideFrameAnimation() self.rewardList[i]:hideFrameAnimation()
end end
else else
self.rewardList[i].baseObject:setActive(false) self.rewardList[i].baseObject:setActive(false)
end end
end end
rewardLayout:RefreshLayout() rewardLayout:RefreshLayout()
end end
return StandardCell return StandardCell

View File

@ -1,7 +1,7 @@
local TaskCell = class("TaskCell", BaseCell) local TaskCell = class("TaskCell", BaseCell)
local REWARD_CELL_COUNT = 1 local REWARD_CELL_COUNT = 1
function TaskCell:refresh(actTaskId) function TaskCell:refresh(actId, actTaskId)
local uiMap = self:getUIMap() local uiMap = self:getUIMap()
local bg = uiMap["task_cell.bg"] local bg = uiMap["task_cell.bg"]
local descTx = uiMap["task_cell.bg.desc_tx"] local descTx = uiMap["task_cell.bg.desc_tx"]
@ -21,17 +21,17 @@ function TaskCell:refresh(actTaskId)
local funcBtn = uiMap["task_cell.bg.func_btn"] local funcBtn = uiMap["task_cell.bg.func_btn"]
local funcTx = uiMap["task_cell.bg.func_btn.desc_tx"] local funcTx = uiMap["task_cell.bg.func_btn.desc_tx"]
local num = DataManager.ActSprintSummonDataAll:getActTaskNum(actTaskId) local num = DataManager.ActivityData:getTaskProg(actId, actTaskId)
local taskType = DataManager.ActSprintSummonDataAll:getActTaskType(actTaskId) local taskType = DataManager.ActivityData:getTaskType(actTaskId)
local limit = DataManager.ActSprintSummonDataAll:getActTaskNumber1(actTaskId) local limit = DataManager.ActivityData:getTaskTarget(actTaskId)
local rewards = DataManager.ActSprintSummonDataAll:getActTaskReward(actTaskId) local rewards = DataManager.ActivityData:getTaskReward(actTaskId)
local hasGot = DataManager.ActSprintSummonDataAll:getHasGotTaskReward(actTaskId) local hasGot = DataManager.ActivityData:isTaskReceived(actId, actTaskId)
-- 修订 -- 修订
if num > limit then if num > limit then
num = limit num = limit
end end
descTx:setText(GFunc.getTaskDesc(taskType, limit)) descTx:setText(GFunc.getTaskDesc(taskType, limit) .. " actTaskId = " .. actTaskId)
self.slider.value = num / limit self.slider.value = num / limit
sliderTx:setText(num .. "/" .. limit) sliderTx:setText(num .. "/" .. limit)
for i = 1, REWARD_CELL_COUNT do for i = 1, REWARD_CELL_COUNT do
@ -53,7 +53,7 @@ function TaskCell:refresh(actTaskId)
funcBtn:setActive(true) funcBtn:setActive(true)
if num >= limit then if num >= limit then
funcBtn:setSprite(GConst.ATLAS_PATH.COMMON, "common_btn_yellow_5") funcBtn:setSprite(GConst.ATLAS_PATH.COMMON, "common_btn_yellow_5")
funcTx:setText(I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_CLAIM)) funcTx:setText(I18N:getGlobalText(I18N.GlobalConst.BTN_CLAIM))
else else
funcBtn:setSprite(GConst.ATLAS_PATH.COMMON, "common_btn_blue_1") funcBtn:setSprite(GConst.ATLAS_PATH.COMMON, "common_btn_blue_1")
funcTx:setText(I18N:getGlobalText(I18N.GlobalConst.ACT_GOGOGO_DESC_14)) funcTx:setText(I18N:getGlobalText(I18N.GlobalConst.ACT_GOGOGO_DESC_14))
@ -64,11 +64,10 @@ function TaskCell:refresh(actTaskId)
if not hasGot then if not hasGot then
if num >= limit then if num >= limit then
-- 领取 -- 领取
local actId = DataManager.ActSprintSummonDataAll:getActTaskActivityId(actTaskId)
ModuleManager.ActSprintManager:reqTask(actId, actTaskId) ModuleManager.ActSprintManager:reqTask(actId, actTaskId)
else else
-- 跳转 -- 跳转
ModuleManager.TaskManager:goToTask(taskType) ModuleManager.TaskManager:taskGoto(taskType)
end end
end end
end) end)

View File

@ -25,13 +25,13 @@ function StandardComp:init()
end end
function StandardComp:refresh(actId) function StandardComp:refresh(actId)
local turn = DataManager.ActSprintSummonDataAll:getStandardTurn(actId) local turn = DataManager.ActivityData:getTurnScore(actId)
local maxTurn = DataManager.ActSprintSummonDataAll:getStandardMaxTurn(actId) local maxTurn = DataManager.ActivityData:getMaxTurnScore(actId)
local canGetTurnReward = DataManager.ActSprintSummonDataAll:getCanGetTurnReward(actId) local canGetTurnReward = DataManager.ActivityData:getCanGetTurnRewardScore(actId)
local gotAllTurnReward = DataManager.ActSprintSummonDataAll:getGotAllTurnReward(actId) local gotAllTurnReward = DataManager.ActivityData:getGotAllTurnRewardScore(actId)
-- 轮次奖励 -- 轮次奖励
local rewards = DataManager.ActSprintSummonDataAll:getStandardRewards(actId) local rewards = DataManager.ActivityData:getRewardsgetMaxTurnScore(actId)
for i = 1, REWARD_CELL_COUNT do for i = 1, REWARD_CELL_COUNT do
local reward = rewards and rewards[i] local reward = rewards and rewards[i]
if reward then if reward then
@ -74,14 +74,14 @@ function StandardComp:refresh(actId)
end) end)
-- 滑动窗 -- 滑动窗
self.standardList = DataManager.ActSprintSummonDataAll:getActStandardList(actId) self.standardList = DataManager.ActivityData:getActTaskListScore(actId)
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)
self.scrollRect:addInitCallback(function() self.scrollRect:addInitCallback(function()
return CELL return CELL
end) end)
self.scrollRect:addRefreshCallback(function(index, cell) self.scrollRect:addRefreshCallback(function(index, cell)
cell:refresh(self.standardList[index]) cell:refresh(actId, self.standardList[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

@ -12,14 +12,14 @@ end
function TaskComp:refresh(actId) function TaskComp: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])
self.taskList = DataManager.ActSprintSummonDataAll:getActTaskList(actId) self.taskList = DataManager.ActivityData:getTaskSortList(actId)
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)
self.scrollRect:addInitCallback(function() self.scrollRect:addInitCallback(function()
return CELL return CELL
end) end)
self.scrollRect:addRefreshCallback(function(index, cell) self.scrollRect:addRefreshCallback(function(index, cell)
cell:refresh(self.taskList[index]) cell:refresh(actId, self.taskList[index].id)
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

@ -439,7 +439,7 @@ end
function ActSprintSummonData:hasStandardRp(actId) function ActSprintSummonData:hasStandardRp(actId)
actId = actId or self:getActId() actId = actId or self:getActId()
return self:getCanGetTurnReward(actId) or self:getCanAnyStandardTaskCanGetReward(actId) return DataManager.ActivityData:getCanGetTurnRewardScore(actId) or self:getCanAnyStandardTaskCanGetReward(actId)
end end
function ActSprintSummonData:hasGiftRp(actId) function ActSprintSummonData:hasGiftRp(actId)
@ -645,21 +645,11 @@ function ActSprintSummonData:getStandardRewards(actId)
return GConst.ActSprintConst.ACT_ROUND_REWARD[actId] return GConst.ActSprintConst.ACT_ROUND_REWARD[actId]
end end
function ActSprintSummonData:getCanGetTurnReward(actId)
actId = actId or self.actId
-- 当前任务全部领取 未领取当前波次奖励
if (self.standardClaimed < self:getStandardTurn(actId)) then
return true
else
return false
end
end
function ActSprintSummonData:getCanAnyStandardTaskCanGetReward(actId) function ActSprintSummonData:getCanAnyStandardTaskCanGetReward(actId)
actId = actId or self.actId actId = actId or self.actId
local taskList = self:getActStandardList(actId) local taskList = DataManager.ActivityData:getActTaskListScore(actId)
for _, actTaskId in ipairs(taskList) do for _, actTaskId in ipairs(taskList) do
if self:getCanGetTaskReward(actTaskId) then if DataManager.ActivityData:getCanGetTaskRewardScore(actId, actTaskId) then
return true return true
end end
end end
@ -862,15 +852,11 @@ function ActSprintSummonData:getHasFreeGiftCanBuy()
end end
end end
function ActSprintSummonData:getBIType() function ActSprintSummonData:getBINormalTaskNumInfo()
return BIReport.ACT_SPRINT_TYPE.SUMMON
end
function ActSprintSummonData:getBISprintTaskNumInfo()
local num, totalNum = 0, 0 local num, totalNum = 0, 0
local taskList = self:getActStandardTaskIdList() local taskList = self:getActNormalTaskIdList()
for _, taskId in ipairs(taskList) do for _, taskId in ipairs(taskList) do
if self:getHasGotTaskReward(taskId) then if DataManager.ActivityData:isTaskReceived(self.actId, taskId) then
num = num + 1 num = num + 1
end end
totalNum = totalNum + 1 totalNum = totalNum + 1
@ -878,11 +864,16 @@ function ActSprintSummonData:getBISprintTaskNumInfo()
return num, totalNum return num, totalNum
end end
function ActSprintSummonData:getBINormalTaskNumInfo() --@region
function ActSprintSummonData:getBIType()
return BIReport.ACT_SPRINT_TYPE.SUMMON
end
function ActSprintSummonData:getBISprintTaskNumInfo()
local num, totalNum = 0, 0 local num, totalNum = 0, 0
local taskList = self:getActNormalTaskIdList() local taskList = DataManager.ActivityData:getTaskIdListScore(self.actId)
for _, taskId in ipairs(taskList) do for _, taskId in ipairs(taskList) do
if self:getHasGotTaskReward(taskId) then if DataManager.ActivityData:getHasGotTaskRewardScore(self.actId, taskId) then
num = num + 1 num = num + 1
end end
totalNum = totalNum + 1 totalNum = totalNum + 1
@ -892,13 +883,13 @@ end
function ActSprintSummonData:getCanGetRewardStandardTaskList() function ActSprintSummonData:getCanGetRewardStandardTaskList()
local taskIdList = {} local taskIdList = {}
local taskList = self:getActStandardTaskIdList() local taskList = DataManager.ActivityData:getTaskIdListScore(self.actId)
for _, taskId in ipairs(taskList) do for _, taskId in ipairs(taskList) do
if self:getCanGetTaskReward(taskId) then if DataManager.ActivityData:getCanGetTaskRewardScore(self.actId, taskId) then
table.insert(taskIdList, taskId) table.insert(taskIdList, taskId)
end end
end end
return taskIdList return taskIdList
end end
--@endregion
return ActSprintSummonData return ActSprintSummonData

View File

@ -23,6 +23,23 @@ function ActivityData:init(data)
data = data or {} data = data or {}
end end
function ActivityData:initActivityData(actId, data)
if EDITOR_MODE then
Logger.logHighlight("初始化活动任务数据:" .. actId)
Logger.printTable(data)
end
if self.taskData == nil then
self.taskData = {}
end
for i, info in pairs(data) do
if self.taskData[actId] == nil then
self.taskData[actId] = {}
end
self.taskData[actId][info.id] = info
end
end
--region 兑换相关 --region 兑换相关
function ActivityData:initExchangeData(data) function ActivityData:initExchangeData(data)
if EDITOR_MODE then if EDITOR_MODE then
@ -61,70 +78,79 @@ function ActivityData:getExchangeTime(id)
end end
--endregion --endregion
--region --region 任务
function ActivityData:initTaskData(data) function ActivityData:initTaskData(scoreData, normalData)
data = data or {} scoreData = scoreData or {}
data.task_data = data.task_data or {} normalData = normalData or {}
if EDITOR_MODE then if EDITOR_MODE then
Logger.logHighlight("活动任务数据") Logger.logHighlight("活动任务数据")
Logger.printTable(data) Logger.printTable(scoreData)
Logger.printTable(normalData)
end end
self.taskData = self.taskData or {} self.taskData = self.taskData or {}
self.taskDataScore = self.taskDataScore or {}
for i, info in ipairs(data.task_data) do for i, info in ipairs(normalData.task_data) do
self.taskData[info.activity_id] = self.taskData[info.activity_id] or {} self.taskData[info.activity_id] = self.taskData[info.activity_id] or {}
self.taskData[info.activity_id][info.data.id] = info.data self.taskData[info.activity_id][info.data.id] = info.data
end end
for i, info in ipairs(scoreData.task_data) do
self.taskDataScore[info.activity_id] = self.taskDataScore[info.activity_id] or {}
self.taskDataScore[info.activity_id] = info
self.taskDataScore[info.activity_id].claimedMap = {}
for _, taskId in ipairs(info.claimed) do
self.taskDataScore[info.activity_id].claimedMap[taskId] = true
end
end
if not self.isInit then if not self.isInit then
self.isInit = true self.isInit = true
-- 监听任务 -- 监听任务
for id, info in pairs(self:getTaskConfig()) do for id, info in pairs(self:getTaskConfig()) do
ModuleManager.TaskManager:registerTask("ActivityData", info.type, function(count) ModuleManager.TaskManager:registerTask("ActivityData", info.type, function(count)
self:addTaskProgressCallback(info.type, count) self:addTaskProgressCallback(info.type, count)
self:addTaskProgressCallbackScore(info.type, count)
end) end)
end end
-- 跨天 -- 跨天
DataManager:registerCrossDayFunc("ActivityData", function() DataManager:registerCrossDayFunc("ActivityData", function()
self:setDirty() self:setDirty()
end) end)
end end
end end
--region 普通任务
function ActivityData:addTaskProgressCallback(taskType, count) function ActivityData:addTaskProgressCallback(taskType, count)
for actId, data in pairs(self.taskData) do for actId, data in pairs(self.taskData) do
for i, taskId in ipairs(self:getAllTaskIdsByActId(actId)) do for i, taskId in ipairs(self:getAllTaskIdsByActId(actId)) do
if self:getTaskType(taskId) == taskType then if self:getTaskType(taskId) == taskType and self:getTaskDisplay(taskId) == 2 then
self:addTaskProgress(actId, taskId, count) self:addTaskProgress(actId, taskId, count)
end end
end end
end end
end end
function ActivityData:initActivityData(actId, data)
if EDITOR_MODE then
Logger.logHighlight("初始化活动任务数据:" .. actId)
Logger.printTable(data)
end
if self.taskData == nil then -- 添加任务进度
self.taskData = {} function ActivityData:addTaskProgress(actId, taskId, count)
end if not self:isTaskFinished(actId, taskId) then
for i, info in pairs(data) do local taskType = self:getTaskType(taskId)
if self.taskData[actId] == nil then local data = self:getTaskData(actId, taskId)
self.taskData[actId] = {} if table.containValue(GConst.TaskConst.RELPACE_TASK_TYPE, taskType) then
data.progress = math.max(data.progress or 0, count)
else
data.progress = (data.progress or 0) + count
end end
self.taskData[actId][info.id] = info
end end
self:setDirty()
end end
function ActivityData:getTaskData(actId, taskId) function ActivityData:getTaskData(actId, taskId)
if taskId then if taskId then
if self.taskData[actId] == nil then self.taskData[actId] = self.taskData[actId] or {}
self.taskData[actId] = {}
end
if self.taskData[actId][taskId] == nil then if self.taskData[actId][taskId] == nil then
self.taskData[actId][taskId] = {id = taskId, progress = 0, stage_claimed = 0} self.taskData[actId][taskId] = {id = taskId, progress = 0, claimed = 0}
end end
return self.taskData[actId][taskId] return self.taskData[actId][taskId]
else else
@ -159,7 +185,7 @@ end
function ActivityData:isTaskReceived(actId, taskId) function ActivityData:isTaskReceived(actId, taskId)
taskId = tonumber(taskId) taskId = tonumber(taskId)
local data = self:getTaskData(actId, taskId) local data = self:getTaskData(actId, taskId)
return data and data.stage_claimed and data.stage_claimed > 0 return data and data.claimed and data.claimed > 0
end end
-- 任务是否已完成 -- 任务是否已完成
@ -175,33 +201,228 @@ end
-- 重置任务数据 -- 重置任务数据
function ActivityData:resetTaskData(actId) function ActivityData:resetTaskData(actId)
for taskId, data in pairs(self:getTaskData(actId)) do for taskId, data in pairs(self:getTaskData(actId)) do
data.stage_claimed = 0 data.claimed = 0
data.progress = 0 data.progress = 0
end end
self:setDirty() self:setDirty()
end end
-- 添加任务进度
function ActivityData:addTaskProgress(actId, taskId, count)
if not self:isTaskFinished(actId, taskId) then
local taskType = self:getTaskType(taskId)
local data = self:getTaskData(actId, taskId)
if table.containValue(GConst.TaskConst.TASK_TYPE, taskType) then
data.progress = math.max(data.progress or 0, count)
else
data.progress = (data.progress or 0) + count
end
end
self:setDirty()
end
-- 领奖成功 -- 领奖成功
function ActivityData:onTaskClaimed(actId, taskId) function ActivityData:onTaskClaimed(actId, taskId)
local data = self:getTaskData(actId, taskId) local data = self:getTaskData(actId, taskId)
data.stage_claimed = 1 data.claimed = 1
self:setDirty() self:setDirty()
end end
-- 普通任务列表
function ActivityData:getTaskSortList(actId)
local list = {}
local cfg = self:getTaskConfig()
for taskId, info in pairs(cfg) do
if info.activity == actId and info.display == 2 then
local info = {}
info.id = taskId
info._sort = 1000000 - taskId
if self:canClaimTask(actId, taskId) then
info._sort = info._sort + 100000000
end
if not self:isTaskFinished(actId, taskId) then
info._sort = info._sort + 10000000
end
table.insert(list, info)
end
end
table.sort(list, function(a, b)
-- 已完成(可领奖) > 进行中 > 已完成(已领奖) > id
return a._sort > b._sort
end)
return list
end
--endregion
--region 积分任务
-- 达标任务
function ActivityData:getTaskIdListScore(actId)
local cfg = self:getTaskConfig()
local actTaskList = {}
for taskId, info in pairs(cfg) do
if info.activity == actId and info.display == 1 then
table.insert(actTaskList, taskId)
end
end
return actTaskList
end
function ActivityData:addTaskProgressCallbackScore(taskType, count)
for actId, data in pairs(self.taskDataScore) do
local actTaskList = self:getTaskIdListScore(actId)
if actTaskList and actTaskList[1] then
if self:getTaskType(actTaskList[1]) == taskType then
data.score = (data.score or 0) + count
end
end
end
end
-- 添加任务进度
function ActivityData:addTaskProgressScore(actId, taskId, count)
if not self:isTaskFinishedScore(actId, taskId) then
self.taskDataScore[actId].score = (self.taskDataScore[actId].score or 0) + count
end
self:setDirty()
end
function ActivityData:getTaskNumScore(actId, actTaskId)
if self:getTaskDisplay(actTaskId) == 1 then
return self.taskDataScore[actId].score or 0
else
return self.taskData[actTaskId] or 0
end
end
function ActivityData:getMaxTurnScore(actId)
return GConst.ActSprintConst.ACT_ROUND_LIMIT[actId]
end
function ActivityData:getRewardsgetMaxTurnScore(actId)
return GConst.ActSprintConst.ACT_ROUND_REWARD[actId]
end
function ActivityData:getHasGotTaskRewardScore(actId, actTaskId)
return self.taskDataScore[actId].round >= self:getMaxTurnScore(actId) or self.taskDataScore[actId].claimedMap[actTaskId]
end
function ActivityData:getTaskDataScore(actId)
return self.taskDataScore[actId] or {activity_id = actId, score = 0, total_score = 0, round = 0, round_claimed = 0, claimed = {}}
end
-- 获取任务当前进度
function ActivityData:getTaskProgScore(actId)
local data = self:getTaskDataScore(actId)
return data and data.score or 0
end
-- 任务是否已完成
function ActivityData:isTaskFinishedScore(actId, taskId)
return self:getTaskProgScore(actId) >= self:getTaskTarget(taskId)
end
function ActivityData:getTurnLimitScore(actId)
local scoreLimit = 0
local list = self:getTaskIdListScore(actId)
for _, id in ipairs(list) do
local cfg = self:getTaskConfig(id)
if cfg then
if self:getTaskTarget(id) > scoreLimit then
scoreLimit = self:getTaskTarget(id)
end
end
end
return scoreLimit
end
-- 特定任务是否可领奖
function ActivityData:getCanGetTaskRewardScore(actId, actTaskId)
if not self:getHasGotTaskRewardScore(actId, actTaskId) and self:getTaskNumScore(actId, actTaskId) >= self:getTaskTarget(actTaskId) then
return true
else
return false
end
end
function ActivityData:getCanGetTurnRewardScore(actId)
actId = actId or self.actId
-- 当前任务全部领取 未领取当前波次奖励
if (self:getClaimedTurnScore(actId) < self:getTurnScore(actId)) then
return true
else
return false
end
end
-- 是否已经领完了全部的轮次奖励
function ActivityData:getGotAllTurnRewardScore(actId)
local claimed = self:getClaimedTurnScore(actId) or 0
local maxTurn = self:getMaxTurnScore(actId)
return claimed >= maxTurn
end
function ActivityData:getTurnScore(actId)
return self.taskDataScore[actId].round or 0
end
function ActivityData:getClaimedTurnScore(actId)
return self.taskDataScore[actId].round_claimed or 0
end
-- 成功领取轮次奖励
function ActivityData:onGetTurnRewardScore(actId)
self.taskDataScore[actId].round_claimed = (self.taskDataScore[actId].round_claimed or 0) + 1
self:setDirty()
end
-- 领取任务成功
function ActivityData:onTaskSuccessScore(actId, actTaskId)
self.taskDataScore[actId] = self.taskDataScore[actId] or {}
if actTaskId and actTaskId > 0 then
self.taskDataScore[actId].claimedMap[actTaskId] = true
else
local list = self:getTaskIdListScore(actId)
for _, id in ipairs(list) do
if self:getCanGetTaskRewardScore(actId, id) then
self.taskDataScore[actId].claimedMap[id] = true
end
end
end
-- 如果所有任务都领取了 增加轮次
local list = self:getTaskIdListScore(actId)
local isAllGot = true
for _, id in ipairs(list) do
if not self:getHasGotTaskRewardScore(actId, id) then
isAllGot = false
break
end
end
if isAllGot then
self.taskDataScore[actId].round = (self.taskDataScore[actId].round or 0) + 1
self.taskDataScore[actId].claimedMap = {}
self.taskDataScore[actId].score = self.taskDataScore[actId].score - self:getTurnLimitScore(actId)
end
self:setDirty()
end
-- 达标任务列表
function ActivityData:getActTaskListScore(actId)
local list = {}
local cfg = self:getTaskConfig()
for taskId, info in pairs(cfg) do
if info.activity == actId and info.display == 1 then
table.insert(list, taskId)
end
end
table.sort(list, function(a, b)
-- 已完成(可领奖) > 进行中 > 已完成(已领奖) > id
local canGetA = self:getCanGetTaskRewardScore(actId, a)
local canGetB = self:getCanGetTaskRewardScore(actId, b)
if canGetA == canGetB then
local gotA = self:getHasGotTaskRewardScore(actId, a)
local gotB = self:getHasGotTaskRewardScore(actId, b)
if gotA == gotB then
return a < b
else
return gotB
end
else
return canGetA
end
end)
return list
end
--endregion
--endregion
--region 任务配置 --region 任务配置
function ActivityData:getTaskConfig(taskId) function ActivityData:getTaskConfig(taskId)
if taskId then if taskId then
@ -235,6 +456,10 @@ end
function ActivityData:getTaskDisplay(taskId) function ActivityData:getTaskDisplay(taskId)
return self:getTaskConfig(taskId).display return self:getTaskConfig(taskId).display
end end
function ActivityData:getTaskI18NName(taskId)
return ConfigManager:getConfig("act_task")[taskId].desc
end
--endregion --endregion
--endregion --endregion