WardrobeTotalItem = WardrobeTotalItem or BaseClass(BaseItem) local WardrobeTotalItem = WardrobeTotalItem function WardrobeTotalItem:__init() self.base_file = "wardrobe" self.layout_file = "WardrobeTotalItem" self.model = WardrobeModel:GetInstance() self:Load() end function WardrobeTotalItem:Load_callback() self.nodes = { "progress_text:tmp", "bg:img", "wardrob_text:tmp", "btn:obj:img", } self:GetChildren(self.nodes) self:AddEvents() if self.need_refreshData then self:UpdateView() end end function WardrobeTotalItem:AddEvents( ) local function on_jump( ... ) local jump_id1, jump_id2 = self.model:GetJumpIdByType(self.data.type) if jump_id1 and jump_id2 then OpenFun.Open(jump_id1, jump_id2) end end AddClickEvent(self.btn_obj, on_jump) end function WardrobeTotalItem:UpdateView( ) local res_name = string.format("wardrobe_type%s", self.data.type) lua_resM:setOutsideImageSprite(self, self.bg_img, GameResPath.GetWardrobeImage(res_name)) lua_resM:setImageSprite(self, self.btn_img, "wardrobe_asset", "wardrobe_btn"..self.data.type) self.wardrob_text_tmp.text = string.format("风采值:%s", HtmlColorTxt(self.data.wardrobe_value, "#FDFFC2")) self.progress_text_tmp.text = string.format("收集度:%s/%s", HtmlColorTxt(self.data.collect, "#FFFFFF"), self.data.sum_collect) end function WardrobeTotalItem: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 WardrobeTotalItem:__delete( ) end