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

152 line
5.6 KiB

  1. -- <*
  2. -- @Author: huangcong
  3. -- @Description: 社团领取感谢列表item
  4. -- *>
  5. GuildSupportInfoMainGiftItem = GuildSupportInfoMainGiftItem or BaseClass(BaseItem)
  6. GuildSupportInfoMainGiftItem.Width = 208
  7. GuildSupportInfoMainGiftItem.Height = 266
  8. local GuildSupportInfoMainGiftItem = GuildSupportInfoMainGiftItem
  9. function GuildSupportInfoMainGiftItem:__init(parent_wnd,prefab_asset,layer_name)
  10. self.base_file = "guild"
  11. self.layout_file = "GuildSupportInfoMainGiftItem"
  12. self.parent_wnd = parent_wnd
  13. self.layer_name = layer_name
  14. self.model = GuildModel:getInstance()
  15. self:Load()
  16. end
  17. function GuildSupportInfoMainGiftItem:Load_callback()
  18. self.nodes = {
  19. "get_btn:imgex", "descImg:img", "nameText:tmp",
  20. "head_con","desc:tmp", "roleNameText:tmp", "bg:img",
  21. "roleNameText/sex:img", "roleNameText/vip", "touch:obj",
  22. }
  23. self:GetChildren(self.nodes)
  24. self.desc_tmp.text = "被协助者"
  25. self.role_head = HeadRoleItem.New(self.head_con)
  26. self.role_head:SetItemSize(52, 52)
  27. if not self.transform.gameObject.activeSelf then
  28. self.transform.gameObject:SetActive(true)
  29. end
  30. self:AddEvents()
  31. if self.need_refreshData then
  32. self:UpdateView()
  33. end
  34. end
  35. function GuildSupportInfoMainGiftItem:AddEvents( )
  36. local function click_event(target)
  37. if target == self.touch_obj then
  38. if self.data then
  39. if self.data.is_get == 0 then --可以领取--todo
  40. local data = DeepCopy(self.data)
  41. data.role_list = {{
  42. name = self.data.name,
  43. picture = self.data.picture,
  44. role_id = self.data.role_id,
  45. sex = self.data.sex,
  46. sup_vip_type = self.data.sup_vip_type,
  47. vip_flag = self.data.vip_flag,
  48. profile_photo_id = self.data.profile_photo_id,
  49. dress_board_id = self.data.dress_board_id,
  50. }
  51. }
  52. self.model:Fire(GuildModel.OPEN_GUILD_SUPPORT_THANK_VIEW,GuildModel.SupportType.Award,data)
  53. else
  54. Message.show("已经领取过了哦!","fault")
  55. end
  56. end
  57. end
  58. end
  59. AddClickEvent(self.touch_obj, click_event)
  60. end
  61. function GuildSupportInfoMainGiftItem:UpdateView( )
  62. if self.data then
  63. if not self.vipItem then
  64. self.vipItem = RoleVipItem.New(self.vip)
  65. end
  66. if self.data.type == GuildModel.SupportThankType.SpellList and self.data.role_id < 10 then -- 社团假人
  67. -- 加载头像
  68. local head_data = {
  69. vo = {
  70. id = self.data.role_id,
  71. profile_photo_id = 424008,
  72. do_not_click = true,
  73. },
  74. show_tip = false,
  75. }
  76. self.role_head:SetData(head_data)
  77. self.vipItem:SetData(0, 0)
  78. self.sex_img.enabled = false
  79. else
  80. local head_data = {
  81. vo = {
  82. id = self.data.role_id,
  83. server_id = self.data.ser_id or 0,
  84. career = self.data.career,
  85. sex = self.data.sex,
  86. turn = self.data.turn,
  87. picture_ver = self.data.picture_ver,
  88. picture = self.data.picture,
  89. profile_photo_id = self.data.profile_photo_id,
  90. dress_board_id = self.data.dress_board_id,
  91. level = self.data.lv,
  92. use_bg = 2
  93. },
  94. show_tip = false,
  95. }
  96. self.role_head:SetData(head_data)
  97. self.vipItem:SetData(self.data.vip_flag,self.data.sup_vip_type)
  98. if self.data.sex then
  99. lua_resM:setImageSprite(self, self.sex_img, "common_asset", self.data.sex == 1 and "com_boy" or "com_girl", true)
  100. end
  101. self.sex_img.enabled = true
  102. end
  103. self.roleNameText_tmp.text = self.data.name
  104. -- 根据红包领取情况加载按钮状态
  105. local icon_res, btn_gray = "guild_support_get_pointfilter", false -- 按钮资源和灰化
  106. if self.data.is_get == 0 then -- 还没发的红包,置顶
  107. icon_res = "guild_support_get_pointfilter"
  108. btn_gray = false
  109. else
  110. icon_res = "guild_support_have_get_pointfilter"
  111. btn_gray = true
  112. end
  113. lua_resM:setImageSprite(self, self.get_btn_imgex, "guildSupport_asset", icon_res, true)
  114. SetImageGray(self.bg_img,btn_gray)
  115. SetImageGray(self.descImg_img,btn_gray)
  116. local cfg
  117. if self.data.type == GuildModel.SupportThankType.Normal then
  118. cfg = self.model:GetGuildSupportCfg(self.data.support_cfg_id)
  119. self.nameText_tmp.text = cfg and cfg.mod_name or ""
  120. elseif self.data.type == GuildModel.SupportThankType.SpellList then
  121. cfg = Config.Guildorder[self.data.support_cfg_id]
  122. self.nameText_tmp.text = cfg and Trim(cfg.name) or ""
  123. end
  124. end
  125. end
  126. function GuildSupportInfoMainGiftItem:SetData( data )
  127. self.data = data
  128. if self.is_loaded then
  129. self.need_refreshData = false
  130. self:UpdateView()
  131. else
  132. self.need_refreshData = true
  133. end
  134. end
  135. function GuildSupportInfoMainGiftItem:__delete( )
  136. if self.role_head then
  137. self.role_head:DeleteMe()
  138. self.role_head = nil
  139. end
  140. if self.vipItem then
  141. self.vipItem:DeleteMe()
  142. self.vipItem = nil
  143. end
  144. end