源战役客户端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

606 lines
21 KiB

  1. ChildSkillViewNew = ChildSkillViewNew or BaseClass(BaseView)
  2. local ChildSkillViewNew = ChildSkillViewNew
  3. -- skillContent 和 SkillItem的参数
  4. local ITEM_HEIGHT = 118 -- itme的高度
  5. local SPACE_Y = 8 -- item的间隔
  6. local SCROLL_HEIGHT = 503 -- 显示的高度
  7. function ChildSkillViewNew:__init()
  8. self.base_file = "child"
  9. self.layout_file = "ChildSkillViewNew"
  10. self.layer_name = "UI"
  11. self.destroy_imm = true
  12. self.use_background = G_USING_BG --全屏界面默认使用这个参数
  13. self.hide_maincancas = true --全屏界面需要放开隐藏主UI
  14. self.change_scene_close = true
  15. self.append_to_ctl_queue = false --是否要添加进界面堆栈
  16. self.need_show_money = false --是否要显示顶部的金钱栏
  17. self.blur_activity_bg = true
  18. self.close_fog = true
  19. self.model = ChildModel:getInstance()
  20. self.content_y = 0 -- skillcontent的posy
  21. self.skill_item_list = {}
  22. self.attr_item_list = {}
  23. self.attr_item_next_list = {}
  24. self.select_item = 0
  25. self.skill_count = TableSize(self.model:GetChildSkillList())
  26. self.load_callback = function ()
  27. self:LoadSuccess()
  28. self:AddEvent()
  29. end
  30. self.open_callback = function ( )
  31. self:OpenSuccess()
  32. end
  33. self.switch_callback = function(index)
  34. self:SwitchTab(index)
  35. end
  36. self.destroy_callback = function ( )
  37. self:DestroySuccess()
  38. end
  39. end
  40. function ChildSkillViewNew:Open( )
  41. --self.data = data
  42. BaseView.Open(self)
  43. end
  44. function ChildSkillViewNew:LoadSuccess()
  45. local nodes = {
  46. "bg:raw",
  47. -- 技能预览
  48. "rt_image_show","toggle_play:obj",
  49. -- downCon
  50. "downCon/btn_level_up/confirmBtnText:tmp",
  51. "downCon/btn_level_up/btn_level_up_red_dot:obj",
  52. "downCon/btn_level_up:obj",
  53. "downCon/img_arrow_fight:obj",
  54. "downCon/curCon:obj",
  55. "downCon/curCon/ScrollView_attr/Viewport/content_attr",
  56. "downCon/curCon/txt_lv:tmp",
  57. "downCon/curCon/txt_fight:txt",
  58. "downCon/nextCon:obj",
  59. "downCon/nextCon/txt_lv_after:tmp",
  60. "downCon/nextCon/txt_fight_after:txt",
  61. "downCon/nextCon/ScrollView_attr_after/Viewport/content_attr_after",
  62. "downCon/itemCon:obj",
  63. "downCon/itemCon/item_parent:obj",
  64. -- "downCon/itemCon/ui_num_bg/item_num_txt:tmp",
  65. --技能描述
  66. "skill_desc_bg/skill_desc_txt2:tmp", "skill_desc_bg/di/skill_icon:img",
  67. "skill_desc_bg/skill_desc_txt3:tmp", "skill_desc_bg/skill_desc_txt:tmp",
  68. "skill_desc_bg/skill_desc_txt_name:tmp",
  69. --左侧技能tab
  70. "ScrollView_skill/Viewport/skillContent",
  71. -- 其他
  72. "none_bg:obj", "close:obj",
  73. "upBtn:obj", "downBtn:obj", "ScrollView_skill:scroll",
  74. "skill_bg:img",
  75. "downBtn/downBtnRed:obj",
  76. }
  77. self:GetChildren(nodes)
  78. self:UpdateBaseView( )
  79. end
  80. function ChildSkillViewNew:UpdateBaseView( )
  81. lua_resM:setOutsideRawImage(self, self.bg_raw, GameResPath.GetViewBigBg("child_skill_bg_1173_647"))
  82. lua_resM:setOutsideImageSprite(self, self.skill_bg_img, GameResPath.GetChildIcon("child_skill_show_bg"), false)
  83. -- local close_callback = function()
  84. -- self:Close()
  85. -- end
  86. -- self.tab_win = UITabWindow.New(self.transform, nil, nil,
  87. -- close_callback, self.background_wnd, nil, UITabWindow.SizeSmallHallNoTab, false,nil,true)
  88. -- --self.tab_win:SetTitleRes("child_asset","child_title") --标题
  89. -- self.tab_win:SetBackgroundRes("child_skill_bg_1280_720")
  90. -- self.tab_win:SetTitleText("宝宝技能")
  91. -- self.tab_win:ChangeShowFlag("Child")
  92. -- if self.ScrollView_skill_scroll then
  93. -- self.ScrollView_skill_scroll.onValueChanged:RemoveAllListeners()
  94. -- self.ScrollView_skill_scroll.onValueChanged:AddListener(function()
  95. -- self:UpdateArrowObj()
  96. -- end)
  97. -- end
  98. -- 设置背景UI放到后面
  99. local function bg_back_func( ... )
  100. if self.background_wnd and self.background_wnd:GetComponent("RawImageExtend") then
  101. self:MoveUIToBack(self.background_wnd:GetComponent("RawImageExtend"))
  102. end
  103. -- self:MoveUIToBack(self.tab_win.win_bg)
  104. self:MoveUIToBack(self.bg_raw)
  105. self:MoveUIToBack(self.skill_bg_img)
  106. end
  107. if self.background_wnd then
  108. bg_back_func()
  109. else
  110. self.bg_back_func = bg_back_func
  111. end
  112. end
  113. function ChildSkillViewNew:UpdateArrowObj()
  114. if self.skill_count > 4 then
  115. local _, y = GetAnchoredPosition(self.skillContent)
  116. self.downBtn_obj:SetActive(y < 380)
  117. self.upBtn_obj:SetActive(y > 100)
  118. self:UpdateDownBtnRedDot(y)
  119. else
  120. self.downBtn_obj:SetActive(false)
  121. self.upBtn_obj:SetActive(false)
  122. end
  123. end
  124. function ChildSkillViewNew:AddEvent()
  125. local function onBtnClickHandler(target, x, y)
  126. if target == self.btn_level_up_obj then
  127. if self.select_item.skill_lv == 0 then
  128. self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16513,1,self.select_item.skill_id)--
  129. else
  130. self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16513,2,self.select_item.skill_id)
  131. end
  132. elseif target == self.toggle_play_obj then
  133. self:UpdateRoleModel()
  134. elseif target == self.close_obj then
  135. self:Close()
  136. elseif target == self.upBtn_obj then
  137. self.skillContent.localPosition = Vector2(0, 0)
  138. elseif target == self.downBtn_obj then
  139. self.skillContent.localPosition = Vector2(0, 495)
  140. end
  141. end
  142. AddClickEvent(self.btn_level_up_obj, onBtnClickHandler)
  143. AddClickEvent(self.toggle_play_obj, onBtnClickHandler)
  144. AddClickEvent(self.close_obj, onBtnClickHandler)
  145. AddClickEvent(self.upBtn_obj, onBtnClickHandler)
  146. AddClickEvent(self.downBtn_obj, onBtnClickHandler)
  147. -- 红点更新
  148. local function updata_Child_RED_DOT_VIEW_fun(id)
  149. if id ~= ChildConst.TabId.ChildSkill then return end
  150. --logWarn('=======Msh:ChildSkillViewNew.lua[138]=======')
  151. self:UpdateRedDot()
  152. self:UpdateRedDotBtn()
  153. self:UpdateDownBtnRedDot( )
  154. end
  155. self.updata_Child_RED_DOT_VIEW_id = self.model:Bind(ChildConst.Child_RED_DOT_VIEW, updata_Child_RED_DOT_VIEW_fun)
  156. -- 激活技能升级
  157. local function updata_child_skill_info_fun(skill_id,skill_lv)
  158. local skill_id = skill_id or self.cur_skill_id
  159. local skill_lv = skill_lv or self.cur_skill_lv
  160. self:SetSkillCon(skill_id,skill_lv, true)
  161. self.select_item:SetData(skill_id,skill_lv)
  162. end
  163. self.updata_child_skill_info = self.model:Bind(ChildConst.UPDATA_CHILD_SKILL_INFO, updata_child_skill_info_fun,vo)
  164. end
  165. function ChildSkillViewNew:OpenSuccess()
  166. self:UpdateView()
  167. end
  168. function ChildSkillViewNew:UpdateView()
  169. self:SetIsOpenCon()
  170. local skill_list = self.model:GetChildSkillList()
  171. local function callback( item )
  172. for k,v in pairs(self.skill_item_list) do
  173. v:SetChosen(false)
  174. end
  175. item:SetChosen(true)
  176. self:SetSkillCon(item.skill_id,item.skill_lv)
  177. self.select_item = item
  178. self:UpdateRoleModel()
  179. self:UpdateRedDot()
  180. self:UpdateRedDotBtn()
  181. end
  182. local item_count = 0
  183. for k,v in pairs(skill_list) do
  184. local item = self.skill_item_list[k]
  185. if item == nil then
  186. item = ChildSkillItem.New(self.skillContent)
  187. self.skill_item_list[k] = item
  188. end
  189. self.skill_item_list[k]:SetData(v.skill_id,v.skill_lv,callback)
  190. if k == 1 then
  191. self:SetSkillCon(v.skill_id,v.skill_lv)
  192. self.select_item = self.skill_item_list[k]
  193. self.skill_item_list[k]:SetChosen(true)
  194. end
  195. item_count = item_count + 1
  196. end
  197. self.item_count = item_count
  198. self.content_size_y = self.item_count * (ITEM_HEIGHT + SPACE_Y) - SPACE_Y
  199. self:UpdateRedDotBtn()
  200. self:UpdateRedDot()
  201. self:UpdateDownBtnRedDot( )
  202. --SetSizeDeltaX(self.Content, (135+16.6)*(#skill_list)+20)
  203. self:UpdateRoleModel()
  204. end
  205. -- 设置消耗的材料数目
  206. --[[function ChildSkillViewNew:SetNumText(need_num, have_num)
  207. local color = have_num >= need_num and ColorUtil.GREEN_DARK or ColorUtil.RED_DARK
  208. self.item_num_txt_tmp.text = string.format("<color=%s>%s</color>/%s", color,have_num,need_num)
  209. end--]]
  210. -- 设置宝宝技能数据显示
  211. function ChildSkillViewNew:SetSkillCon( skill_id,lv, check_effect )
  212. local skill_id = skill_id or self.cur_skill_id
  213. self.cur_skill_id = skill_id
  214. local lv = lv or self.cur_skill_lv
  215. self.cur_skill_lv = lv
  216. local selectList = self.model:GetConfigChildSkillInfo(skill_id,lv) -- 当前技能数据
  217. local selectList_next = self.model:GetConfigChildSkillInfo(skill_id,lv+1) -- 下一级技能数据
  218. local skill_is_max = not (TableSize(selectList_next) > 0)
  219. -- 消耗材料显示
  220. if not skill_is_max then -- 技能是否是最高级
  221. if not self.levelUpAwardItem then -- 升级消耗材料
  222. self.levelUpAwardItem = UIObjPool:getInstance():PopItem(UIObjPool.UIType.AwardItem,self.item_parent)
  223. self.levelUpAwardItem:SetItemSize(62, 62)
  224. end
  225. local active_cost = stringtotable(selectList_next.active_cost)
  226. if active_cost[1][1] == 0 then
  227. self.levelUpAwardItem:SetData(active_cost[1][2])
  228. end
  229. local have_num = GoodsModel:getInstance():GetTypeGoodsNum(active_cost[1][2]) or 0
  230. local need_num = active_cost[1][3]
  231. local get_str = HtmlColorTxt(have_num, have_num < need_num and ColorUtil.RED_DARK or ColorUtil.GREEN_DARK) .."/".. need_num
  232. self.levelUpAwardItem:SetNumStr("")
  233. self.levelUpAwardItem:IsGetGoods(true, get_str, true)
  234. --self:SetNumText(active_cost[1][3], hadNum)
  235. self.itemCon_obj:SetActive(true)
  236. else
  237. self.itemCon_obj:SetActive(false) -- 满级就不用显示消耗材料
  238. end
  239. -- 战斗力及等级
  240. local is_up = false -- 是否播放进阶特效
  241. local last_str = self.txt_lv_tmp.text
  242. self.txt_lv_tmp.text = selectList.level..""
  243. if not self.show_fight_effect then self.show_fight_effect = 0 end -- 初始化
  244. if self.has_init then
  245. if (self.show_fight_effect <= 0) and check_effect and last_str ~= self.txt_lv_tmp.text then
  246. is_up = true
  247. local function call_back( )
  248. self.show_fight_effect = self.show_fight_effect - 1
  249. end
  250. self:ClearUIEffect(self.txt_fight_after)
  251. self:ClearUIEffect(self.txt_fight)
  252. -- 两个特效正在播
  253. if not skill_is_max then
  254. self.show_fight_effect = self.show_fight_effect + 1
  255. self:AddUIEffect("ui_jinjieshuxing", self.txt_fight_after,
  256. self.layer_name, Vector3(-160,40,0), 1, false, 0.75, nil, call_back)
  257. end
  258. self.show_fight_effect = self.show_fight_effect + 1
  259. self:AddUIEffect("ui_jinjieshuxing", self.txt_fight,
  260. self.layer_name, Vector3(-160,40,0), 1, false, 0.75, nil, call_back)
  261. end
  262. end
  263. if not self.has_init then -- 第一次初始化标志
  264. self.has_init = true
  265. end
  266. self.txt_fight_txt.text = "f" .. GetFighting(stringtotable(selectList.add_attr_list))
  267. self.txt_lv_after_tmp.text = skill_is_max and "已满级" or (selectList.level + 1)..""
  268. self.txt_fight_after_txt.text = skill_is_max and "" or "f" .. GetFighting(stringtotable(selectList_next.add_attr_list))
  269. -- 按钮描述
  270. if lv == 0 then
  271. self.confirmBtnText_tmp.text = "激活技能"
  272. else
  273. self.confirmBtnText_tmp.text = "提升等级"
  274. end
  275. -- 技能属性
  276. local attr_list = self.model:GetChildSkillShowAttrList(selectList.sequence, selectList.level)
  277. for i=1,#self.attr_item_list do -- 隐藏一下先
  278. self.attr_item_list[i]:SetVisible(false)
  279. end
  280. for k,v in pairs(attr_list) do
  281. local item = self.attr_item_list[k]
  282. if item == nil then
  283. item = ChildSkillAttrItem.New(self.content_attr)
  284. self.attr_item_list[k] = item
  285. end
  286. self.attr_item_list[k]:SetData(v.attr_id,v.num_before,k, is_up)
  287. item:SetVisible(true)
  288. end
  289. for i=1,#self.attr_item_next_list do
  290. self.attr_item_next_list[i]:SetVisible(false)
  291. end
  292. if not skill_is_max then -- 是否是最高级
  293. for k,v in pairs(attr_list) do
  294. local item_next = self.attr_item_next_list[k]
  295. if item_next == nil then
  296. item_next = ChildSkillAttrItem.New(self.content_attr_after)
  297. self.attr_item_next_list[k] = item_next
  298. end
  299. self.attr_item_next_list[k]:SetData(v.attr_id,v.num_after,k, is_up) --裂成两个attr
  300. item_next:SetVisible(true)
  301. end
  302. end
  303. -- 技能文本类信息
  304. local list = ConfigItemMgr.Instance:GetSkillItem(skill_id)
  305. -- 名字
  306. local skillLv = stringtotable(selectList.active_skill)
  307. local skill_lv_num = skillLv and Trim(skillLv[1][2]) or 0
  308. self.skill_desc_txt_name_tmp.text = Trim(list.name).." Lv."..skill_lv_num
  309. -- 描述
  310. local desc_lv = skill_lv_num == 0 and 1 or skill_lv_num
  311. if list.lvs[tonumber(desc_lv)] then
  312. self.skill_desc_txt2_tmp.text = ChuanWenManager:getInstance():FormatColorTag(Trim(list.lvs[tonumber(desc_lv)].desc))
  313. else
  314. self.skill_desc_txt2_tmp.text = Trim(list.name)
  315. end
  316. -- 升至下级的提示文本
  317. if skill_is_max then
  318. self.skill_desc_txt3_tmp.text = "当前被激活的技能已满级\n"
  319. else
  320. local show_str1 = "" -- 觉醒要求
  321. local show_str2 = "" -- 战力前置
  322. local show_str3 = "" -- 技能前置
  323. -- 觉醒技能要求
  324. local near_up_level = self.model:GetConfigChildSkillNearActiveLevel((skillLv and Trim(skillLv[1][2]) or 0) + 1)
  325. if near_up_level then
  326. show_str1 = string.format("觉醒等级 <color=%s>%s</color> 级时升至下级\n","#16ea00",near_up_level)
  327. else
  328. show_str1 = "当前被激活的技能已满级\n"
  329. end
  330. if skill_lv_num == 0 then -- 未激活时
  331. show_str1 = string.format("觉醒等级 <color=%s>%s</color> 级时升至下级\n","#16ea00",1)
  332. end
  333. -- 战力要求
  334. local color = ColorUtil.RED
  335. if RoleManager.Instance.mainRoleInfo.fighting >= selectList_next.need_power then
  336. color = ColorUtil.GREEN
  337. end
  338. show_str2 = string.format("玩家战力达到 <color=%s>%s</color>\n", color, selectList_next.need_power)
  339. -- 技能要求
  340. local skill_list_open_nearest = self.model:GetOpenSkillNearestId()
  341. local before_skill_name = ""
  342. if Config.Childskill[(selectList.sequence - 1).."@1"] then
  343. before_skill_name = Config.Childskill[(selectList.sequence - 1).."@1"].skill_name
  344. else
  345. before_skill_name = ""
  346. end
  347. local isActive = lv > 0
  348. local color = ColorUtil.RED
  349. if skill_list_open_nearest and selectList.sequence == skill_list_open_nearest.sequence or isActive then
  350. color = ColorUtil.GREEN
  351. end
  352. show_str3 = string.format("激活前置技能 <color=%s>%s</color>", color, before_skill_name)
  353. self.skill_desc_txt3_tmp.text = show_str1 .. show_str2 .. show_str3
  354. end
  355. -- 技能图标 selectList.active_skill and
  356. if skill_id then
  357. lua_resM:setOutsideImageSprite(self, self.skill_icon_img, GameResPath.GetSkillIcon(skill_id), true)
  358. end
  359. -- 主动/被动技能描述
  360. if list and list.type == 1 then
  361. self.skill_desc_txt_tmp.text = "宝宝主动技能"
  362. else
  363. self.skill_desc_txt_tmp.text = "宝宝被动技能"
  364. end
  365. if skill_is_max then
  366. self.confirmBtnText_tmp.text = "已满级"
  367. self.img_arrow_fight_obj:SetActive(false)
  368. -- SetLocalPositionX(self.txt_fight, -10)
  369. -- SetLocalPositionX(self.ScrollView_attr, 35.1)
  370. self.nextCon_obj:SetActive(false)
  371. --self.ScrollView_attr_after_obj:SetActive(false)
  372. --self.txt_fight_after_obj:SetActive(false)
  373. --self.show_need_con_obj:SetActive(false)
  374. --SetLocalPositionX(self.btn_level_up, 34.8)
  375. else
  376. self.img_arrow_fight_obj:SetActive(true)
  377. self.nextCon_obj:SetActive(true)
  378. -- SetLocalPositionX(self.txt_fight, -254.3)
  379. -- SetLocalPositionX(self.ScrollView_attr, -206.3)
  380. --self.ScrollView_attr_after_obj:SetActive(true)
  381. --self.txt_fight_after_obj:SetActive(true)
  382. --self.show_need_con_obj:SetActive(true)
  383. --SetLocalPositionX(self.btn_level_up, 357.8)
  384. end
  385. end
  386. -- 刷新技能预览
  387. function ChildSkillViewNew:UpdateRoleModel( )
  388. if not self.toggle_play_obj or not self.rt_image_show then
  389. return
  390. end
  391. self.toggle_play_obj:SetActive(false)
  392. self:CancelSkillAnimation()
  393. local function delay()
  394. self.toggle_play_obj:SetActive(true)
  395. end
  396. self.effect_time_id = GlobalTimerQuest:AddDelayQuest(delay,2)
  397. self:SetRoleData(true)
  398. end
  399. function ChildSkillViewNew:SetRoleData()
  400. local skill_vo = SkillManager:getInstance():GetFightSkillMovie(self.cur_skill_id)
  401. if not (skill_vo and skill_vo.particles and skill_vo.particles[1] and skill_vo.particles[1].res) then
  402. return
  403. end
  404. local effect_name = skill_vo.particles[1].res
  405. local skill_cfg = ChildConst.SKILL_EFFECT_SHOW_CFG[effect_name] or {}
  406. local show_figure_id = false
  407. if self.model:GetChildCurState() < ChildConst.BABY_STATE.YOUNG then
  408. show_figure_id = self.model:GetBaseChildModelID( ChildConst.BABY_STATE.YOUNG,
  409. self.model.childInfo.child_sex )
  410. else
  411. show_figure_id = self.model:GetChildCloth()
  412. end
  413. self.show_figure_id = show_figure_id
  414. local res_data = {
  415. father_node = self,
  416. transform = self.rt_image_show,
  417. fashion_type = FuncOpenModel.TypeId.Child,
  418. figure_id = show_figure_id,
  419. ui_model_type = UIModelCommon.ModelType.Model,
  420. can_rotate = false,
  421. action_name_list = {"skill"},
  422. scale = 150,
  423. position = skill_cfg.position or Vector3(-50, -160, 0),
  424. rotate = skill_cfg.rotate or Vector3(-5, 45, 0),
  425. show_baby_attack_effect = effect_name,
  426. }
  427. FuncOpenModel:getInstance():SetModelRes(res_data)
  428. -- print('Msh:ChildSkillViewNew.lua[456] data', effect_name)
  429. end
  430. -- 更新向下箭头红点
  431. function ChildSkillViewNew:UpdateDownBtnRedDot( content_y )
  432. if not self.item_count then return end
  433. local content_y = content_y or self.content_y
  434. self.content_y = content_y
  435. local hide_size_y = self.content_size_y - content_y - SCROLL_HEIGHT -- 处于下方的隐藏中content的高度
  436. local hide_count = math.floor( hide_size_y / (ITEM_HEIGHT + SPACE_Y) )
  437. -- 检查红点 隐藏中的Item的红点
  438. local bool = false
  439. for i = self.item_count - hide_count + 1, self.item_count do
  440. if self.skill_item_list[i]:GetRedDot() then
  441. bool = true
  442. break
  443. end
  444. end
  445. self.downBtnRed_obj:SetActive(bool)
  446. end
  447. -- 更新技能页签红点
  448. function ChildSkillViewNew:UpdateRedDot( )
  449. if self.model:IsCanUpSkill() then
  450. local skillList = self.model:GetChildSkillList( )
  451. local skill_list_open_nearest = self.model:GetOpenSkillNearestId()
  452. --logWarn('=======Msh:ChildSkillViewNew.lua[460]=======')
  453. for k,v in pairs(skillList) do
  454. local skill_list_next = self.model:GetConfigChildSkillInfo(v.skill_id,v.skill_lv+1)
  455. if TableSize(skill_list_next) > 0 then -- 是否是最高级
  456. local active_cost = stringtotable(skill_list_next.active_cost)
  457. if active_cost[1][1] == 0 then
  458. local hadNum = GoodsModel:getInstance():GetTypeGoodsNum(active_cost[1][2]) or 0
  459. local isNearst = (not skill_list_open_nearest) or ( v.sequence <= skill_list_open_nearest.sequence)
  460. --logWarn('=======Msh:ChildSkillViewNew.lua[468]=======')
  461. --print('Msh:ChildSkillViewNew.lua[469] hadNum', hadNum, active_cost[1][3], isNearst, k)
  462. if self.skill_item_list[k] then
  463. self.skill_item_list[k]:SetRedDot(hadNum >= active_cost[1][3] and isNearst)
  464. end
  465. end
  466. end
  467. end
  468. end
  469. end
  470. -- 更新按钮红点
  471. function ChildSkillViewNew:UpdateRedDotBtn( )
  472. if self.model:IsCanUpSkill() then
  473. local skill_list_open_nearest = self.model:GetOpenSkillNearestId()
  474. local select_sequence = self.model:GetConfigChildSkillInfo(self.select_item.skill_id,1).sequence --死取一级的名字
  475. local skill_list_next = self.model:GetConfigChildSkillInfo(self.select_item.skill_id, self.select_item.skill_lv+1)
  476. --logWarn('=======Msh:ChildSkillViewNew.lua[480]=======')
  477. --print('Msh:ChildSkillViewNew.lua[481] data', self.select_item.skill_id)
  478. --print('Msh:ChildSkillViewNew.lua[481] data', select_sequence)
  479. --print('Msh:ChildSkillViewNew.lua[481] data', self.select_item.skill_lv)
  480. --PrintTable(skill_list_next)
  481. if TableSize(skill_list_next) > 0 then -- 是否是最高级
  482. local active_cost = stringtotable(skill_list_next.active_cost)
  483. if active_cost[1][1] == 0 then
  484. local hadNum = GoodsModel:getInstance():GetTypeGoodsNum(active_cost[1][2]) or 0
  485. local isNearst = (not skill_list_open_nearest) or ( select_sequence <= skill_list_open_nearest.sequence)
  486. --logWarn('=======Msh:ChildSkillViewNew.lua[484]=======')
  487. --print('Msh:ChildSkillViewNew.lua[485] data', hadNum, active_cost[1][3], isNearst)
  488. self.btn_level_up_red_dot_obj:SetActive(hadNum >= active_cost[1][3] and isNearst)
  489. end
  490. else
  491. --logWarn('=======Msh:ChildSkillViewNew.lua[489]=======')
  492. self.btn_level_up_red_dot_obj:SetActive(false)
  493. end
  494. end
  495. end
  496. -- 设置界面锁定状态
  497. function ChildSkillViewNew:SetIsOpenCon( )
  498. local child_list = self.model:GetChildInfo()
  499. local limit_num = self.model:GetConfigChildKvVal("skill_open_stage")
  500. if self.none_bg_obj and self.text_limit_txt then
  501. self.none_bg_obj:SetActive(not(child_list.child_age_month >= limit_num))
  502. self.text_limit_txt.text = string.format("成长达<color=%s>%s</color>月开启","#f4adff",limit_num)
  503. end
  504. end
  505. function ChildSkillViewNew:SwitchTab( index )
  506. end
  507. function ChildSkillViewNew:CancelSkillAnimation( )
  508. if self.effect_time_id then
  509. GlobalTimerQuest:CancelQuest(self.effect_time_id)
  510. self.effect_time_id = nil
  511. end
  512. end
  513. function ChildSkillViewNew:DestroySuccess( )
  514. self:CancelSkillAnimation()
  515. for i, v in ipairs(self.attr_item_list) do
  516. v:DeleteMe()
  517. v = nil
  518. end
  519. self.attr_item_list = {}
  520. for i, v in ipairs(self.attr_item_next_list) do
  521. v:DeleteMe()
  522. v = nil
  523. end
  524. self.attr_item_next_list = {}
  525. for i, v in ipairs(self.skill_item_list) do
  526. v:DeleteMe()
  527. v = nil
  528. end
  529. self.skill_item_list = {}
  530. if self.updata_child_skill_info then
  531. self.model:UnBind(self.updata_child_skill_info)
  532. self.updata_child_skill_info = nil
  533. end
  534. if self.updata_Child_RED_DOT_VIEW_id then
  535. self.model:UnBind(self.updata_Child_RED_DOT_VIEW_id)
  536. self.updata_Child_RED_DOT_VIEW_id = nil
  537. end
  538. UIObjPool:getInstance():PushItem(UIObjPool.UIType.AwardItem, self.levelUpAwardItem)
  539. self.levelUpAwardItem = nil
  540. if self.tab_win then
  541. self.tab_win:DeleteMe()
  542. self.tab_win = nil
  543. end
  544. if self.updata_Child_RED_DOT_VIEW_id then
  545. self.model:UnBind(self.updata_Child_RED_DOT_VIEW_id)
  546. self.updata_Child_RED_DOT_VIEW_id = nil
  547. end
  548. end