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

141 行
4.3 KiB

  1. --[[@------------------------------------------------------------------
  2. @description:
  3. @author:huangcong
  4. ----------------------------------------------------------------------]]
  5. GuildSupportInfoMainThankView = GuildSupportInfoMainThankView or BaseClass(BaseItem)
  6. local GuildSupportInfoMainThankView = GuildSupportInfoMainThankView
  7. function GuildSupportInfoMainThankView:__init()
  8. self.base_file = "guild"
  9. self.layout_file = "GuildSupportInfoMainThankView"
  10. self.model = GuildModel:getInstance()
  11. self.main_vo = RoleManager:getInstance():GetMainRoleVo()
  12. self:Load()
  13. end
  14. function GuildSupportInfoMainThankView:Load_callback()
  15. local nodes = {
  16. "itemScroll","itemScroll/Viewport/itemCon",
  17. "nodata_bg:obj:raw","nodata_bg/nodata_desc:tmp","nodata_bg/nodata_desc_click:tmp:obj",
  18. }
  19. self:GetChildren(nodes)
  20. lua_resM:setOutsideRawImage(self, self.nodata_bg_raw, GameResPath.GetViewBigBg("guild_support_empty_bg"),false)
  21. if self.main_vo.guild_id > 0 then
  22. self.nodata_desc_click_obj:SetActive(false)
  23. self.nodata_bg_obj:SetActive(false)
  24. self.nodata_desc_tmp.text = ""
  25. else--显示超链接
  26. self.nodata_bg_obj:SetActive(true)
  27. self.nodata_desc_click_obj:SetActive(true)
  28. self.nodata_desc_tmp.text = "未加入社团~\n请前往 加入或创建社团."
  29. end
  30. self.nodata_desc_click_tmp.text = "<u>社团列表</u>"
  31. self.model:Fire(GuildModel.REQUEST_CCMD_EVENT,40068)
  32. if self.need_refreshData then
  33. self:SetData(self.speaciel_data)
  34. end
  35. self:InitEvent()
  36. end
  37. function GuildSupportInfoMainThankView:__delete()
  38. end
  39. function GuildSupportInfoMainThankView:InitEvent()
  40. local function onBtnClickHandler(target,x,y)
  41. if target == self.nodata_desc_click_obj then--加入社团
  42. self.model:Fire(GuildModel.CLOSE_GUILD_SUPPORT_IFNO_VIEW)
  43. OpenFun.Open(400,0)
  44. end
  45. end
  46. AddClickEvent(self.nodata_desc_click_obj, onBtnClickHandler, LuaSoundManager.SOUND_UI.NONE)
  47. local function updateDataInfo( )
  48. if not self.is_loaded then
  49. return
  50. end
  51. if self.main_vo.guild_id > 0 then
  52. self:UpdateItemList()
  53. end
  54. end
  55. self:BindEvent(self.model, GuildModel.UPDATE_SUPPORT_THANK_LIST, updateDataInfo)--刷新协助信息列表
  56. end
  57. function GuildSupportInfoMainThankView:SetData(speaciel_data)
  58. self.speaciel_data = speaciel_data or self.speaciel_data
  59. if self.is_loaded then
  60. self.need_refreshData = false
  61. else
  62. self.need_refreshData = true
  63. return
  64. end
  65. if self.main_vo.guild_id > 0 then
  66. self:UpdateItemList()
  67. end
  68. end
  69. --更新协助信息item
  70. function GuildSupportInfoMainThankView:UpdateItemList( )
  71. local item_list = self.model:GetSupportThankList() or {}
  72. -- print("huangcong:GuildSupportInfoMainThankView [start:132] :", item_list)
  73. -- PrintTable(item_list)
  74. -- print("huangcong:GuildSupportInfoMainThankView [end]")
  75. if not item_list or TableSize(item_list) == 0 then
  76. self.nodata_bg_obj:SetActive(true)
  77. self.nodata_desc_tmp.text = "暂未发现可发送的感谢~\n可以多寻求其他成员的帮助哦"
  78. else
  79. self.nodata_bg_obj:SetActive(false)
  80. self.nodata_desc_tmp.text = ""
  81. end
  82. if self.speaciel_data then
  83. for i,v in ipairs(item_list) do
  84. if self.speaciel_data.support_id == v.support_id
  85. and self.speaciel_data.type == v.type
  86. and v.is_send == 0
  87. then
  88. self.speaciel_data = nil
  89. if v.type == GuildModel.SupportThankType.Normal then
  90. self.model:Fire(GuildModel.OPEN_GUILD_SUPPORT_THANK_VIEW, GuildModel.SupportType.Thank, v)
  91. elseif v.type == GuildModel.SupportThankType.SpellList then
  92. self.model:Fire(GuildModel.OPEN_GUILD_SL_THANK_VIEW, true, v)
  93. end
  94. break
  95. end
  96. end
  97. end
  98. if not self.item_creator_com then
  99. self.item_creator_com = self:AddUIComponent(UI.ItemListCreator)
  100. else
  101. -- self.item_creator_com:Reset()
  102. end
  103. local info = {
  104. data_list = item_list,
  105. item_con = self.itemCon,
  106. item_class = GuildSupportInfoMainThankItem,
  107. item_height = GuildSupportInfoMainThankItem.Height,
  108. item_width = GuildSupportInfoMainThankItem.Width,
  109. start_x = 2,
  110. start_y = -2,
  111. space_x = 18,
  112. space_y = 15,
  113. scroll_view = self.itemScroll,
  114. create_frequency = 0.02,
  115. reuse_item_num = 12,
  116. show_col = 4,
  117. on_update_item = function(item, i, v)
  118. item:SetData(v,i)
  119. end,
  120. }
  121. self.item_creator_com:UpdateItems(info)
  122. end
  123. function GuildSupportInfoMainThankView:BtnCloseEvt()--关闭按钮回调
  124. self.model:Fire(GuildModel.CLOSE_GUILD_SUPPORT_IFNO_VIEW)
  125. end