local ActivityDailyComulativeRechargeBTItem = class('ActivityDailyComulativeRechargeBTItem', require('Activities/ActivityTypeItem')) local ActivityTaskItem = require("Activities/ActivityTaskItem") function ActivityDailyComulativeRechargeBTItem:ctor() self.curDay = 0 self.curDayEndTime = 0 self.dayTaskList = nil self.redPointType = Enum.RPNotifyType.DailyRechargeBT end function ActivityDailyComulativeRechargeBTItem:SyncSrvData(serverData, curDayEndTime) if not self.dayTaskList then self.dayTaskList = {} end local curDay = serverData.cur_day if self.curDay ~= curDay then self.curDay = curDay ManagerContainer.LuaEventMgr:Dispatch(UIEventNames.EID_Activity_Day_Change,self.actId) end self.curDayEndTime = tonumber(tostring(curDayEndTime / 1000)) local taskList = serverData.bt_zhenjia_recharge_task_list for i = 1, #taskList do local taskData = taskList[i] local task = self:GetTaskById(taskData.task_id) if not task then task = ActivityTaskItem:new(taskData.task_id) self.dayTaskList[#self.dayTaskList+1] = task end task:SyncServerData(taskData) end self:SortTask(self.dayTaskList) end function ActivityDailyComulativeRechargeBTItem:SortTask(taskList) if taskList == nil or #taskList < 2 then return end table.sort( taskList, function(a, b) if a.showPriority < b.showPriority then return true elseif a.showPriority > b.showPriority then return false else return a.taskId < b.taskId end end ) end function ActivityDailyComulativeRechargeBTItem:GetTaskById(id) for i = 1, #self.dayTaskList do if self.dayTaskList[i].taskId == id then return self.dayTaskList[i] end end return nil end function ActivityDailyComulativeRechargeBTItem:GetDayTaskList() return self.dayTaskList end function ActivityDailyComulativeRechargeBTItem:HasRedPoint() if self.dayTaskList == nil then return false end for i = 1, #self.dayTaskList do local task = self.dayTaskList[i] if task:HasRedPoint() then return true end end return false end function ActivityDailyComulativeRechargeBTItem:GetDayLeftTime() local leftTime = self.curDayEndTime - ManagerContainer.LuaTimerMgr:GetTimeSecond() if leftTime < 0 then leftTime = 0 end return leftTime end return ActivityDailyComulativeRechargeBTItem