-- <* -- @Author: Saber -- @Description: 社团申请管理-成员/职位管理节点 -- *> GuildApplyMgrItem = GuildApplyMgrItem or BaseClass(BaseItem) local GuildApplyMgrItem = GuildApplyMgrItem function GuildApplyMgrItem:__init(parent_wnd,prefab_asset,layer_name) self.base_file = "guild" self.layout_file = "GuildApplyMgrItem" self.parent_wnd = parent_wnd self.layer_name = layer_name self.model = GuildModel:getInstance() self:Load() end function GuildApplyMgrItem:Load_callback() local nodes = { "head_con", "reject_btn:obj", "pass_btn:obj", "info_con/vip_con", "info_con/sex_flag:img", "info_con/name:tmp", "power_val:txt", "apply_pos_con:obj", "apply_pos_con/pos_bg:img", "apply_time:tmp", } self:GetChildren(nodes) self.head_role = HeadRoleItem.New(self.head_con) self.head_role:SetItemSize(69, 69) -- 加载vip节点 self.vipItem = RoleVipItem.New(self.vip_con) self.vipItem:SetAnchoredPosition(0, 0) self:AddEvents() if self.need_refreshData then self:UpdateView() end end function GuildApplyMgrItem:AddEvents( ) local function click_event(target) if target == self.reject_btn_obj then -- 拒绝请求 self:OnApplyBtnClick(0) elseif target == self.pass_btn_obj then -- 通过请求 self:OnApplyBtnClick(1) end end AddClickEvent(self.reject_btn_obj, click_event) AddClickEvent(self.pass_btn_obj, click_event) end function GuildApplyMgrItem:SetData( tab_type, index, data ) self.tab_type = tab_type self.index = index self.data = data if self.is_loaded then self.need_refreshData = false self:UpdateView() else self.need_refreshData = true end end function GuildApplyMgrItem:UpdateView( ) -- 加载头像信息 local head_data = { show_tip = true, use_bg = 1, vo = { id = self.data.role_id, server_id = self.data.server_id, career = self.data.career, sex = self.data.sex, turn = self.data.turn, profile_photo_id = self.data.profile_photo_id, level = self.data.level, dress_board_id = self.data.dress_id or self.data.dress_board, }, } self.head_role:SetData(head_data) -- 加载其他信息 self.vipItem:SetData(self.data.vip_flag,self.data.sup_vip_type) self.name_tmp.text = self.data.name lua_resM:setImageSprite(self, self.sex_flag_img, "common_asset", self.data.sex == 1 and "com_boy" or "com_girl", true) local sex_pos_x = 50 + self.name_tmp.preferredWidth SetAnchoredPositionX(self.sex_flag, sex_pos_x) self.power_val_txt.text = "f" .. self.data.power self.apply_time_tmp.text = TimeUtil:GetTimeStrByServerTime(self.data.time) -- 1为申请入会类型,不需要展示职位申请,2即职位申请类型,展示职位申请 local show_pos = self.tab_type == 2 if self.apply_pos_con_obj.activeSelf ~= show_pos then self.apply_pos_con_obj:SetActive(show_pos) end SetAnchoredPositionY(self.apply_time, show_pos and -15 or 2) if show_pos then lua_resM:setImageSprite(self, self.pos_bg_img, "guild_asset", "g_pos_icon" .. self.data.position, true) end end -- 点击审批按钮 1:允许 0:拒绝 function GuildApplyMgrItem:OnApplyBtnClick(flag) if self.data and self.data.role_id then self.model:Fire(GuildModel.RequestSetApplyMemberStateEvt, self.data.role_id, flag) end end function GuildApplyMgrItem:__delete( ) if self.vipItem then self.vipItem:DeleteMe() self.vipItem = nil end if self.head_role then self.head_role:DeleteMe() self.head_role = nil end end