--[[@------------------------------------------------------------------ @description:社团协助信息感谢列表界面 @author:huangcong ----------------------------------------------------------------------]] GuildSupportInfoMainThankView = GuildSupportInfoMainThankView or BaseClass(BaseItem) local GuildSupportInfoMainThankView = GuildSupportInfoMainThankView function GuildSupportInfoMainThankView:__init() self.base_file = "guild" self.layout_file = "GuildSupportInfoMainThankView" self.model = GuildModel:getInstance() self.main_vo = RoleManager:getInstance():GetMainRoleVo() self:Load() end function GuildSupportInfoMainThankView:Load_callback() local nodes = { "itemScroll","itemScroll/Viewport/itemCon", "nodata_bg:obj:raw","nodata_bg/nodata_desc:tmp","nodata_bg/nodata_desc_click:tmp:obj", } self:GetChildren(nodes) lua_resM:setOutsideRawImage(self, self.nodata_bg_raw, GameResPath.GetViewBigBg("guild_support_empty_bg"),false) if self.main_vo.guild_id > 0 then self.nodata_desc_click_obj:SetActive(false) self.nodata_bg_obj:SetActive(false) self.nodata_desc_tmp.text = "" else--显示超链接 self.nodata_bg_obj:SetActive(true) self.nodata_desc_click_obj:SetActive(true) self.nodata_desc_tmp.text = "未加入社团~\n请前往 加入或创建社团." end self.nodata_desc_click_tmp.text = "社团列表" self.model:Fire(GuildModel.REQUEST_CCMD_EVENT,40068) if self.need_refreshData then self:SetData(self.speaciel_data) end self:InitEvent() end function GuildSupportInfoMainThankView:__delete() end function GuildSupportInfoMainThankView:InitEvent() local function onBtnClickHandler(target,x,y) if target == self.nodata_desc_click_obj then--加入社团 self.model:Fire(GuildModel.CLOSE_GUILD_SUPPORT_IFNO_VIEW) OpenFun.Open(400,0) end end AddClickEvent(self.nodata_desc_click_obj, onBtnClickHandler, LuaSoundManager.SOUND_UI.NONE) local function updateDataInfo( ) if not self.is_loaded then return end if self.main_vo.guild_id > 0 then self:UpdateItemList() end end self:BindEvent(self.model, GuildModel.UPDATE_SUPPORT_THANK_LIST, updateDataInfo)--刷新协助信息列表 end function GuildSupportInfoMainThankView:SetData(speaciel_data) self.speaciel_data = speaciel_data or self.speaciel_data if self.is_loaded then self.need_refreshData = false else self.need_refreshData = true return end if self.main_vo.guild_id > 0 then self:UpdateItemList() end end --更新协助信息item function GuildSupportInfoMainThankView:UpdateItemList( ) local item_list = self.model:GetSupportThankList() or {} -- print("huangcong:GuildSupportInfoMainThankView [start:132] :", item_list) -- PrintTable(item_list) -- print("huangcong:GuildSupportInfoMainThankView [end]") if not item_list or TableSize(item_list) == 0 then self.nodata_bg_obj:SetActive(true) self.nodata_desc_tmp.text = "暂未发现可发送的感谢~\n可以多寻求其他成员的帮助哦" else self.nodata_bg_obj:SetActive(false) self.nodata_desc_tmp.text = "" end if self.speaciel_data then for i,v in ipairs(item_list) do if self.speaciel_data.support_id == v.support_id and self.speaciel_data.type == v.type and v.is_send == 0 then self.speaciel_data = nil if v.type == GuildModel.SupportThankType.Normal then self.model:Fire(GuildModel.OPEN_GUILD_SUPPORT_THANK_VIEW, GuildModel.SupportType.Thank, v) elseif v.type == GuildModel.SupportThankType.SpellList then self.model:Fire(GuildModel.OPEN_GUILD_SL_THANK_VIEW, true, v) end break end end end if not self.item_creator_com then self.item_creator_com = self:AddUIComponent(UI.ItemListCreator) else -- self.item_creator_com:Reset() end local info = { data_list = item_list, item_con = self.itemCon, item_class = GuildSupportInfoMainThankItem, item_height = GuildSupportInfoMainThankItem.Height, item_width = GuildSupportInfoMainThankItem.Width, start_x = 2, start_y = -2, space_x = 18, space_y = 15, scroll_view = self.itemScroll, create_frequency = 0.02, reuse_item_num = 12, show_col = 4, on_update_item = function(item, i, v) item:SetData(v,i) end, } self.item_creator_com:UpdateItems(info) end function GuildSupportInfoMainThankView:BtnCloseEvt()--关闭按钮回调 self.model:Fire(GuildModel.CLOSE_GUILD_SUPPORT_IFNO_VIEW) end