PsionicSkillAttrItem = PsionicSkillAttrItem or BaseClass(BaseItem)
|
|
local PsionicSkillAttrItem = PsionicSkillAttrItem
|
|
|
|
function PsionicSkillAttrItem:__init(parent_wnd,prefab_asset,layer_name)
|
|
self.base_file = "psionic"
|
|
self.layout_file = "PsionicSkillAttrItem"
|
|
self.parent_wnd = parent_wnd
|
|
self.layer_name = layer_name
|
|
|
|
self.model = PsionicModel:getInstance()
|
|
self:Load()
|
|
end
|
|
|
|
function PsionicSkillAttrItem:Load_callback()
|
|
local nodes = {
|
|
"arrow:img",
|
|
"val_name:tmp",
|
|
"val:tmp",
|
|
"val_add:tmp",
|
|
"effect_con",
|
|
}
|
|
self:GetChildren(nodes)
|
|
|
|
|
|
self:AddEvents()
|
|
if self.need_refreshData then
|
|
self:UpdateView()
|
|
end
|
|
end
|
|
|
|
-- 需特殊处理隐藏时的特效表现
|
|
function PsionicSkillAttrItem:SetVisible(state, force_hide)
|
|
BaseItem.SetVisible(self, state, force_hide)
|
|
if not state then
|
|
self:ClearUIEffect(self.effect_con)
|
|
self.showing_effect = false
|
|
end
|
|
end
|
|
|
|
function PsionicSkillAttrItem:AddEvents( )
|
|
local function play_effect(type)
|
|
if type and type == PsionicConst.EffectType.Skill and not self.showing_effect then
|
|
local function callback()
|
|
self.showing_effect = false
|
|
end
|
|
self:ClearUIEffect(self.effect_con)
|
|
self:AddUIEffect("ui_jinjieshuxing", self.effect_con, self.layer_name, Vector3(-175, 0, 0), 1, false, 0.75, nil, call_back)
|
|
self.showing_effect = true
|
|
end
|
|
end
|
|
self:BindEvent(self.model, PsionicConst.PLAY_EFFECT, play_effect)
|
|
end
|
|
|
|
function PsionicSkillAttrItem:UpdateView( )
|
|
if self.data then
|
|
if self.data.attr_list then -- 判断满级的情况,等级
|
|
self.val_name_tmp.text = WordManager:GetProperties(self.data.attr_list.type)
|
|
|
|
local cur_val = WordManager:GetPropertyValue(self.data.attr_list.type, self.data.attr_list.cur_val)
|
|
local next_val = self.data.is_max and "" or "+" .. WordManager:GetPropertyValue(self.data.attr_list.type, self.data.attr_list.next_val - self.data.attr_list.cur_val)
|
|
self.val_tmp.text = cur_val
|
|
self.val_add_tmp.text = next_val
|
|
self.arrow_img.enabled = not self.data.is_max and true or false
|
|
end
|
|
end
|
|
end
|
|
|
|
function PsionicSkillAttrItem:SetData( data, index )
|
|
self.data = data
|
|
self.index = index
|
|
if self.is_loaded then
|
|
self.need_refreshData = false
|
|
self:UpdateView()
|
|
else
|
|
self.need_refreshData = true
|
|
end
|
|
end
|
|
|
|
function PsionicSkillAttrItem:__delete( )
|
|
|
|
end
|