|
ChildSkillViewNew = ChildSkillViewNew or BaseClass(BaseView)
|
|
local ChildSkillViewNew = ChildSkillViewNew
|
|
|
|
-- skillContent 和 SkillItem的参数
|
|
local ITEM_HEIGHT = 118 -- itme的高度
|
|
local SPACE_Y = 8 -- item的间隔
|
|
local SCROLL_HEIGHT = 503 -- 显示的高度
|
|
|
|
|
|
function ChildSkillViewNew:__init()
|
|
self.base_file = "child"
|
|
self.layout_file = "ChildSkillViewNew"
|
|
self.layer_name = "UI"
|
|
self.destroy_imm = true
|
|
self.use_background = G_USING_BG --全屏界面默认使用这个参数
|
|
self.hide_maincancas = true --全屏界面需要放开隐藏主UI
|
|
self.change_scene_close = true
|
|
self.append_to_ctl_queue = false --是否要添加进界面堆栈
|
|
self.need_show_money = false --是否要显示顶部的金钱栏
|
|
self.blur_activity_bg = true
|
|
self.close_fog = true
|
|
|
|
self.model = ChildModel:getInstance()
|
|
self.content_y = 0 -- skillcontent的posy
|
|
|
|
self.skill_item_list = {}
|
|
self.attr_item_list = {}
|
|
self.attr_item_next_list = {}
|
|
self.select_item = 0
|
|
self.skill_count = TableSize(self.model:GetChildSkillList())
|
|
|
|
self.load_callback = function ()
|
|
self:LoadSuccess()
|
|
self:AddEvent()
|
|
end
|
|
self.open_callback = function ( )
|
|
self:OpenSuccess()
|
|
end
|
|
self.switch_callback = function(index)
|
|
self:SwitchTab(index)
|
|
end
|
|
self.destroy_callback = function ( )
|
|
self:DestroySuccess()
|
|
end
|
|
end
|
|
|
|
function ChildSkillViewNew:Open( )
|
|
--self.data = data
|
|
BaseView.Open(self)
|
|
end
|
|
|
|
function ChildSkillViewNew:LoadSuccess()
|
|
local nodes = {
|
|
"bg:raw",
|
|
-- 技能预览
|
|
"rt_image_show","toggle_play:obj",
|
|
-- downCon
|
|
"downCon/btn_level_up/confirmBtnText:tmp",
|
|
"downCon/btn_level_up/btn_level_up_red_dot:obj",
|
|
"downCon/btn_level_up:obj",
|
|
|
|
"downCon/img_arrow_fight:obj",
|
|
"downCon/curCon:obj",
|
|
"downCon/curCon/ScrollView_attr/Viewport/content_attr",
|
|
"downCon/curCon/txt_lv:tmp",
|
|
"downCon/curCon/txt_fight:txt",
|
|
"downCon/nextCon:obj",
|
|
"downCon/nextCon/txt_lv_after:tmp",
|
|
"downCon/nextCon/txt_fight_after:txt",
|
|
"downCon/nextCon/ScrollView_attr_after/Viewport/content_attr_after",
|
|
|
|
"downCon/itemCon:obj",
|
|
"downCon/itemCon/item_parent:obj",
|
|
-- "downCon/itemCon/ui_num_bg/item_num_txt:tmp",
|
|
--技能描述
|
|
"skill_desc_bg/skill_desc_txt2:tmp", "skill_desc_bg/di/skill_icon:img",
|
|
"skill_desc_bg/skill_desc_txt3:tmp", "skill_desc_bg/skill_desc_txt:tmp",
|
|
"skill_desc_bg/skill_desc_txt_name:tmp",
|
|
--左侧技能tab
|
|
"ScrollView_skill/Viewport/skillContent",
|
|
-- 其他
|
|
"none_bg:obj", "close:obj",
|
|
"upBtn:obj", "downBtn:obj", "ScrollView_skill:scroll",
|
|
"skill_bg:img",
|
|
"downBtn/downBtnRed:obj",
|
|
}
|
|
self:GetChildren(nodes)
|
|
self:UpdateBaseView( )
|
|
end
|
|
|
|
function ChildSkillViewNew:UpdateBaseView( )
|
|
lua_resM:setOutsideRawImage(self, self.bg_raw, GameResPath.GetViewBigBg("child_skill_bg_1173_647"))
|
|
lua_resM:setOutsideImageSprite(self, self.skill_bg_img, GameResPath.GetChildIcon("child_skill_show_bg"), false)
|
|
-- local close_callback = function()
|
|
-- self:Close()
|
|
-- end
|
|
-- self.tab_win = UITabWindow.New(self.transform, nil, nil,
|
|
-- close_callback, self.background_wnd, nil, UITabWindow.SizeSmallHallNoTab, false,nil,true)
|
|
-- --self.tab_win:SetTitleRes("child_asset","child_title") --标题
|
|
-- self.tab_win:SetBackgroundRes("child_skill_bg_1280_720")
|
|
-- self.tab_win:SetTitleText("宝宝技能")
|
|
-- self.tab_win:ChangeShowFlag("Child")
|
|
|
|
-- if self.ScrollView_skill_scroll then
|
|
-- self.ScrollView_skill_scroll.onValueChanged:RemoveAllListeners()
|
|
-- self.ScrollView_skill_scroll.onValueChanged:AddListener(function()
|
|
-- self:UpdateArrowObj()
|
|
-- end)
|
|
-- end
|
|
|
|
-- 设置背景UI放到后面
|
|
local function bg_back_func( ... )
|
|
if self.background_wnd and self.background_wnd:GetComponent("RawImageExtend") then
|
|
self:MoveUIToBack(self.background_wnd:GetComponent("RawImageExtend"))
|
|
end
|
|
-- self:MoveUIToBack(self.tab_win.win_bg)
|
|
self:MoveUIToBack(self.bg_raw)
|
|
self:MoveUIToBack(self.skill_bg_img)
|
|
end
|
|
if self.background_wnd then
|
|
bg_back_func()
|
|
else
|
|
self.bg_back_func = bg_back_func
|
|
end
|
|
end
|
|
|
|
function ChildSkillViewNew:UpdateArrowObj()
|
|
if self.skill_count > 4 then
|
|
local _, y = GetAnchoredPosition(self.skillContent)
|
|
self.downBtn_obj:SetActive(y < 380)
|
|
self.upBtn_obj:SetActive(y > 100)
|
|
self:UpdateDownBtnRedDot(y)
|
|
else
|
|
self.downBtn_obj:SetActive(false)
|
|
self.upBtn_obj:SetActive(false)
|
|
end
|
|
end
|
|
|
|
function ChildSkillViewNew:AddEvent()
|
|
local function onBtnClickHandler(target, x, y)
|
|
if target == self.btn_level_up_obj then
|
|
if self.select_item.skill_lv == 0 then
|
|
self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16513,1,self.select_item.skill_id)--
|
|
else
|
|
self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16513,2,self.select_item.skill_id)
|
|
end
|
|
elseif target == self.toggle_play_obj then
|
|
self:UpdateRoleModel()
|
|
elseif target == self.close_obj then
|
|
self:Close()
|
|
elseif target == self.upBtn_obj then
|
|
self.skillContent.localPosition = Vector2(0, 0)
|
|
elseif target == self.downBtn_obj then
|
|
self.skillContent.localPosition = Vector2(0, 495)
|
|
end
|
|
end
|
|
AddClickEvent(self.btn_level_up_obj, onBtnClickHandler)
|
|
AddClickEvent(self.toggle_play_obj, onBtnClickHandler)
|
|
AddClickEvent(self.close_obj, onBtnClickHandler)
|
|
AddClickEvent(self.upBtn_obj, onBtnClickHandler)
|
|
AddClickEvent(self.downBtn_obj, onBtnClickHandler)
|
|
|
|
-- 红点更新
|
|
local function updata_Child_RED_DOT_VIEW_fun(id)
|
|
if id ~= ChildConst.TabId.ChildSkill then return end
|
|
--logWarn('=======Msh:ChildSkillViewNew.lua[138]=======')
|
|
self:UpdateRedDot()
|
|
self:UpdateRedDotBtn()
|
|
self:UpdateDownBtnRedDot( )
|
|
end
|
|
self.updata_Child_RED_DOT_VIEW_id = self.model:Bind(ChildConst.Child_RED_DOT_VIEW, updata_Child_RED_DOT_VIEW_fun)
|
|
|
|
-- 激活技能升级
|
|
local function updata_child_skill_info_fun(skill_id,skill_lv)
|
|
local skill_id = skill_id or self.cur_skill_id
|
|
local skill_lv = skill_lv or self.cur_skill_lv
|
|
self:SetSkillCon(skill_id,skill_lv, true)
|
|
self.select_item:SetData(skill_id,skill_lv)
|
|
end
|
|
self.updata_child_skill_info = self.model:Bind(ChildConst.UPDATA_CHILD_SKILL_INFO, updata_child_skill_info_fun,vo)
|
|
end
|
|
|
|
function ChildSkillViewNew:OpenSuccess()
|
|
self:UpdateView()
|
|
end
|
|
|
|
function ChildSkillViewNew:UpdateView()
|
|
self:SetIsOpenCon()
|
|
local skill_list = self.model:GetChildSkillList()
|
|
local function callback( item )
|
|
for k,v in pairs(self.skill_item_list) do
|
|
v:SetChosen(false)
|
|
end
|
|
item:SetChosen(true)
|
|
self:SetSkillCon(item.skill_id,item.skill_lv)
|
|
self.select_item = item
|
|
self:UpdateRoleModel()
|
|
self:UpdateRedDot()
|
|
self:UpdateRedDotBtn()
|
|
end
|
|
local item_count = 0
|
|
for k,v in pairs(skill_list) do
|
|
local item = self.skill_item_list[k]
|
|
if item == nil then
|
|
item = ChildSkillItem.New(self.skillContent)
|
|
self.skill_item_list[k] = item
|
|
end
|
|
self.skill_item_list[k]:SetData(v.skill_id,v.skill_lv,callback)
|
|
if k == 1 then
|
|
self:SetSkillCon(v.skill_id,v.skill_lv)
|
|
self.select_item = self.skill_item_list[k]
|
|
self.skill_item_list[k]:SetChosen(true)
|
|
end
|
|
item_count = item_count + 1
|
|
end
|
|
self.item_count = item_count
|
|
self.content_size_y = self.item_count * (ITEM_HEIGHT + SPACE_Y) - SPACE_Y
|
|
self:UpdateRedDotBtn()
|
|
self:UpdateRedDot()
|
|
self:UpdateDownBtnRedDot( )
|
|
--SetSizeDeltaX(self.Content, (135+16.6)*(#skill_list)+20)
|
|
self:UpdateRoleModel()
|
|
end
|
|
|
|
-- 设置消耗的材料数目
|
|
--[[function ChildSkillViewNew:SetNumText(need_num, have_num)
|
|
local color = have_num >= need_num and ColorUtil.GREEN_DARK or ColorUtil.RED_DARK
|
|
self.item_num_txt_tmp.text = string.format("<color=%s>%s</color>/%s", color,have_num,need_num)
|
|
end--]]
|
|
|
|
-- 设置宝宝技能数据显示
|
|
function ChildSkillViewNew:SetSkillCon( skill_id,lv, check_effect )
|
|
local skill_id = skill_id or self.cur_skill_id
|
|
self.cur_skill_id = skill_id
|
|
local lv = lv or self.cur_skill_lv
|
|
self.cur_skill_lv = lv
|
|
local selectList = self.model:GetConfigChildSkillInfo(skill_id,lv) -- 当前技能数据
|
|
local selectList_next = self.model:GetConfigChildSkillInfo(skill_id,lv+1) -- 下一级技能数据
|
|
|
|
local skill_is_max = not (TableSize(selectList_next) > 0)
|
|
-- 消耗材料显示
|
|
if not skill_is_max then -- 技能是否是最高级
|
|
if not self.levelUpAwardItem then -- 升级消耗材料
|
|
self.levelUpAwardItem = UIObjPool:getInstance():PopItem(UIObjPool.UIType.AwardItem,self.item_parent)
|
|
self.levelUpAwardItem:SetItemSize(62, 62)
|
|
end
|
|
local active_cost = stringtotable(selectList_next.active_cost)
|
|
if active_cost[1][1] == 0 then
|
|
self.levelUpAwardItem:SetData(active_cost[1][2])
|
|
end
|
|
local have_num = GoodsModel:getInstance():GetTypeGoodsNum(active_cost[1][2]) or 0
|
|
local need_num = active_cost[1][3]
|
|
local get_str = HtmlColorTxt(have_num, have_num < need_num and ColorUtil.RED_DARK or ColorUtil.GREEN_DARK) .."/".. need_num
|
|
self.levelUpAwardItem:SetNumStr("")
|
|
self.levelUpAwardItem:IsGetGoods(true, get_str, true)
|
|
|
|
--self:SetNumText(active_cost[1][3], hadNum)
|
|
self.itemCon_obj:SetActive(true)
|
|
else
|
|
self.itemCon_obj:SetActive(false) -- 满级就不用显示消耗材料
|
|
end
|
|
|
|
-- 战斗力及等级
|
|
local is_up = false -- 是否播放进阶特效
|
|
local last_str = self.txt_lv_tmp.text
|
|
self.txt_lv_tmp.text = selectList.level.."级"
|
|
|
|
if not self.show_fight_effect then self.show_fight_effect = 0 end -- 初始化
|
|
if self.has_init then
|
|
if (self.show_fight_effect <= 0) and check_effect and last_str ~= self.txt_lv_tmp.text then
|
|
is_up = true
|
|
local function call_back( )
|
|
self.show_fight_effect = self.show_fight_effect - 1
|
|
end
|
|
self:ClearUIEffect(self.txt_fight_after)
|
|
self:ClearUIEffect(self.txt_fight)
|
|
|
|
-- 两个特效正在播
|
|
if not skill_is_max then
|
|
self.show_fight_effect = self.show_fight_effect + 1
|
|
self:AddUIEffect("ui_jinjieshuxing", self.txt_fight_after,
|
|
self.layer_name, Vector3(-160,40,0), 1, false, 0.75, nil, call_back)
|
|
end
|
|
self.show_fight_effect = self.show_fight_effect + 1
|
|
self:AddUIEffect("ui_jinjieshuxing", self.txt_fight,
|
|
self.layer_name, Vector3(-160,40,0), 1, false, 0.75, nil, call_back)
|
|
end
|
|
end
|
|
if not self.has_init then -- 第一次初始化标志
|
|
self.has_init = true
|
|
end
|
|
|
|
self.txt_fight_txt.text = "f" .. GetFighting(stringtotable(selectList.add_attr_list))
|
|
self.txt_lv_after_tmp.text = skill_is_max and "已满级" or (selectList.level + 1).."级"
|
|
self.txt_fight_after_txt.text = skill_is_max and "" or "f" .. GetFighting(stringtotable(selectList_next.add_attr_list))
|
|
|
|
-- 按钮描述
|
|
if lv == 0 then
|
|
self.confirmBtnText_tmp.text = "激活技能"
|
|
else
|
|
self.confirmBtnText_tmp.text = "提升等级"
|
|
end
|
|
|
|
-- 技能属性
|
|
local attr_list = self.model:GetChildSkillShowAttrList(selectList.sequence, selectList.level)
|
|
for i=1,#self.attr_item_list do -- 隐藏一下先
|
|
self.attr_item_list[i]:SetVisible(false)
|
|
end
|
|
for k,v in pairs(attr_list) do
|
|
local item = self.attr_item_list[k]
|
|
if item == nil then
|
|
item = ChildSkillAttrItem.New(self.content_attr)
|
|
self.attr_item_list[k] = item
|
|
end
|
|
self.attr_item_list[k]:SetData(v.attr_id,v.num_before,k, is_up)
|
|
item:SetVisible(true)
|
|
end
|
|
|
|
for i=1,#self.attr_item_next_list do
|
|
self.attr_item_next_list[i]:SetVisible(false)
|
|
end
|
|
if not skill_is_max then -- 是否是最高级
|
|
for k,v in pairs(attr_list) do
|
|
local item_next = self.attr_item_next_list[k]
|
|
if item_next == nil then
|
|
item_next = ChildSkillAttrItem.New(self.content_attr_after)
|
|
self.attr_item_next_list[k] = item_next
|
|
end
|
|
self.attr_item_next_list[k]:SetData(v.attr_id,v.num_after,k, is_up) --裂成两个attr
|
|
item_next:SetVisible(true)
|
|
end
|
|
end
|
|
|
|
-- 技能文本类信息
|
|
local list = ConfigItemMgr.Instance:GetSkillItem(skill_id)
|
|
-- 名字
|
|
local skillLv = stringtotable(selectList.active_skill)
|
|
local skill_lv_num = skillLv and Trim(skillLv[1][2]) or 0
|
|
self.skill_desc_txt_name_tmp.text = Trim(list.name).." Lv."..skill_lv_num
|
|
-- 描述
|
|
local desc_lv = skill_lv_num == 0 and 1 or skill_lv_num
|
|
if list.lvs[tonumber(desc_lv)] then
|
|
self.skill_desc_txt2_tmp.text = ChuanWenManager:getInstance():FormatColorTag(Trim(list.lvs[tonumber(desc_lv)].desc))
|
|
else
|
|
self.skill_desc_txt2_tmp.text = Trim(list.name)
|
|
end
|
|
|
|
-- 升至下级的提示文本
|
|
if skill_is_max then
|
|
self.skill_desc_txt3_tmp.text = "当前被激活的技能已满级\n"
|
|
else
|
|
local show_str1 = "" -- 觉醒要求
|
|
local show_str2 = "" -- 战力前置
|
|
local show_str3 = "" -- 技能前置
|
|
-- 觉醒技能要求
|
|
local near_up_level = self.model:GetConfigChildSkillNearActiveLevel((skillLv and Trim(skillLv[1][2]) or 0) + 1)
|
|
if near_up_level then
|
|
show_str1 = string.format("觉醒等级 <color=%s>%s</color> 级时升至下级\n","#16ea00",near_up_level)
|
|
else
|
|
show_str1 = "当前被激活的技能已满级\n"
|
|
end
|
|
if skill_lv_num == 0 then -- 未激活时
|
|
show_str1 = string.format("觉醒等级 <color=%s>%s</color> 级时升至下级\n","#16ea00",1)
|
|
end
|
|
-- 战力要求
|
|
local color = ColorUtil.RED
|
|
if RoleManager.Instance.mainRoleInfo.fighting >= selectList_next.need_power then
|
|
color = ColorUtil.GREEN
|
|
end
|
|
show_str2 = string.format("玩家战力达到 <color=%s>%s</color>\n", color, selectList_next.need_power)
|
|
|
|
-- 技能要求
|
|
local skill_list_open_nearest = self.model:GetOpenSkillNearestId()
|
|
local before_skill_name = ""
|
|
if Config.Childskill[(selectList.sequence - 1).."@1"] then
|
|
before_skill_name = Config.Childskill[(selectList.sequence - 1).."@1"].skill_name
|
|
else
|
|
before_skill_name = "无"
|
|
end
|
|
local isActive = lv > 0
|
|
local color = ColorUtil.RED
|
|
if skill_list_open_nearest and selectList.sequence == skill_list_open_nearest.sequence or isActive then
|
|
color = ColorUtil.GREEN
|
|
end
|
|
show_str3 = string.format("激活前置技能 <color=%s>%s</color>", color, before_skill_name)
|
|
|
|
self.skill_desc_txt3_tmp.text = show_str1 .. show_str2 .. show_str3
|
|
end
|
|
|
|
-- 技能图标 selectList.active_skill and
|
|
if skill_id then
|
|
lua_resM:setOutsideImageSprite(self, self.skill_icon_img, GameResPath.GetSkillIcon(skill_id), true)
|
|
end
|
|
|
|
-- 主动/被动技能描述
|
|
if list and list.type == 1 then
|
|
self.skill_desc_txt_tmp.text = "宝宝主动技能"
|
|
else
|
|
self.skill_desc_txt_tmp.text = "宝宝被动技能"
|
|
end
|
|
|
|
if skill_is_max then
|
|
self.confirmBtnText_tmp.text = "已满级"
|
|
self.img_arrow_fight_obj:SetActive(false)
|
|
-- SetLocalPositionX(self.txt_fight, -10)
|
|
-- SetLocalPositionX(self.ScrollView_attr, 35.1)
|
|
self.nextCon_obj:SetActive(false)
|
|
--self.ScrollView_attr_after_obj:SetActive(false)
|
|
--self.txt_fight_after_obj:SetActive(false)
|
|
--self.show_need_con_obj:SetActive(false)
|
|
--SetLocalPositionX(self.btn_level_up, 34.8)
|
|
else
|
|
self.img_arrow_fight_obj:SetActive(true)
|
|
self.nextCon_obj:SetActive(true)
|
|
-- SetLocalPositionX(self.txt_fight, -254.3)
|
|
-- SetLocalPositionX(self.ScrollView_attr, -206.3)
|
|
--self.ScrollView_attr_after_obj:SetActive(true)
|
|
--self.txt_fight_after_obj:SetActive(true)
|
|
--self.show_need_con_obj:SetActive(true)
|
|
--SetLocalPositionX(self.btn_level_up, 357.8)
|
|
end
|
|
end
|
|
|
|
-- 刷新技能预览
|
|
function ChildSkillViewNew:UpdateRoleModel( )
|
|
if not self.toggle_play_obj or not self.rt_image_show then
|
|
return
|
|
end
|
|
|
|
self.toggle_play_obj:SetActive(false)
|
|
self:CancelSkillAnimation()
|
|
local function delay()
|
|
self.toggle_play_obj:SetActive(true)
|
|
end
|
|
self.effect_time_id = GlobalTimerQuest:AddDelayQuest(delay,2)
|
|
self:SetRoleData(true)
|
|
end
|
|
|
|
function ChildSkillViewNew:SetRoleData()
|
|
local skill_vo = SkillManager:getInstance():GetFightSkillMovie(self.cur_skill_id)
|
|
if not (skill_vo and skill_vo.particles and skill_vo.particles[1] and skill_vo.particles[1].res) then
|
|
return
|
|
end
|
|
local effect_name = skill_vo.particles[1].res
|
|
local skill_cfg = ChildConst.SKILL_EFFECT_SHOW_CFG[effect_name] or {}
|
|
local show_figure_id = false
|
|
if self.model:GetChildCurState() < ChildConst.BABY_STATE.YOUNG then
|
|
show_figure_id = self.model:GetBaseChildModelID( ChildConst.BABY_STATE.YOUNG,
|
|
self.model.childInfo.child_sex )
|
|
else
|
|
show_figure_id = self.model:GetChildCloth()
|
|
end
|
|
self.show_figure_id = show_figure_id
|
|
local res_data = {
|
|
father_node = self,
|
|
transform = self.rt_image_show,
|
|
fashion_type = FuncOpenModel.TypeId.Child,
|
|
figure_id = show_figure_id,
|
|
ui_model_type = UIModelCommon.ModelType.Model,
|
|
can_rotate = false,
|
|
action_name_list = {"skill"},
|
|
scale = 150,
|
|
position = skill_cfg.position or Vector3(-50, -160, 0),
|
|
rotate = skill_cfg.rotate or Vector3(-5, 45, 0),
|
|
show_baby_attack_effect = effect_name,
|
|
}
|
|
FuncOpenModel:getInstance():SetModelRes(res_data)
|
|
-- print('Msh:ChildSkillViewNew.lua[456] data', effect_name)
|
|
end
|
|
|
|
-- 更新向下箭头红点
|
|
function ChildSkillViewNew:UpdateDownBtnRedDot( content_y )
|
|
if not self.item_count then return end
|
|
local content_y = content_y or self.content_y
|
|
self.content_y = content_y
|
|
local hide_size_y = self.content_size_y - content_y - SCROLL_HEIGHT -- 处于下方的隐藏中content的高度
|
|
|
|
local hide_count = math.floor( hide_size_y / (ITEM_HEIGHT + SPACE_Y) )
|
|
|
|
-- 检查红点 隐藏中的Item的红点
|
|
local bool = false
|
|
for i = self.item_count - hide_count + 1, self.item_count do
|
|
if self.skill_item_list[i]:GetRedDot() then
|
|
bool = true
|
|
break
|
|
end
|
|
end
|
|
self.downBtnRed_obj:SetActive(bool)
|
|
end
|
|
|
|
-- 更新技能页签红点
|
|
function ChildSkillViewNew:UpdateRedDot( )
|
|
if self.model:IsCanUpSkill() then
|
|
local skillList = self.model:GetChildSkillList( )
|
|
local skill_list_open_nearest = self.model:GetOpenSkillNearestId()
|
|
--logWarn('=======Msh:ChildSkillViewNew.lua[460]=======')
|
|
for k,v in pairs(skillList) do
|
|
local skill_list_next = self.model:GetConfigChildSkillInfo(v.skill_id,v.skill_lv+1)
|
|
if TableSize(skill_list_next) > 0 then -- 是否是最高级
|
|
local active_cost = stringtotable(skill_list_next.active_cost)
|
|
if active_cost[1][1] == 0 then
|
|
local hadNum = GoodsModel:getInstance():GetTypeGoodsNum(active_cost[1][2]) or 0
|
|
local isNearst = (not skill_list_open_nearest) or ( v.sequence <= skill_list_open_nearest.sequence)
|
|
--logWarn('=======Msh:ChildSkillViewNew.lua[468]=======')
|
|
--print('Msh:ChildSkillViewNew.lua[469] hadNum', hadNum, active_cost[1][3], isNearst, k)
|
|
if self.skill_item_list[k] then
|
|
self.skill_item_list[k]:SetRedDot(hadNum >= active_cost[1][3] and isNearst)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
-- 更新按钮红点
|
|
function ChildSkillViewNew:UpdateRedDotBtn( )
|
|
if self.model:IsCanUpSkill() then
|
|
local skill_list_open_nearest = self.model:GetOpenSkillNearestId()
|
|
local select_sequence = self.model:GetConfigChildSkillInfo(self.select_item.skill_id,1).sequence --死取一级的名字
|
|
local skill_list_next = self.model:GetConfigChildSkillInfo(self.select_item.skill_id, self.select_item.skill_lv+1)
|
|
--logWarn('=======Msh:ChildSkillViewNew.lua[480]=======')
|
|
--print('Msh:ChildSkillViewNew.lua[481] data', self.select_item.skill_id)
|
|
--print('Msh:ChildSkillViewNew.lua[481] data', select_sequence)
|
|
--print('Msh:ChildSkillViewNew.lua[481] data', self.select_item.skill_lv)
|
|
--PrintTable(skill_list_next)
|
|
if TableSize(skill_list_next) > 0 then -- 是否是最高级
|
|
local active_cost = stringtotable(skill_list_next.active_cost)
|
|
if active_cost[1][1] == 0 then
|
|
local hadNum = GoodsModel:getInstance():GetTypeGoodsNum(active_cost[1][2]) or 0
|
|
local isNearst = (not skill_list_open_nearest) or ( select_sequence <= skill_list_open_nearest.sequence)
|
|
--logWarn('=======Msh:ChildSkillViewNew.lua[484]=======')
|
|
--print('Msh:ChildSkillViewNew.lua[485] data', hadNum, active_cost[1][3], isNearst)
|
|
self.btn_level_up_red_dot_obj:SetActive(hadNum >= active_cost[1][3] and isNearst)
|
|
end
|
|
else
|
|
--logWarn('=======Msh:ChildSkillViewNew.lua[489]=======')
|
|
self.btn_level_up_red_dot_obj:SetActive(false)
|
|
end
|
|
end
|
|
end
|
|
|
|
-- 设置界面锁定状态
|
|
function ChildSkillViewNew:SetIsOpenCon( )
|
|
local child_list = self.model:GetChildInfo()
|
|
local limit_num = self.model:GetConfigChildKvVal("skill_open_stage")
|
|
if self.none_bg_obj and self.text_limit_txt then
|
|
self.none_bg_obj:SetActive(not(child_list.child_age_month >= limit_num))
|
|
self.text_limit_txt.text = string.format("成长达<color=%s>%s</color>月开启","#f4adff",limit_num)
|
|
end
|
|
end
|
|
|
|
function ChildSkillViewNew:SwitchTab( index )
|
|
|
|
end
|
|
|
|
function ChildSkillViewNew:CancelSkillAnimation( )
|
|
if self.effect_time_id then
|
|
GlobalTimerQuest:CancelQuest(self.effect_time_id)
|
|
self.effect_time_id = nil
|
|
end
|
|
end
|
|
|
|
function ChildSkillViewNew:DestroySuccess( )
|
|
self:CancelSkillAnimation()
|
|
for i, v in ipairs(self.attr_item_list) do
|
|
v:DeleteMe()
|
|
v = nil
|
|
end
|
|
self.attr_item_list = {}
|
|
|
|
for i, v in ipairs(self.attr_item_next_list) do
|
|
v:DeleteMe()
|
|
v = nil
|
|
end
|
|
self.attr_item_next_list = {}
|
|
|
|
for i, v in ipairs(self.skill_item_list) do
|
|
v:DeleteMe()
|
|
v = nil
|
|
end
|
|
self.skill_item_list = {}
|
|
|
|
|
|
if self.updata_child_skill_info then
|
|
self.model:UnBind(self.updata_child_skill_info)
|
|
self.updata_child_skill_info = nil
|
|
end
|
|
|
|
if self.updata_Child_RED_DOT_VIEW_id then
|
|
self.model:UnBind(self.updata_Child_RED_DOT_VIEW_id)
|
|
self.updata_Child_RED_DOT_VIEW_id = nil
|
|
end
|
|
|
|
|
|
UIObjPool:getInstance():PushItem(UIObjPool.UIType.AwardItem, self.levelUpAwardItem)
|
|
self.levelUpAwardItem = nil
|
|
|
|
if self.tab_win then
|
|
self.tab_win:DeleteMe()
|
|
self.tab_win = nil
|
|
end
|
|
|
|
if self.updata_Child_RED_DOT_VIEW_id then
|
|
self.model:UnBind(self.updata_Child_RED_DOT_VIEW_id)
|
|
self.updata_Child_RED_DOT_VIEW_id = nil
|
|
end
|
|
end
|