|
|
- CommonInstructionItem = CommonInstructionItem or BaseClass(BaseItem)
- local CommonInstructionItem = CommonInstructionItem
- local SetSizeDelta = SetSizeDelta
-
- function CommonInstructionItem:__init()
- self.base_file = "common"
- self.layout_file = "CommonInstructionItem"
- self.height = 0
- self:Load()
- end
-
- function CommonInstructionItem:Load_callback()
- self.title_text, self.content_text = GetChildTexts(self.transform,{"titleCon/titleText","contentText"})
- self.content_tra = self:GetChild("contentText")
- self.title_go = self:GetChild("titleCon").gameObject
- end
-
- function CommonInstructionItem:SetData(vo)
- if vo then
- if vo.itemTitle=="" then --无需子标题
- self.title_go:SetActive(false)
- self.content_tra.anchoredPosition = Vector2(97, 0)
- else
- self.title_go:SetActive(true)
- self.title_text.text = vo.itemTitle
- self.content_tra.anchoredPosition = Vector2(97, -48)
- end
- self.content_text.text = vo.content
- self.height = self.content_text.preferredHeight + 10
- SetSizeDelta(self.content_tra, 600,self.height)
-
- self.height = self.height + 55
- end
- end
-
- function CommonInstructionItem:GetHeight()
- return self.height
- end
|