This commit is contained in:
xiekaidong 2023-05-29 15:07:49 +08:00
commit 09cb92bce2
5 changed files with 35 additions and 25 deletions

View File

@ -23,9 +23,9 @@ EventManager.CUSTOM_EVENT = {
SHOW_ELIMINATION_TUTORAIL = "SHOW_ELIMINATION_TUTORAIL",
BOARD_FILL_OVER = "BOARD_FILL_OVER",
LOGIN_REQ_SUCCESS = "LOGIN_REQ_SUCCESS",
DAILY_TASK_ADD_PROGRESS = "DAILY_TASK_ADD_PROGRESS",
DAILY_TASK_COMPLETE = "DAILY_TASK_COMPLETE", -- 每日任务完成
BOSS_ENTER_ANI_OVER = "BOSS_ENTER_ANI_OVER",
TIME_TRIGGERED_NEW_EMAIL = "TIME_TRIGGERED_NEW_EMAIL", -- 邮件到时间请求是否有新邮件
TIME_TRIGGERED_NEW_EMAIL = "TIME_TRIGGERED_NEW_EMAIL", -- 邮件到时间请求是否有新邮件
SKILL_REFRESH_SUCC = "SKILL_REFRESH_SUCC",
-- BORAD_TOUCH_BEGIN = "BORAD_TOUCH_BEGIN",
-- BORAD_TOUCH_OVER = "BORAD_TOUCH_OVER"

View File

@ -11,6 +11,7 @@ local GAME_RES_WHITE_LIST = {
GConst.ATLAS_PATH.ICON_ITEM,
GConst.ATLAS_PATH.ICON_HERO,
GConst.ATLAS_PATH.ICON_BUFF,
GConst.ATLAS_PATH.ICON_TASK,
}
---- 预加载游戏资源

View File

@ -2,8 +2,10 @@ local TaskManager = class("TaskManager", BaseModule)
local BATTLE_TASK_FIELD = GConst.BattleConst.BATTLE_TASK_FIELD
function TaskManager:init()
self:addEventListener(EventManager.CUSTOM_EVENT.DAILY_TASK_ADD_PROGRESS, function(id, taskId, from, to)
ModuleManager.TaskToastManager:showToast(id, taskId, from, to)
self:addEventListener(EventManager.CUSTOM_EVENT.DAILY_TASK_COMPLETE, function(id, taskId, from, to)
if DataManager.DailyTaskData:getIsOpen() then
ModuleManager.TaskToastManager:showToast(id, taskId, from, to)
end
end)
self:addEventListener(EventManager.CUSTOM_EVENT.UI_SHOW_COMPLETE, function()
ModuleManager.TaskToastManager:checkOnOpenUI()

View File

@ -17,10 +17,10 @@ local function sortTask(taskList)
if completeA then
return a.id < b.id
else -- 没有完成的优先显示战令解锁
if a.bountyLock == b.bountyLock then
if a.lock == b.lock then
return a.id < b.id
else
return a.bountyLock
return b.lock
end
end
else

View File

@ -46,24 +46,28 @@ function DailyTaskData:init(data)
type = v.type,
reset = v.reset
}
if not dailyTaskObj.claimed and dailyTaskObj.progress >= dailyTaskObj.needProgress then
dailyTaskObj.redPoint = true
if dailyTaskObj.type == 1 then
dailyRedPoint = dailyRedPoint + 1
else
challengeRedPoint = challengeRedPoint + 1
end
else
dailyTaskObj.redPoint = false
end
if v.bounty then
if self.isUnlockBountyDailyTask then
dailyTaskObj.lock = false
else
dailyTaskObj.lock = true
end
if self.isUnlockBountyDailyTask then
dailyTaskObj.lock = false
else
dailyTaskObj.lock = true
end
else
dailyTaskObj.lock = false
end
if not dailyTaskObj.lock then -- 只有解锁的任务才注册监听任务进度
if dailyTaskObj.lock then
dailyTaskObj.redPoint = false
else
if not dailyTaskObj.claimed and dailyTaskObj.progress >= dailyTaskObj.needProgress then
dailyTaskObj.redPoint = true
if dailyTaskObj.type == 1 then
dailyRedPoint = dailyRedPoint + 1
else
challengeRedPoint = challengeRedPoint + 1
end
else
dailyTaskObj.redPoint = false
end
local list = self.taskTypeMap[taskInfo.type]
if list == nil then
list = {}
@ -130,11 +134,11 @@ function DailyTaskData:refreshDailyTask(task)
dailyTaskObj.type = dailyTaskInfo.type
dailyTaskObj.reset = dailyTaskInfo.reset
local redPoint = false
if not dailyTaskObj.claimed and dailyTaskObj.progress >= dailyTaskObj.needProgress then
if not dailyTaskObj.lock and not dailyTaskObj.claimed and dailyTaskObj.progress >= dailyTaskObj.needProgress then
redPoint = true
end
local originTaskType = originTaskInfo.type
if originTaskType ~= taskInfo.type then -- 任务类型变了
if not dailyTaskObj.lock and originTaskType ~= taskInfo.type then -- 任务类型变了
self:unregisterTask(id, originTaskType)
self:registerTask(dailyTaskObj, taskInfo.type)
end
@ -307,6 +311,9 @@ function DailyTaskData:getIfCanClaimTask(task)
end
function DailyTaskData:addTaskProgress(task, taskType, count)
if task.lock then
return
end
local currProgress = task.progress
if currProgress >= task.needProgress then
return
@ -314,7 +321,7 @@ function DailyTaskData:addTaskProgress(task, taskType, count)
local can = self:getIfCanClaimTask(task)
task.progress = task.progress + count
if not can and self:getIfCanClaimTask(task) then
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.DAILY_TASK_ADD_PROGRESS, task.id, task.taskId, currProgress, task.needProgress)
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.DAILY_TASK_COMPLETE, task.id, task.taskId, currProgress, task.needProgress)
if task.type == 1 and task.reset == 1 and taskType ~= GConst.TaskConst.TASK_TYPE.COMPLETED_DALY_TASK then
ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.COMPLETED_DALY_TASK)
end