|
|
- require("game.guide.GuideModel")
- require("game.guide.GuideShowView")
- require("game.guide.GuidePromptView")
- require("game.guide.HelpType")
- require("game.guide.GuideMasktView")
- require("game.guide.GuideHorseUseView")
- require("game.guide.ReChargePreView")
- require("game.guide.GuideTaskLimitView")
- require("game.guide.GuideIntroduceView")
- require("game.guide.GuideSpiritView")
- require("game.guide.GuideSpiritItem")
-
- --新增
- require("game.guide.GuideWelcomeView")
- require("game.guide.GuideStartView")
-
-
- GuideController = GuideController or BaseClass(BaseController)
- local GuideController = GuideController
- function GuideController:__init()
- GuideController.Instance = self
- self.model = GuideModel:getInstance()
- self.is_monster_create = false -- 是否怪物已经创建
- self.sound_id = 0
- self:RegisterProtocals()
- self:InitEvent()
- end
-
- function GuideController:RegisterProtocals()
- self:RegisterProtocal(10210, "on10210") --终身引导的事件列表
- self:RegisterProtocal(10211, "on10211") --终身引导的事件状态变更
- end
-
- function GuideController:on10210( )
- local vo = SCMD10210.New(true)
- self.model:SetLifelongHelpList(vo.list)
- end
-
- function GuideController:on10211( )
- local vo = SCMD10211.New(true)
- self.model:SetLifelongHelp(vo)
- end
-
-
- function GuideController:InitEvent()
- local function onReqLifelongHelp( id, state )
- self:SendFmtToGame(10211, "hc", id, state)
- end
- GlobalEventSystem:Bind(GuideModel.REQ_LIFELONG_HELPER_CHANGE, onReqLifelongHelp)
-
- --游戏登陆加载配置
- local function onGameStart()
- self.func_help_vo = false
- self.need_force_do_task = false
- self.model:ClearData()
- self.model:InitCookiesList()
- self.model:FinishOverHelp()
- GlobalEventSystem:Fire(EventName.IS_SHOW_TRUN_MASK_HELPER) --cookie加载完 刷新一下主界面
-
- --检测自动做主线
- self:StartCheckAutoDoTask()
- --获取终身引导的事件列表
- self:SendFmtToGame(10210)
- end
- GlobalEventSystem:Bind(EventName.COOKIE_INIT_FINISH, onGameStart)
-
- --新手剧情
- local function onWelcome(chapter_id)
- if ClientConfig.alpha_mode then
- return
- end
- if not self.story_view then
- self.story_view = GuideWelcomeView.New()
- end
- self.story_view:Open(chapter_id)
- end
- GlobalEventSystem:Bind(EventName.PLAY_ENTER_WELCOME_VIEW, onWelcome)
-
- --新手剧情
- local function onGuideStart(chapter_id)
- if ClientConfig.alpha_mode then
- return
- end
- if not self.guide_start_view then
- self.guide_start_view = GuideStartView.New()
- end
- self.guide_start_view:Open(chapter_id)
- end
- GlobalEventSystem:Bind(EventName.PLAY_ENTER_GUIDE_START_VIEW, onGuideStart)
-
-
- local function onSceneLoadFiinish()
- --当前需要触发特殊引导
- if self.need_retrigger_special_type and SceneManager:getInstance():IsMainCityorYieldSceneNotGuild() then
- local function on_delay( )
- GlobalEventSystem:Fire(GuideModel.EXECUTE_LIFELONG_HELPER, self.need_retrigger_special_type)
- self.need_retrigger_special_type = false
- end
- setTimeout(on_delay, 0.5)
- end
- --执行cookie所有的引导
- if not self.model.scene_init_finish then
- self.model.scene_init_finish = true
- setTimeout(function () self:TriggerAllHelper() end,0.3)
- end
- end
- GlobalEventSystem:Bind(EventName.SCENE_LOAD_VIEW_COMPLETE,onSceneLoadFiinish)
-
- -- 升级
- local function onLevelUp(lv)
- -- self:TriggerHelper(GuideModel.LEVEL_TRIGGER_TYPE,lv) -- 触发升级引导
- --特殊引导
- if lv and lv == GuideModel.LIFELONG_MARKET_OPEN_TYPE_LEVEL then
- if self.model:NeedTriggerMarketOpenType() then
- self.need_retrigger_special_type = GuideModel.LIFELONG_TYPE.MARKET_OPEN
- end
- elseif lv and lv == GuideModel.LIFELONG_ELITE_ASSESS_TYPE_LEVEL then
- self.need_retrigger_special_type = GuideModel.LIFELONG_TYPE.ELITE_ASSESS
- end
- --当前是在大世界中,则直接触发
- if self.need_retrigger_special_type and SceneManager:getInstance():IsMainCityorYieldSceneNotGuild() then
- local function on_delay( )
- GlobalEventSystem:Fire(GuideModel.EXECUTE_LIFELONG_HELPER, self.need_retrigger_special_type)
- self.need_retrigger_special_type = false
- end
- setTimeout(on_delay, 0.5)
- end
- end
- RoleManager:getInstance().mainRoleInfo:Bind(EventName.CHANGE_LEVEL, onLevelUp)
- GlobalEventSystem:Bind(EventName.OFFLINE_LEVEL_UP, onLevelUp) --离线挂机,上线触发升级
-
- local function onTaskFinishHandler(taskId)
- self:TriggerHelper(GuideModel.TASK_TRIGGER_TYPE,taskId)
- self:TriggerStory(taskId)
- end
- GlobalEventSystem:Bind(TaskEvent.ANS_FINISHED_TASK_LIST, onTaskFinishHandler)
-
- local function onTaskSuccessHandler(taskId)
- --支线完成引导
- if taskId == 3150001 then
- local helpVo = GuideModel:getInstance():GetHelpVo(HelpType.TYPE_EXTENSION_LINE_TASK_FINISH,1)
- if helpVo then
- GlobalEventSystem:Fire(EventName.FINISH_CURRENT_HELP_STEP,helpVo)
- end
- end
- end
- GlobalEventSystem:Bind(TaskEventType.TASK_SUCCESS, onTaskSuccessHandler)
-
- local function onFinsishCurrentStep(helpVo,ignore_prompt)
- self:FinishCurrentHelpStep(helpVo,ignore_prompt)
- end
- GlobalEventSystem:Bind(EventName.FINISH_CURRENT_HELP_STEP,onFinsishCurrentStep)
-
- local function onFinsishAllStep(helpVo)
- self.model:FinishAll(helpVo)
- end
- GlobalEventSystem:Bind(EventName.FINISH_ALL_HELP_STEP,onFinsishAllStep)
-
- --新手引导测试
- local function onTestHelpStep(lv)
- -- self:TriggerHelper(GuideModel.LEVEL_TRIGGER_TYPE,lv) -- 触发升级引导
- self:TriggerHelper(GuideModel.TASK_TRIGGER_TYPE,lv)
- end
- GlobalEventSystem:Bind(EventName.TEST_HELP_STEP,onTestHelpStep)
-
- local function onGuideIntroduceView (helpVo)
- if self.GuideIntroduceView == nil then
- self.GuideIntroduceView = GuideIntroduceView.New()
- end
- self.GuideIntroduceView:Open(helpVo)
- end
- GlobalEventSystem:Bind(EventName.OPEN_GUIDE_INTRODUCE_VIEW,onGuideIntroduceView)
-
- local function onGuideMasktView(ref_tar,prompt_type)
- if self.GuideMasktView == nil then
- self.GuideMasktView = GuideMasktView.New()
- end
-
- self.GuideMasktView:Open(ref_tar,prompt_type)
- end
-
- GlobalEventSystem:Bind(EventName.OPEN_FORCE_MASK_VIEW,onGuideMasktView)
-
- local function onOpenGuideTaskLimitView(show)
- if show then
- if self.GuideTaskLimitView == nil then
- self.GuideTaskLimitView = GuideTaskLimitView.New()
- end
- self.GuideTaskLimitView:Open()
- else
- if self.GuideTaskLimitView and self.GuideTaskLimitView:HasOpen() then
- self.GuideTaskLimitView:Close()
- end
- end
- end
- GlobalEventSystem:Bind(EventName.OPEN_GUIDE_TASK_LIMIT, onOpenGuideTaskLimitView)
-
- local function onGuideSpiritView()
- if self.GuideSpiritView == nil then
- self.GuideSpiritView = GuideSpiritView.New()
- end
- self.GuideSpiritView:Open()
- end
- GlobalEventSystem:Bind(EventName.OPEN_GUIDE_SPIRIT_VIEW,onGuideSpiritView)
-
- local function onGuideHorseUseView()
- if self.GuideHorseUseView == nil then
- self.GuideHorseUseView = GuideHorseUseView.New()
- end
- self.GuideHorseUseView:Open()
- end
- GlobalEventSystem:Bind(EventName.OPEN_HORSE_GUIDE_VIEW,onGuideHorseUseView)
-
- local function onGuidePromptView(attach_node,ui_attach_node,call_back,helpVo,view_layout_file,layer_name,z_depth)
- if self.GuidePromptView then
- self.GuidePromptView:Close()
- end
-
- if self.GuidePromptView == nil then
- self.GuidePromptView = GuidePromptView.New()
- end
- self.GuidePromptView:Open(attach_node,ui_attach_node,call_back,helpVo,view_layout_file,layer_name,z_depth)
- end
- GlobalEventSystem:Bind(EventName.OPEN_GUIDE_PROMPT_VIEW,onGuidePromptView)
-
- local function onCloseGuidePromptView(layout_file)
- if self.GuidePromptView then
- local view_layout_file = self.GuidePromptView.view_layout_file
- if layout_file == nil or layout_file == view_layout_file then
- self.GuidePromptView:Close()
- end
- end
- end
- GlobalEventSystem:Bind(EventName.CLOSE_GUIDE_PROMPT_VIEW,onCloseGuidePromptView)
-
- local function change_account()
- if self.GuidePromptView then
- self.GuidePromptView:Close()
- end
- end
- GlobalEventSystem:Bind(EventName.CHANGE_ACCOUNT,change_account)
- GlobalEventSystem:Bind(EventName.CHANGE_ROLE,change_account)
-
- local function onDirectExecuteGuide(helpVo)
- if helpVo then
- self:ExecuteHelps(helpVo)
- TaskModel:getInstance():SetTaskAutoFlag(true)
- end
- end
-
- self.model:Bind(GuideModel.DIRECT_EXECUTE_HELPER,onDirectExecuteGuide)
- end
-
- -- cfg_id 可能为等级 或者任务id
- function GuideController:TriggerHelper(type,cfg_id)
- -- if ClientConfig.alpha_mode then
- -- return
- -- end
- local voList
-
- if type == GuideModel.LEVEL_TRIGGER_TYPE then
- voList = self.model:GetLevelConfig(cfg_id)
- elseif type == GuideModel.TASK_TRIGGER_TYPE then
- voList = self.model:GetTaskConfig(cfg_id)
- end
-
- if voList == nil or #voList < 1 then
- return
- end
- -- print("tanar :GuideController [start:259] ================= ")
- -- PrintTable(voList)
- -- print("tanar :GuideController [end] ================= ")
- for i,vo in ipairs(voList) do
- if not self.model:HasExecuteStep(vo) then
- self:ExecuteHelps(vo)
- break
- end
- end
- end
-
- --执行所有cookie的引导
- function GuideController:TriggerAllHelper( )
- local lvList = self.model:GetLvCookieList()
- for k,v in pairs(lvList) do
- if not v.isEnd then
- local helpList = self.model:GetLevelConfig(v.lv)
- if helpList and helpList[v.step] and not self.model:IsOverHelp(v.help_type) then
- self:ExecuteHelps(helpList[v.step])
- end
- end
- end
-
- local taskList = self.model:GetTaskCookieList()
- for k,v in pairs(taskList) do
- if not v.isEnd then
- local helpList = self.model:GetTaskConfig(v.task_id)
- if helpList and helpList[v.step] and not self.model:IsOverHelp(v.help_type) then
- self:ExecuteHelps(helpList[v.step])
- end
- end
- end
-
- self.model:TriggerBreakGuide()
- self.model:TriggerBreakLevelGuide()
- end
-
- function GuideController:PlaySound(helpVo)
- lua_soundM:StopEffect(self, LuaSoundManager.SOUND_TYPE.GUIDE, self.sound_id)
- if helpVo.sound and Trim(helpVo.sound) ~= "" then
- self.sound_id = lua_soundM:PlayEffect(self, Trim(helpVo.sound), false, LuaSoundManager.SOUND_TYPE.GUIDE, 1)
- end
- end
-
-
- -- 执行引导
- function GuideController:ExecuteHelps(helpVo)
- if helpVo == nil then
- return
- end
- --判断条件
- if helpVo.step==1 then
-
- if helpVo.task_id==Config.ConfigHelper.firstRecharge then
- --如果首充了,就不引导
- if not RechargeActivityModel:getInstance():IsNoFirstRecharge() or PlatformMgr:getInstance():IsMlLianyun() then
- self:FinishCurrentHelpStep(helpVo)
- GlobalEventSystem:Fire(EventName.START_AUTO_DO_TASK)
- return
- end
- elseif helpVo.task_id==Config.ConfigHelper.firstRechargeTip then
- if PlatformMgr:getInstance():IsMlLianyun() then
- self:FinishCurrentHelpStep(helpVo)
- GlobalEventSystem:Fire(EventName.START_AUTO_DO_TASK)
- return
- end
- end
- end
-
- --为防止多个新功能开放,必须先把之前的清除
- if helpVo.help_type == HelpType.NEW_FUNC_OPEN then
- local last_helpVo = GuideModel:getInstance():GetHelpVo(HelpType.NEW_FUNC_OPEN,1)
- if last_helpVo then
- self.model:FinishCurrHelper(last_helpVo)
- end
-
- FuncOpenModel:getInstance():ClearOpenCondition()
- FuncOpenModel:getInstance():ClearOpenFuncData()
-
- if self.open_timer_id then
- GlobalTimerQuest:CancelQuest(self.open_timer_id)
- self.open_timer_id = nil
- end
- --这个单独处理
- if not SceneManager.Instance:IsMainCityorYieldScene() then
- self.func_help_vo = helpVo
- return
- end
- GlobalEventSystem:Fire(EventName.OPEN_STRENGTH_VIEW, false)
- end
-
- self.model:SetCurTriggerType(helpVo.type)
- self.model:SetCurHelpType(helpVo.help_type)
- self.model:SetCurHelpStep(helpVo.step)
- self.model:SetCurHelpVo(helpVo)
- helpVo.isEnd = false --正在执行的 标记为false
- --写入cookies
- self.model:SetHelperStep(helpVo)
-
- if helpVo.hide_small_ui then
- self.model:SetHideSmallUI(true)
- ItemUseModel:getInstance():HideItemUseView()
- self.model:HideUILayUI()
- end
- if helpVo.help_type == HelpType.NEW_FUNC_OPEN then
- -- GlobalEventSystem:Fire(EventName.CLOSE_ALL_VIEW)
- -- GlobalEventSystem:Fire(EventName.CLOSE_CHAT_VIEW)
- -- GlobalEventSystem:Fire(EventName.OPEN_TASK_BOUNTY_REWARD_VIEW,nil,true)
- -- local onDelay = function( )
- -- GlobalEventSystem:Fire(EventName.TRIGGER_NEW_FUNC_OPEN_HELPER,helpVo)
- -- self:ChangeSound(helpVo)
- -- end
- -- self.open_timer_id = setTimeout(onDelay, 0.3)
- GlobalEventSystem:Fire(EventName.STOP_AUTO_DO_TASK)
- GlobalEventSystem:Fire(EventName.TRIGGER_NEW_FUNC_OPEN_HELPER,helpVo)
- elseif helpVo.help_type == HelpType.TASK_ITEM_SHOW then
- -- if self.show_timer_id then
- -- GlobalTimerQuest:CancelQuest(self.show_timer_id)
- -- self.show_timer_id = nil
- -- end
- -- EventSystem.Fire(GlobalEventSystem, EventName.STOPAUTOFIGHT, false, true)--寻路要先切换掉自动挂机状态
- -- GlobalEventSystem:Fire(EventName.STOP_AUTO_DO_TASK)
- -- GlobalEventSystem:Fire(EventName.CLOSE_ALL_VIEW)
- -- local onDelay = function( )
- -- self:ShowModel(helpVo)
- -- self:ChangeSound(helpVo)
- -- end
- -- self.show_timer_id = setTimeout(onDelay, 0.1)
- GlobalEventSystem:Fire(EventName.GUIDE_CLOSE_VIEW)
- self:ShowModel(helpVo)
- elseif helpVo.help_type == HelpType.OPEN_UI_VIEW then
- self:OpenUI(helpVo)
- self:FinishCurrentHelpStep(helpVo)
- --收起菜单
-
- setTimeout(function()
- GlobalEventSystem:Fire(EventName.OPEN_LEFT_MIDDLE_MENU, false)
- end,0.6)
-
- elseif helpVo.help_type == HelpType.ENTER_MISSION then
- self:EnterMission(helpVo)
- self:FinishCurrentHelpStep(helpVo)
- elseif helpVo.help_type == HelpType.CAST_SKILL then --播放技能
- self:CastSkill(helpVo)
- elseif helpVo.help_type == HelpType.FORCE_MASK then --强制遮罩
-
- elseif helpVo.help_type == HelpType.OPEN_LIST_SHOW_ICON then --展开列表图标显示特效
- local onDelay = function ( )
- self:ExpandIconList(helpVo)
- self:FinishCurrentHelpStep(helpVo)
- end
- setTimeout(onDelay, 0.3)
- GlobalEventSystem:Fire(EventName.START_AUTO_DO_TASK)
- elseif helpVo.help_type == HelpType.OPEN_LIST_SHOW_PROMPT then --展开列表图标显示指引
- local onDelay = function ( )
- if helpVo.task_id == Config.ConfigHelper.mountTask then --永恒碑谷没开启的话, 要升级后再判断一次
- if not ActivityIconManager:getInstance():IsIconShow(21) then
- self.model.wait_level_up = helpVo
- return
- end
- end
- self:ShowIconListGuide(helpVo)
- end
- setTimeout(onDelay, 0.5)
- elseif helpVo.help_type == HelpType.DELAY_TIME then --延迟执行 param 为延迟的秒数
- self:DelayTime(helpVo)
- elseif helpVo.help_type == HelpType.CONTINUM_TASK then --继续任务
- self:ContinumTask(helpVo)
- elseif helpVo.help_type == HelpType.HIDE_SMALL_UI then --隐藏一些如道具使用的小界面
- ItemUseModel:getInstance():HideItemUseView()
- self.model:HideUILayUI()
- self:FinishCurrentHelpStep(helpVo)
- elseif helpVo.help_type == HelpType.SHOW_SMALL_UI then --显示一些如道具使用的小界面
- ItemUseModel:getInstance():ShowItemUseView()
- self.model:ShowUILayUI()
- self:FinishCurrentHelpStep(helpVo)
- elseif helpVo.help_type == HelpType.SHOW_CHAPTER then --章节引导
- GlobalEventSystem:Fire(EventName.PLAY_ENTER_WELCOME_VIEW, helpVo.chapter_id)
- -- elseif helpVo.help_type == HelpType.PLAY_SOUND then --变身降神
- -- if helpVo.sound and Trim(helpVo.sound) ~= "" then
- -- self:PlaySound(helpVo)
- -- end
- -- self:FinishCurrentHelpStep(helpVo)
- end
-
- --播放音效
- if helpVo.sound and Trim(helpVo.sound) ~= "" then
- self:PlaySound(helpVo)
- end
-
- GlobalEventSystem:Fire(EventName.TRIGGER_GUIDE_TYPE, helpVo)
- end
-
- -- 打开UI
- function GuideController:OpenUI(helpVo)
- if helpVo then
- local param = helpVo.param
- local arr = stringtotable(param)
- if arr and arr[1] then
- local winId = tostring(arr[1][1])
- local subId = tonumber(arr[1][2])
- local value = tonumber(arr[1][3])
- OpenFun.Open(winId, subId, value)
- end
- end
- end
-
- function GuideController:ShowModel(helpVo)
- -- if helpVo then
- -- local param = helpVo.param
- -- local arr = Split(param,",")
- -- if arr and #arr > 0 then
- -- GlobalEventSystem:Fire(EventName.OPEN_GUIDE_SHOW_VIEW,arr,helpVo.saying)
- -- end
- -- end
- local onDelay = function( )
- -- self:CheckHideUILayer(helpVo)
- GlobalEventSystem:Fire(EventName.TRIGGER_NEW_FUNC_OPEN_HELPER,helpVo)
- self:ChangeSound(helpVo)
- end
- setTimeout(onDelay, 0.1)
- end
-
- function GuideController:EnterMission(helpVo)
- local mission_id = tonumber(helpVo.param)
- BaseDungeonModel:getInstance():Fire(BaseDungeonModel.REQUEST_CCMD_EVENT, 61001, mission_id)
- end
-
- function GuideController:ExpandIconList( helpVo )
- if helpVo then
- local param = helpVo.param
- local arr = Split(param,",")
- if arr and #arr > 0 then
- GlobalEventSystem:Fire(EventName.EXPAND_LIST_SHOW,arr)
- end
- end
- end
-
- function GuideController:ShowIconListGuide( helpVo )
- if helpVo then
- local param = helpVo.param
- local arr = Split(param,",")
- if arr and #arr > 0 then
- GlobalEventSystem:Fire(EventName.EXPAND_LIST_GUIDE,arr)
- end
- end
- end
-
- -- 结束当前引导 ignore_prompt 一般用于引导最后一步 结束不关闭
- function GuideController:FinishCurrentHelpStep(helpVo,ignore_prompt)
- if helpVo == nil then
- return
- end
-
- --关掉界面 这些引导不关,避免把其他引导关了
- if not ignore_prompt then
- GlobalEventSystem:Fire(EventName.CLOSE_GUIDE_PROMPT_VIEW)
- end
-
- local show_small_ui = false
- if helpVo.show_small_ui then
- show_small_ui = true
- end
- local next_help_vo = self.model:GetNextHelpVo(helpVo)
-
- if next_help_vo then
- self:ExecuteHelps(next_help_vo)
- else
- --如果只配置了一个引导,而且是隐藏UI,则需要显示出来
- if helpVo.hide_small_ui then
- show_small_ui = true
- end
- self.model:FinishCurrHelper(helpVo)
-
- end
-
- if show_small_ui then
- self.model:SetHideSmallUI(false)
- ItemUseModel:getInstance():ShowItemUseView()
- self.model:ShowUILayUI()
- end
- end
-
- -- 场景切换清除数据跟特效
- function GuideController:ClearHelpDataAndRes()
- end
-
- -- 释放技能
- function GuideController:CastSkill(helpVo)
- --新手变身降神 不需要释放技能
- local god_id = RoleManager.Instance.mainRoleInfo.god_id
- if god_id > 0 then
- self:FinishCurrentHelpStep(helpVo)
- return
- end
-
- local career = RoleManager:getInstance():GetMainRoleCareer()
-
- local arr = Split(helpVo.param,",")
- if arr and arr[career] then
- local career = RoleManager:getInstance():GetMainRoleCareer()
- local skill_id = tonumber(arr[career])
- local movie_cfg = SkillManager.Instance:GetFightSkillMovie(skill_id)
- if movie_cfg and movie_cfg.back_swing then
- SkillManager:getInstance():setCurrentSkillId(skill_id)
- EventSystem.Fire(GlobalEventSystem,FightEvent.RELEASE_MAIN_SKILL,nil,nil,nil,SkillManager.SKILL_ATTACK_TYPE.ONLY_FIRE_ATTACK,true)
- local delay_fun = function ()
- self:FinishCurrentHelpStep(helpVo)
- end
- setTimeout(delay_fun, movie_cfg.back_swing + 0.15)
- end
- end
- end
-
- function GuideController:ChangeSound( helpVo )
- if helpVo.sound and Config.ConfigSound.SoundTime[Trim(helpVo.sound)] then
- local onDealy = function ( )
- self.time_id = nil
- if self.old_value then
- LuaSoundManager:getInstance():ChangeVolume(self.old_value)
- end
- end
- if not self.time_id then
- self.old_value = soundMgr.volume
- LuaSoundManager:getInstance():ChangeVolume(self.old_value*0.2)
- self.time_id = setTimeout(onDealy, Config.ConfigSound.SoundTime[Trim(helpVo.sound)])
- end
- end
- end
-
- --延迟执行
- function GuideController:DelayTime(helpVo)
- local time = tonumber(helpVo.param)
- local delay_fun = function ()
- self:FinishCurrentHelpStep(helpVo)
- end
- setTimeout(delay_fun, time)
- end
-
- --继续执行任务
- function GuideController:ContinumTask(helpVo)
- self:FinishCurrentHelpStep(helpVo)
- EventSystem.Fire(GlobalEventSystem,EventName.FORCE_TO_DO_TASK)
- end
-
- --开始检测站街自动任务
- function GuideController:StartCheckAutoDoTask()
- self:StopCheckAutoDoTask()
- if RoleManager.Instance.mainRoleInfo.level > GuideModel.AUTO_DOTASK.level then return end
-
- local function auto_onhook_check()
- local main_role = Scene.Instance:GetMainRole()
- if not Scene.Instance:GetMainRole() or not SceneManager:getInstance():IsMainCityAndFieldScene() then
- return
- end
- if RoleManager.Instance.mainRoleInfo.level > GuideModel.AUTO_DOTASK.level then
- self:StopCheckAutoDoTask()
- return
- end
- local stand_time = self.model.auto_task_stand_time ~= 0 and Time.time - self.model.auto_task_stand_time or 0
- local touch_time = GlobalUserOperateTime ~= 0 and Time.time - GlobalUserOperateTime or 0
-
- if stand_time > GuideModel.AUTO_DOTASK.time and touch_time > GuideModel.AUTO_DOTASK.time then
- GlobalEventSystem:Fire(EventName.FORCE_TO_DO_TASK)
- GlobalEventSystem:Fire(EventName.START_AUTO_DO_TASK)
- end
- end
- self.start_autotask_timer_id = GlobalTimerQuest:AddPeriodQuest(auto_onhook_check, 5, -1)
- end
-
- function GuideController:StopCheckAutoDoTask()
- if self.start_autotask_timer_id then
- GlobalTimerQuest:CancelQuest(self.start_autotask_timer_id)
- self.start_autotask_timer_id = false
- end
- end
-
- function GuideController:TriggerStory(task_id)
- if task_id == 10360 then
- if RoleManager.Instance.mainRoleInfo.career == 1 or RoleManager.Instance.mainRoleInfo.career == 2 then
- task_id = 1036001
- else
- task_id = 1036002
- end
- end
- local story_cfg = Config.Story[99999][task_id]
- if story_cfg then
- local main_role = Scene.Instance.main_role
- if story_cfg and main_role then
- main_role:DoStory(story_cfg)
- end
- end
- end
|