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

92 行
2.3 KiB

  1. CSMainAppointAllRoleListItem = CSMainAppointAllRoleListItem or BaseClass(BaseItem)
  2. local CSMainAppointAllRoleListItem = CSMainAppointAllRoleListItem
  3. function CSMainAppointAllRoleListItem:__init()
  4. self.base_file = "csMain"
  5. self.layout_file = "CSMainAppointAllRoleListItem"
  6. self.model = CSMainModel:getInstance()
  7. self.role_item_list = {}
  8. self:Load()
  9. end
  10. function CSMainAppointAllRoleListItem:Load_callback()
  11. self.nodes = {
  12. "bg2:img", "bg1:img", "roleCon", "time:tmp",
  13. }
  14. self:GetChildren(self.nodes)
  15. lua_resM:setOutsideImageSprite(self, self.bg1_img, GameResPath.GetCSMainImage("cs_main_appoint_bottom_2_short"))
  16. lua_resM:setOutsideImageSprite(self, self.bg2_img, GameResPath.GetCSMainImage("cs_main_appoint_bottom_1"))
  17. self:AddEvents()
  18. if self.need_refreshData then
  19. self:UpdateView()
  20. end
  21. end
  22. function CSMainAppointAllRoleListItem:AddEvents( )
  23. end
  24. function CSMainAppointAllRoleListItem:UpdateView( )
  25. self.time_tmp.text = string.format("[%s]",TimeUtil:timeConversion(self.data.issue, "yyyy.mm.dd"))
  26. local role_list = {}
  27. local my_ser_num = RoleManager.Instance.mainRoleInfo.server_num
  28. for i,v in ipairs(self.data.servers) do
  29. if v.ser_num == my_ser_num then
  30. for k,v in pairs(v.directors) do
  31. role_list[v.pos] = v
  32. end
  33. end
  34. end
  35. for k,v in pairs(self.role_item_list) do
  36. v:SetVisible(false)
  37. end
  38. for i=1,7 do
  39. local item = self.role_item_list[i]
  40. if not item then
  41. item = CSMainAppointRoleItem.New(self.roleCon)
  42. self.role_item_list[i] = item
  43. end
  44. if i == 1 then
  45. item:SetAnchoredPosition(-130 , 92)
  46. elseif i == 2 then
  47. item:SetAnchoredPosition(0 , 92)
  48. elseif i == 3 then
  49. item:SetAnchoredPosition(130 , 92)
  50. elseif i == 4 then
  51. item:SetAnchoredPosition(-195 , -88)
  52. elseif i == 5 then
  53. item:SetAnchoredPosition(-65 , -88)
  54. elseif i == 6 then
  55. item:SetAnchoredPosition(65 , -88)
  56. elseif i == 7 then
  57. item:SetAnchoredPosition(195 , -88)
  58. end
  59. item:SetVisible(true)
  60. item:SetData(role_list[i],i)
  61. end
  62. end
  63. function CSMainAppointAllRoleListItem:SetData( data )
  64. self.data = data
  65. if self.is_loaded then
  66. self.need_refreshData = false
  67. self:UpdateView()
  68. else
  69. self.need_refreshData = true
  70. end
  71. end
  72. function CSMainAppointAllRoleListItem:__delete( )
  73. for i, v in ipairs(self.role_item_list) do
  74. v:DeleteMe()
  75. end
  76. self.role_item_list = {}
  77. end