|
|
- -- <*
- -- @Author: huangcong
- -- @Description: 社团领取感谢列表item
- -- *>
- GuildSupportInfoMainGiftItem = GuildSupportInfoMainGiftItem or BaseClass(BaseItem)
- GuildSupportInfoMainGiftItem.Width = 208
- GuildSupportInfoMainGiftItem.Height = 266
- local GuildSupportInfoMainGiftItem = GuildSupportInfoMainGiftItem
- function GuildSupportInfoMainGiftItem:__init(parent_wnd,prefab_asset,layer_name)
- self.base_file = "guild"
- self.layout_file = "GuildSupportInfoMainGiftItem"
- self.parent_wnd = parent_wnd
- self.layer_name = layer_name
- self.model = GuildModel:getInstance()
- self:Load()
- end
-
- function GuildSupportInfoMainGiftItem:Load_callback()
- self.nodes = {
- "get_btn:imgex", "descImg:img", "nameText:tmp",
- "head_con","desc:tmp", "roleNameText:tmp", "bg:img",
- "roleNameText/sex:img", "roleNameText/vip", "touch:obj",
- }
- self:GetChildren(self.nodes)
-
- self.desc_tmp.text = "被协助者"
- self.role_head = HeadRoleItem.New(self.head_con)
- self.role_head:SetItemSize(52, 52)
- if not self.transform.gameObject.activeSelf then
- self.transform.gameObject:SetActive(true)
- end
- self:AddEvents()
- if self.need_refreshData then
- self:UpdateView()
- end
- end
-
- function GuildSupportInfoMainGiftItem:AddEvents( )
- local function click_event(target)
- if target == self.touch_obj then
- if self.data then
- if self.data.is_get == 0 then --可以领取--todo
- local data = DeepCopy(self.data)
- data.role_list = {{
- name = self.data.name,
- picture = self.data.picture,
- role_id = self.data.role_id,
- sex = self.data.sex,
- sup_vip_type = self.data.sup_vip_type,
- vip_flag = self.data.vip_flag,
- profile_photo_id = self.data.profile_photo_id,
- dress_board_id = self.data.dress_board_id,
- }
- }
- self.model:Fire(GuildModel.OPEN_GUILD_SUPPORT_THANK_VIEW,GuildModel.SupportType.Award,data)
- else
- Message.show("已经领取过了哦!","fault")
- end
- end
- end
- end
- AddClickEvent(self.touch_obj, click_event)
- end
-
- function GuildSupportInfoMainGiftItem:UpdateView( )
- if self.data then
- if not self.vipItem then
- self.vipItem = RoleVipItem.New(self.vip)
- end
- if self.data.type == GuildModel.SupportThankType.SpellList and self.data.role_id < 10 then -- 社团假人
- -- 加载头像
- local head_data = {
- vo = {
- id = self.data.role_id,
- profile_photo_id = 424008,
- do_not_click = true,
- },
- show_tip = false,
- }
- self.role_head:SetData(head_data)
- self.vipItem:SetData(0, 0)
- self.sex_img.enabled = false
- else
- local head_data = {
- vo = {
- id = self.data.role_id,
- server_id = self.data.ser_id or 0,
- career = self.data.career,
- sex = self.data.sex,
- turn = self.data.turn,
- picture_ver = self.data.picture_ver,
- picture = self.data.picture,
- profile_photo_id = self.data.profile_photo_id,
- dress_board_id = self.data.dress_board_id,
- level = self.data.lv,
- use_bg = 2
- },
- show_tip = false,
- }
- self.role_head:SetData(head_data)
- self.vipItem:SetData(self.data.vip_flag,self.data.sup_vip_type)
- if self.data.sex then
- lua_resM:setImageSprite(self, self.sex_img, "common_asset", self.data.sex == 1 and "com_boy" or "com_girl", true)
- end
- self.sex_img.enabled = true
- end
- self.roleNameText_tmp.text = self.data.name
-
- -- 根据红包领取情况加载按钮状态
- local icon_res, btn_gray = "guild_support_get_pointfilter", false -- 按钮资源和灰化
- if self.data.is_get == 0 then -- 还没发的红包,置顶
- icon_res = "guild_support_get_pointfilter"
- btn_gray = false
- else
- icon_res = "guild_support_have_get_pointfilter"
- btn_gray = true
- end
- lua_resM:setImageSprite(self, self.get_btn_imgex, "guildSupport_asset", icon_res, true)
- SetImageGray(self.bg_img,btn_gray)
- SetImageGray(self.descImg_img,btn_gray)
- local cfg
- if self.data.type == GuildModel.SupportThankType.Normal then
- cfg = self.model:GetGuildSupportCfg(self.data.support_cfg_id)
- self.nameText_tmp.text = cfg and cfg.mod_name or ""
- elseif self.data.type == GuildModel.SupportThankType.SpellList then
- cfg = Config.Guildorder[self.data.support_cfg_id]
- self.nameText_tmp.text = cfg and Trim(cfg.name) or ""
- end
- end
- end
-
- function GuildSupportInfoMainGiftItem:SetData( data )
- self.data = data
- if self.is_loaded then
- self.need_refreshData = false
- self:UpdateView()
- else
- self.need_refreshData = true
- end
- end
-
- function GuildSupportInfoMainGiftItem:__delete( )
- if self.role_head then
- self.role_head:DeleteMe()
- self.role_head = nil
- end
- if self.vipItem then
- self.vipItem:DeleteMe()
- self.vipItem = nil
- end
- end
-
|