|
|
- InstructionItem2 = InstructionItem2 or BaseClass(BaseItem)
- function InstructionItem2:__init()
- self.base_file = "common"
- -- self.use_local_view = true
- self.layout_file = "instructionItem2"
- self.height = 0
- self:Load()
- end
-
- function InstructionItem2:Load_callback()
- self.titleText = self:GetChild("title"):GetComponent("Text")
- self.titleCon = self:GetChild("title").gameObject
- self.contentText = self:GetChild("content")
- self.contentText_t = self:GetChild("content"):GetComponent("Text")
- end
-
- function InstructionItem2:SetData(vo)
- if vo then
- local width=0
- if vo.itemTitle =="" then --无需子标题
- self.titleCon:SetActive(false)
- self.contentText.transform.anchoredPosition = Vector2(0, -45)
- width = 651.8
- else
- width = 620.9
- self.titleCon:SetActive(true)
- self.titleText.text = vo.itemTitle
- self.contentText.transform.anchoredPosition = Vector2(30, -70)
- end
- self.contentText_t.text = vo.content
- self.height = self.contentText_t.preferredHeight
- self.contentText.sizeDelta = Vector2(width,self.height)
- self.height = self.height + 35
- end
- end
-
- function InstructionItem2:GetHeight()
- return self.height
- end
|