local UIOACommonTaskBase = require("View/OperationActivity/OACommonBase/UIOACommonTaskBase") local UISuperGoldHonorOrderTask = UIViewClass(UIOACommonTaskBase) local function SortRule(taskCfg_a, taskCfg_b) if taskCfg_a.Sort == taskCfg_b.Sort then return taskCfg_a.cfg.ID < taskCfg_b.cfg.ID end return taskCfg_a.Sort < taskCfg_b.Sort end function UISuperGoldHonorOrderTask:OnButtonClicked(comp) if comp == self.btn_Close then self:CloseView() elseif comp == self.btn_Get then MDL.OACommon.ClaimAtyTaskAllRwdRequest(self.activityId) end end function UISuperGoldHonorOrderTask:InitPanel() self.isOpen = MDL.SuperGoldHonorOrder.GetCurHonorOrderIsOpen(self.activityId) self.btn_Get:SetRedPoint(self.isOpen and CTL.OACommon.IsHasTaskRedPoint(self.activityId)) self.btn_Get:SetGray(not self.isOpen) local taskList = {} local curHonorOrderId = MDL.SuperGoldHonorOrder.GetServerInfoByActivityID(self.activityId).HonorOrderId for i, v in DataSheetManager.SuperGoldHonorOrderTask[curHonorOrderId]:GetEnumerator() do local status = MDL.OACommon.GetTaskStatus(self.activityId, v.ID) if status == MDL.OACommon.ActivityTaskState.Done then --此处用id-1取上一个数据,可能拿不到 local __, lastCfg = DataSheetManager.SuperGoldHonorOrderTask[curHonorOrderId]:TryGetDataByID(v.ID - 1) if lastCfg and lastCfg.TaskID == v.TaskID then local lastStatus = MDL.OACommon.GetTaskStatus(self.activityId, v.ID - 1) if lastStatus == MDL.OACommon.ActivityTaskState.Commit then table.insert(taskList, {cfg = v, Sort = 1}) end else table.insert(taskList, {cfg = v, Sort = 1}) end elseif status == MDL.OACommon.ActivityTaskState.Commit then table.insert(taskList, {cfg = v, Sort = 3}) else local isSuccess, lastCfg = DataSheetManager.SuperGoldHonorOrderTask[curHonorOrderId]:TryGetDataByID(v.ID - 1) if isSuccess and lastCfg.TaskID == v.TaskID then local lastStatus = MDL.OACommon.GetTaskStatus(self.activityId, v.ID - 1) if lastStatus == MDL.OACommon.ActivityTaskState.Commit then table.insert(taskList, {cfg = v, Sort = 2}) end else table.insert(taskList, {cfg = v, Sort = 2}) end end end UIUtils.SetActive(self.btn_Get, CTL.OACommon.IsHasTaskRedPoint(self.activityId)) table.sort(taskList, SortRule) self.loop_Tasks:ReloadAll(taskList) end function UISuperGoldHonorOrderTask:InitTaskInfoCell(cellTable, data) local data = data.cfg for i, v in ipairs(cellTable.group_Items) do local itemData = data.Item_Table[i] if itemData then UIUtils.SetActive(v.gameObject, true) UTL.Item.SetItemCell(v, itemData.ItemID, itemData.ItemNum) else UIUtils.SetActive(v.gameObject, false) end end local triggerData = DataSheetManager.TriggerID:GetDataByID(data.TriggerID).Unlock_Table[1] local status = MDL.OACommon.GetTaskStatus(self.activityId, data.ID) local taskStateEnum = MDL.OACommon.ActivityTaskState local progressCount = triggerData.UnlockConditionParamA if triggerData.UnlockCondition == LuaConst.TriggerType.SuperGold_PassLevel or triggerData.UnlockCondition == LuaConst.TriggerType.SuperGold_LevelEnding then progressCount = 1 end local triggerCount = progressCount if status == taskStateEnum.Done then -- 可领取 cellTable.state_Btn:SetState(0) elseif status == taskStateEnum.Commit then -- 已领取 cellTable.state_Btn:SetState(2) else triggerCount = MDL.OACommon.GetTriggerCount(self.activityId, triggerData.UnlockCondition, triggerData.UnlockConditionParamB) if triggerData.UnlockCondition == LuaConst.TriggerType.Login_Count then cellTable.state_Btn:SetState(3) else cellTable.state_Btn:SetState(1) end end local curCount = triggerCount if tonumber(triggerCount) < tonumber(progressCount) then curCount = UTL.Color.FormatRedColor(triggerCount) else curCount = UTL.Color.FormatTextByColor("633D22", triggerCount) end cellTable.txt_TaskContent.text = MDL.Unlock.GetDesByTriggerID(triggerData) .. string.format("(%s/%s)", curCount, progressCount) end function UISuperGoldHonorOrderTask:ClickTaskInfoCell(cellTable, target, data) local data = data.cfg if target == cellTable.event_Collect then local status = MDL.OACommon.GetTaskStatus(self.activityId, data.ID) if status == MDL.OACommon.ActivityTaskState.Done then MDL.OACommon.OATaskRewardReq(self.activityId, data.ID) elseif status == MDL.OACommon.ActivityTaskState.UnDone then if not MDL.SuperGoldHonorOrder.GetCurHonorOrderIsOpen(self.activityId) then CTL.Tips.AddTipsMsg(Const_IDS["IDS_ERRORCODE_174_WarnCode_Activity_EndWrongHint"]) -- 活动已结束 return end --处理一个前往的逻辑 local unlockCondition = DataSheetManager.TriggerID:GetDataByID(data.TriggerID).Unlock_Table[1].UnlockCondition local gotoViewID = DataSheetManager.TriggerType:GetDataByID(unlockCondition).ItemSourceID local unlockId = DataSheetManager.ItemSource:GetDataByID(gotoViewID).UnlockID if unlockId > 0 and not MDL.Unlock.IsUnlock(unlockId) then CTL.Tips.AddTipsMsg(Const_IDS["IDS_7DayActivity_Hint_6"]) return end local heroType = MDL.SuperGoldMain.GetHeroTypeByActivityId(self.activityId) if gotoViewID == MDL.ItemSources.SourceType.SuperGoldStory or gotoViewID == MDL.ItemSources.SourceType.SuperGoldBoss or gotoViewID == MDL.ItemSources.SourceType.SuperGoldLottery then if not MDL.SuperGoldMain.IsActivityInFuncTime(self.activityId) then CTL.Tips.AddTipsMsg(Const_IDS["IDS_GoldHeroActivity_TimeHint3"]) return else CTL.ItemSources.ExecuteSourceFunctionById(gotoViewID, nil, {heroType = heroType, activityId = self.activityId}) end else CTL.ItemSources.ExecuteSourceFunctionById(gotoViewID, nil, {heroType = heroType, activityId = self.activityId}) end end else for i, v in ipairs(cellTable.group_Items) do if target == v.event_Click then UTL.ItemTips.ShowCommonTipsById(data.Item_Table[i].ItemID) end end end end return UISuperGoldHonorOrderTask