源战役客户端
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

38 lignes
1.1 KiB

il y a 4 semaines
  1. InstructionItem2 = InstructionItem2 or BaseClass(BaseItem)
  2. function InstructionItem2:__init()
  3. self.base_file = "common"
  4. -- self.use_local_view = true
  5. self.layout_file = "instructionItem2"
  6. self.height = 0
  7. self:Load()
  8. end
  9. function InstructionItem2:Load_callback()
  10. self.titleText = self:GetChild("title"):GetComponent("Text")
  11. self.titleCon = self:GetChild("title").gameObject
  12. self.contentText = self:GetChild("content")
  13. self.contentText_t = self:GetChild("content"):GetComponent("Text")
  14. end
  15. function InstructionItem2:SetData(vo)
  16. if vo then
  17. local width=0
  18. if vo.itemTitle =="" then --无需子标题
  19. self.titleCon:SetActive(false)
  20. self.contentText.transform.anchoredPosition = Vector2(0, -45)
  21. width = 651.8
  22. else
  23. width = 620.9
  24. self.titleCon:SetActive(true)
  25. self.titleText.text = vo.itemTitle
  26. self.contentText.transform.anchoredPosition = Vector2(30, -70)
  27. end
  28. self.contentText_t.text = vo.content
  29. self.height = self.contentText_t.preferredHeight
  30. self.contentText.sizeDelta = Vector2(width,self.height)
  31. self.height = self.height + 35
  32. end
  33. end
  34. function InstructionItem2:GetHeight()
  35. return self.height
  36. end