ChatDressPropItem = ChatDressPropItem or BaseClass(BaseItem)
|
|
|
|
function ChatDressPropItem:__init(parent_wnd, prefab_asset, layer_name, update_type)
|
|
self.base_file = "chatDress"
|
|
self.layout_file = "ChatDressPropItem"
|
|
if update_type then
|
|
self.layout_file = "ChatDressUpdatePropItem"
|
|
end
|
|
-- self.use_local_view = true
|
|
self:Load()
|
|
end
|
|
|
|
function ChatDressPropItem:Load_callback()
|
|
self.title,
|
|
self.value
|
|
-- self.up_value
|
|
= GetChildTexts(self.transform, {
|
|
"title",
|
|
"value"
|
|
-- "up/value"
|
|
})
|
|
-- self.up,
|
|
self.bg
|
|
= GetChildGameObjects(self.transform, {
|
|
-- "up",
|
|
"bg"
|
|
})
|
|
|
|
if self.need_refreshData then
|
|
self:SetData(self.id, self.now_value, self.color_type)
|
|
end
|
|
end
|
|
|
|
function ChatDressPropItem:SetData(id, now_value, color_type)
|
|
self.id = id
|
|
self.now_value = now_value
|
|
--self.hide_index = hide_index or 1
|
|
-- self.add = add
|
|
self.color_type = color_type
|
|
if self.is_loaded then
|
|
color_type = color_type or 1
|
|
local colorStr = ""
|
|
if color_type == 1 then
|
|
colorStr = Color(24/255,164/255,38/255)
|
|
elseif color_type == 2 then
|
|
colorStr = Color(72/255,72/255,72/255)
|
|
end
|
|
-- self.bg:SetActive(hide_index % 2 ~= 0)
|
|
local _, name, _, value = WordManager:GetPropertyInfo(tonumber(id), now_value,nil,nil, Config.ConfigItemAttr.Module.Dress)
|
|
self.title.text = name.."+"..value
|
|
self.title.color = colorStr
|
|
-- self.value.text = value
|
|
|
|
--if add and add > 0 then
|
|
-- self.up:SetActive(true)
|
|
-- local _, name2, _, value2 = WordManager:GetPropertyInfo(tonumber(id),add, nil,nil,Config.ConfigItemAttr.Module.Dress)
|
|
-- self.up_value.text = value2
|
|
--else
|
|
-- self.up:SetActive(false)
|
|
-- end
|
|
else
|
|
self.need_refreshData = true
|
|
end
|
|
end
|
|
|
|
function ChatDressPropItem:__delete()
|
|
|
|
end
|
|
|