源战役客户端
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

69 行
1.8 KiB

  1. LightAttrItemTwo = LightAttrItemTwo or BaseClass(BaseItem)
  2. local LightAttrItemTwo = LightAttrItemTwo
  3. -- LightAttrItemTwo.Width = 200
  4. -- LightAttrItemTwo.Height = 90
  5. function LightAttrItemTwo:__init()
  6. self.base_file = "light"
  7. self.layout_file = "LightAttrItemTwo"
  8. self.model = FosterModel:GetInstance()
  9. self:Load()
  10. end
  11. function LightAttrItemTwo:Load_callback()
  12. self.nodes = {
  13. "lb_num:tmp", "attr_icon1:img", "lb_attr:tmp", "lb_add:tmp", "up_image1:obj", "bg:obj"
  14. }
  15. self:GetChildren(self.nodes)
  16. self:AddEvents()
  17. if self.need_refreshData then
  18. self:UpdateView()
  19. end
  20. self.lb_num_tmp.text = ""
  21. end
  22. function LightAttrItemTwo:AddEvents( )
  23. end
  24. function LightAttrItemTwo:UpdateView( )
  25. if not self.data then return end
  26. local change_num = (self.data.next_value1 or self.data.value1) - self.data.value1
  27. change_num = change_num > 0 and change_num or 0
  28. if change_num > 0 then
  29. local _, name1, _, val1 = WordManager:GetPropertyInfo(tonumber(self.data.attr_id1), change_num)
  30. self.lb_add_tmp.text = val1
  31. self.up_image1_obj:SetActive(true)
  32. else
  33. self.lb_add_tmp.text = ""
  34. self.up_image1_obj:SetActive(false)
  35. end
  36. local _, name1, _, val1 = WordManager:GetPropertyInfo(tonumber(self.data.attr_id1), self.data.value1)
  37. self.lb_attr_tmp.text = name1 .. "" .. val1
  38. -- self.lb_num_tmp.text = val1
  39. if WordManager:GetAttrIsSpecial(self.data.attr_id1) then
  40. SetAttrIconByColorType(self, self.attr_icon1_img, self.data.attr_id1, nil, 2)
  41. else
  42. SetAttrIconByColorType(self, self.attr_icon1_img, self.data.attr_id1, nil, 1)
  43. end
  44. self.bg_obj:SetActive(self.index % 2 == 0)
  45. end
  46. function LightAttrItemTwo:SetData( index, data)
  47. self.index = index
  48. self.data = data
  49. if self.is_loaded then
  50. self.need_refreshData = false
  51. self:UpdateView()
  52. else
  53. self.need_refreshData = true
  54. end
  55. end
  56. function LightAttrItemTwo:__delete( )
  57. end