|
|
- WardrobeVerTabItem = WardrobeVerTabItem or BaseClass(BaseItem)
- local WardrobeVerTabItem = WardrobeVerTabItem
-
- function WardrobeVerTabItem:__init()
- self.base_file = "wardrobe"
- self.layout_file = "WardrobeVerTabItem"
- self.model = WardrobeModel:GetInstance()
-
- self:Load()
- end
-
- function WardrobeVerTabItem:Load_callback()
- self.nodes = {
- "select_image:obj", "name_text:tmp", "bg:img", "click_con:obj", "icon_image:img",
- }
- self:GetChildren(self.nodes)
-
-
- self:AddEvents()
- if self.need_refreshData then
- self:UpdateView()
- end
- if self.need_reselect then
- self:SetItemSelect(self.cur_select_index)
- end
- end
-
- function WardrobeVerTabItem:AddEvents( )
- local function on_click( )
- if self.call_back_func then
- self.call_back_func(self.index)
- end
- end
- AddClickEvent(self.click_con_obj, on_click)
- end
-
- function WardrobeVerTabItem:UpdateView( )
- self:SetItemSelect(self.cur_select_index)
- local stage = self.model:GetMyWardrobeStage()
- local color_str = "#a9c1e1"
- if self.data.condition <= stage then--开放了的
- color_str = "#ffffff"
- lua_resM:setImageSprite(self, self.bg_img, "wardrobe_asset", "wardrobe_item1")
- else
- lua_resM:setImageSprite(self, self.bg_img, "wardrobe_asset", "wardrobe_item2")
- end
- self.name_text_tmp.text = HtmlColorTxt(self.data.store_name, color_str)
- end
- function WardrobeVerTabItem:SetData( data, index, call_back_func, cur_select_index )
- self.data = data
- self.index = index
- self.call_back_func = call_back_func
- self.cur_select_index = cur_select_index
- if self.is_loaded then
- self.need_refreshData = false
- self:UpdateView()
- else
- self.need_refreshData = true
- end
- end
-
- function WardrobeVerTabItem:SetItemSelect( index )
- self.cur_select_index = index
- if self.is_loaded then
- self.select_image_obj:SetActive(self.index == index)
- if self.index == index then
- lua_resM:setImageSprite(self, self.icon_image_img, "wardrobe_asset", "wardrobe_item6",true)
- else
- local stage = self.model:GetMyWardrobeStage()
- if self.data.condition <= stage then--开放了的
- lua_resM:setImageSprite(self, self.icon_image_img, "wardrobe_asset", "wardrobe_item5",true)
- else
- lua_resM:setImageSprite(self, self.icon_image_img, "wardrobe_asset", "wardrobe_item4",true)
- end
- end
- self.need_reselect = false
- else
- self.need_reselect = true
- end
- end
- -- a9c1e1 锁定
- -- ffffff 解锁
-
- function WardrobeVerTabItem:__delete( )
-
- end
|