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

1053 行
29 KiB

  1. GuidePromptView = GuidePromptView or BaseClass(BaseView)
  2. local GuidePromptView = GuidePromptView
  3. GuidePromptView.ArrowDir =
  4. {
  5. Right = 1,
  6. Left = 2,
  7. Bottom = 3,
  8. Top = 4,
  9. LeftBottom = 5,
  10. RightBottom = 6,
  11. LeftTop = 7,
  12. RightTop = 8,
  13. }
  14. function GuidePromptView:__init()
  15. self.base_file = "guide"
  16. self.layout_file = "GuidePromptView"
  17. self.layer_name = "Activity"
  18. self.destroy_imm = true
  19. self.use_background = false
  20. self.append_to_ctl_queue = false
  21. self.change_scene_close = true
  22. self.open_wnd_anim = 0
  23. self.force_no_ctl_queue = true
  24. self.model = GuideModel:getInstance()
  25. --self.use_local_view = true
  26. self:AddPreLoadList("common", {"ArrowComponent"})
  27. self.is_set_zdepth = true
  28. self.is_show_prompt = true
  29. self.x = 0
  30. self.y = 0
  31. self.w = 0
  32. self.h = 0
  33. self.alpha_value = 0.6
  34. self.load_callback = function ()
  35. self.gameObject:SetActive(false)
  36. self:LoadSuccess()
  37. self:InitEvent()
  38. end
  39. self.open_callback = function ()
  40. if UnityEngine.Transform.Equals(self.attch_node,nil) then
  41. return
  42. end
  43. self.model:SetPromptViewOpenState(true)
  44. self:InitView()
  45. if self.z_depth then
  46. UIDepth.SetUIDepth(self.transform.gameObject,true, self.z_depth)
  47. end
  48. end
  49. self.close_callback = function ()
  50. self.model:SetPromptViewOpenState(false)
  51. self:Clear()
  52. end
  53. self.destroy_callback = function ()
  54. end
  55. end
  56. --attch_node 用于计算 挂载点的相对位置
  57. --ui_attach_node 当前view的挂载点
  58. function GuidePromptView:Open(attch_node,ui_attach_node,call_back,helpVo,view_layout_file,layer_name, z_depth)
  59. if UnityEngine.Transform.Equals(attch_node,nil) then
  60. return
  61. end
  62. self.time_diff = 10 --定时器时间
  63. self.attch_node = attch_node
  64. self.ui_attach_node = ui_attach_node
  65. self.call_back = call_back
  66. self.help_type = helpVo.help_type
  67. self.step = helpVo.step
  68. self.helpVo = helpVo
  69. self.time_diff = helpVo.time_diff or self.time_diff
  70. self.layer_name = layer_name or "Activity"
  71. self.view_layout_file = view_layout_file
  72. self.z_depth = z_depth
  73. BaseView.Open(self)
  74. end
  75. function GuidePromptView:Clear()
  76. if self.item_event_id then
  77. GlobalEventSystem:UnBind(self.item_event_id)
  78. self.item_event_id = nil
  79. end
  80. self:DeleteArrowTip()
  81. self:StopTimer()
  82. self:CancelLeaveTimer()
  83. self:StopAnim()
  84. end
  85. function GuidePromptView:InitView()
  86. self.transform:SetParent(self.ui_attach_node)
  87. SetLocalScale(self.transform)
  88. print("tanar: [GuidePromptView 84]=> self.help_type: ",self.help_type)
  89. self:SetFocusPointMsg(self.attch_node)
  90. self:DeleteArrowTip()
  91. self:StopTimer()
  92. if self.help_type == HelpType.DO_MAIN_TASK then
  93. self:DoMainTaskPrompt()
  94. elseif self.help_type == HelpType.TASK_SELECT then
  95. self:TaskSelectPrompt()
  96. elseif self.help_type == HelpType.TYPE_LIGHT then
  97. self:TypeLightPrompt()
  98. elseif self.help_type == HelpType.TYPE_SUIT_COLLECT then
  99. self:TypeSuitCollectPrompt()
  100. elseif self.help_type == HelpType.TYPE_HORSE then
  101. self:TypeHorsePrompt()
  102. elseif self.help_type == HelpType.TYPE_DUNGEON then
  103. self:TypeDunGeonPrompt()
  104. elseif self.help_type == HelpType.TYPE_PEARL then
  105. self:TypePearlPrompt()
  106. elseif self.help_type == HelpType.TYPE_EQUIP_STRENGTH then
  107. self:TypeEquipStrengthlPrompt()
  108. elseif self.help_type == HelpType.TYPE_JARVIS then
  109. self:TypeJarvisPrompt()
  110. elseif self.help_type == HelpType.TYPE_PKRANK then
  111. self:TypePkrankPrompt()
  112. elseif self.help_type == HelpType.TYPE_DAILY then
  113. self:TypeDailyPrompt()
  114. elseif self.help_type == HelpType.TYPE_EXP_DUNGEON then
  115. self:TypeExpDungeonPrompt()
  116. elseif self.help_type == HelpType.TYPE_EQUIP_SUIT_ACTIVE then
  117. self:TypeEquipSuitActivePrompt()
  118. elseif self.help_type == HelpType.OPEN_LIST_SHOW_PROMPT then
  119. self:ListPrompt()
  120. elseif self.help_type == HelpType.NEWER_TASK_AWARD_UNLOCK then
  121. self:NewerTaskAwardPromt()
  122. elseif self.help_type == HelpType.TYPE_SPECIAL_PEARL then
  123. self:TypeSpecialPearlPrompt()
  124. elseif self.help_type == HelpType.TYPE_TOWER then
  125. self:TypeTowerPrompt()
  126. elseif self.help_type == HelpType.TYPE_BOSS or self.help_type == HelpType.TYPE_MONEY_BOSS then
  127. self:TypeBossPrompt()
  128. elseif self.help_type == HelpType.TYPE_EXTENSION_LINE_TASK then
  129. self:TypeExtensionLineTaskPrompt()
  130. elseif self.help_type == HelpType.TYPE_EXTENSION_LINE_TASK_FINISH then
  131. self:TypeExtensionLineTaskFinshPrompt()
  132. elseif self.help_type == HelpType.TYPE_GUILD then
  133. self:TypeGuildPrompt()
  134. elseif self.help_type == HelpType.TYPE_WAR_SOUL then
  135. self:TypeWarSoulPrompt()
  136. elseif self.help_type == HelpType.TYPE_EQUIP_COLLECT_ONE then
  137. self:TypeEquipCollectOnePrompt()
  138. elseif self.help_type == HelpType.TYPE_EQUIP_COLLECT_TWO then
  139. self:TypeEquipCollectTwoPrompt()
  140. elseif self.help_type == HelpType.GUILD_CSGR_COLLECT then
  141. self:TypeGuildCSGRCollect()
  142. elseif self.help_type == HelpType.MATE_CHANGE_NAME then
  143. self:TypeMateChangeName()
  144. elseif self.help_type == HelpType.MONEY_BOSS_FIRST_IN then
  145. self:TypeMoneyBossFirstIn()
  146. elseif self.help_type == HelpType.TYPE_EQUIP_COLLECT_ONE_CLOSE then
  147. self:TypeEquipCollectClosePrompt()
  148. elseif self.help_type == HelpType.TYPE_NEW_MAIN_LINE_TASK then
  149. self:TypeNewMainLinePrompt()
  150. elseif self.help_type == HelpType.TYPE_PSIONIC then
  151. self:TypePsionicPrompt()
  152. elseif self.help_type == HelpType.VIP_ANGRY_SKILL_PLAY then
  153. self:TypeVIPSkillPrompt()
  154. elseif self.help_type == HelpType.TYPE_EQUIP_RED then
  155. self:TypeEquipRedPrompt()
  156. elseif self.help_type == HelpType.DESERTED_BOSS_MON then
  157. self:TypeDesertecBoss()
  158. elseif self.help_type == HelpType.BABYDUN_ACTIVATED_SKILL then
  159. self:TypeBabydunActivatedSkill()
  160. elseif self.help_type == HelpType.TYPE_CLOTHE_FACTORY then
  161. self:TypeClotheFactory()
  162. elseif self.help_type == HelpType.GUILD_SPEED_ACT_CLICK then--社团快速点击
  163. self:TypeGuildSpeedAct()
  164. elseif self.help_type == HelpType.TYPE_MAIN_LINE_DUNGEON then
  165. self:TypeMainLineDungeonPrompt()
  166. elseif self.help_type == HelpType.TYPE_MAIN_PLOT_DUNGEON_SWEEP_TIPS then
  167. self:TypeMainPlotdungeonSweepPrompt()
  168. elseif self.help_type == HelpType.LIFELONG_MARKET_OPEN_TYPE then
  169. self:TypeMarketOpen()
  170. elseif self.help_type == HelpType.LIFELONG_MARKET_SELL_TYPE then
  171. self:TypeMarketSell()
  172. elseif self.help_type == HelpType.LIFELONG_EQUIP_EVOLVE_TYPE then
  173. self:TypeEquipEvolve()
  174. elseif self.help_type == HelpType.TYPE_SHOW_FIGHT_UP_TIPS then
  175. self:TypeShowFightUpTips()
  176. elseif self.help_type == HelpType.LIFELONG_ELITE_ASSESS_TYPE then
  177. self:TypeEliteAssess()
  178. elseif self.help_type == HelpType.LIFELONG_SERVEN_TARGET_TYPE then
  179. self:TypeServenTarget()
  180. else
  181. self:CommonPrompt()
  182. end
  183. end
  184. function GuidePromptView:LoadSuccess()
  185. self.contentCon,
  186. self.border,
  187. self.focus_point,
  188. self.roleImage
  189. = GetChildTransforms(self.transform,
  190. {
  191. "Border/Content",
  192. "Border",
  193. "FocusPoint",
  194. "Border/RoleImage",
  195. })
  196. self.effect,
  197. self.click_btn = self:GetChildGameObjects({
  198. "Effect",
  199. "Border/ClickBtn"
  200. })
  201. self.content = self:GetChild("Border/Content"):GetComponent("TMPro.TextMeshProUGUI")
  202. self.sayer = self:GetChild("Border/Sayer"):GetComponent("TMPro.TextMeshProUGUI")
  203. local nodes = {
  204. "Border2/anim_root/Content2:tmp",
  205. "Border:obj",
  206. "Border2:obj",
  207. "Border2/anim_root/ClickBtn2:obj",
  208. "Border2/anim_root/arrow_dir_root:obj",
  209. "Border2/anim_root",
  210. }
  211. self:GetChildren(nodes)
  212. self.effect:SetActive(true)
  213. end
  214. function GuidePromptView:InitEvent()
  215. local onItemDel = function ( item_name,layout_file)
  216. if self._use_delete_method then return end
  217. if not IsNull(self.ui_attach_node) and self.ui_attach_node.name and self.ui_attach_node.name==item_name then --有些BaseItem销毁了,但是没有先关闭此界面,导致报错
  218. self:Close()
  219. end
  220. end
  221. self.item_event_id = GlobalEventSystem:Bind(EventName.BASE_ITEM_DELETE, onItemDel)
  222. local function clickFunc(target)
  223. if target == self.click_btn or target == self.ClickBtn2_obj then
  224. if self.call_back then
  225. self.call_back()
  226. end
  227. end
  228. end
  229. AddClickEvent(self.click_btn,clickFunc)
  230. AddClickEvent(self.ClickBtn2_obj,clickFunc)
  231. end
  232. function GuidePromptView:ShowArrow(dir,x,y,ignore_focus)
  233. local show_type = self.helpVo.show_type == nil and 1 or 2
  234. if self.arrow_tip == nil then
  235. self.arrow_tip = ArrowComponent.New(self.transform)
  236. self.arrow_tip:SetArrowType(show_type)
  237. end
  238. local depth = self:GetCurrLayerDepth("Top")
  239. if ignore_focus then
  240. self.arrow_tip:ShowArrow(dir,co.TableXY(x,y),depth)
  241. else
  242. self.arrow_tip:ShowArrow(dir,co.TableXY(self.x + x,self.y + y),depth)
  243. end
  244. end
  245. function GuidePromptView:ShowBubble(x,y,ignore_focus,size,pos,content, role_img_size, role_img_pos,content_sizeDelta, arrow_tip_dir)
  246. local helpVo = self.helpVo
  247. if helpVo.task_id == HelpType.SHOW_NEW_MAIN_LINE_TIP_ID then
  248. local main_task = TaskModel.getInstance():GetMainTask()
  249. if main_task and RoleManager.Instance.mainRoleInfo.level >= main_task.level then
  250. helpVo.saying = "继续主线任务吧"
  251. else
  252. helpVo.saying = "推荐完成任务"
  253. end
  254. end
  255. local sayer = Trim(helpVo.sayer) or ""
  256. local saying = Trim(helpVo.saying) or ""
  257. local show_type = helpVo.show_type == nil and 1 or 2
  258. local show_focus = helpVo.show_focus == nil and true or helpVo.show_focus
  259. local show_timer = helpVo.show_timer or false
  260. local str = content or "(<color=#14e64a>%d秒</color>后自动继续)"
  261. local delay_show = helpVo.delay_show
  262. local effect_pos = helpVo.effect_pos and Vector3.New(helpVo.effect_pos.x, helpVo.effect_pos.y, helpVo.effect_pos.z or 0) or Vector3.New(0, 0, 0)
  263. if show_focus then
  264. local layer_name = self.layer_name
  265. if layer_name == "Top" then
  266. layer_name = "UpTop"
  267. end
  268. self:AddUIEffect("ui_jujiaodianji", self.attch_node.transform, layer_name, effect_pos, 1, true)
  269. end
  270. self.arrow_tip_dir = arrow_tip_dir
  271. if show_type == 1 then
  272. self.Border_obj:SetActive(true)
  273. self.Border2_obj:SetActive(false)
  274. elseif show_type == 2 then
  275. self.Border_obj:SetActive(false)
  276. self.Border2_obj:SetActive(true)
  277. if ignore_focus then
  278. self.Border2.localPosition = Vector3(x,y,0)
  279. else
  280. self.Border2.localPosition = Vector3(self.x + x,self.y + y,0)
  281. end
  282. local font_size = helpVo.font_size or 20
  283. if saying ~= "" then
  284. saying = string.gsub(saying, "@n@", "\n")
  285. self.Content2_tmp.text = saying
  286. else
  287. self.Content2_tmp.text = "点击完成"
  288. end
  289. self.Content2_tmp.fontSize = font_size
  290. else
  291. self.Border_obj:SetActive(false)
  292. self.Border2_obj:SetActive(false)
  293. return
  294. end
  295. if saying ~= "" and show_type == 1 then
  296. saying = string.gsub(saying, "@n@", "\n")
  297. -- self.sayer.text = sayer
  298. self.border.gameObject:SetActive(true)
  299. if size then
  300. self.border.sizeDelta = size
  301. if role_img_size then
  302. self.roleImage.sizeDelta = role_img_size
  303. end
  304. if role_img_pos then
  305. self.roleImage.localPosition = role_img_pos
  306. end
  307. end
  308. if content_sizeDelta then
  309. self.content.transform.sizeDelta = content_sizeDelta
  310. end
  311. -- local hide_timer = "hide_timer" -- Trim(self.helpVo.param)
  312. -- if hide_timer == "hide_timer" then
  313. if show_timer then
  314. self.content.text = saying .. string.format(str,self.time_diff)
  315. self:StartTimer(content)
  316. else
  317. self.content.text = saying
  318. end
  319. local width = self.content.preferredWidth
  320. local height = self.content.preferredHeight
  321. local sizeDelta = self.border.sizeDelta
  322. if ignore_focus then
  323. self.border.localPosition = Vector3(x,y,0)
  324. else
  325. self.border.localPosition = Vector3(self.x + x,self.y + y,0)
  326. end
  327. if pos then
  328. self.contentCon.localPosition = pos
  329. else
  330. --如果是一行 则居中显示
  331. local x = width < 280 and (-width / 2 + 38) or -80
  332. --self.contentCon.localPosition = Vector3(x ,height / 2 + sizeDelta.y / 2,0)
  333. end
  334. if not size then
  335. if role_img_size then
  336. self.roleImage.sizeDelta = role_img_size
  337. end
  338. if role_img_pos then
  339. self.roleImage.localPosition = role_img_pos
  340. end
  341. end
  342. else
  343. self.border.gameObject:SetActive(false)
  344. end
  345. if self.delay_timer then
  346. GlobalTimerQuest:CancelQuest(self.delay_timer)
  347. self.delay_timer = nil
  348. end
  349. if delay_show then
  350. local function delay_func( )
  351. if not IsNull(self.gameObject) then
  352. self.gameObject:SetActive(true)
  353. end
  354. end
  355. if not self.delay_timer then
  356. self.delay_timer = GlobalTimerQuest:AddDelayQuest(delay_func,delay_show)
  357. end
  358. end
  359. if self.arrow_tip_dir then
  360. self:StartAnim()
  361. else
  362. self:StopAnim()
  363. end
  364. end
  365. function GuidePromptView:ShowEffect(x,y,scale,effect_name)
  366. x = x or 0
  367. y = y or 0
  368. local effect = newObject(self.effect)
  369. effect.transform:SetParent(self.transform)
  370. effect.transform.localScale = Vector3.one
  371. effect.transform.localPosition = Vector3(x,y,0)
  372. scale = scale or co.TableXY(1,1)
  373. effect_name = effect_name or "ui_anniu_6"
  374. local layer_name = self.layer_name
  375. if layer_name == "Top" then
  376. layer_name = "UpTop"
  377. end
  378. self:AddUIEffect(effect_name,effect.transform, layer_name, nil, scale, true, nil, nil,nil)
  379. end
  380. --获取聚焦点的信息
  381. function GuidePromptView:SetFocusPointMsg(attch_node,w,h,x_offset,y_offset)
  382. if UnityEngine.Transform.Equals(attch_node,nil) then
  383. self:Close()
  384. return
  385. end
  386. if attch_node == nil or self.transform==nil then
  387. return
  388. end
  389. self.focus_point:SetParent(attch_node)
  390. self.focus_point.localPosition = Vector3(0,0,0)
  391. self.focus_point:SetParent(self.transform)
  392. self.x = self.focus_point.localPosition.x + (x_offset or 0)
  393. self.y = self.focus_point.localPosition.y + (y_offset or 0)
  394. end
  395. function GuidePromptView:SetDefaultFocusPoint()
  396. self.x = 0
  397. self.y = 0
  398. self.w = 0
  399. self.h = 0
  400. end
  401. function GuidePromptView:SetDepth(layer)
  402. if self.transform and layer then
  403. self.transform.gameObject:GetComponent("Canvas").sortingOrder = layer
  404. end
  405. end
  406. function GuidePromptView:CommonPrompt()
  407. if self.step == 2 then
  408. self:ShowArrow(1,-130,0)
  409. self:ShowBubble(-460,-50)
  410. elseif self.step == 3 then
  411. self:ShowArrow(1,-130,0)
  412. self:ShowBubble(-460,-50)
  413. elseif self.step == 4 then
  414. self:ShowArrow(1,-80,0)
  415. self:ShowBubble(-252,-155)
  416. end
  417. end
  418. function GuidePromptView:DoMainTaskPrompt( )
  419. if self.step == 1 then
  420. self:ShowBubble(-320,65)
  421. self:ShowArrow(6,-100,50)
  422. end
  423. end
  424. function GuidePromptView:TaskSelectPrompt( )
  425. if self.step == 1 then
  426. self:ShowBubble(-220,50)
  427. self:ShowArrow(6,0,10)
  428. end
  429. end
  430. function GuidePromptView:TypeLightPrompt( )
  431. if self.step == 3 then
  432. self:ShowBubble(320,-200)
  433. self:ShowArrow(7,80,-80)
  434. elseif self.step == 4 then
  435. self:ShowBubble(-280,60)
  436. self:ShowArrow(6,-55,45)
  437. elseif self.step == 5 then
  438. self:ShowArrow(8,-50,-50)
  439. self:ShowBubble()
  440. end
  441. end
  442. function GuidePromptView:TypeSuitCollectPrompt( )
  443. if self.step == 3 then
  444. self:ShowBubble(-300,-200)
  445. self:ShowArrow(8,-60,-50)
  446. end
  447. end
  448. function GuidePromptView:TypeHorsePrompt( )
  449. if self.step == 3 then
  450. self:ShowBubble(-325,50)
  451. self:ShowArrow(6,-100,45)
  452. elseif self.step == 5 then
  453. self:ShowArrow(8,-10,-40)
  454. self:ShowBubble()
  455. end
  456. end
  457. function GuidePromptView:TypeDunGeonPrompt( )
  458. if self.step == 3 then
  459. self:ShowBubble(-1100,120)
  460. self:ShowArrow(5,-1270,80)
  461. end
  462. end
  463. function GuidePromptView:TypePearlPrompt( )
  464. if self.step == 3 then
  465. self:ShowBubble(-325,50)
  466. self:ShowArrow(6,-100,45)
  467. elseif self.step == 4 then
  468. self:ShowArrow(8,-10,-40)
  469. self:ShowBubble()
  470. end
  471. end
  472. function GuidePromptView:TypeEquipStrengthlPrompt( )
  473. if self.step == 3 then
  474. self:ShowBubble(-330,60)
  475. self:ShowArrow(6,-110,50)
  476. elseif self.step == 4 then
  477. self:ShowArrow(8,-10,-40)
  478. self:ShowBubble()
  479. end
  480. end
  481. function GuidePromptView:TypeJarvisPrompt( )
  482. if self.step == 3 then
  483. self:ShowBubble(-325,50)
  484. self:ShowArrow(6,-100,45)
  485. elseif self.step == 4 then
  486. self:ShowArrow(8,-10,-40)
  487. self:ShowBubble()
  488. end
  489. end
  490. function GuidePromptView:TypePkrankPrompt( )
  491. if self.step == 3 then
  492. self:ShowBubble(-310,60)
  493. self:ShowArrow(6,-100,50)
  494. end
  495. end
  496. function GuidePromptView:TypeDailyPrompt( )
  497. if self.step == 3 then
  498. self:ShowBubble(0,0)
  499. self:ShowArrow(1,-100,0)
  500. end
  501. end
  502. function GuidePromptView:TypeExpDungeonPrompt( )
  503. if self.step == 3 then
  504. self:ShowBubble(15000,7000)
  505. self:ShowArrow(5,6000,6000)
  506. elseif self.step == 4 then
  507. self:ShowBubble(-320,50)
  508. self:ShowArrow(6,-100,40)
  509. end
  510. end
  511. function GuidePromptView:TypeEquipSuitActivePrompt( )
  512. if self.step == 3 then
  513. self:ShowBubble(350,-130)
  514. self:ShowArrow(2,110,-60)
  515. elseif self.step == 4 then
  516. self:ShowBubble(-9999,9999)
  517. self:ShowArrow(5,-9999,9999)
  518. end
  519. end
  520. function GuidePromptView:NewerTaskAwardPromt( )
  521. if self.step == 2 then
  522. self:ShowBubble(163,-110)
  523. self:ShowArrow(7,82,-45)
  524. elseif self.step == 3 then
  525. self:ShowBubble(0,-135)
  526. self:ShowArrow(4,2,-40)
  527. end
  528. end
  529. function GuidePromptView:TypeSpecialPearlPrompt( )
  530. if self.step == 3 then
  531. self:ShowBubble(-325,50)
  532. self:ShowArrow(6,-100,45)
  533. elseif self.step == 5 then
  534. self:ShowArrow(8,-10,-40)
  535. self:ShowBubble()
  536. end
  537. end
  538. function GuidePromptView:TypeTowerPrompt( )
  539. if self.step == 3 then
  540. self:ShowBubble(-325,50)
  541. self:ShowArrow(6,-100,45)
  542. end
  543. end
  544. function GuidePromptView:TypeBossPrompt( )
  545. if self.step == 3 then
  546. self:ShowBubble(-325,50)
  547. self:ShowArrow(6,-100,45)
  548. end
  549. end
  550. function GuidePromptView:TypeGuildPrompt( )
  551. if self.step == 3 then
  552. self:ShowBubble(-425,250)
  553. self:ShowArrow(6,-100,-1000)
  554. end
  555. end
  556. function GuidePromptView:TypeWarSoulPrompt( )
  557. if self.step == 3 then
  558. self:ShowBubble(250,70)
  559. self:ShowArrow(5,70,50)
  560. elseif self.step == 4 then
  561. self:ShowBubble(310,-250)
  562. self:ShowArrow(7,80,-80)
  563. end
  564. end
  565. function GuidePromptView:TypeEquipCollectOnePrompt( )
  566. if self.step == 1 then
  567. self:ShowBubble(-270,70)
  568. self:ShowArrow(6,-70,50)
  569. end
  570. end
  571. function GuidePromptView:TypeEquipCollectTwoPrompt( )
  572. if self.step == 1 then
  573. self:ShowBubble(-270,70)
  574. self:ShowArrow(6,-70,50)
  575. end
  576. end
  577. function GuidePromptView:TypeGuildCSGRCollect( )
  578. if self.step == 1 then
  579. self:ShowBubble(-290,-80)
  580. self:ShowArrow(1,-60,0)
  581. end
  582. end
  583. function GuidePromptView:TypeMateChangeName( )
  584. if self.step == 1 then
  585. self:ShowBubble(-290,-80)
  586. self:ShowArrow(1,-60,0)
  587. end
  588. end
  589. function GuidePromptView:TypeExtensionLineTaskPrompt( )
  590. if self.step == 2 then
  591. self:ShowBubble(300,-250)
  592. self:ShowArrow(7,100,-100)
  593. end
  594. end
  595. function GuidePromptView:TypeExtensionLineTaskFinshPrompt( )
  596. if self.step == 1 then
  597. self:ShowBubble(205,-60,nil ,nil,nil,nil,nil,nil,nil,1)
  598. -- self:ShowArrow(2,130,-30)
  599. end
  600. end
  601. function GuidePromptView:TypeNewMainLinePrompt( )
  602. if self.step == 1 then
  603. self:ShowBubble(205,-60,nil ,nil,nil,nil,nil,nil,nil,1)
  604. end
  605. end
  606. function GuidePromptView:TypePsionicPrompt( )
  607. if self.step == 3 then
  608. self:ShowArrow(1,-50,-30)
  609. self:ShowBubble(-300,-120)
  610. elseif self.step == 4 then
  611. self:ShowArrow(1,9999,9999)
  612. self:ShowBubble(9999,9999)
  613. elseif self.step == 5 then
  614. self:ShowArrow(1,-75,0)
  615. self:ShowBubble(-320,-80)
  616. end
  617. end
  618. function GuidePromptView:TypeVIPSkillPrompt( )
  619. if self.step == 1 then
  620. self:ShowArrow(2,125,105)
  621. self:ShowBubble(350,25)
  622. end
  623. end
  624. function GuidePromptView:TypeGuildSpeedAct( )
  625. if self.step == 1 then
  626. self:ShowArrow(3,0,75)
  627. self:ShowBubble(-130,65)
  628. end
  629. end
  630. function GuidePromptView:TypeMainLineDungeonPrompt( )
  631. if self.step == 3 then
  632. self:ShowArrow(GuidePromptView.ArrowDir.RightBottom,-20,75)
  633. self:ShowBubble(-170,85)
  634. end
  635. end
  636. function GuidePromptView:TypeMainPlotdungeonSweepPrompt( )
  637. if self.step == 1 then
  638. self:ShowArrow(GuidePromptView.ArrowDir.RightBottom,-200,75)
  639. self:ShowBubble(-430,85)
  640. elseif self.step == 2 then
  641. self:ShowArrow(GuidePromptView.ArrowDir.RightTop,-10,-40)
  642. self:ShowBubble()
  643. end
  644. end
  645. function GuidePromptView:TypeEquipRedPrompt( )
  646. if self.step == 3 then
  647. self:ShowArrow(5,20,20)
  648. self:ShowBubble(220,20)
  649. end
  650. end
  651. function GuidePromptView:TypeMoneyBossFirstIn( )
  652. if self.step == 1 then
  653. local x,y = -75,-75
  654. self:ShowBubble(-260+x,-200+y)
  655. self:ShowArrow(8,-40+x,-35+y)
  656. elseif self.step == 2 then
  657. self:ShowBubble(270,-210)
  658. self:ShowArrow(7,-40+100,-35-20)
  659. end
  660. end
  661. function GuidePromptView:TypeDesertecBoss( )
  662. self:ShowBubble(270,-210+50)
  663. self:ShowArrow(7,-40+100,-35-20+50)
  664. end
  665. function GuidePromptView:TypeBabydunActivatedSkill( )
  666. if self.step == 1 then
  667. self:ShowBubble(-290,-80)
  668. self:ShowArrow(1,-60,0)
  669. end
  670. end
  671. function GuidePromptView:TypeClotheFactory( )
  672. if self.step == 3 then
  673. self:ShowBubble(-450,250)
  674. self:ShowArrow(1,-210,330)
  675. elseif self.step == 4 then
  676. self:ShowBubble(-360,-80)
  677. self:ShowArrow(1,-130,0)
  678. end
  679. end
  680. function GuidePromptView:TypeEquipCollectClosePrompt( )
  681. if self.step == 1 then
  682. local x,y = -75,-75
  683. self:ShowBubble(-260+x,-200+y)
  684. self:ShowArrow(8,-40+x,-35+y)
  685. end
  686. end
  687. function GuidePromptView:ListPrompt()
  688. local param = Split(self.helpVo.param, ",")
  689. if tonumber(param[1]) == 2 then --左下角
  690. self:ShowArrow(9,-15,100)
  691. self:ShowBubble(-315,90)
  692. elseif tonumber(param[1]) == 1 then --右上角
  693. self:ShowArrow(8,-40,-40)
  694. self:ShowBubble(-260,-210)
  695. end
  696. UIDepth.SetUIDepth(self.gameObject,true,self:GetCurrLayerDepth("Main"))
  697. UIDepth.SetUIDepth(self.arrow_tip.gameObject,true,self:GetCurrLayerDepth("Main"))
  698. end
  699. function GuidePromptView:TypeMarketOpen( )
  700. self:ShowBubble(0,-110)
  701. self:ShowArrow(4,0,-30)
  702. UIDepth.SetUIDepth(self.gameObject,true,self:GetCurrLayerDepth("Main"))
  703. UIDepth.SetUIDepth(self.arrow_tip.gameObject,true,self:GetCurrLayerDepth("Main"))
  704. end
  705. function GuidePromptView:TypeMarketSell( )
  706. if self.step == 1 then
  707. self:ShowBubble(0+40,-250)
  708. self:ShowArrow(4,0+40,-70)
  709. elseif self.step == 2 then
  710. self:ShowBubble(0,70)
  711. self:ShowArrow(3,0,70)
  712. UIDepth.SetUIDepth(self.gameObject,true,self:GetCurrLayerDepth("Top")+1)
  713. UIDepth.SetUIDepth(self.arrow_tip.gameObject,true,self:GetCurrLayerDepth("Top")+1)
  714. end
  715. end
  716. function GuidePromptView:TypeEquipEvolve( )
  717. if self.step == 1 then
  718. self:ShowBubble(-280-80-55-75+20,60-80-193-60+20)
  719. self:ShowArrow(1,-55-80-55-25+5,45-80-80-10-25-5-10)
  720. elseif self.step == 2 then
  721. self:ShowBubble(0,70+40)
  722. self:ShowArrow(3,0,70+40)
  723. end
  724. end
  725. function GuidePromptView:TypeShowFightUpTips( )
  726. if self.step == 1 then
  727. self:ShowBubble(-370,-30)
  728. self:ShowArrow(GuidePromptView.ArrowDir.Right,-120,50)
  729. end
  730. end
  731. function GuidePromptView:TypeEliteAssess( )
  732. self:ShowBubble(135,-30)
  733. self:ShowArrow(2,47,0)
  734. UIDepth.SetUIDepth(self.gameObject,true,self:GetCurrLayerDepth("Main"))
  735. UIDepth.SetUIDepth(self.arrow_tip.gameObject,true,self:GetCurrLayerDepth("Main"))
  736. end
  737. function GuidePromptView:TypeServenTarget( )
  738. self:ShowBubble(0,-110)
  739. self:ShowArrow(4,0,-30)
  740. UIDepth.SetUIDepth(self.gameObject,true,self:GetCurrLayerDepth("Main"))
  741. UIDepth.SetUIDepth(self.arrow_tip.gameObject,true,self:GetCurrLayerDepth("Main"))
  742. end
  743. function GuidePromptView:DeleteArrowTip()
  744. if self.helpVo.show_focus and not IsNull(self.attch_node) then
  745. self:ClearUIEffect(self.attch_node.transform)
  746. end
  747. if self.arrow_tip then
  748. self.arrow_tip:DeleteMe()
  749. self.arrow_tip = nil
  750. end
  751. end
  752. function GuidePromptView:Show(bool)
  753. self.gameObject:SetActive(bool)
  754. end
  755. function GuidePromptView:StartTimer(content)
  756. local str = content or "(<color=#4EAE1AFF>%d秒</color>后自动继续)"
  757. local show_timer = self.helpVo.show_timer or false
  758. local saying = Trim(self.helpVo.saying) or ""
  759. local function onTimer()
  760. if UnityEngine.Transform.Equals(self.attch_node,nil) then
  761. self:Close()
  762. return
  763. end
  764. self.time_diff = self.time_diff - 1
  765. if self.time_diff > 0 then
  766. -- local hide_timer = "hide_timer" --Trim(self.helpVo.param)
  767. -- if hide_timer == "hide_timer" then
  768. if show_timer then
  769. self.content.text = saying .. string.format(str,self.time_diff)
  770. else
  771. self.content.text = saying
  772. end
  773. else
  774. self:StopTimer()
  775. if self.call_back then
  776. self.call_back()
  777. end
  778. end
  779. end
  780. if not self.timer_id then
  781. self.timer_id = GlobalTimerQuest:AddPeriodQuest(onTimer, 1, -1)
  782. end
  783. end
  784. function GuidePromptView:StopTimer()
  785. if self.timer_id then
  786. GlobalTimerQuest:CancelQuest(self.timer_id)
  787. self.timer_id = nil
  788. end
  789. if self.delay_timer then
  790. GlobalTimerQuest:CancelQuest(self.delay_timer)
  791. self.delay_timer = nil
  792. end
  793. end
  794. function GuidePromptView:ShowBlackMask(x,y,w,h)
  795. --左上
  796. self.C2 = UiFactory.createChild(self.transform,UIType.ImageExtend,"C2")
  797. self.C2.transform.pivot = Vector2(0,1)
  798. self.C2.transform:SetAsFirstSibling()
  799. self.C2_Image = self.C2:GetComponent("ImageExtend")
  800. self.C2_Image.color = Color(0,0,0,self.alpha_value)
  801. lua_resM:setImageSprite(self,self.C2_Image,"common_asset","story_ui_2")
  802. --左下
  803. self.C4 = UiFactory.createChild(self.transform,UIType.ImageExtend,"C4")
  804. self.C4.transform.pivot = Vector2(0,0)
  805. self.C4.transform:SetAsFirstSibling()
  806. self.C4_Image = self.C4:GetComponent("ImageExtend")
  807. self.C4_Image.color = Color(0,0,0,self.alpha_value)
  808. lua_resM:setImageSprite(self,self.C4_Image,"common_asset","story_ui_2")
  809. --右上
  810. self.C6 = UiFactory.createChild(self.transform,UIType.ImageExtend,"C6")
  811. self.C6.transform.pivot = Vector2(1,1)
  812. self.C6.transform:SetAsFirstSibling()
  813. self.C6_Image = self.C6:GetComponent("ImageExtend")
  814. self.C6_Image.color = Color(0,0,0,self.alpha_value)
  815. lua_resM:setImageSprite(self,self.C6_Image,"common_asset","story_ui_2")
  816. --右下
  817. self.C8 = UiFactory.createChild(self.transform,UIType.ImageExtend,"C8")
  818. self.C8.transform.pivot = Vector2(1,0)
  819. self.C8.transform:SetAsFirstSibling()
  820. self.C8_Image = self.C8:GetComponent("ImageExtend")
  821. self.C8_Image.color = Color(0,0,0,self.alpha_value)
  822. lua_resM:setImageSprite(self,self.C8_Image,"common_asset","story_ui_2")
  823. self:UpdateRectMask(x,y,w,h)
  824. end
  825. --设置矩形遮罩的位置
  826. function GuidePromptView:UpdateRectMask(x,y,w,h)
  827. local width,height = nil
  828. self.C2.transform.anchoredPosition = Vector3(-ScreenWidth/2,ScreenHeight/2,0)
  829. width = ScreenWidth/2 + x - w / 2
  830. height = ScreenHeight / 2 - y + h / 2
  831. self.C2.transform.sizeDelta = Vector2(width,height)
  832. self.C4.transform.anchoredPosition = Vector3(-ScreenWidth/2,-ScreenHeight/2,0)
  833. width = ScreenWidth/2 + x + w / 2
  834. height = ScreenHeight / 2 + y - h/2
  835. self.C4.transform.sizeDelta = Vector2(width,height)
  836. self.C6.transform.anchoredPosition = Vector3(ScreenWidth/2,ScreenHeight/2,0)
  837. width = ScreenWidth/2 - x + w / 2
  838. height = ScreenHeight / 2 - y - h/2
  839. self.C6.transform.sizeDelta = Vector2(width,height)
  840. self.C8.transform.anchoredPosition = Vector3(ScreenWidth/2,-ScreenHeight/2,0)
  841. width = ScreenWidth/2 - x - w / 2
  842. height = ScreenHeight / 2 + y + h/2
  843. self.C8.transform.sizeDelta = Vector2(width,height)
  844. end
  845. --设置矩形遮罩的位置
  846. function GuidePromptView:ShowLeaveTimer(x,y)
  847. if not self.time_label then
  848. self.time_label = UiFactory.createChild(self.attch_node, UIType.Label2)
  849. self.time_label.transform.pivot = Vector2(0, 1)
  850. self.time_label.transform.anchoredPosition = Vector2(x,y)
  851. self.time_txt = self.time_label:GetComponent("Text")
  852. end
  853. self:CancelLeaveTimer()
  854. local onUpdate = function ( )
  855. if UnityEngine.Transform.Equals(self.attch_node,nil) then
  856. self:Close()
  857. return
  858. end
  859. self.time_diff = self.time_diff - 1
  860. if self.time_diff <= 0 then
  861. self.time_txt.text = ""
  862. self:CancelLeaveTimer()
  863. if self.call_back then
  864. self.call_back()
  865. end
  866. return
  867. end
  868. self.time_txt.text = self.time_diff.."s后自动关闭"
  869. end
  870. self.time_txt.text = ""
  871. if not self.leave_timer_id then
  872. self.time_txt.text = self.time_diff.."s后自动关闭"
  873. self.leave_timer_id = GlobalTimerQuest:AddPeriodQuest(onUpdate, 1, -1)
  874. end
  875. onUpdate()
  876. end
  877. function GuidePromptView:CancelLeaveTimer( )
  878. if self.leave_timer_id then
  879. GlobalTimerQuest:CancelQuest(self.leave_timer_id)
  880. self.leave_timer_id = nil
  881. end
  882. end
  883. function GuidePromptView:GetAnimEndPos(i_type)
  884. if not self.old_pos then
  885. self.old_pos = Vector3(0,0,0)
  886. end
  887. local pos = Vector3(self.old_pos.x, self.old_pos.y, self.old_pos.z )
  888. --目前就只有左右2个方向
  889. if i_type == 1 or i_type == 2 then
  890. pos = Vector3(-10 + self.old_pos.x , self.old_pos.y, self.old_pos.z )
  891. end
  892. return pos
  893. end
  894. function GuidePromptView:StopAnim()
  895. if not IsNull(self.arrow_dir_root_obj) then
  896. self.arrow_dir_root_obj:SetActive(false)
  897. end
  898. if self.tween_id then
  899. TweenLite.Stop(self.tween_id)
  900. self.tween_id = nil
  901. end
  902. if self.tween_id2 then
  903. TweenLite.Stop(self.tween_id2)
  904. self.tween_id2 = nil
  905. end
  906. if self.tween_id3 then
  907. TweenLite.Stop(self.tween_id3)
  908. self.tween_id3 = nil
  909. end
  910. end
  911. function GuidePromptView:StartAnim()
  912. if self.arrow_tip_dir == 1 then
  913. SetAnchoredPosition(self.arrow_dir_root, -90, 0 )
  914. SetLocalScale(self.arrow_dir_root, -1, 1, 1)
  915. else
  916. SetAnchoredPosition(self.arrow_dir_root, 90, 0 )
  917. SetLocalScale(self.arrow_dir_root, 1, 1, 1)
  918. end
  919. self.arrow_dir_root_obj:SetActive(true)
  920. self.old_pos = self.anim_root.localPosition
  921. if self.twenn_id == nil then
  922. local function onCompleted()
  923. self:ArrowAnimation()
  924. end
  925. self.tween_id = TweenLite.to(self, self.anim_root,TweenLite.UiAnimationType.POS, self:GetAnimEndPos(self.arrow_tip_dir) ,0.6,onCompleted,TweenFunc.EASE_IN_OUT)
  926. end
  927. end
  928. function GuidePromptView:ArrowAnimation()
  929. local call_fun = function ()
  930. local function onCompleted()
  931. self:ArrowAnimation()
  932. end
  933. self.tween_id3 =TweenLite.to(self, self.anim_root,TweenLite.UiAnimationType.POS, self:GetAnimEndPos(self.arrow_tip_dir) ,0.6,onCompleted,TweenFunc.EASE_IN_OUT)
  934. end
  935. self.tween_id2 =TweenLite.to(self, self.anim_root,TweenLite.UiAnimationType.POS,self:GetAnimEndPos(), 0.6, call_fun, TweenFunc.EASE_IN_OUT)
  936. end