ChildGrowItem = ChildGrowItem or BaseClass(BaseItem)
|
|
function ChildGrowItem:__init()
|
|
self.base_file = "child"
|
|
self.layout_file = "ChildGrowItem"
|
|
self.is_delay_callback = true
|
|
-- self.use_local_view = true
|
|
self:Load()
|
|
end
|
|
|
|
function ChildGrowItem:Load_callback()
|
|
self.nodes = {
|
|
"txt_attr_name:tmp","txt_num1:tmp","txt_num2:tmp:obj",
|
|
"img_icon:img","img_arrow:obj","bg:obj",
|
|
|
|
}
|
|
self:GetChildren(self.nodes)
|
|
self:InitEvent()
|
|
if self.need_refreshData then
|
|
self:SetData(self.attrId, self.num1, self.num2, self.index, self.need_effect)
|
|
end
|
|
end
|
|
|
|
function ChildGrowItem:InitEvent()
|
|
|
|
end
|
|
|
|
function ChildGrowItem:SetData(attrId,num1,num2,index, need_effect)
|
|
self.attrId = attrId or 1
|
|
self.num1 = num1 or ""
|
|
self.num2 = num2 or nil
|
|
self.index = index
|
|
self.need_effect = need_effect
|
|
if self.is_loaded then
|
|
self.txt_num1_tmp.text = self.num1
|
|
|
|
local _, name1, _, val1 = WordManager:GetPropertyInfo(attrId, num1)
|
|
self.txt_attr_name_tmp.text = name1
|
|
|
|
local ab_name,res_name = GameResPath.GetAttrIcon(attrId)
|
|
lua_resM:setImageSprite(self, self.img_icon_img, ab_name,res_name,true)
|
|
if not self.num2 then --满级时
|
|
self.img_arrow_obj:SetActive(false)
|
|
self.txt_num2_obj:SetActive(false)
|
|
--SetLocalPositionX(self.txt_num1, 52)
|
|
--self.txt_num1_tmp.text = num1.." (Max)"
|
|
else
|
|
self.img_arrow_obj:SetActive(true)
|
|
self.txt_num2_obj:SetActive(true)
|
|
self.txt_num2_tmp.text = self.num2 - self.num1
|
|
--SetLocalPositionX(self.txt_num1, -44.1)
|
|
end
|
|
|
|
if self.need_effect then
|
|
if not self.is_in_effect then
|
|
self.is_in_effect = true
|
|
local function call_back( )
|
|
self.is_in_effect = false
|
|
end
|
|
self:ClearUIEffect(self.txt_num1)
|
|
self:AddUIEffect("ui_jinjieshuxing", self.txt_num1, self.layer_name, Vector3(-95,0,0), 0.7, false, 0.75, nil, call_back)
|
|
end
|
|
|
|
end
|
|
|
|
-- if index and index % 2 == 0 then
|
|
-- self.bg_obj:SetActive(true)
|
|
-- else
|
|
-- self.bg_obj:SetActive(false)
|
|
-- end
|
|
else
|
|
self.need_refreshData = true
|
|
end
|
|
end
|