源战役客户端
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

635 righe
22 KiB

  1. LightSubView = LightSubView or BaseClass(BaseItem)
  2. local LightSubView = LightSubView
  3. -- LightSubView.Width = 200
  4. -- LightSubView.Height = 90
  5. function LightSubView:__init(parent_wnd,prefab_asset,layer_name)
  6. self.base_file = "light"
  7. self.layout_file = "LightSubView"
  8. self.layer_name = layer_name
  9. self.model = LightModel:GetInstance()
  10. self.full_screen = true
  11. self.ani_left = -200
  12. self.ani_right = 200
  13. self.adjust_mid = {left = 240, right = 600}
  14. self.cur_select_id = false
  15. self.tab_item_list = {}
  16. self.model:Fire(LightModel.REQUEST_CCMD_EVENT, 14700)
  17. self:Load()
  18. end
  19. function LightSubView:Load_callback()
  20. self.nodes = {
  21. "right", "mid", "left", "left/scroll_left/Viewport/Content_left", "left/scroll_left", "right/btn_skin:img:obj", "mid/power_text:txt",
  22. "right/attr_scroll/Viewport/attr_con", "right/attr_scroll", "mid/roleCon", "mid/di_name:img", "right/attr_scroll/Viewport:img",
  23. "right/con_skill/icon_skill:img:obj", "right/con_skill/skill_name:tmp",
  24. "right/con_skill/skill_des:tmp",
  25. "right/con_skill/skill_level:tmp",
  26. "right/con_condition_other:obj","right/con_condition_other/lb_active_other:tmp",
  27. "right/con_up:obj", "right/con_condition_other/di_active_other",
  28. "right/con_up/btn_up:obj:img", "right/con_up/btn_up/btn_red:obj", "right/con_up/btn_up/btn_up_text:tmp",
  29. "right/con_up/cost_con/name_text:tmp", "right/con_up/cost_con/num_text:tmp", "right/con_up/cost_con/cost_item_con","right/con_up/cost_con:obj",
  30. "right/con_star_2:obj", "right/con_star_1",
  31. "right/con_star_1/star_5:img", "right/con_star_1/star_2:img", "right/con_star_1/star_3:img", "right/con_star_1/star_6:img", "right/con_star_1/star_1:img", "right/con_star_1/star_4:img",
  32. "right/con_star_2/star2_5:img", "right/con_star_2/star2_2:img", "right/con_star_2/star2_3:img", "right/con_star_2/star2_6:img", "right/con_star_2/star2_1:img", "right/con_star_2/star2_4:img",
  33. "right/lb_attr:tmp", "right/lb_attr_des:tmp", "right/icon_special:img", "right/lb_grade:tmp",
  34. "right/btn_active:obj:img", "mid/lb_name:tmp", "right/btn_active/btn_active_red:obj",
  35. "right/lb_tip_up:tmp", "right/di_1:img","right/con_di_cost:obj", "mid/di_fight",
  36. }
  37. self:GetChildren(self.nodes)
  38. self:RegisterMask(self.Viewport_img)
  39. self.cost_item = self.cost_item or UIObjPool:getInstance():PopItem(UIObjPool.UIType.AwardItem,self.cost_item_con)
  40. self.cost_item:SetItemSize(59,59)
  41. lua_resM:setOutsideImageSprite(self,self.di_1_img,"/client/assets/icon/light/light_bg_1.png")
  42. -------------------------
  43. self:AddEvents()
  44. self:UpdateView()
  45. self:AddToStageHandler()
  46. end
  47. function LightSubView:AddEvents( )
  48. local function call_back( target )
  49. if target == self.btn_skin_obj then
  50. self.model:Fire(LightModel.REQUEST_CCMD_EVENT, 14702,self.cur_select_id)
  51. elseif target == self.btn_up_obj then
  52. local helpVo = GuideModel:getInstance():GetHelpVo(HelpType.TYPE_LIGHT,4)
  53. if helpVo then
  54. GlobalEventSystem:Fire(EventName.FINISH_CURRENT_HELP_STEP,helpVo)
  55. end
  56. if self.need_more_goods_id then
  57. --道具不足弹物品
  58. UIToolTipMgr:getInstance():AppendGoodsTips(self.need_more_goods_id,nil,nil,nil,nil,nil,nil,true)
  59. return
  60. end
  61. local is_active = self.model:GetLightIsActive( self.cur_select_id )
  62. if is_active then
  63. self.model:Fire(LightModel.REQUEST_CCMD_EVENT, 14701,self.cur_select_id)
  64. else
  65. self.model:Fire(LightModel.REQUEST_CCMD_EVENT, 14703,self.cur_select_id)
  66. end
  67. elseif target == self.icon_skill_obj then
  68. local conf = self.model:GetLightConfOne( self.cur_select_id )
  69. if not conf then return end
  70. local skill_info = stringtotable(conf.skill)
  71. -------------------------
  72. local data = {
  73. skill_id = tonumber(skill_info[1]),
  74. skill_lv = tonumber(skill_info[2]),
  75. }
  76. GlobalEventSystem:Fire(EventName.OPEN_COMMON_SKILL_TIPS, data)
  77. elseif target == self.btn_active_obj then
  78. if self.need_more_goods_id then
  79. --道具不足弹物品
  80. UIToolTipMgr:getInstance():AppendGoodsTips(self.need_more_goods_id,nil,nil,nil,nil,nil,nil,true)
  81. return
  82. elseif self.jump_active and self.jump_active[1] then
  83. OpenFun.Open(self.jump_active[1],self.jump_active[2])
  84. return
  85. end
  86. self.model:Fire(LightModel.REQUEST_CCMD_EVENT, 14703,self.cur_select_id)
  87. local helpVo = GuideModel:getInstance():GetHelpVo(HelpType.TYPE_LIGHT,4)
  88. if helpVo then
  89. GlobalEventSystem:Fire(EventName.FINISH_CURRENT_HELP_STEP,helpVo)
  90. end
  91. end
  92. end
  93. AddClickEvent(self.btn_skin_obj,call_back,false)
  94. AddClickEvent(self.btn_up_obj,call_back,false)
  95. AddClickEvent(self.icon_skill_obj,call_back,false)
  96. AddClickEvent(self.btn_active_obj,call_back,false)
  97. local function updata_all( )
  98. self:UpdateView()
  99. end
  100. self:BindEvent(self.model, LightModel.ANS_LIGHT_BASE, updata_all)
  101. local function ANS_LIGHT_UPGRADE( lv )
  102. if lv then
  103. self:ShowEveryUpEffect(true)
  104. self:ShowStarEffect(lv)
  105. else
  106. self:UpdateView()
  107. end
  108. end
  109. self:BindEvent(self.model, LightModel.ANS_LIGHT_UPGRADE, ANS_LIGHT_UPGRADE)
  110. local function on_ans_update_red_dot( )
  111. self:CheckRedDot()
  112. end
  113. self:BindEvent(NewMainRoleModel:getInstance(), NewMainRoleModel.ANS_UPDATE_RED_DOT, on_ans_update_red_dot)
  114. local function onGuideTrigger()
  115. self:AddToStageHandler()
  116. end
  117. self.guide_trigger_id = GlobalEventSystem:Bind(EventName.TRIGGER_GUIDE_TYPE,onGuideTrigger)
  118. end
  119. function LightSubView:CheckRedDot( )
  120. if self.is_loaded then
  121. local can_active = self.model:CanLightActive( false,self.cur_select_id )
  122. self.btn_red_obj:SetActive(can_active or self.model:CanLightUpGrade( false,self.cur_select_id ))
  123. self.btn_active_red_obj:SetActive(can_active)
  124. if self.jump_active and self.jump_active[1] then
  125. SetImageGray( self.btn_active_img, false )
  126. else
  127. SetImageGray( self.btn_active_img, not can_active )
  128. end
  129. if self.item_list_com then
  130. self.item_list_com:IterateItems(function( item, i )
  131. item:UpdateRed()
  132. end)
  133. end
  134. end
  135. end
  136. function LightSubView:UpdateView( )
  137. self:UpdateRight()
  138. self:ShowModel()
  139. end
  140. function LightSubView:ShowStarEffect( star )
  141. if not star then return end
  142. star = star % 6
  143. star = star == 0 and 6 or star
  144. if self["star_"..star] then
  145. self:AddUIEffect("ui_jinjiestar", self["star_"..star].transform, self.layer_name, nil, 1, false)
  146. end
  147. end
  148. function LightSubView:ShowEveryUpEffect( is_upgrade )
  149. if not self.showing_attr_effect then
  150. --快速点击还能看到重播是因为节点隐藏显示重复触发
  151. self.showing_attr_effect = true
  152. local function clockFun()
  153. self.showing_attr_effect = false
  154. if self.attr_effect_time_id then
  155. GlobalTimerQuest:CancelQuest(self.attr_effect_time_id)
  156. self.attr_effect_time_id = nil
  157. end
  158. end
  159. self.attr_effect_time_id = self.attr_effect_time_id or GlobalTimerQuest:AddPeriodQuest(clockFun, 0.75, 1)
  160. -------------------------
  161. if self.attr_list_com and self.attr_list_com.item_list then
  162. for k,v in pairs(self.attr_list_com.item_list) do
  163. if v.attr_icon1 then
  164. self:AddUIEffect("ui_jinjieshuxing", v.attr_icon1, self.layer_name, Vector3(-40,0,0), 1, false, nil, true)
  165. end
  166. end
  167. end
  168. end
  169. -------------------------
  170. if is_upgrade then
  171. --跳级才播放
  172. if not self.showing_mode_effect then
  173. local function call_back( )
  174. self.showing_mode_effect = false
  175. end
  176. self:ClearUIEffect(self.di_fight.transform)
  177. self:AddUIEffect("ui_jinjie", self.di_fight, self.layer_name, Vector3(165,180,0), 1, false, 1.5, nil, call_back)
  178. self.showing_mode_effect = true
  179. end
  180. end
  181. end
  182. function LightSubView:UpdateRight( )
  183. self:SetTabItem()
  184. self:ShowProp()
  185. self:UpdateSkill()
  186. self:UpdateCost()
  187. self:UpdateStarShow()
  188. self:ShowUseStatus()
  189. -------------------------
  190. self:CheckRedDot()
  191. end
  192. function LightSubView:SetTabItem( )
  193. local list_data = self.model:GetLightSubTabInfo( )
  194. -------------------------
  195. if not self.cur_select_id then
  196. if not list_data[1] then return end
  197. self.cur_select_id = list_data[1].id
  198. end
  199. -------------------------
  200. local function call_back( cur_select_id )
  201. if cur_select_id and cur_select_id ~= self.cur_select_id then
  202. self.cur_select_id = cur_select_id
  203. self:UpdateView()
  204. end
  205. end
  206. if not self.item_list_com then
  207. self.item_list_com = self:AddUIComponent(UI.ItemListCreator)
  208. end
  209. local info = {
  210. data_list = list_data,
  211. item_con = self.Content_left,
  212. item_class = LightTabItem,
  213. item_width = 143,
  214. item_height = 125,
  215. space_x = 8,
  216. space_y = 5.25,
  217. start_x = 4,
  218. start_y = -8,
  219. scroll_view = self.scroll_left,
  220. create_frequency = 0,
  221. is_scroll_back_on_update = false,
  222. on_update_item = function(item, i, v)
  223. item:SetData(i, v, call_back,self.cur_select_id)
  224. end,
  225. }
  226. self.item_list_com:UpdateItems(info)
  227. end
  228. function LightSubView:ShowProp( )
  229. if not self.is_loaded then return end
  230. local basic = self.model:GetLightInfoOne( self.cur_select_id )
  231. local grade,star = 0,0
  232. if basic then
  233. grade = basic.grade
  234. star = basic.lv
  235. end
  236. -------------------------
  237. local conf = self.model:GetLightLvConfOne( self.cur_select_id, grade, star )
  238. if not conf then return end
  239. -------------------------
  240. local base_attr = stringtotable(conf.attrs)
  241. local is_active = self.model:GetLightIsActive( self.cur_select_id )
  242. self.power_text_txt.text = "f" .. GetFighting(base_attr, is_active)
  243. --处理一下attr_list 改成两个一组
  244. local count = #base_attr
  245. local new_base_attr = {}
  246. local is_max = self.model:GetLightIsMax( self.cur_select_id )
  247. for i = 1, count do
  248. local data = {
  249. attr_id1 = base_attr[i] and base_attr[i][1] or nil,
  250. value1 = base_attr[i] and base_attr[i][2] or nil,
  251. next_value1 = base_attr[i] and base_attr[i][3] or nil,
  252. }
  253. -------------------------
  254. if not is_max then
  255. local conf_next = self.model:GetLightLvConfOne( self.cur_select_id,conf.next_grade,conf.next_lv )
  256. if conf_next then
  257. local last_attrs = stringtotable(conf_next.attrs)
  258. for kk,vv in pairs(last_attrs) do
  259. if vv[1] == data.attr_id1 then
  260. data.next_value1 = vv[2]
  261. break
  262. end
  263. end
  264. end
  265. end
  266. -------------------------
  267. table.insert(new_base_attr, data)
  268. end
  269. if not self.attr_list_com then
  270. self.attr_list_com = self:AddUIComponent(UI.ItemListCreator)
  271. end
  272. local info = {
  273. data_list = new_base_attr,
  274. item_con = self.attr_con,
  275. item_class = LightAttrItemThree,
  276. item_width = 363,
  277. item_height = 36,
  278. space_x = 20,
  279. -- space_y = 0,
  280. start_x = 2,
  281. -- start_y = 0,
  282. scroll_view = self.attr_scroll,
  283. -- create_frequency = 0,
  284. is_scroll_back_on_update = false,
  285. on_update_item = function(item, i, v)
  286. item:SetData(i,v)
  287. end,
  288. }
  289. self.attr_list_com:UpdateItems(info)
  290. end
  291. function LightSubView:ShowUseStatus( )
  292. local is_active = self.model:GetLightIsActive( self.cur_select_id )
  293. self.btn_skin_obj:SetActive(is_active)
  294. local basic = self.model:GetLightInfoOne( self.cur_select_id )
  295. -------------------------
  296. if basic and (basic.display == 1) then
  297. lua_resM:setImageSprite(self,self.btn_skin_img,'light_asset',"light_icon_17",true)
  298. else
  299. lua_resM:setImageSprite(self,self.btn_skin_img,'light_asset',"light_icon_16",true)
  300. end
  301. end
  302. function LightSubView:ShowModel( force )
  303. if not self.is_loaded then
  304. return
  305. end
  306. if (self.show_effect_id ~= self.cur_select_id) or force then
  307. local res_data = {
  308. father_node = self,
  309. transform = self.roleCon,
  310. fashion_type = FuncOpenModel.TypeId.Light,
  311. -- size = Vector2(720,720),
  312. scale = 3,
  313. position = Vector3(-20,-150,0),
  314. ui_model_type = UIModelCommon.ModelType.BackModel,
  315. light_id = self.cur_select_id,
  316. layer_name = self.layer_name
  317. }
  318. FuncOpenModel:getInstance():SetModelRes(res_data)
  319. self.show_effect_id = self.cur_select_id
  320. -------------------------
  321. local conf = self.model:GetLightConfOne( self.cur_select_id )
  322. -- 幻光名字根据品质变色
  323. lua_resM:setImageSprite(self, self.di_name_img, "light_asset", "light_di_16" .. "_" .. conf.color, true)
  324. self.lb_name_tmp.text = conf and Trim(conf.name) or ""
  325. local mat = conf.color == 1 and ShaderTools.TMPSharedMaterialType.FZZZOutlineDarkBlueBtn
  326. or (conf.color == 2 and ShaderTools.TMPSharedMaterialType.FZZZOutlineDeepPurpleTitle
  327. or (conf.color == 3 and ShaderTools.TMPSharedMaterialType.FZZZOutlineDarkOrangeBtn
  328. or ShaderTools.TMPSharedMaterialType.FZZZSDFDefault))
  329. SetTMPSharedMaterial(self.lb_name_tmp, mat)
  330. end
  331. end
  332. function LightSubView:UpdateSkill( )
  333. if not self.is_loaded then return end
  334. local conf = self.model:GetLightConfOne( self.cur_select_id )
  335. if not conf then return end
  336. local skill_info = stringtotable(conf.skill)
  337. local skill_conf = SkillManager:getInstance():getSkillFromConfig(skill_info[1])
  338. -- 品质变色
  339. self.skill_name_tmp.text = HtmlColorTxt(Trim(skill_conf.name or ""), self.model.text_color[conf.color]) .. HtmlColorTxt(conf.color == 3 and "" or "(激活高阶幻光可升级)", ColorUtil.ORANGE, 0.8)
  340. self.skill_level_tmp.text = "lv." .. Trim(conf.color)
  341. -- local skill_desc_str = Trim(skill_conf.lvs[tonumber(skill_info[2])].desc or "")
  342. -- if skill_desc_str ~= "" then
  343. -- local pos = string.find(skill_desc_str, '(')
  344. -- end
  345. self.skill_des_tmp.text = Trim(skill_conf.lvs[tonumber(skill_info[2])].desc or "")
  346. lua_resM:setOutsideImageSprite(self, self.icon_skill_img, GameResPath.GetSkillIcon(tonumber(skill_info[1])),true)
  347. end
  348. function LightSubView:UpdateStarShow( )
  349. local basic = self.model:GetLightInfoOne( self.cur_select_id )
  350. local grade,star = 0,0
  351. if basic then
  352. grade = basic.grade
  353. star = basic.lv
  354. end
  355. local conf = self.model:GetLightConfOne(self.cur_select_id)
  356. local is_active = self.model:GetLightIsActive( self.cur_select_id )
  357. self.lb_grade_tmp.text = is_active and ((grade == 0 and 1 or grade) .. "") or ""
  358. -------------------------
  359. local is_max = self.model:GetLightIsMax( self.cur_select_id )
  360. self.con_star_2_obj:SetActive(not is_max)
  361. SetAnchoredPositionX( self.con_star_1.transform, is_max and 70 or -32.59065 )
  362. local img_node,use_style,next_lv,next_grade,temp_conf = false,false,false,false,false
  363. local function get_show_style( id )
  364. id = id or 1
  365. id = id % 6
  366. return (id == 0) and 6 or id
  367. end
  368. for i=1,6 do
  369. img_node = self["star_" .. i .. "_img"]
  370. use_style = grade > 0 and grade or 1
  371. if star >= i then
  372. lua_resM:setImageSprite(self, img_node, "light_asset", "light_star_" .. get_show_style(use_style) .. "_1",true)
  373. else
  374. if use_style == 1 then
  375. lua_resM:setImageSprite(self, img_node, "light_asset", "light_star_0",true)
  376. else
  377. lua_resM:setImageSprite(self, img_node, "light_asset", "light_star_" .. get_show_style(use_style-1) .. "_1",true)
  378. end
  379. end
  380. -------------------------
  381. if not is_max then
  382. temp_conf = self.model:GetLightLvConfOne( self.cur_select_id,grade,star )
  383. if temp_conf then
  384. next_lv = temp_conf.next_lv
  385. next_grade = temp_conf.next_grade
  386. img_node = self["star2_" .. i .. "_img"]
  387. use_style = next_grade > 0 and next_grade or 1
  388. if next_lv >= i then
  389. lua_resM:setImageSprite(self, img_node, "light_asset", "light_star_" .. get_show_style(use_style) .. "_1",true)
  390. else
  391. if use_style == 1 then
  392. lua_resM:setImageSprite(self, img_node, "light_asset", "light_star_0",true)
  393. else
  394. lua_resM:setImageSprite(self, img_node, "light_asset", "light_star_" .. get_show_style(use_style-1) .. "_1",true)
  395. end
  396. end
  397. end
  398. end
  399. end
  400. -------------------------
  401. --特殊属性
  402. local lv_conf = self.model:GetLightLvConfOne( self.cur_select_id, grade, star )
  403. if not lv_conf then return end
  404. local temp_data2 = stringtotable(lv_conf.spe_attrs)
  405. local attr_num = temp_data2[1] and tonumber(temp_data2[1][2] or 0) or 0
  406. local min_val = 999
  407. local min_grade,min_lv = 999,999
  408. local attr_id = false
  409. for k,v in pairs(Config.Visuslv) do
  410. if v.id == self.cur_select_id then
  411. for a,b in pairs(stringtotable(v.spe_attrs)) do
  412. attr_id = attr_id or b[1]
  413. if b[1] == attr_id and b[2] > attr_num then
  414. if min_grade > v.grade then
  415. min_val = b[2]
  416. min_grade = v.grade
  417. min_lv = v.lv
  418. elseif min_grade == v.grade then
  419. if min_lv > v.lv then
  420. min_val = b[2]
  421. min_grade = v.grade
  422. min_lv = v.lv
  423. end
  424. end
  425. end
  426. end
  427. end
  428. end
  429. if attr_id then
  430. local _, name1, _, val1 = WordManager:GetPropertyInfo(attr_id, attr_num == 0 and min_val or attr_num)
  431. local is_active = self.model:GetLightIsActive( self.cur_select_id )
  432. self.lb_attr_tmp.text = name1 .. "" .. val1
  433. SetAttrIconByColorType(self, self.icon_special_img, attr_id, nil, 2)
  434. local temp_str = is_active and (temp_data2[1] and "提升)" or "激活)") or "解锁)"
  435. self.lb_attr_des_tmp.text = "(" .. min_grade .. "" .. min_lv .. "" .. temp_str
  436. if min_grade == 999 then
  437. self.lb_attr_des_tmp.text = ""
  438. end
  439. else
  440. local _, name1, _, val1 = WordManager:GetPropertyInfo(attr_id, attr_num == 0 and min_val or attr_num)
  441. self.lb_attr_tmp.text = name1 .. "" .. val1
  442. self.lb_attr_des_tmp.text = ""
  443. end
  444. end
  445. function LightSubView:UpdateCost( )
  446. local is_active = self.model:GetLightIsActive( self.cur_select_id )
  447. local success_rate = 0--成功率
  448. -------------------------
  449. local base_conf = self.model:GetLightConfOne( self.cur_select_id )
  450. if not base_conf then
  451. return
  452. end
  453. local basic = self.model:GetLightInfoOne( self.cur_select_id )
  454. local grade,star = 0,0
  455. if basic then
  456. grade = basic.grade
  457. star = basic.lv
  458. end
  459. local cost_data = stringtotable(base_conf.item)[1]
  460. local lv_conf = self.model:GetLightLvConfOne( self.cur_select_id, grade, star )
  461. if not is_active then
  462. cost_data = stringtotable(base_conf.item)[1]
  463. else
  464. if lv_conf then
  465. cost_data = stringtotable(lv_conf.cost)[1]
  466. success_rate = lv_conf.rate
  467. end
  468. end
  469. if is_active then
  470. self.lb_tip_up_tmp.text = string.format( "成功率:<color=#fdffc2>%d%%</color>", success_rate )
  471. else
  472. self.lb_tip_up_tmp.text = ""
  473. end
  474. if self.model:GetLightIsMax( self.cur_select_id ) then
  475. self.lb_tip_up_tmp.text = ""
  476. self.btn_up_text_tmp.text = "已满级"
  477. SetImageGray( self.btn_up_img, true )
  478. SetTMPSharedMaterial(self.btn_up_text_tmp, ShaderTools.TMPSharedMaterialType.FZZZOutlineDarkGrayBtn)
  479. else
  480. if is_active then
  481. self.btn_up_text_tmp.text = (lv_conf.next_lv == 1 and grade ~= 0) and "突破" or "升星"
  482. else
  483. self.btn_up_text_tmp.text = "激活"
  484. end
  485. SetImageGray( self.btn_up_img, false )
  486. SetTMPSharedMaterial(self.btn_up_text_tmp, ShaderTools.TMPSharedMaterialType.FZZZSDFOutlineDarkOrangeBtn)
  487. end
  488. self.need_more_goods_id = false
  489. self.jump_active = false
  490. if cost_data then
  491. --使用道具
  492. self.btn_up_obj:SetActive(true)
  493. self.con_condition_other_obj:SetActive(false)
  494. self.btn_active_obj:SetActive(false)
  495. self.cost_con_obj:SetActive(true)
  496. -------------------------
  497. self.cost_item:SetDataWithMapId(cost_data[2])
  498. self.name_text_tmp.text = GoodsModel:getInstance():getGoodsName(cost_data[2], true)
  499. local goods_num = GoodsModel:getInstance():GetGoodsNumFromType(cost_data[1], cost_data[2])
  500. self.num_text_tmp.text = WordManager:AddColorToString(goods_num,goods_num >= cost_data[3] and '2CF86F' or 'ff203a',false) .. "/" .. cost_data[3]
  501. self.need_more_goods_id = goods_num < cost_data[3] and cost_data[2] --消耗道具提示
  502. self.con_di_cost_obj:SetActive(true)
  503. else
  504. self.cost_con_obj:SetActive(false)
  505. --不需要使用道具
  506. if is_active then
  507. --满级?
  508. self.btn_up_obj:SetActive(true)
  509. self.con_condition_other_obj:SetActive(false)
  510. self.btn_active_obj:SetActive(false)
  511. -------------------------
  512. self.con_di_cost_obj:SetActive(true)
  513. else
  514. --需要条件激活
  515. self.btn_up_obj:SetActive(false)
  516. local can_active = self.model:CanLightActive(false,self.cur_select_id)
  517. self.con_condition_other_obj:SetActive(true)
  518. self.btn_active_obj:SetActive(true)
  519. -------------------------
  520. if not can_active then
  521. self.jump_active = stringtotable(base_conf.guide) or false
  522. end
  523. if self.jump_active and self.jump_active[1] then
  524. lua_resM:setImageSprite(self,self.btn_active_img,'light_asset',"light_icon_23",true)
  525. else
  526. lua_resM:setImageSprite(self,self.btn_active_img,'light_asset',"light_icon_22",true)
  527. end
  528. self.lb_active_other_tmp.text = Trim(base_conf.desc) or ""
  529. local info_condition = stringtotable(base_conf.condition)
  530. if info_condition[1] and info_condition[1][1] == "login" then
  531. local cur = self.model:GetLoginDay( )
  532. local is_enough = cur >= tonumber(info_condition[1][2])
  533. cur = is_enough and tonumber(info_condition[1][2]) or cur
  534. local color = is_enough and ColorUtil.GREEN_DARK or ColorUtil.RED_DARK
  535. self.lb_active_other_tmp.text = self.lb_active_other_tmp.text .. "(" .. HtmlColorTxt( cur, color) .. "/" .. tonumber(info_condition[1][2]) .. ")"
  536. end
  537. self.con_di_cost_obj:SetActive(false)
  538. -------------------------
  539. --但是仍然要显示进阶道具?
  540. --[[local lv_conf = self.model:GetLightLvConfOne( self.cur_select_id, 0, 0 )
  541. if lv_conf then
  542. cost_data = stringtotable(lv_conf.cost)[1]
  543. end
  544. self.cost_item:SetDataWithMapId(cost_data[2])
  545. self.name_text_tmp.text = GoodsModel:getInstance():getGoodsName(cost_data[2], false)
  546. local goods_num = GoodsModel:getInstance():GetGoodsNumFromType(cost_data[1], cost_data[2])
  547. self.num_text_tmp.text = WordManager:AddColorToString(goods_num,goods_num >= cost_data[3] and '00b82b' or 'fa1022',false) .. "/" .. cost_data[3]
  548. self.need_more_goods_id = (not can_active) and cost_data[2] or false --消耗道具提示--]]
  549. end
  550. end
  551. end
  552. function LightSubView:SetData( _a,_b,select_id )
  553. self.select_id = select_id
  554. if self.is_loaded then
  555. -- self.need_refreshData = false
  556. self:UpdateView()
  557. self:ShowModel(true)
  558. -- else
  559. -- self.need_refreshData = true
  560. end
  561. end
  562. function LightSubView:__delete( )
  563. if self.cost_item then
  564. UIObjPool:getInstance():PushItem(UIObjPool.UIType.AwardItem, self.cost_item)
  565. self.cost_item = nil
  566. end
  567. if self.attr_effect_time_id then
  568. GlobalTimerQuest:CancelQuest(self.attr_effect_time_id)
  569. self.attr_effect_time_id = nil
  570. end
  571. if self.guide_trigger_id then
  572. GlobalEventSystem:UnBind(self.guide_trigger_id)
  573. self.guide_trigger_id = nil
  574. end
  575. if self.di_fight then
  576. self:ClearUIEffect(self.di_fight.transform)
  577. end
  578. end
  579. function LightSubView:AddToStageHandler()
  580. local helpVo = GuideModel:getInstance():GetHelpVo(HelpType.TYPE_LIGHT,4)
  581. if not helpVo then return end
  582. local help_type = helpVo.help_type
  583. local step = helpVo.step
  584. local button = false
  585. if help_type == HelpType.TYPE_LIGHT and step == 4 then
  586. button = self.btn_active_obj
  587. end
  588. if button then
  589. local function call_back()
  590. end
  591. GlobalEventSystem:Fire(EventName.OPEN_GUIDE_PROMPT_VIEW, button.transform, button.transform.parent.transform, call_back, helpVo, self.layout_file)
  592. end
  593. end