源战役客户端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.1 KiB

  1. CommonInstructionItem = CommonInstructionItem or BaseClass(BaseItem)
  2. local CommonInstructionItem = CommonInstructionItem
  3. local SetSizeDelta = SetSizeDelta
  4. function CommonInstructionItem:__init()
  5. self.base_file = "common"
  6. self.layout_file = "CommonInstructionItem"
  7. self.height = 0
  8. self:Load()
  9. end
  10. function CommonInstructionItem:Load_callback()
  11. self.title_text, self.content_text = GetChildTexts(self.transform,{"titleCon/titleText","contentText"})
  12. self.content_tra = self:GetChild("contentText")
  13. self.title_go = self:GetChild("titleCon").gameObject
  14. end
  15. function CommonInstructionItem:SetData(vo)
  16. if vo then
  17. if vo.itemTitle=="" then --无需子标题
  18. self.title_go:SetActive(false)
  19. self.content_tra.anchoredPosition = Vector2(97, 0)
  20. else
  21. self.title_go:SetActive(true)
  22. self.title_text.text = vo.itemTitle
  23. self.content_tra.anchoredPosition = Vector2(97, -48)
  24. end
  25. self.content_text.text = vo.content
  26. self.height = self.content_text.preferredHeight + 10
  27. SetSizeDelta(self.content_tra, 600,self.height)
  28. self.height = self.height + 55
  29. end
  30. end
  31. function CommonInstructionItem:GetHeight()
  32. return self.height
  33. end