源战役客户端
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

920 行
24 KiB

  1. GuideModel = GuideModel or BaseClass(BaseModel)
  2. --[[
  3. NEW_FUNC_OPEN之类这种不保存在cookieGetCurHelpVo获取当前触发的引导
  4. HORSE_TYPE之类要保存在cookie的GetHelpVo获取该类型的引导
  5. ]]
  6. --引导触发类型
  7. GuideModel.LEVEL_TRIGGER_TYPE = 1
  8. GuideModel.TASK_TRIGGER_TYPE = 2
  9. GuideModel.WEAPON_TASK_ID = 10020 --采集武器任务id
  10. GuideModel.MONSTER_TASK_ID = 10000101 --三连打怪任务id
  11. GuideModel.MONSTER_ID = 1001000 --三连打怪怪物id
  12. GuideModel.VIP_EXPERIENCE_ID = 102008 --vip体验id
  13. GuideModel.VIP_EXPERIENCE_ID2 = 102036 --vip体验id2
  14. GuideModel.WeaponMonster = 10000020 --武器采集怪
  15. GuideModel.WingMonster = 1002302 --翅膀采集怪
  16. GuideModel.SpiritBgId = 501001 --星灵唤醒背景模型id
  17. GuideModel.SpiritId = 501002 --星灵唤醒模型id
  18. GuideModel.ExtendTaskId = 2080101 --装备精炼支线Id
  19. GuideModel.CHANGE_GOD_ID = 1001
  20. GuideModel.CHANGE_GOD_SCENE_ID = 10000 --变身降神场景
  21. GuideModel.CHANGE_GOD_ANGER_DOT = 3000 --变身降神最大怒气值
  22. GuideModel.STAR_HIT_SKILL_DUN_ID = 3002 --星灵羁绊技能引导副本Id
  23. GuideModel.GodUseMaxEffectLevel = 50 --将神使用大特效的等级
  24. GuideModel.MONSTER_COLLECT = { --因为只有一只,做成假采集,不然会和其他人抢
  25. [10000020] = 10020, --武器
  26. [10020023] = 10300, --坐骑
  27. }
  28. GuideModel.SCENE_ID = 1001
  29. GuideModel.MARRIAGE_ADVERTISE = 10050
  30. --直接执行引导
  31. GuideModel.DIRECT_EXECUTE_HELPER = "GuideModel.DIRECT_EXECUTE_HELPER"
  32. --社团引导
  33. GuideModel.NOT_PASS_APPLY_GUIDE = "GuideModel.NOT_PASS_APPLY_GUIDE"
  34. --执行终身引导
  35. GuideModel.EXECUTE_LIFELONG_HELPER = "GuideModel.EXECUTE_LIFELONG_HELPER"
  36. --终身引导事件变更
  37. GuideModel.REQ_LIFELONG_HELPER_CHANGE = "GuideModel.REQ_LIFELONG_HELPER_CHANGE"
  38. GuideModel.MONSTER_POS =
  39. {
  40. [1] = {x = 4767,y = 5550},
  41. [2] = {x = 5070,y = 5625},
  42. [3] = {x = 5375,y = 5648},
  43. }
  44. GuideModel.ICON_TYPE =
  45. {
  46. RIGHT_TOP = 1,
  47. SKILL = 2,
  48. BOTTOM = 3,
  49. }
  50. --自动待机一定时间,就要去做主线
  51. GuideModel.AUTO_DOTASK =
  52. {
  53. time = 600,
  54. level = 90,
  55. }
  56. --接了主线,一定时间提示手指
  57. GuideModel.DO_MAIN_TASK_TIPS =
  58. {
  59. time = 600,
  60. level = 90,
  61. }
  62. --缓存某些按钮世界坐标的类型
  63. GuideModel.CACHE_POS_TYPE =
  64. {
  65. TASK_PROGRESS = 1, --任务面板进度条的位置
  66. DIALOGUE_CLICK_BTN = 2, --对话界面 确定按钮 位置
  67. }
  68. --终身引导的类型
  69. GuideModel.LIFELONG_TYPE =
  70. {
  71. MARKET_OPEN = 1,
  72. MARKET_SELL = 2,
  73. EQUIP_EVOLVE = 3,
  74. ELITE_ASSESS = 4,
  75. SERVEN_TARGET = 5,
  76. STRENGTH_TIPS = 6,
  77. }
  78. GuideModel.LIFELONG_MARKET_OPEN_TYPE_LEVEL = 115
  79. GuideModel.LIFELONG_ELITE_ASSESS_TYPE_LEVEL = 108
  80. GuideModel.LIFELONG_SERVEN_TARGET_TYPE_LEVEL = 112
  81. function GuideModel:__init()
  82. GuideModel.Instance = self
  83. self.level_trigger_list = {} --等级触发的引导
  84. self.task_trigger_list = {} --任务触发的引导
  85. self.icon_guide_list = {} --触发引导的时候 这些已经激活的图标要先隐藏
  86. self.cookies_list = {}
  87. self.single_cookies_list = {} --针对只执行一次的引导
  88. self.is_load_data = false --是否已经加载过数据,只需要家再一次
  89. self.curr_trigger_type = nil --当前引导的触发类型 1 为等级 2 为 任务
  90. self.curr_help_type = nil --当前引导类型
  91. self.curr_help_step = nil --当前引导步骤
  92. self.curr_help_vo = nil -- 当期引导数据
  93. self.is_hide_small_ui = false --隐藏小界面
  94. self.scene_init_finish =false --场景初始化加载完成
  95. self.wait_level_up = false --等待升级再触发引导
  96. self.has_wait = false
  97. self.is_change_god_time = false --是否是降神变身期间
  98. self.need_finish_guide_first = false --是否要先完成引导在任务
  99. self.need_open_vip_view = false --是否需要打开续费界面
  100. self.is_prompt_view_open = false
  101. self.is_open_func_open = false
  102. self.need_excute_lottery = false --是否需要执行抽奖第二步引导
  103. self.show_item_use_after_close_view = false
  104. self.open_view_need_stop = false --打开某个界面是否需要暂停寻路
  105. self.need_delay_execute_guide = false --切场景的时候可能弹出副本界面结算所以要错开
  106. self.gem_mission_execute_task = false --魂珠副本优先做任务 不继续下一关
  107. self.need_force_do_task = false
  108. self.auto_task_stand_time = 0 --站街时多少秒时,自动做主线任务
  109. self.cache_guide_pos_list = {}
  110. self:LoadHelpDataFromConfig()
  111. self.lifelong_help_list = {}
  112. self.cache_show_guide = {} --缓存登陆只显示一次的引导
  113. end
  114. --清除缓存数据
  115. function GuideModel:ClearData()
  116. end
  117. function GuideModel:getInstance()
  118. if GuideModel.Instance == nil then
  119. GuideModel.New();
  120. end
  121. return GuideModel.Instance;
  122. end
  123. --从配置表读取数据到
  124. function GuideModel:LoadHelpDataFromConfig()
  125. if self.is_load_data then
  126. return
  127. end
  128. self.is_load_data = true
  129. for k,v in pairs(Config.ConfigHelper.Level) do
  130. local list = self.level_trigger_list[k]
  131. if list == nil then
  132. list = {}
  133. self.level_trigger_list[k] = list
  134. end
  135. for i,vo in ipairs(v) do
  136. vo.type = 1 --类型 1 属于等级 2 属于任务
  137. vo.lv = k
  138. vo.step = i
  139. table.insert(list,vo)
  140. end
  141. --图标创建出来要隐藏 除非v.ignore_fly
  142. local icon_cfg = stringtotable(v[1].param)
  143. if icon_cfg and icon_cfg[1] and not v.ignore_fly then
  144. local data = icon_cfg[1]
  145. if not self.icon_guide_list[data[1]] then
  146. self.icon_guide_list[data[1]] = {}
  147. end
  148. self.icon_guide_list[data[1]][data[2]] = v
  149. end
  150. end
  151. for k,v in pairs(Config.ConfigHelper.Task) do
  152. local list = self.task_trigger_list[k]
  153. if list == nil then
  154. list = {}
  155. self.task_trigger_list[k] = list
  156. end
  157. for i,vo in ipairs(v) do
  158. vo.type = 2 --类型 1 属于等级 2 属于任务
  159. vo.task_id = k
  160. vo.step = i
  161. table.insert(list,vo)
  162. end
  163. --图标创建出来要隐藏 除非v.ignore_fly
  164. local icon_cfg = stringtotable(v[1].param)
  165. if icon_cfg and icon_cfg[1] and not v.ignore_fly then
  166. local data = icon_cfg[1]
  167. if not self.icon_guide_list[data[1]] then
  168. self.icon_guide_list[data[1]] = {}
  169. end
  170. self.icon_guide_list[data[1]][data[2]] = v
  171. end
  172. end
  173. -- print("huangcong:GuideModel [start:185] :", self.icon_guide_list)
  174. -- PrintTable(self.task_trigger_list)
  175. -- print("huangcong:GuideModel [end]")
  176. end
  177. --type图标的类型 右上角图标 右下角图标 技能图标
  178. function GuideModel:GetIconIsGuild( type,index )
  179. if self.icon_guide_list[type] then
  180. return self.icon_guide_list[type][index]
  181. end
  182. end
  183. --获取等级配置
  184. function GuideModel:GetLevelConfig(lv)
  185. return self.level_trigger_list[lv]
  186. end
  187. --获取任务配置 -- 暂时先不加任务状态
  188. function GuideModel:GetTaskConfig(task_id)
  189. if self.task_trigger_list[task_id] and self.task_trigger_list[task_id] then
  190. return self.task_trigger_list[task_id]
  191. end
  192. return nil
  193. end
  194. function GuideModel:SetCurTriggerType(trigger_type)
  195. self.curr_trigger_type = trigger_type
  196. end
  197. function GuideModel:GetCurTriggerType()
  198. return self.curr_trigger_type
  199. end
  200. function GuideModel:SetCurHelpType(help_type)
  201. self.curr_help_type = help_type
  202. end
  203. function GuideModel:GetCurHelpType()
  204. return self.curr_help_type
  205. end
  206. function GuideModel:SetCurHelpStep(step)
  207. self.curr_help_step = step
  208. end
  209. function GuideModel:GetCurHelpStep()
  210. return self.curr_help_step
  211. end
  212. function GuideModel:SetCurHelpVo(vo)
  213. self.curr_help_vo = vo
  214. end
  215. function GuideModel:GetCurHelpVo()
  216. return self.curr_help_vo
  217. end
  218. function GuideModel:GetHelpCfg( helpVo )
  219. if helpVo.type == GuideModel.LEVEL_TRIGGER_TYPE then
  220. return Config.ConfigHelper.Level[helpVo.lv][helpVo.step]
  221. elseif helpVo.type == GuideModel.TASK_TRIGGER_TYPE then
  222. return Config.ConfigHelper.Task[helpVo.task_id][helpVo.step]
  223. end
  224. end
  225. --判断步骤值是否要执行
  226. function GuideModel:HasExecuteStep(helpVo)
  227. --如果没有数据,算他执行过
  228. if helpVo == nil then
  229. return true
  230. end
  231. local data = self.cookies_list[helpVo.type]
  232. if data then
  233. if helpVo.type == GuideModel.LEVEL_TRIGGER_TYPE then
  234. if helpVo.lv == 999991009 or helpVo.lv == 999991014 then ---将神\羁绊可以重复引导
  235. return false
  236. end
  237. local vo = data[helpVo.lv]
  238. if vo then
  239. return vo.step < helpVo.step
  240. end
  241. elseif helpVo.type == GuideModel.TASK_TRIGGER_TYPE then
  242. local vo = data[helpVo.task_id]
  243. if vo then
  244. return vo.step < helpVo.step
  245. end
  246. end
  247. end
  248. return false
  249. end
  250. --保存引导
  251. function GuideModel:SetHelperStep(helpVo)
  252. if helpVo == nil then
  253. return true
  254. end
  255. self.cookies_list[helpVo.type] = self.cookies_list[helpVo.type] or {}
  256. local type = helpVo.type
  257. local data = self.cookies_list[helpVo.type]
  258. if type == GuideModel.LEVEL_TRIGGER_TYPE then
  259. data[helpVo.lv] = data[helpVo.lv] or {}
  260. data[helpVo.lv].lv = helpVo.lv
  261. data[helpVo.lv].step = helpVo.step
  262. data[helpVo.lv].isEnd = helpVo.isEnd
  263. data[helpVo.lv].help_type = helpVo.help_type
  264. elseif type == GuideModel.TASK_TRIGGER_TYPE then
  265. data[helpVo.task_id] = data[helpVo.task_id] or {}
  266. data[helpVo.task_id].task_id = helpVo.task_id
  267. data[helpVo.task_id].step = helpVo.step
  268. data[helpVo.task_id].isEnd = helpVo.isEnd
  269. data[helpVo.task_id].help_type = helpVo.help_type
  270. end
  271. self:SaveHelpStepToCookies()
  272. end
  273. --只保存几个值 触发类型 触发id = 等级或者任务id 触发步骤
  274. function GuideModel:InitCookiesList()
  275. -- self.cookies_list = self:GetHelpStepFromCookies()
  276. self.cookies_list = self.cookies_list or {}
  277. local type = GuideModel.LEVEL_TRIGGER_TYPE
  278. self.cookies_list[type] = self.cookies_list[type] or {}
  279. type = GuideModel.TASK_TRIGGER_TYPE
  280. self.cookies_list[type] = self.cookies_list[type] or {}
  281. self.single_cookies_list = self:GetSingleHelpStepFromCookies() or {}
  282. end
  283. function GuideModel:GetLvCookieList( )
  284. return self.cookies_list[GuideModel.LEVEL_TRIGGER_TYPE] or {}
  285. end
  286. function GuideModel:GetTaskCookieList( )
  287. return self.cookies_list[GuideModel.TASK_TRIGGER_TYPE] or {}
  288. end
  289. function GuideModel:GetHelpStepFromCookies()
  290. return CookieWrapper.Instance:GetCookie(CookieLevelType.Account,CookieKey.HELPER_TIMES)
  291. end
  292. function GuideModel:GetSingleHelpStepFromCookies()
  293. return CookieWrapper.Instance:GetCookie(CookieLevelType.Account,CookieKey.SINGLE_HELPER_TIMES)
  294. end
  295. --操作cookies
  296. function GuideModel:SaveHelpStepToCookies()
  297. -- CookieWrapper.Instance:SaveCookie(CookieLevelType.Account,CookieTimeType.TYPE_ALWAYS,CookieKey.HELPER_TIMES,self.cookies_list)
  298. -- CookieWrapper.Instance:WriteAll()
  299. end
  300. --操作cookies
  301. function GuideModel:SaveSingleHelpStepToCookies(key)
  302. self.single_cookies_list[key] = true
  303. CookieWrapper.Instance:SaveCookie(CookieLevelType.Account,CookieTimeType.TYPE_ALWAYS,CookieKey.SINGLE_HELPER_TIMES,self.single_cookies_list)
  304. CookieWrapper.Instance:WriteAll()
  305. end
  306. function GuideModel:GetSingleTimesCookieList(key)
  307. return self.single_cookies_list[key]
  308. end
  309. --操作cookies
  310. function GuideModel:FinishCurrHelper(helpVo)
  311. helpVo.isEnd = true
  312. self:SetHelperStep(helpVo)
  313. self.curr_trigger_type = nil
  314. self.curr_help_type = nil
  315. self.curr_help_step = nil
  316. self.curr_help_vo = nil
  317. self:SaveHelpStepToCookies()
  318. end
  319. --只结束引导,不处理其他事情
  320. function GuideModel:OnlyFinishCurrHelper(helpVo)
  321. --如果当前保存的引导不清理掉 切场景的时候会重新引导
  322. if self.curr_help_vo and self.curr_help_vo.help_type == helpVo.help_type then
  323. self:SetCurHelpVo(nil)
  324. end
  325. helpVo.isEnd = true
  326. self:SetHelperStep(helpVo)
  327. self:SaveHelpStepToCookies()
  328. end
  329. --完成全部引导,避免触发下一步
  330. function GuideModel:FinishAll( helpVo )
  331. if helpVo == nil then
  332. return
  333. end
  334. GlobalEventSystem:Fire(EventName.CLOSE_GUIDE_PROMPT_VIEW)
  335. local voList
  336. local step = helpVo.step
  337. local type = helpVo.type
  338. if type == GuideModel.LEVEL_TRIGGER_TYPE then
  339. voList = self:GetLevelConfig(helpVo.lv)
  340. elseif type == GuideModel.TASK_TRIGGER_TYPE then
  341. voList = self:GetTaskConfig(helpVo.task_id)
  342. end
  343. for k,v in pairs(voList) do
  344. v.isEnd = true
  345. self:SetHelperStep(v)
  346. end
  347. self.curr_trigger_type = nil
  348. self.curr_help_type = nil
  349. self.curr_help_step = nil
  350. self.curr_help_vo = nil
  351. self:SaveHelpStepToCookies()
  352. end
  353. --获取下一个步骤引导数据
  354. function GuideModel:GetNextHelpVo(helpVo)
  355. if helpVo == nil then
  356. return
  357. end
  358. local voList
  359. local step = helpVo.step
  360. local type = helpVo.type
  361. if type == GuideModel.LEVEL_TRIGGER_TYPE then
  362. voList = self:GetLevelConfig(helpVo.lv)
  363. elseif type == GuideModel.TASK_TRIGGER_TYPE then
  364. voList = self:GetTaskConfig(helpVo.task_id)
  365. end
  366. if voList and #voList > step then
  367. return voList[step + 1]
  368. end
  369. return nil
  370. end
  371. --获取下一个步骤引导数据
  372. function GuideModel:HasHelperExetuteWhenChangeScene()
  373. if self.curr_help_type and self.curr_help_vo then
  374. return self.curr_help_vo
  375. end
  376. return false
  377. end
  378. --隐藏UI层的UI
  379. function GuideModel:HideUILayUI( )
  380. -- local go = panelMgr:GetParent("UI")
  381. -- if go then
  382. -- go.gameObject:SetActive(false)
  383. -- end
  384. -- go = panelMgr:GetParent("Top")
  385. -- if go then
  386. -- go.gameObject:SetActive(false)
  387. -- end
  388. end
  389. function GuideModel:ShowUILayUI( )
  390. -- local go = panelMgr:GetParent("UI")
  391. -- if go then
  392. -- go.gameObject:SetActive(true)
  393. -- end
  394. -- go = panelMgr:GetParent("Top")
  395. -- if go then
  396. -- go.gameObject:SetActive(true)
  397. -- end
  398. end
  399. --是否当前正在执行的引导
  400. function GuideModel:IsCurrHelper(help_type,step)
  401. if not self.scene_init_finish then
  402. return false
  403. end
  404. local vo = self:GetHelpVo(help_type,step)
  405. return vo
  406. end
  407. --不需要缓存了,直接拿当前触发的引导数据
  408. function GuideModel:GetCurHelpTypeAndStep(help_type, step)
  409. local help_vo = self:GetCurHelpVo()
  410. if help_vo then
  411. --指定类型跟步骤,就要匹配一下当前的引导是否是想要的
  412. if help_type and step then
  413. if help_type == help_vo.help_type and step == help_vo.step then
  414. return help_vo, help_vo.help_type, help_vo.step
  415. end
  416. else
  417. return help_vo, help_vo.help_type, help_vo.step
  418. end
  419. end
  420. end
  421. function GuideModel:GetHelpVo(help_type, step)
  422. if not self.scene_init_finish then
  423. return false
  424. end
  425. local help_vo = self:GetCurHelpTypeAndStep(help_type, step)
  426. local help_list = {}
  427. if help_vo and help_vo.task_id then
  428. help_list = self:GetTaskConfig(help_vo.task_id)
  429. end
  430. return help_vo, (step == #help_list and step > 0)
  431. --[[
  432. --需要走缓存的,基本不用了
  433. local lvList = self:GetLvCookieList()
  434. for k,v in pairs(lvList) do
  435. if not v.isEnd and v.step==step then
  436. local helpList = self:GetLevelConfig(v.lv)
  437. if helpList and helpList[v.step] then
  438. if helpList[v.step].help_type==help_type then
  439. return helpList[v.step], step == #helpList
  440. end
  441. end
  442. end
  443. end
  444. local taskList = self:GetTaskCookieList()
  445. for k,v in pairs(taskList) do
  446. if not v.isEnd and v.step==step then
  447. local helpList = self:GetTaskConfig(v.task_id)
  448. if helpList and helpList[v.step] then
  449. if helpList[v.step].help_type==help_type then
  450. return helpList[v.step], step == #helpList
  451. end
  452. end
  453. end
  454. end
  455. ]]
  456. end
  457. --创建客户端怪物
  458. function GuideModel:CreateClientMonster()
  459. self:CreateMonster(1,GuideModel.MONSTER_ID,GuideModel.MONSTER_POS[1])
  460. self:CreateMonster(2,GuideModel.MONSTER_ID,GuideModel.MONSTER_POS[2])
  461. self:CreateMonster(3,GuideModel.MONSTER_ID,GuideModel.MONSTER_POS[3])
  462. end
  463. --创建怪物
  464. function GuideModel:DeleteClientMonster()
  465. SceneManager.Instance:DeleteClientMonstersByInstanceId(1)
  466. SceneManager.Instance:DeleteClientMonstersByInstanceId(2)
  467. SceneManager.Instance:DeleteClientMonstersByInstanceId(3)
  468. end
  469. --创建怪物
  470. function GuideModel:CreateMonster(instance_id,mon_id,pos,assign_angle)
  471. local monsterVo = MonsterVo.New()
  472. monsterVo.instance_id = instance_id
  473. monsterVo.type_id = mon_id
  474. local cfg_data = ConfigItemMgr.Instance:GetMonsterDataItem(monsterVo.type_id)
  475. if cfg_data then
  476. monsterVo.monster_res = cfg_data.icon
  477. monsterVo.name = cfg_data.name
  478. monsterVo.type = 0
  479. monsterVo.move_speed = cfg_data.speed
  480. monsterVo.icon_scale = tonumber(cfg_data.icon_scale)
  481. end
  482. monsterVo:SetBasePropertyFromConfig()
  483. monsterVo.pos_x = pos.x
  484. monsterVo.pos_y = pos.y
  485. if monsterVo.monster_res == 0 then
  486. return --暂时没处理
  487. else
  488. monsterVo.guaji_flag = 1
  489. end
  490. monsterVo.level = 1
  491. monsterVo.hp=1
  492. monsterVo.mp=1
  493. monsterVo.maxHp=1
  494. monsterVo.maxMp=1
  495. monsterVo.is_story = true
  496. monsterVo.guaji_flag = 0
  497. monsterVo.hide_flag = false
  498. monsterVo.can_attack = 1
  499. monsterVo.assign_angle = assign_angle
  500. monsterVo.is_client_monster = true --是否是客户端怪物
  501. print("= = = = =创建怪物xxx:", monsterVo,monsterVo.name,monsterVo.instance_id, monsterVo.type)
  502. SceneManager.Instance:AddMonsterVo(monsterVo, false)
  503. end
  504. --是否是客户端怪物
  505. function GuideModel:IsClientMonster(instance_id)
  506. return instance_id == 1 or instance_id == 2 or instance_id == 3
  507. end
  508. --是否是ActivityIconView强制引导
  509. function GuideModel:IsTopForceMask( )
  510. local helpVo = self:GetCurHelpVo()
  511. if helpVo then
  512. local param = tonumber(helpVo.param)
  513. if param and param == 1 or param == 2 then
  514. return true
  515. end
  516. end
  517. return false
  518. end
  519. --是否是RightBottomView强制引导
  520. function GuideModel:IsBottomForceMask( )
  521. -- local helpVo = self:GetCurHelpVo()
  522. -- if helpVo then
  523. -- local param = tonumber(helpVo.param)
  524. -- if param and param == 1 or param == 4 or param == 5 or param == 6 or param == 10 or param == 12 then
  525. -- return true
  526. -- end
  527. -- end
  528. return false
  529. end
  530. --如果是第三步骤 删除
  531. function GuideModel:TryHideGuidePromptView()
  532. if self.curr_help_step == 3 then
  533. GlobalEventSystem:Fire(EventName.CLOSE_GUIDE_PROMPT_VIEW)
  534. end
  535. end
  536. --是否怪物在九宫格 而且判断是否做完打怪任务,做完就不创建了
  537. function GuideModel:IsMonsterNearPlayer()
  538. local role = Scene.Instance:GetMainRole()
  539. if role then
  540. local real_pos_x, real_pos_y = role:GetRealPos()
  541. local distance = GameMath.GetDistance(real_pos_x,real_pos_y,GuideModel.MONSTER_POS[2].x,GuideModel.MONSTER_POS[2].y)
  542. if distance < 4000000 then
  543. return true
  544. else
  545. return false
  546. end
  547. else
  548. return false
  549. end
  550. end
  551. --把断线不需要重新执行的引导设置为执行完
  552. function GuideModel:FinishOverHelp( )
  553. local lvList = self:GetLvCookieList()
  554. for k,v in pairs(lvList) do
  555. if not v.isEnd then
  556. local helpList = self:GetLevelConfig(v.lv)
  557. if helpList and helpList[v.step] and self:IsOverHelp(v.help_type) then
  558. v.isEnd = true
  559. end
  560. end
  561. end
  562. local taskList = self:GetTaskCookieList()
  563. for k,v in pairs(taskList) do
  564. if not v.isEnd then
  565. local helpList = self:GetTaskConfig(v.task_id)
  566. if helpList and helpList[v.step] and self:IsOverHelp(v.help_type) then
  567. v.isEnd = true
  568. end
  569. end
  570. end
  571. self:SaveHelpStepToCookies()
  572. end
  573. --重连不触发的引导类型
  574. function GuideModel:IsOverHelp( type )
  575. if type == HelpType.NEW_FUNC_OPEN or type == HelpType.OPEN_UI_VIEW
  576. or type == HelpType.ENTER_MISSION or type == HelpType.CAST_SKILL
  577. or type == HelpType.OPEN_LIST_SHOW_ICON
  578. or type == HelpType.DELAY_TIME
  579. or type == HelpType.CONTINUM_TASK or type == HelpType.CONTINUM_TASK
  580. or type == HelpType.HIDE_SMALL_UI or type == HelpType.SHOW_SMALL_UI
  581. or type == HelpType.SHOW_CHAPTER or type == HelpType.TASK_ITEM_SHOW then
  582. return true
  583. end
  584. end
  585. --是否有改变降神引导
  586. function GuideModel:IsChangeGodTime()
  587. return self.is_change_god_time
  588. end
  589. function GuideModel:IsSceneInitFinish()
  590. return self.scene_init_finish
  591. end
  592. function GuideModel:TriggerBreakGuide()
  593. if not self:IsSceneInitFinish() then
  594. return
  595. end
  596. if self.scene_init_finish and TaskModel:getInstance().notMain == true then
  597. TaskModel:getInstance():DefaultTaskShowArrow()
  598. end
  599. end
  600. function GuideModel:TriggerBreakLevelGuide()
  601. if not self:IsSceneInitFinish() then
  602. return
  603. end
  604. if not TaskModel:getInstance().showExtendTip then
  605. return
  606. end
  607. if self.scene_init_finish then
  608. GlobalEventSystem:Fire(EventName.TEST_HELP_STEP, 999991017)
  609. GlobalEventSystem:Fire(EventName.IS_SHOW_TRUN_MASK_HELPER)
  610. end
  611. end
  612. function GuideModel:SetNeedFinishGuideFirst(bool)
  613. self.need_finish_guide_first = bool
  614. if bool then
  615. setTimeout(function()
  616. GuideModel:getInstance():SetNeedFinishGuideFirst(false)
  617. end,3)
  618. end
  619. end
  620. function GuideModel:IsNeedFinishGuideFirst()
  621. return self.need_finish_guide_first
  622. end
  623. function GuideModel:StopTask()
  624. if SceneManager:getInstance():IsMainCityAndFieldScene() then
  625. GlobalEventSystem:Fire(EventName.STOP_AUTO_DO_TASK)
  626. end
  627. end
  628. function GuideModel:BeginTask(layout_file,need_do_task)
  629. need_do_task = need_do_task == nil and true or need_do_task
  630. if need_do_task and SceneManager:getInstance():IsMainCityAndFieldScene() then
  631. GlobalEventSystem:Fire(EventName.START_AUTO_DO_TASK)
  632. end
  633. GlobalEventSystem:Fire(EventName.CLOSE_GUIDE_PROMPT_VIEW,layout_file)
  634. end
  635. function GuideModel:SetHideSmallUI(bool)
  636. self.is_hide_small_ui = bool
  637. if bool then
  638. if self.hide_timer_id ~= nil then
  639. GlobalTimerQuest:CancelQuest(self.hide_timer_id)
  640. self.hide_timer_id = nil
  641. end
  642. --加入定时器保护 防止一直为true
  643. local function onTimer()
  644. self.is_hide_small_ui = false
  645. self.hide_timer_id = nil
  646. end
  647. self.hide_timer_id = GlobalTimerQuest:AddDelayQuest(onTimer, 5)
  648. end
  649. end
  650. function GuideModel:IsHideSmallUI()
  651. return self.is_hide_small_ui
  652. end
  653. function GuideModel:SetNeedOpenVipView(bool)
  654. self.need_open_vip_view = bool
  655. end
  656. function GuideModel:SetPromptViewOpenState(bool)
  657. self.is_prompt_view_open = bool
  658. end
  659. function GuideModel:IsPromptViewOpen()
  660. return self.is_prompt_view_open
  661. end
  662. function GuideModel:SetNeedExecuteLottery(bool)
  663. self.need_excute_lottery = bool
  664. end
  665. function GuideModel:IsNeedExecuteLottery()
  666. return self.need_excute_lottery
  667. end
  668. function GuideModel:IsPromptViewOpen()
  669. return self.is_prompt_view_open
  670. end
  671. function GuideModel:CanShowVipExperienceView()
  672. return SceneManager.Instance:IsMainCityorYieldScene() and not self:IsPromptViewOpen() and not self:IsHideSmallUI()
  673. end
  674. function GuideModel:SetShowItemUseAfterCloseView(bool)
  675. self.show_item_use_after_close_view = bool
  676. end
  677. function GuideModel:IsNeedhowItemUseAfterCloseView()
  678. return self.show_item_use_after_close_view
  679. end
  680. function GuideModel:IsOpenViewNeedStop()
  681. return self.open_view_need_stop
  682. end
  683. function GuideModel:SetOpenViewNeedStopFlag(bool)
  684. self.open_view_need_stop = bool
  685. end
  686. function GuideModel:IsNeedDelayExecuteGuide()
  687. return self.need_delay_execute_guide
  688. end
  689. function GuideModel:SetNeedDelayExecuteGuide(bool)
  690. self.need_delay_execute_guide = bool
  691. end
  692. function GuideModel:IsGemMissionExecuteTask()
  693. return self.gem_mission_execute_task
  694. end
  695. function GuideModel:SetGemMissionExecuteTask(bool)
  696. self.gem_mission_execute_task = bool
  697. end
  698. function GuideModel:SetGuideCachePos(btn_trans, pos_type)
  699. if not self.cache_guide_pos_list[pos_type] then
  700. if btn_trans then
  701. local root_wnd = GameObject()
  702. root_wnd.transform:SetParent(btn_trans)
  703. root_wnd.transform.localPosition = v or Vector3(0,0,0)
  704. root_wnd.transform.localScale = Vector3(1,1,1)
  705. root_wnd.transform:SetParent(panelMgr:GetParent("Main").transform)
  706. LuaViewManager.PuskMainCanvasCon(lua_viewM, root_wnd.transform)
  707. self.cache_guide_pos_list[pos_type] = root_wnd.transform.localPosition
  708. destroy(root_wnd)
  709. end
  710. end
  711. end
  712. function GuideModel:GetGuideCachePos(pos_type)
  713. return self.cache_guide_pos_list[pos_type] or Vector3(0,0,0)
  714. end
  715. --终身事件列表,只会保存已完成的
  716. function GuideModel:SetLifelongHelpList( list )
  717. for k,v in pairs(list or {}) do
  718. self.lifelong_help_list[v.id] = v.state
  719. end
  720. end
  721. --终身事件存储
  722. function GuideModel:SetLifelongHelp( vo )
  723. self.lifelong_help_list[vo.id] = vo.state
  724. end
  725. --终身事件查询
  726. function GuideModel:IsLifelongHelpFinish( id )
  727. if self.lifelong_help_list[id] then
  728. return self.lifelong_help_list[id] == 1
  729. end
  730. return false
  731. end
  732. --检测一代装备不满足全身紫色及以上品质(不包括守护和首饰),则触发市场引导
  733. function GuideModel:NeedTriggerMarketOpenType( )
  734. local suit_1_3_num = GoodsModel:getInstance():GetEquipCurSuitOrangeNum(1,1,3)
  735. return suit_1_3_num and suit_1_3_num < 7
  736. end
  737. --是否已经触发过引导
  738. function GuideModel:IsCheckedShowGuide(guide_id)
  739. return self.cache_show_guide[guide_id]
  740. end
  741. --是否已经触发过引导
  742. function GuideModel:SetShowedGuide(guide_id)
  743. if not guide_id then return end
  744. self.cache_show_guide[guide_id] = true
  745. end