|
|
- PopupSelectItem = PopupSelectItem or BaseClass(BaseItem)
- function PopupSelectItem:__init()
- self.base_file = "uiComponent"
- self.layout_file = "PopupSelectItem"
- self:Load()
- end
-
- function PopupSelectItem:Load_callback()
-
- self.border_btn = self:GetChild("Border").gameObject
- self.content = self:GetChild("Content"):GetComponent("Text")
-
- if self.need_refreshData then
- self:SetData(self.index,self.layout_file,self.data,self.callback)
- end
-
- local function onClickHandler(target)
- if target == self.border_btn then
- if self.data then
- if self.callback then
- self.callback(self.data)
- end
- GlobalEventSystem:Fire(EventName.SELECT_POPUP_LIST_ITEM,self.layout_file,self.data)
- end
- end
- end
- AddClickEvent(self.border_btn,onClickHandler)
-
- end
-
- --pre_stage 为当前选中的鉴定物配置表的state
- function PopupSelectItem:SetData(index,layout_file,data,callback)
- self.index = index
- self.layout_file = layout_file
- self.data = data
- self.callback = callback
-
- if self.is_loaded then
- self.need_refreshData = false
- self.content.text = data.content
- else
- self.need_refreshData = true
- end
-
- self:SetPosition(0,(index - 1) * - 50)
- end
-
- function PopupSelectItem:__delete()
-
- end
|