local EventSystem = require('Event/EventSystem') local gold_hero_secret_opt_pb = require 'Proto/gold_hero_secret_opt_pb' local fuben_pb = require 'Proto/fuben_pb' local GoldenHeroStory_Model = {} local private = {} --任务状态枚举 GoldenHeroStory_Model.Enum_TaskState = { Doing = 1, --进行中 Done = 2, --已结束 Lock = 3, --未解锁 } GoldenHeroStory_Model.LevelState = { Lock = 0, -- 未解锁 UnLock = 1, -- 已解锁,未通关 Sweep = 2 -- 已通关,可扫荡 } --关卡成就状态枚举 GoldenHeroStory_Model.Enum_LevelAchieveState = { Doing = 0, --进行中 WaitForGet = 1, --待领取 Done = 2, --已领取 } function GoldenHeroStory_Model.OnStartup() NetManager.RegisterMsgCB(MessageEnums.MessageGoldHeroFBSweep, private.GoldHeroFBSweepResponse) -- 武将秘闻-关卡扫荡 NetManager.RegisterMsgCB(MessageEnums.MessageGoldHeroFBAchievementAward, private.GoldHeroFBAchievementAwardResponse) -- 武将秘闻-领取关卡成就奖励 NetManager.RegisterMsgCB(MessageEnums.MessageGoldHeroStoryAward, private.GoldHeroStoryAwardResponse) -- 武将秘闻-领取秘闻录奖励 NetManager.RegisterMsgCB(MessageEnums.MessageGoldHeroSkipAllStory, private.GoldHeroSkipAllStoryResp) -- 武将秘闻-跳过金将活动所有剧情 EventSystem.Regist(EventID.UI_GoldenHero_RefreshCurrency, private.RefreshStorySweepRp) private.ActivityType = MDL.OperationActivity.ActivityType.GoldenHero private.secretInfoDict = {} -- 服务器下发秘闻数据 -- 本地数据 private.goldenHeroTaskIDList = {} -- key:模板ID ;value:模板ID对应的任务列表 private.goldenHeroLevelIDList = {} -- key:模板ID ;value:模板ID对应的关卡列表 private.initRedPointList = {} -- 初始化红点树的活动ID数组 --临时变量,进副本保存,出副本删除 private.tempActivityId = nil -- 活动ID private.tempLevelId = nil -- 副本ID end --region *********************************** 外界获取数据接口 *********************************** ---@return number 当前体力值 function GoldenHeroStory_Model.GetGoldHeroLevelCurrencyCountByActivityId(activityId) local heroType = MDL.GoldenHeroMain.GetHeroTypeByActivityId(activityId) local levelEnergyType = DataSheetManager.GoldHeroActivityModeData:GetDataByHeroType(heroType).LevelEnergyType return MDL.GoldenHeroMain.GetGoldHeroEnergyInfo(levelEnergyType) end ---@return table 获取任务链ID列表 function GoldenHeroStory_Model.GetTaskIDListByGoldenHeroID(goldenHeroID) if not private.goldenHeroTaskIDList[goldenHeroID] then private.goldenHeroTaskIDList[goldenHeroID] = {} for k,v in DataSheetManager.GoldHeroActivityGroup[goldenHeroID]:GetEnumerator() do if #v.TaskID > 0 then for i,taskID in ipairs(v.TaskID) do table.insert(private.goldenHeroTaskIDList[goldenHeroID], taskID) end end end end return private.goldenHeroTaskIDList[goldenHeroID] end ---@return table 获取关卡ID列表 function GoldenHeroStory_Model.GetLevelIDListByGoldenHeroID(goldenHeroID) if not private.goldenHeroLevelIDList[goldenHeroID] then private.goldenHeroLevelIDList[goldenHeroID] = {} for k,v in DataSheetManager.GoldHeroActivityGroup[goldenHeroID]:GetEnumerator() do if #v.LevelID > 0 then for i,levelID in ipairs(v.LevelID) do if levelID > 0 then table.insert(private.goldenHeroLevelIDList[goldenHeroID], levelID) end end end end end return private.goldenHeroLevelIDList[goldenHeroID] end --region *********************************** 关卡相关 ************************************* ---@return number 关卡是否解锁 function GoldenHeroStory_Model.GetGoldHeroLevelStateByActivityID_LevelID(activityID, levelID) local levelUnLock = GoldenHeroStory_Model.LevelState.Lock for k,v in ipairs(private.secretInfoDict[activityID].openFBInfos) do if v.id == levelID then levelUnLock = v.achState end end return levelUnLock end ---@return table 获取指定关卡的成就信息 function GoldenHeroStory_Model.GetLevelGoalDataByActivityID_LevelID_LevelGoalID(activityID, levelID, leveGoalID) for k,v in ipairs(private.secretInfoDict[activityID].openFBInfos) do if v.id == levelID then for _,info in ipairs(v.achieves) do if info.achieveId == leveGoalID then return info end end end end return {achieveId = leveGoalID, state = GoldenHeroStory_Model.Enum_LevelAchieveState.Doing, count = 0} end ---@return number 获取指定关卡的活动ID function GoldenHeroStory_Model.GetActivityIDByLevelID(levelID) for i,activityData in pairs(private.secretInfoDict) do for j,GoldHeroFBInfo in ipairs(activityData.openFBInfos) do if GoldHeroFBInfo.id == levelID then return activityData.activityId end end end return 0 end ---@return number 获取指定关卡的成就进度 function GoldenHeroStory_Model.GetLevelGoalFinishCountByActivityID_LevelID(activityID, levelID) local finishCount = 0 for k,v in ipairs(private.secretInfoDict[activityID].openFBInfos) do if v.id == levelID then for _,info in ipairs(v.achieves) do if info.state >= 1 then finishCount = finishCount + 1 end end end end return finishCount end ---@return boolean 获取指定LevelID的红点状态 function GoldenHeroStory_Model.GetLevelRedPointByActivityID_LevelID(activityID, levelID) local goldHeroFBInfoList = private.secretInfoDict[activityID].openFBInfos for _,openFBInfo in ipairs(goldHeroFBInfoList) do if openFBInfo.id == levelID then if openFBInfo.achState == 1 then return true end for _,achieve in ipairs(openFBInfo.achieves) do if achieve.state == 1 then return true end end end end return false end ---@return boolean 获取指定activityID的新增关卡红点状态 function GoldenHeroStory_Model.GetLevelRedPointByActivityID(activityID) if MDL.GoldenHeroMain.IsActivityInFuncTime(activityID) and private.secretInfoDict[activityID] then local goldHeroFBInfoList = private.secretInfoDict[activityID].openFBInfos for _,openFBInfo in ipairs(goldHeroFBInfoList) do if openFBInfo.achState == 1 then return true end end end return false end ---@return boolean 获取指定activityID的关卡成就奖励可领取红点状态 function GoldenHeroStory_Model.GetAchievementRewardRedPointByActivityID(activityID) if MDL.GoldenHeroMain.IsActivityInFuncTime(activityID) and private.secretInfoDict[activityID] then local goldHeroFBInfoList = private.secretInfoDict[activityID].openFBInfos for _,openFBInfo in ipairs(goldHeroFBInfoList) do for _,achieve in ipairs(openFBInfo.achieves) do if achieve.state == GoldenHeroStory_Model.Enum_LevelAchieveState.WaitForGet then return true end end end end return false end ---@return boolean 获取指定activityID,levelID的关卡成就奖励可领取红点状态 function GoldenHeroStory_Model.GetAchievementRewardRedPointByActivityID_LevelID(activityID, levelID) if MDL.GoldenHeroMain.IsActivityInFuncTime(activityID) and private.secretInfoDict[activityID] then local goldHeroFBInfoList = private.secretInfoDict[activityID].openFBInfos for _,openFBInfo in ipairs(goldHeroFBInfoList) do if openFBInfo.id == levelID then for _,achieve in ipairs(openFBInfo.achieves) do if achieve.state == GoldenHeroStory_Model.Enum_LevelAchieveState.WaitForGet then return true end end end end end return false end ---@return boolean 获取指定activityID,levelID的关卡成就奖励可领取状态 function GoldenHeroStory_Model.GetAchievementRewardRedPointListByActivityID_LevelID(activityID, levelID) local rpList = {} local goldHeroFBInfoList = private.secretInfoDict[activityID].openFBInfos for _,openFBInfo in ipairs(goldHeroFBInfoList) do if openFBInfo.id == levelID then for _,achieve in ipairs(openFBInfo.achieves) do table.insert(rpList, achieve.state) end end end return #rpList > 0 and rpList or {GoldenHeroStory_Model.Enum_LevelAchieveState.Doing, GoldenHeroStory_Model.Enum_LevelAchieveState.Doing, GoldenHeroStory_Model.Enum_LevelAchieveState.Doing} end ---@return boolean 获取指定activityID中的关卡可扫荡状态 function GoldenHeroStory_Model.GetSweepRedPointByActivityID(activityID) local timeId = DataSheetManager.GoldHeroActivityModeData:GetDataByHeroType(MDL.GoldenHeroMain.GetHeroTypeByActivityId(activityID)).DailyRankEndTime if not UTL.Time.IsServerInOpeningTime(1, timeId) then return false end if MDL.GoldenHeroMain.IsActivityInFuncTime(activityID) and private.secretInfoDict[activityID] then for k,v in ipairs(private.secretInfoDict[activityID].openFBInfos) do if v.achState == GoldenHeroStory_Model.LevelState.Sweep and CTL.GoldenHeroStory.IsEnergyEnough(activityID, v.id) then return true end end end return false end ---@return boolean 获取指定activityID,levelID的关卡可扫荡状态 function GoldenHeroStory_Model.GetSweepRedPointByActivityID_LevelID(activityID, levelID) local timeId = DataSheetManager.GoldHeroActivityModeData:GetDataByHeroType(MDL.GoldenHeroMain.GetHeroTypeByActivityId(activityID)).DailyRankEndTime if not UTL.Time.IsServerInOpeningTime(1, timeId) then return false end if MDL.GoldenHeroMain.IsActivityInFuncTime(activityID) and private.secretInfoDict[activityID] and CTL.GoldenHeroStory.IsEnergyEnough(activityID, levelID) then for k,v in ipairs(private.secretInfoDict[activityID].openFBInfos) do if v.id == levelID then if v.achState == GoldenHeroStory_Model.LevelState.Sweep then return true else return false end end end end return false end ---@return void 响应金将货币刷新事件,刷新可扫荡红点 function private.RefreshStorySweepRp() local goldHeroInfoList = MDL.OperationActivity.GetOperationActivityInfo(private.ActivityType) if goldHeroInfoList then for i, v in pairs(goldHeroInfoList) do local activityId = v.activityId if private.initRedPointList[activityId] then local isCanSweep = GoldenHeroStory_Model.GetSweepRedPointByActivityID(activityId) and MDL.GoldenHeroMain.IsActivityInFuncTime(activityId) MDL.RedPoint.UpdateNodeStateByLogicParams(isCanSweep, CTL.GoldenHeroMain.RpEventId[activityId].TownHome, CTL.GoldenHeroMain.RpEventId[activityId].StorySweep) end end end end --endregion *********************************** 关卡相关 ************************************* --region ******************************** 任务相关 ***************************** ---@return number 获取任务链状态 function GoldenHeroStory_Model.GetTaskStateByActivityID_HeroType_TaskFatherID(activityID, heroType, taskFatherID) local taskGroupInfo = private.secretInfoDict[activityID].groupInfo if taskGroupInfo then if taskGroupInfo.doneIds and #taskGroupInfo.doneIds > 0 then for i = 1, #taskGroupInfo.doneIds do local goldHeroActivityGroupCfg = DataSheetManager.GoldHeroActivityGroup[heroType]:GetDataByGroupID(taskGroupInfo.doneIds[i]) for k,v in ipairs(goldHeroActivityGroupCfg.TaskID) do if v == taskFatherID then return GoldenHeroStory_Model.Enum_TaskState.Done end end end end if taskGroupInfo.doingId and taskGroupInfo.doingId > 0 then local goldHeroActivityGroupCfg = DataSheetManager.GoldHeroActivityGroup[heroType]:GetDataByGroupID(taskGroupInfo.doingId) for k,v in ipairs(goldHeroActivityGroupCfg.TaskID) do if v == taskFatherID then local activityTaskLineID = DataSheetManager.GoldHeroActivityTask:GetDataByTaskID(v).TaskChainID local taskList = MDL.Task.GetTaskList(MDL.Task.Enum_TaskType.GoldHeroActivity) if taskList then for __, task in pairs(taskList) do if activityTaskLineID == task.taskChildData[1].TaskLineID then return GoldenHeroStory_Model.Enum_TaskState.Doing end end end local doneTaskList = MDL.Task.GetCompletedTaskByID(activityTaskLineID) if doneTaskList then return GoldenHeroStory_Model.Enum_TaskState.Done end end end end end return GoldenHeroStory_Model.Enum_TaskState.Lock end ---@return number 获取ActivityID function GoldenHeroStory_Model.GetActivityIDByTaskLineID(taskLineID) local heroType = 0 local goldHeroActivityTaskID = 0 for k,taskData in DataSheetManager.GoldHeroActivityTask:GetEnumerator() do if taskData.TaskChainID == taskLineID then goldHeroActivityTaskID = taskData.TaskID heroType = taskData.HeroType break end end local groupID = 0 if goldHeroActivityTaskID > 0 then for k,groupData in DataSheetManager.GoldHeroActivityGroup[heroType]:GetEnumerator() do for i,taskIdData in ipairs(groupData.TaskID) do if taskIdData == goldHeroActivityTaskID then groupID = groupData.GroupID break end end if groupID > 0 then break end end end if groupID > 0 then for i,activityData in pairs(private.secretInfoDict) do for j,groupId in ipairs(activityData.groupInfo.doneIds) do if groupId == groupID and activityData.heroType == heroType then local isOpen = CTL.OperationActivity.IsOperationActivityOpen(MDL.OperationActivity.GetOperationActivityInfo(private.ActivityType)[activityData.activityId]) local isStillGoing = CTL.OperationActivity.IsOperationActivityStillGoing(private.ActivityType, activityData.activityId) if isOpen and isStillGoing then return activityData.activityId end end end if activityData.groupInfo.doingId == groupID and activityData.heroType == heroType then local isOpen = CTL.OperationActivity.IsOperationActivityOpen(MDL.OperationActivity.GetOperationActivityInfo(private.ActivityType)[activityData.activityId]) local isStillGoing = CTL.OperationActivity.IsOperationActivityStillGoing(private.ActivityType, activityData.activityId) if isOpen and isStillGoing then return activityData.activityId end end end end return nil end ---@return table 获取开放组ID数组 function GoldenHeroStory_Model.GetServerGroupInfoByActivityID(activityID) local groupIDList = {} local groupData = private.secretInfoDict[activityID].groupInfo for k,v in ipairs(groupData.doneIds) do table.insert(groupIDList, v) end if groupData.doingId > 0 then table.insert(groupIDList, groupData.doingId) end return groupIDList end ---@return boolean 是否显示下一关倒计时 function GoldenHeroStory_Model.IsShowNextLevelTimerByActivityID(activityID, heroType) if GoldenHeroStory_Model.IsUnclockAllEndingByActivityID(activityID) then return false end local startTime = MDL.OperationActivity.GetOperationActivityInfo(private.ActivityType, activityID).startTime local curDay = UTL.Time.GetTimestampDay(startTime) -- 当前是活动第几天 local openGroupCount = 0 -- 记录当前天数能开启的任务组数量 for _,v in DataSheetManager.GoldHeroActivityOpen[heroType]:GetEnumerator() do if v.Day <= curDay then openGroupCount = openGroupCount + v.OpenGroup end end local serverOpenGroupCount = 0 local serverOpenGroupIDList = {} local groupData = private.secretInfoDict[activityID].groupInfo for k,v in ipairs(groupData.doneIds) do table.insert(serverOpenGroupIDList, v) end for _,groupID in ipairs(serverOpenGroupIDList) do local groupCfg = DataSheetManager.GoldHeroActivityGroup[heroType]:GetDataByGroupID(groupID) if #groupCfg.NextGroupID < 2 then serverOpenGroupCount = serverOpenGroupCount + 1 end end if curDay >= DataSheetManager.GoldHeroActivityOpen[heroType]:GetDataCount() and serverOpenGroupCount >= openGroupCount then return false end return serverOpenGroupCount >= openGroupCount end --endregion ******************************** 任务相关 ***************************** --region ********************************** 秘闻录相关 ************************************** ---@return table 获取结局ID列表 function GoldenHeroStory_Model.GetEndingIDListByActivityID(activityID) return private.secretInfoDict[activityID].stories end ---@return boolean 获取指定activityID的秘闻录奖励可领取红点状态 function GoldenHeroStory_Model.GetEndingRewardRedPointByActivityID(activityID) if MDL.GoldenHeroMain.IsActivityInFuncTime(activityID) and private.secretInfoDict[activityID] then local endingInfoList = private.secretInfoDict[activityID].stories for _,endingInfo in ipairs(endingInfoList) do if endingInfo.state == 1 then return true end end end return false end --是否已经解锁了所有结局 function GoldenHeroStory_Model.IsUnclockAllEndingByActivityID(activityID) local stories = private.secretInfoDict[activityID].stories if stories then for _, v in ipairs(stories) do if v.state == 0 then return false end end end return true end --是否可以跳过金将列传剧情关卡线(已经通过一次关) function GoldenHeroStory_Model.IsCanSkipLevel(activityID) return private.secretInfoDict[activityID] and private.secretInfoDict[activityID].hasReadAllStory or false end --endregion ********************************** 秘闻录相关 ************************************** --endregion *********************************** 外界获取数据接口 ************************************* --region ******************* 交互协议 **************************** ---@public 登录推送秘闻数据 function GoldenHeroStory_Model.SyncPullGoldHeroSecretInfo(msgResp) private.secretInfoDict = {} for k,v in ipairs(msgResp) do local activityId = v.activityId private.secretInfoDict[activityId] = v MDL.GoldenHeroMain.SetHeroTryFirstPassRp(v.isFirstTrialRed) if private.initRedPointList[activityId] then local goldenHeroRP = CTL.GoldenHeroMain.RpEventId[activityId] local isOpenActive = MDL.GoldenHeroMain.IsActivityInFuncTime(activityId) local isShowEnding = DataSheetManager.GoldHeroActivityModeData:GetDataByHeroType(MDL.GoldenHeroMain.GetHeroTypeByActivityId(activityId)).IsDisplayRecord if isShowEnding then local isHasEndingReward = GoldenHeroStory_Model.GetEndingRewardRedPointByActivityID(activityId) and isOpenActive MDL.RedPoint.UpdateNodeStateByLogicParams(isHasEndingReward, goldenHeroRP.TownHome, goldenHeroRP.StoryEndingReward) end local isHasAchievementReward = GoldenHeroStory_Model.GetAchievementRewardRedPointByActivityID(activityId) and isOpenActive MDL.RedPoint.UpdateNodeStateByLogicParams(isHasAchievementReward, goldenHeroRP.TownHome, goldenHeroRP.StoryAchievementReward) local isHasNewLevel = GoldenHeroStory_Model.GetLevelRedPointByActivityID(activityId) and isOpenActive MDL.RedPoint.UpdateNodeStateByLogicParams(isHasNewLevel, goldenHeroRP.TownHome, goldenHeroRP.StoryNewLevel) local isCanSweep = GoldenHeroStory_Model.GetSweepRedPointByActivityID(activityId) and isOpenActive MDL.RedPoint.UpdateNodeStateByLogicParams(isCanSweep, goldenHeroRP.TownHome, goldenHeroRP.StorySweep) --武将试用红点 MDL.RedPoint.UpdateNodeStateByLogicParams(MDL.GoldenHeroMain.GetHeroTryFirstPassRp(), goldenHeroRP.TownHome, goldenHeroRP.HeroTryFirstPass) else CTL.GoldenHeroMain.InitStoryRedPointTreeByActivityId(activityId) private.initRedPointList[activityId] = true --武将试用红点 CTL.GoldenHeroMain.InitHeroTryFirstPassRedPointTreeByActivityId(activityId) end MDL.GoldenHeroMain.SetGoldHeroEnergyBuyCount(activityId, v.buyInfo) end EventSystem.Dispatch(EventID.UI_GoldenHeroStory_RefreshStoryPanel) end ---@public 登录推送开幕、结局弹窗数据 function GoldenHeroStory_Model.GoldHeroOpenStoryChange(msgResp) --logging.log(LTAG.LOG, "GoldHeroOpenStoryChange", msgResp) if msgResp.openStoryId > 0 then CTL.GoldenHeroStory.OpenGoldHeroStoryEndingPanel(msgResp.openStoryId) elseif msgResp.openGroupId > 0 then CTL.GoldenHeroStory.OpenGoldenHeroStoryStartPanel(msgResp.openGroupId) end end ---@public 关卡扫荡 function GoldenHeroStory_Model.GoldHeroFBSweepRequest(activityID, fuBenID, sweepNum) local msg = gold_hero_secret_opt_pb.GoldHeroFBSweepReq() msg.activityId = activityID msg.fbId = fuBenID msg.sweepNum = sweepNum NetManager.SendMessage(MessageEnums.MessageGoldHeroFBSweep, msg) end function private.GoldHeroFBSweepResponse(msgResp) --[[ for i,v in ipairs(msgResp.SweepRewardList) do logging.log(LTAG.LOG," GoldHeroFBSweepResponse ", v) end --]] EventSystem.Dispatch(EventID.UI_SweepFuben_Refresh, msgResp.SweepRewardList) end ---@public 领取关卡成就奖励 function GoldenHeroStory_Model.GoldHeroFBAchievementAwardRequest(activityID, id) local msg = gold_hero_secret_opt_pb.GoldHeroFBAchievementAwardReq() msg.activityId = activityID msg.id = id NetManager.SendMessage(MessageEnums.MessageGoldHeroFBAchievementAward, msg) end function private.GoldHeroFBAchievementAwardResponse(msgResp) --logging.log(LTAG.LOG, "GoldHeroFBAchievementAwardResponse", msgResp) local goldHeroFBInfoList = private.secretInfoDict[msgResp.activityId].openFBInfos for k,v in ipairs(goldHeroFBInfoList) do if v.id == msgResp.fbInfo.id then v.achState = msgResp.fbInfo.achState for _,achieve in ipairs(msgResp.fbInfo.achieves) do for _,curAchieve in ipairs(v.achieves) do if achieve.achieveId == curAchieve.achieveId then curAchieve.state = achieve.state end end end end end local isHasAchievementReward = GoldenHeroStory_Model.GetAchievementRewardRedPointByActivityID(msgResp.activityId) MDL.RedPoint.UpdateNodeStateByLogicParams(isHasAchievementReward, CTL.GoldenHeroMain.RpEventId[msgResp.activityId].TownHome, CTL.GoldenHeroMain.RpEventId[msgResp.activityId].StoryAchievementReward) EventSystem.Dispatch(EventID.UI_GoldenHeroStory_RefreshStoryStarPanel) end ---@public 领取秘闻录的奖励 function GoldenHeroStory_Model.GoldHeroStoryAwardRequest(activityID, endingID) local msg = gold_hero_secret_opt_pb.GoldHeroStoryAwardReq() msg.activityId = activityID msg.id = endingID NetManager.SendMessage(MessageEnums.MessageGoldHeroStoryAward, msg) end function private.GoldHeroStoryAwardResponse(msgResp) --logging.log(LTAG.LOG, "GoldHeroStoryAwardResponse", msgResp) local goldHeroStoryEndingList = private.secretInfoDict[msgResp.activityId].stories for k,v in ipairs(goldHeroStoryEndingList) do if v.id == msgResp.storyInfo.id then v.state = msgResp.storyInfo.state end end local isHasEndingReward = GoldenHeroStory_Model.GetEndingRewardRedPointByActivityID(msgResp.activityId) MDL.RedPoint.UpdateNodeStateByLogicParams(isHasEndingReward, CTL.GoldenHeroMain.RpEventId[msgResp.activityId].TownHome, CTL.GoldenHeroMain.RpEventId[msgResp.activityId].StoryEndingReward) EventSystem.Dispatch(EventID.UI_GoldenHeroStory_RefreshEnding) end ---@public 领取秘闻录的奖励 function GoldenHeroStory_Model.GoldHeroSkipAllStoryReq(activityID) local msg = gold_hero_secret_opt_pb.GoldHeroSkipAllStoryReq() msg.activityId = activityID NetManager.SendMessage(MessageEnums.MessageGoldHeroSkipAllStory, msg) end function private.GoldHeroSkipAllStoryResp(msgResp) EventSystem.Dispatch(EventID.UI_GoldenHeroStory_GoldHeroSkipAllStory) end ---@public 进副本 function GoldenHeroStory_Model.EnterGoldenHeroStoryRequest(goldenHeroActivityLevelId, mapID, activityId) if CTL.TeamMatch.IsCanGoOtherScene(LuaConst.LevelType.GoldHeroExperience, mapID) == false then return end local msg = fuben_pb.EnterFubenReq() msg.id = goldenHeroActivityLevelId msg.mapType = LuaConst.LevelType.GoldHeroExperience msg.mapID = mapID --logging.log(LTAG.LOG, "EnterGoldenHeroStoryRequest", msg, MessageEnums.MessageEnterFuben) NetManager.SendMessage(MessageEnums.MessageEnterFuben, msg) local levelCfg = DataSheetManager.GoldHeroActivityLevel:GetDataByID(goldenHeroActivityLevelId) local levelState = GoldenHeroStory_Model.GetGoldHeroLevelStateByActivityID_LevelID(activityId, levelCfg.ID) -- 关卡状态 local isFirst = levelState == GoldenHeroStory_Model.LevelState.UnLock private.SaveTempData(activityId, goldenHeroActivityLevelId, isFirst) CTL.GoldenHeroMain.SetIsOpenedActivity() end --endregion ******************* 交互协议 **************************** --region ******************************** 关卡结束返回数据处理 ******************************* function GoldenHeroStory_Model.LoadTempData() return private.tempActivityId, private.tempLevelId, private.tempLevelIsFirst end function private.SaveTempData(activityId, levelID, levelIsFirst) private.tempActivityId = activityId private.tempLevelId = levelID private.tempLevelIsFirst = levelIsFirst end function GoldenHeroStory_Model.ClearTempData() private.tempActivityId = nil private.tempLevelId = nil private.tempLevelIsFirst = nil end function GoldenHeroStory_Model.GetCurLevelSystemData() return DataSheetManager.GoldHeroActivityLevel:GetDataByID(private.tempLevelId) end --endregion ******************************** 关卡结束返回数据处理 ******************************* return GoldenHeroStory_Model