local OfficialPosition_Controller = {} local EventSystem = require('Event/EventSystem') local private = {} local APPLY_FLAG = "OfficialPositionApplyFlag" local TRANS_PROFIT = 100020 --需要转化参数的官职权益 private.PromotionExpTitle = 0 --战斗内晋升的官职,需要回到主城再做表现 private.ApplyTimeHandle = 0 --下次"可报名"计时器句柄 private.FirstPromotionNpcId = 0 private.currentOfficialPositionIdOfExam = 0 --当前报名用的官职ID private.officialPositionExamNpcId = 0 --当前交互的官职报名npc function OfficialPosition_Controller.OnStartup() EventSystem.Regist(EventID.TownLevelBegin, private.OnShowPromotionExp) EventSystem.Regist(EventID.AfterTownLevelBegin, private.ContinueFindOnce) EventSystem.Regist(EventID.UI_RefreshOfficialPositionInfo, private.OnTitleChange) EventSystem.Regist(EventID.FunctionUnlockUpdate, private.OnFunctionUnlockUpdate) EventSystem.Regist(EventID.CharacterTeamGsChange, private.OnPowerChange) private.FirstPromotionNpcId = DataSheetManager.OfficialPosition:GetDataByID(1).NPC end --演武校场榜单 function OfficialPosition_Controller.OpenSoloRank() UIManager.OpenView(Const_UI_Lua.UIEnum.UIOfficialPositionRank) end --上期榜单 function OfficialPosition_Controller.OpenRankLast() UIManager.OpenView(Const_UI_Lua.UIEnum.UIOfficialPositionRankLast) end --官职主界面 function OfficialPosition_Controller.OpenMainPanel() local isUnlock, content = MDL.Unlock.IsClientUnlockWithText(MDL.Unlock.FunctionType.OfficialPosition, "IDS_Activity_Condition_03") if isUnlock then private.SetApplyFlagShow() UIManager.OpenView(Const_UI_Lua.UIEnum.UIOfficialPositionBase) else CTL.Sound.PlayGameSound("UI_invalid") CTL.Tips.AddTipsMsg(content) end end --报名界面 function OfficialPosition_Controller.OpenApplyList(title) UIManager.OpenView(Const_UI_Lua.UIEnum.UIOfficialPositionApplyList, { [1] = title }) end --战斗结算 function OfficialPosition_Controller.ShowBattleSummary(msg) CTL.HomeMain.CloseOpenView() UIManager.OpenView(Const_UI_Lua.UIEnum.UIOfficialPositionSummary, { [1] = msg.isWin }) end --晋升表现--诏书 function OfficialPosition_Controller.ShowZhaoshu(title) if BattleDataGetter.IsOnlineTownLevel() then OfficialPosition_Controller.ShowLevelUpPanel(title) UIManager.OpenAndPushAll(Const_UI_Lua.UIEnum.UIOfficialPositionZhaoshu, { officialTitle = title }) else private.PromotionExpTitle = title end end function private.OnShowPromotionExp() local expTitle = private.PromotionExpTitle if expTitle > 0 then CTL.OfficialPosition.ShowZhaoshu(expTitle) private.PromotionExpTitle = 0 end end function OfficialPosition_Controller.NextTitleIsHighestTitle() local highestId = 0 for _, v in DataSheetManager.OfficialPosition:GetEnumerator() do if v.ID > highestId then highestId = v.ID end end local info = MDL.OfficialPosition.GetOfficialInfo() local nextTitle = math.min(info.CurTitle + 1, highestId) return nextTitle == highestId -- 如果当前已经是最高等级则下一个等级也算是最高等级 end --当前官职是否可晋升 function OfficialPosition_Controller.IsNextTitleUnlock() local info = MDL.OfficialPosition.GetOfficialInfo() local nextTitle = math.max(info.CurTitle + 1, info.HighestTitle) local isFinish = false local titleData = DataSheetManager.OfficialPosition:GetDataByID(nextTitle) if titleData then if titleData.Type == 1 then if info.FinishDetail ~= nil then isFinish = true for _, v in pairs(info.FinishDetail) do if v == false then isFinish = false break end end end end end return isFinish end --晋升表现 function OfficialPosition_Controller.ShowLevelUpPanel(title) UIManager.OpenView(Const_UI_Lua.UIEnum.UIOfficialPositionLevelUp, { officialTitle = title }) end --录取结果(入口:邮件超链接) function OfficialPosition_Controller.ShowAdmissionResult(title) local titleData = DataSheetManager.OfficialPosition:GetDataByID(title) local promotionData = DataSheetManager.OfficialPositionPromotion:GetDataByGradeID(titleData.GradeID) if promotionData then local hasExpire = true --判断邮件是否过期 local mailTime = MDL.Mail.SelectMailTime local timeTab = promotionData.Unlock_Table if #timeTab == 1 then --每日的时间点,直接判断是否过了一天即可 hasExpire = not UTL.Time.CheckLeftTimeLessOneDay(mailTime) else --找到下一个结算的时间点 local mailWeekDay = tonumber(UTL.Time.OsDateOriginal("%w", mailTime)) local index = 0 for i, v in ipairs(timeTab) do local resultTime = v.ExaminationTime local timeData = DataSheetManager.TimeRefresh:GetDataByID(resultTime) local configWeekDay = timeData.Day if configWeekDay == mailWeekDay then index = (i + 1) % #timeTab break end end index = index == 0 and #timeTab or index local resultTime = timeTab[index].ExaminationTime local timeData = DataSheetManager.TimeRefresh:GetDataByID(resultTime) local nextWeekDay = timeData.Day if nextWeekDay < mailWeekDay then nextWeekDay = nextWeekDay + 7 end local curWeekDay = tonumber(UTL.Time.OsDateOriginal("%w", UTL.Time.GetServerTimestamp())) if curWeekDay == 0 then curWeekDay = 7 end if curWeekDay <= nextWeekDay then hasExpire = false end end if hasExpire then CTL.Tips.AddTipsMsg(Const_IDS.IDS_OfficialPosition_ResultExpired) else UIManager.OpenView(Const_UI_Lua.UIEnum.UIOfficialPositionAdmissionResult, { [1] = title }) end end end --官职录取的对战结果(入口:邮件->录取结果->cell查看) function OfficialPosition_Controller.ShowRecordBattleResult(promotionExamRecord) UIManager.OpenView(Const_UI_Lua.UIEnum.UIOfficialPositionBattleResult, promotionExamRecord) end --收益预览 function OfficialPosition_Controller.ShowProfitPreview() UIManager.OpenView(Const_UI_Lua.UIEnum.UIOfficialPositionProfitPreview) end function OfficialPosition_Controller.GetTitleFullTxt(titleData) return UIUtils.GetLocalizedTxt(Const_IDS[titleData.Name1]) .. "·" .. UIUtils.GetLocalizedTxt(Const_IDS[titleData.Name2]) end function OfficialPosition_Controller.GetTitleFullTxtMainVN(titleData) return UIUtils.GetLocalizedTxt(Const_IDS[titleData.Name1]) .. "\n" .. UIUtils.GetLocalizedTxt(Const_IDS[titleData.Name2]) end --场景头顶官职信息显示 function OfficialPosition_Controller.GetModelNameShow(title) if title and title > 0 then local titleData = DataSheetManager.OfficialPosition:GetDataByID(title) return UTL.Color.FormatQualityText(string.FormatByIdsId(Const_IDS.IDS_HeadInfoUI_OfficialPosition, UIUtils.GetLocalizedTxt(Const_IDS[titleData.Name1])), titleData.QualityColor) end return "" end function OfficialPosition_Controller.GetColorTitleFullTxt(title) local titleData = DataSheetManager.OfficialPosition:GetDataByID(title) return UTL.Color.FormatQualityText(OfficialPosition_Controller.GetTitleFullTxt(titleData), titleData.QualityColor) end function OfficialPosition_Controller.GetGradeDescByGradeID(gradeID) local titleData = MDL.OfficialPosition.GetTitleDataByGradeID(gradeID) return UIUtils.GetLocalizedTxt(Const_IDS[titleData.Name1]) end --前往晋升/报名的NPC function OfficialPosition_Controller.GoToPromotionOrExam(titleData) if not MDL.Team.IsFollowing() then NotSyncBattleSetter.StopAutoFightPathInTown() --停止现在的寻路(主要是为了清空其他寻路的缓存) local npcId = titleData.NPC local __, levelCfgReplaceData = DataSheetManager.LevelCfgReplace:TryGetDataByReplaceID_ReplaceType(titleData.NPC, LuaConst.LevelCfgReplaceType.Npc) if levelCfgReplaceData and MDL.Unlock.IsComplete(levelCfgReplaceData.Condition, levelCfgReplaceData.ConditionParam) then private.FindingNpcId = levelCfgReplaceData.ReplaceTarget else private.FindingNpcId = titleData.NPC end NotSyncBattleSetter.FindPathByNPCIDAndRide(private.FindingNpcId) else CTL.Tips.AddTipsMsg(Const_IDS["IDS_Team_FollowCanNotDoThis"]) end end function private.ContinueFindOnce() if private.FindingNpcId then NotSyncBattleSetter.FindPathByNPCIDAndRide(private.FindingNpcId) private.FindingNpcId = nil end end function OfficialPosition_Controller.OnStopFindPath() private.FindingNpcId = nil end function OfficialPosition_Controller.CheckFirstTitlePromotion(npcId) if private.FirstPromotionNpcId == npcId then return MDL.OfficialPosition.GetHasFinishFirstTitle() end return false end --保存当前报名用的官职ID function OfficialPosition_Controller.SetCurrentOfficialPositionOfExam(id) private.currentOfficialPositionIdOfExam = id end function OfficialPosition_Controller.SetOfficialPositionExamNpc(npcId) private.officialPositionExamNpcId = npcId end --阶段1晋升 function OfficialPosition_Controller.OfficialPositionPromotion() if CTL.OfficialPosition.IsNextTitleUnlock() then MDL.OfficialPosition.PromotionTitleReq() else CTL.Tips.AddTipsMsg(Const_IDS.IDS_OfficialPosition_CantPromotion) end end --阶段2,PVE function OfficialPosition_Controller.OfficialPositionPve() local curTitle = MDL.OfficialPosition.GetCurTitle() MDL.LevelSelect.EnterFuben(LuaConst.LevelType.OfficialPosition, curTitle + 1) end --发送报名请求 function OfficialPosition_Controller.OfficialPositionExam() local tarExamTitleID = private.currentOfficialPositionIdOfExam if tarExamTitleID == 0 then --为空时,说明是直接点击npc弹出,此时报名的是这个npcID对应的官职最高品阶 local curTitleID = MDL.OfficialPosition.GetCurTitleData().ID --历史最高跟当前一致时,报名的是下一个官职 local highestTitle = math.max(curTitleID + 1, MDL.OfficialPosition.GetOfficialInfo().HighestTitle) local examTitleID = 0 for _,v in DataSheetManager.OfficialPosition:GetEnumerator() do if v.NPC == private.officialPositionExamNpcId and v.Type >= 3 and v.ID <= highestTitle then if v.ID > examTitleID then examTitleID = v.ID end end end tarExamTitleID = examTitleID end if tarExamTitleID > 0 then MDL.OfficialPosition.ApplyExamReq(tarExamTitleID) end OfficialPosition_Controller.SetOfficialPositionExamNpc(0) OfficialPosition_Controller.SetCurrentOfficialPositionOfExam(0) end --当前是否在报名时间内 function OfficialPosition_Controller.IsInApplyTime(title) local isInTime = false local _, titleData = DataSheetManager.OfficialPosition:TryGetDataByID(title) if titleData and titleData.Type > 2 then local pvpData = DataSheetManager.OfficialPositionPromotion:GetDataByGradeID(titleData.GradeID) if pvpData then if MDL.Unlock.IsTriggerIdComplete(pvpData.TriggerID) then local timeTab = pvpData.Unlock_Table for _, v in ipairs(timeTab) do local beginTime = v.StartTime local endTime = v.EndTime if UTL.Time.IsServerInOpeningTime(beginTime, endTime) then isInTime = true break end end end end end return isInTime end --检查是否可以报名 function OfficialPosition_Controller.CheckCanExam(GradeID) --报名 --报名官职品阶不能低于自身 local curGradeID = MDL.OfficialPosition.GetCurGradeID() if GradeID >= curGradeID then return false end --判断是否已在其他品阶报名 local hasExam = MDL.OfficialPosition.GetHasApply() if hasExam then return false, Const_IDS["IDS_OfficialPosition_SignUpWrong3"] end --判断上阵武将人数 local lineUpHeroCount = MDL.Player.GetLineUpHeroCount() if lineUpHeroCount < 6 then return false, Const_IDS["IDS_OfficialPosition_SignUpWrong4"] end --判断是否在报名时间段内,是否没超过报考人数 local isInTime = false local maxNum local pvpData = DataSheetManager.OfficialPositionPromotion:GetDataByGradeID(GradeID) if pvpData then --先判断是否满足解锁条件 if MDL.Unlock.IsTriggerIdComplete(pvpData.TriggerID) == false then return false end maxNum = pvpData.ApplicantsNum local timeTab = pvpData.Unlock_Table for _, v in ipairs(timeTab) do local beginTime = v.StartTime local endTime = v.EndTime if UTL.Time.IsServerInOpeningTime(beginTime, endTime) then isInTime = true break end end end --不在时间段内 if not isInTime then return false, Const_IDS["IDS_OfficialPosition_SignUpWrong1"] end --是否没超过报考人数 if maxNum and MDL.OfficialPosition.ExamInfoList then if #MDL.OfficialPosition.ExamInfoList >= maxNum then return false, Const_IDS["IDS_OfficialPosition_SignUpWrong2"] end end return true end -- 根据grade获取品级名字 function OfficialPosition_Controller.GetOfficialPositionName(grade) for i, v in DataSheetManager.OfficialPosition:GetEnumerator() do if v.GradeID == grade then return UIUtils.GetLocalizedTxt(Const_IDS[v.Name1]) end end return "" end --判断是否达到对应的品阶 function OfficialPosition_Controller.CheckIfUnlock(grade, des) local titleData = MDL.OfficialPosition.GetCurTitleData() if titleData and titleData.GradeID <= grade then return true end local name = "" if des then for i, v in DataSheetManager.OfficialPosition:GetEnumerator() do if v.GradeID == grade then name = UIUtils.GetLocalizedTxt(Const_IDS[v.Name1]) break end end end return false, des and string.FormatByIdsId(Const_IDS.IDS_OfficialPosition_PVPOpen, name) end --判断战力是否足够 function OfficialPosition_Controller.GetHasEnoughPower(titleData) local data = titleData if data == nil then local curTitle = MDL.OfficialPosition.GetCurTitle() local nextTitle = curTitle + 1 data = DataSheetManager.OfficialPosition:GetDataByID(nextTitle) end if data and data.Type == 2 then local pveData = DataSheetManager.OfficialPositionPVE:GetDataByGradeID(data.GradeID) local recommendFight = pveData.Recommend local curFight = MDL.Player.GetLineUpGs() return curFight >= recommendFight end return false end --判断名次是否可晋升 function OfficialPosition_Controller.CheckIfPromotion(title, index) local titleData = DataSheetManager.OfficialPosition:GetDataByID(title) if titleData and titleData.Type > 2 then local pvpData = DataSheetManager.OfficialPositionPromotion:GetDataByGradeID(titleData.GradeID) if pvpData then local promotionsNum = pvpData.PromotionsNum --晋升人数上限 return index <= promotionsNum end end return false end --判断是否官职指定的NPC function OfficialPosition_Controller.CheckNpcSpecialized(npcId) for _, v in DataSheetManager.OfficialPosition:GetEnumerator() do if private.IsOfficialPositionNpc(v.NPC, npcId) then return true end end return false end function private.IsOfficialPositionNpc(srcNpcId, npcId) if srcNpcId == npcId then return true end local __, levelCfgReplaceData = DataSheetManager.LevelCfgReplace:TryGetDataByReplaceID_ReplaceType(srcNpcId, LuaConst.LevelCfgReplaceType.Npc) if levelCfgReplaceData then return levelCfgReplaceData.ReplaceTarget == npcId end return false end --判断是否弹出对话 function OfficialPosition_Controller.CheckNpcExamDialogue(npcId) if MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.OfficialPosition) then --该npc有能够报名的官职 for _, v in DataSheetManager.OfficialPosition:GetEnumerator() do if private.IsOfficialPositionNpc(v.NPC, npcId) and v.Type >= 3 then if OfficialPosition_Controller.CheckCanExam(v.GradeID) then return true end end end end return false end --是否弹出晋升对话 function OfficialPosition_Controller.CheckNpcPromoteDialogue() if MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.OfficialPosition) then local nextTitle = MDL.OfficialPosition.GetCurTitle() + 1 --可能当前官职是最高等级,没有下一等级的配置了,因此用TryGet去读数据 local isSuccess, nextTitleData = DataSheetManager.OfficialPosition:TryGetDataByID(nextTitle) if isSuccess then if nextTitleData.Type == 1 then return OfficialPosition_Controller.IsNextTitleUnlock() elseif nextTitleData.Type == 2 then return true end end end return false end --显示“可报名” function OfficialPosition_Controller.HandleApplyNotice(nextTitleData) --定时器:下次报名时间显示 local nextTime = 0 local pvpData = DataSheetManager.OfficialPositionPromotion:GetDataByGradeID(nextTitleData.GradeID) if pvpData then local timeTab = pvpData.Unlock_Table for _, v in ipairs(timeTab) do local offsetTime = UTL.Time.GetServerIntervalTimeByTimeId(v.StartTime) if nextTime == 0 then nextTime = offsetTime else if offsetTime < nextTime then nextTime = offsetTime end end end end if private.ApplyTimeHandle > 0 then TimerUtil.Remove(private.ApplyTimeHandle) end private.ApplyTimeHandle = TimerUtil.Interval(private.ResetApplyFlagShow, nextTime + 5, 1) EventSystem.Dispatch(EventID.UI_UpdateTitleApplyFlag) end function private.SetApplyFlagShow() local flag = false local nextTitle = MDL.OfficialPosition.GetCurTitle() + 1 local _, titleData = DataSheetManager.OfficialPosition:TryGetDataByID(nextTitle) if titleData and titleData.Type > 2 then flag = OfficialPosition_Controller.GetApplyFlagShow() if flag then PersistentData.PlayerData:Set(APPLY_FLAG, UTL.Time.GetServerTimestamp(), true) end EventSystem.Dispatch(EventID.UI_UpdateTitleApplyFlag) private.OnApplyChange(flag) end end function private.ResetApplyFlagShow() PersistentData.PlayerData:Set(APPLY_FLAG, 0, true) EventSystem.Dispatch(EventID.UI_UpdateTitleApplyFlag) --下个倒计时 local nextTitle = MDL.OfficialPosition.GetCurTitle() + 1 local _, nextTitleData = DataSheetManager.OfficialPosition:TryGetDataByID(nextTitle) if nextTitleData and nextTitleData.Type > 2 then local nextTime = 0 local pvpData = DataSheetManager.OfficialPositionPromotion:GetDataByGradeID(nextTitleData.GradeID) if pvpData then local timeTab = pvpData.Unlock_Table for _, v in ipairs(timeTab) do local offsetTime = UTL.Time.GetServerIntervalTimeByTimeId(v.StartTime) if nextTime == 0 then nextTime = offsetTime else if offsetTime < nextTime then nextTime = offsetTime end end end end if private.ApplyTimeHandle > 0 then TimerUtil.Remove(private.ApplyTimeHandle) end private.ApplyTimeHandle = TimerUtil.Interval(private.ResetApplyFlagShow, nextTime + 5, 1) EventSystem.Dispatch(EventID.UI_UpdateTitleApplyFlag) end end --是否显示"可报名"标识 function OfficialPosition_Controller.GetApplyFlagShow() -- 下一个官职不是最高官职 if not OfficialPosition_Controller.NextTitleIsHighestTitle() then return false end if MDL.OfficialPosition.GetHasApply() then --已经报名 return false end local lineUpHeroCount = MDL.Player.GetLineUpHeroCount() if lineUpHeroCount < 6 then --武将人数不够 return false end local nextTitle = MDL.OfficialPosition.GetCurTitle() + 1 if CTL.OfficialPosition.IsInApplyTime(nextTitle) == false then --不在报名时间内 return false end local timeStamp = PersistentData.PlayerData:Get(APPLY_FLAG,0) if timeStamp > 0 and UTL.Time.IsTimestampSameDay(timeStamp) then --当天已点击 return false end return true end function OfficialPosition_Controller.GetLockDes(TriggerType, Parm, UnlockDes, isUnlock) local content if TriggerType == LuaConst.UnlockConditionType.CompleteMainStory then local taskData = DataSheetManager.TaskFatherData:GetDataByID(Parm) content = isUnlock and UTL.Color.FormatGreenColor(UIUtils.GetLocalizedTxt(Const_IDS[taskData.Brief])) or UTL.Color.FormatRedColor(UIUtils.GetLocalizedTxt(Const_IDS[taskData.Brief])) elseif TriggerType == LuaConst.UnlockConditionType.CompleteWorldBoss then local worldBossData = DataSheetManager.WorldBoss:GetDataByID(Parm) content = isUnlock and UTL.Color.FormatGreenColor(UIUtils.GetLocalizedTxt(Const_IDS[worldBossData.WordBossName])) or UTL.Color.FormatRedColor(UIUtils.GetLocalizedTxt(Const_IDS[worldBossData.WordBossName])) elseif TriggerType == LuaConst.UnlockConditionType.ClimbTowerLevel then local towerData = DataSheetManager.ClimbTowerLevel:GetDataByID(Parm) content = isUnlock and UTL.Color.FormatGreenColor(UIUtils.GetLocalizedTxt(Const_IDS[towerData.LevelName])) or UTL.Color.FormatRedColor(UIUtils.GetLocalizedTxt(Const_IDS[towerData.LevelName])) else content = isUnlock and UTL.Color.FormatGreenColor(Parm) or UTL.Color.FormatRedColor(Parm) end return string.FormatByIdsId(Const_IDS[UnlockDes], content) end function private.OnFunctionUnlockUpdate(funcID, isComplete) if funcID == MDL.Unlock.FunctionType.OfficialPosition and isComplete then private.OnTitleChange() end end --红点逻辑 --类型1监听官职完成度变化 function private.OnTitleChange() if MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.OfficialPosition) then local nextTitle = MDL.OfficialPosition.GetCurTitle() + 1 local isSuccess, nextTitleData = DataSheetManager.OfficialPosition:TryGetDataByID(nextTitle) if nextTitleData then private.CheckRedByTitleData(nextTitleData) end end end --类型2监听战力变化 function private.OnPowerChange() local nextTitle = MDL.OfficialPosition.GetCurTitle() + 1 local _, nextTitleData = DataSheetManager.OfficialPosition:TryGetDataByID(nextTitle) if nextTitleData then private.CheckRedByTitleData(nextTitleData) end end function private.CheckRedByTitleData(data) if data.Type == 1 then local isAllFinish = MDL.OfficialPosition.GetHasFinish() if isAllFinish then CTL.RedPoint.AddRedPoint(CTL.RedPoint.RedPointKey.OfficialPosition_Main_Type1) else CTL.RedPoint.RemoveRedPoint(CTL.RedPoint.RedPointKey.OfficialPosition_Main_Type1) end elseif data.Type == 2 then CTL.RedPoint.RemoveRedPoint(CTL.RedPoint.RedPointKey.OfficialPosition_Main_Type1) local hasEnoughPower = OfficialPosition_Controller.GetHasEnoughPower(data) if hasEnoughPower then CTL.RedPoint.AddRedPoint(CTL.RedPoint.RedPointKey.OfficialPosition_Main_Type2) else CTL.RedPoint.RemoveRedPoint(CTL.RedPoint.RedPointKey.OfficialPosition_Main_Type2) end else private.OnApplyChange(OfficialPosition_Controller.GetApplyFlagShow()) end end --类型3判断是否可报名 function private.OnApplyChange(value) CTL.RedPoint.RemoveRedPoint(CTL.RedPoint.RedPointKey.OfficialPosition_Main_Type1) CTL.RedPoint.RemoveRedPoint(CTL.RedPoint.RedPointKey.OfficialPosition_Main_Type2) if value then CTL.RedPoint.AddRedPoint(CTL.RedPoint.RedPointKey.OfficialPosition_Main_Type3) else CTL.RedPoint.RemoveRedPoint(CTL.RedPoint.RedPointKey.OfficialPosition_Main_Type3) end end function OfficialPosition_Controller.UpdateProfitList(gradeID, profitList) table.clearArray(profitList) --与上一级比较,Parm差值大于0的才插入 local curConfig = DataSheetManager.OfficialProfit:GetDataByGradeID(gradeID) local curParams = curConfig.Unlock_Table local isSuccess, lastConfig = DataSheetManager.OfficialProfit:TryGetDataByGradeID(gradeID + 1) if isSuccess then local lastParams = lastConfig.Unlock_Table for i, v in ipairs(curParams) do local lastParam = lastParams[i].Parm local curParam = v.Parm if curParam - lastParam > 0 then local config = DataSheetManager.OfficialProfitDes:GetDataByProfitID(v.Profit) local data = { Parm = v.Parm, IDS = config.IDS, Icon = config.Icon, } --时间参数配置了秒,需要转化成小时 if v.Profit == TRANS_PROFIT then data.Parm = UTL.Time.TransToHours(data.Parm) end table.insert(profitList, data) end end else for i, v in ipairs(curParams) do if v.Parm > 0 then local config = DataSheetManager.OfficialProfitDes:GetDataByProfitID(v.Profit) local data = { Parm = v.Parm, IDS = config.IDS, Icon = config.Icon, } --时间参数配置了秒,需要转化成小时 if v.Profit == TRANS_PROFIT then data.Parm = UTL.Time.TransToHours(data.Parm) end table.insert(profitList, data) end end end end return OfficialPosition_Controller