源战役客户端
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.

109 lines
3.3 KiB

пре 4 недеља
  1. --[[@------------------------------------------------------------------
  2. @description:tab
  3. @author:huangcong
  4. ----------------------------------------------------------------------]]
  5. GuildSupportInfoMainTab = GuildSupportInfoMainTab or BaseClass(BaseItem)
  6. GuildSupportInfoMainTab.Height = 72
  7. GuildSupportInfoMainTab.Width = 140
  8. local GuildSupportInfoMainTab = GuildSupportInfoMainTab
  9. function GuildSupportInfoMainTab:__init()
  10. self.base_file = "guild"
  11. self.layout_file = "GuildSupportInfoMainTab"
  12. self.is_delay_callback = true
  13. self.choose = false
  14. self.need_red = false
  15. self.choose_index = 1
  16. self.model = GuildModel:getInstance()
  17. self:Load()
  18. end
  19. function GuildSupportInfoMainTab:Load_callback()
  20. self.nodes = {
  21. "selct:obj:img","redDot:obj","bg:obj","tabName:tmp", "touch:obj", "tabChooseName:tmp",
  22. }
  23. self:GetChildren(self.nodes)
  24. if self.need_refreshData then
  25. self:SetData(self.data,self.index,self.choose_index)
  26. self:SetRedDot(self.need_red)
  27. end
  28. self:InitEvent()
  29. end
  30. function GuildSupportInfoMainTab:InitEvent()
  31. local function clickHandler(target)
  32. if target == self.touch_obj then
  33. if self.callback then
  34. self.callback(self.index)
  35. end
  36. end
  37. end
  38. AddClickEvent(self.touch_obj , clickHandler,2)
  39. local function updateThankDataInfo( )
  40. if not self.is_loaded then
  41. return
  42. end
  43. if self.index == GuildModel.SupportTab.Thank then
  44. self:SetRedDot(self.model.support_red_list[GuildModel.SupportTab.Thank] or false)
  45. end
  46. end
  47. self:BindEvent(self.model, GuildModel.UPDATE_SUPPORT_THANK_LIST, updateThankDataInfo)--刷新协助信息列表
  48. local function updateGiftDataInfo( )
  49. if not self.is_loaded then
  50. return
  51. end
  52. if self.index == GuildModel.SupportTab.Gift then
  53. self:SetRedDot(self.model.support_red_list[GuildModel.SupportTab.Gift] or false)
  54. end
  55. end
  56. self:BindEvent(self.model, GuildModel.UPDATE_SUPPORT_GIFT_LIST, updateGiftDataInfo)--刷新协助信息列表
  57. end
  58. function GuildSupportInfoMainTab:__delete()
  59. -- for k,v in pairs(self.item_list) do
  60. -- UIObjPool:getInstance():PushItem(UIObjPool.UIType.AwardItem, v)
  61. -- end
  62. -- self.item_list = {}
  63. end
  64. function GuildSupportInfoMainTab:SetData(data,index,choose_index)
  65. self.data = data or self.data
  66. self.index = index or self.index
  67. self.choose_index = choose_index or self.choose_index
  68. if self.is_loaded then
  69. self.need_refreshData = false
  70. else
  71. self.need_refreshData = true
  72. return
  73. end
  74. self.tabName_tmp.text = self.choose_index == self.index and "" or self.data.name
  75. self.tabChooseName_tmp.text = self.choose_index == self.index and self.data.name or ""
  76. self.selct_obj:SetActive(self.choose_index == self.index)
  77. self:SetRedDot(self.need_red)
  78. end
  79. function GuildSupportInfoMainTab:SetSelect( index )
  80. self.choose_index = index or self.choose_index
  81. if self.is_loaded then
  82. self.tabName_tmp.text = self.choose_index == self.index and "" or self.data.name
  83. self.tabChooseName_tmp.text = self.choose_index == self.index and self.data.name or ""
  84. self.selct_obj:SetActive(self.choose_index == self.index)
  85. else
  86. self.need_refreshData = true
  87. end
  88. end
  89. function GuildSupportInfoMainTab:SetCallBack( callback )
  90. self.callback = callback
  91. end
  92. function GuildSupportInfoMainTab:SetRedDot( bool )
  93. self.need_red = bool
  94. if self.is_loaded then
  95. self.redDot_obj:SetActive(self.need_red)
  96. else
  97. self.need_refreshData = true
  98. end
  99. end