OperationItem = OperationItem or BaseClass(BaseItem)
|
|
OperationItem.Width = 126
|
|
OperationItem.Height = 43
|
|
function OperationItem:__init()
|
|
self.base_file = "sociality"
|
|
self.layout_file = "OperationItem"
|
|
-- self.use_local_view = true
|
|
self:Load()
|
|
end
|
|
|
|
function OperationItem:Load_callback()
|
|
self.nodes = {
|
|
"imgBtn:obj:img", "imgBtn/title:tmp",
|
|
}
|
|
self:GetChildren(self.nodes)
|
|
|
|
self:InitEvent()
|
|
if self.need_refreshData then
|
|
self:SetData(self.info, self.call_back)
|
|
end
|
|
end
|
|
|
|
function OperationItem:InitEvent()
|
|
local function onClickBtnHandler(target)
|
|
if target == self.imgBtn_obj then
|
|
if self.info and self.call_back then
|
|
self.call_back(self.info)
|
|
end
|
|
end
|
|
end
|
|
AddClickEvent(self.imgBtn_obj, onClickBtnHandler)
|
|
end
|
|
|
|
function OperationItem:SetData(info, call_back)
|
|
if not info then return end
|
|
self.info = info
|
|
self.call_back = call_back
|
|
if self.is_loaded then
|
|
self.need_refreshData = false
|
|
local is_guild_opera = self.info.id == 8
|
|
lua_resM:setImageSprite(self,self.imgBtn_img,"alphaCommon_asset",is_guild_opera and "tyui_btn_2" or "tyui_btn_1")
|
|
-- 按钮的字体材质
|
|
if is_guild_opera then
|
|
SetTMPSharedMaterial(self.title_tmp, ShaderTools.TMPSharedMaterialType.FZZZOutlineDarkOrangeBtn)
|
|
else
|
|
SetTMPSharedMaterial(self.title_tmp, ShaderTools.TMPSharedMaterialType.FZZZOutlineDarkBlueBtn)
|
|
end
|
|
if info.secondTitle then
|
|
self.title_tmp.text = info.title2
|
|
else
|
|
self.title_tmp.text = info.title
|
|
end
|
|
else
|
|
self.need_refreshData = true
|
|
end
|
|
|
|
end
|
|
|
|
function OperationItem:SetGray(bool)
|
|
SetImageGray(self.imgBtn_img,bool)
|
|
-- self.title_tmp.color = ColorUtil:ConvertHexToRGBColor("#666666")
|
|
end
|
|
|
|
function OperationItem:__delete()
|
|
end
|