GuildCollectHelpRankView = GuildCollectHelpRankView or BaseClass(BaseItem) local GuildCollectHelpRankView = GuildCollectHelpRankView function GuildCollectHelpRankView:__init() self.base_file = "boss" self.layout_file = "BossMoneyHelpRankView" self.model = GuildModel:getInstance() self:Load() end function GuildCollectHelpRankView:Load_callback() self.nodes = { "con_list:obj","con_role/con_head","con_role/btn_go:obj","con_list/scroll","con_role/btn_close:obj", "con_list/scroll/Viewport/Content","con_role:obj", } self:GetChildren(self.nodes) SetAnchoredPosition( self.transform, -88, 59 ) SetAnchoredPosition( self.con_role, 44, 0 ) self:AddEvents() self:UpdateView() self.model:Fire(GuildModel.REQUEST_CCMD_EVENT,40046) end function GuildCollectHelpRankView:AddEvents( ) -- local function call_back( target ) -- if target == self.btn_close_obj then -- self.model:Fire(GuildModel.REQUEST_CCMD_EVENT,40053) -- elseif target == self.btn_go_obj then -- local data = self.model:GetCurSupportPlayerInfo() -- if data and data.role_id ~= RoleManager.Instance.mainRoleInfo.role_id then -- self.model:Fire(GuildModel.REQUEST_CCMD_EVENT,40808,data.role_id) -- end -- end -- end -- AddClickEvent(self.btn_go_obj,call_back,false) -- AddClickEvent(self.btn_close_obj,call_back,false) local function update_call( ) if not self.is_loaded then return end self:UpdateView() end -- self:BindEvent(self.model, GuildModel.ANS_GUILD_COLLECT_HELP_LIST, update_call) -- self:BindEvent(self.model, GuildModel.UPDATE_GUILD_COLLECT_SUPPORT_INFO_LIST, update_call)--40811 self:BindEvent(self.model, GuildModel.UPDATE_GUILD_COLLECT_NOW_SUPPORT_ID, update_call)--40812 local function update_call_2(scmd_num) if scmd_num ~= 40046 then return end--40046协议的事件才更新 if not self.is_loaded then return end self:UpdateView() end self:BindEvent(self.model, GuildModel.UPDATE_GUILD_SUPPOR_INFO, update_call_2)--40046 end function GuildCollectHelpRankView:UpdateView( ) self:ShowList() self:ShowRole() -- if self.con_list_obj.activeSelf or self.con_role_obj.activeSelf then -- self.model:Fire(GuildModel.CHANGE_GUILD_COLLECT_LEFT_CON_STATE,false) -- else -- self.model:Fire(GuildModel.CHANGE_GUILD_COLLECT_LEFT_CON_STATE,true) -- end -- if self.con_list_obj.activeSelf then -- self.model:Fire(GuildModel.CHANGE_GUILD_COLLECT_LEFT_CON_STATE,false) -- else -- self.model:Fire(GuildModel.CHANGE_GUILD_COLLECT_LEFT_CON_STATE,true) -- end end function GuildCollectHelpRankView:ShowList( ) -- if not self.is_loaded then return end -- local self_support_status = self.model:GetGuildSupportStatus() -- if self_support_status ~= 1 then -- --协助者隐藏 -- self.con_list_obj:SetActive(false) -- return -- end -- ------------------------- -- local sort_list = {} -- for k,v in pairs(self.model:GetCollectHelperInfo( )) do -- sort_list[#sort_list+1] = DeepCopy(v) -- end -- local function sort_call( a,b ) -- --从大到小 -- return a.hurt > b.hurt -- end -- table.sort( sort_list, sort_call ) -- self.item_list = self.item_list or self:AddUIComponent(UI.ItemListCreator) -- local data = { -- data_list = sort_list or {}, -- item_con = self.Content, -- item_class = GuildCollectHelpRankItem, -- -- item_width = BossMoneyHelpRankItem.Width, -- item_height = GuildCollectHelpRankItem.Height, -- scroll_view = self.scroll, -- start_x = 188, -- on_update_item = function(item, i, v) -- item:SetData(i,v) -- end, -- } -- self.item_list:UpdateItems(data) -- self.con_list_obj:SetActive(TableSize(sort_list) > 0) --封印裂隙协助调整,不再显示伤害列表 if not self.is_loaded then return end self.con_list_obj:SetActive(false) end function GuildCollectHelpRankView:ShowRole( ) -- local self_support_status = self.model:GetGuildSupportStatus() -- if self_support_status ~= 2 then -- --我不是协助者 -- self.con_role_obj:SetActive(false) -- return -- end -- local data = self.model:GetCurSupportPlayerInfo() -- if data then -- if data.role_id == RoleManager.Instance.mainRoleInfo.role_id then -- self.con_role_obj:SetActive(false) -- return -- end -- self.head_item = self.head_item or self:CreateItem(HeadRoleItem, self.con_head, self.layer_name) -- self.head_item:SetItemSize(90,90) -- ------------------------- -- local head_data = { -- vo = {id=data.role_id,career=data.career,level=nil,sex=data.sex,turn=data.turn, -- board = data.dress_id,picture_ver = data.picture_ver,picture = data.picture, -- profile_photo_id = data.profile_photo_id}, -- } -- self.head_item:SetData(head_data) -- -- self.con_role_obj:SetActive(true) -- --不要显示这个协助头像框了 -- self.con_role_obj:SetActive(false) -- self.model:Fire(GuildModel.REQUEST_CCMD_EVENT,40808,data.role_id) -- else -- self.con_list_obj:SetActive(false) -- end --封印裂隙调整,不再显示助战头像 if not self.is_loaded then return end self.con_role_obj:SetActive(false) --刚进驻地时需要等一些初始化操作完成后才能执行下面的寻路操作 if not self.model.guild_collect_confim_into_guild_scene then return end --如果只是从驻地外用40808过来寻怪的,就直接寻怪 if self.model.only_find_way_to_guild_collect_mon then if self.model.temp_guild_collect_mon_data then self.model:Fire(GuildModel.FIND_WAY_TO_GUILD_COLLECT_HELP_MON,self.model.temp_guild_collect_mon_data) end self.model.only_find_way_to_guild_collect_mon = false self.model.temp_guild_collect_mon_data = nil return end --如果没特别要求前往寻路杀怪,就不执行 if not self.model.need_go_support_guild_collect_after_40046 then return end local data = nil local guild_collect_support_id = self.model:GetSelfGuildCollectSupportId() local info = self.model:GetGuildSupportInfo() for k,v in pairs(info) do if v.support_sid == guild_collect_support_id then data = v break end end if data and guild_collect_support_id ~= 0 then if data.role_id ~= RoleManager.Instance.mainRoleInfo.role_id then --主动寻路去击杀协助对应的宝箱怪 self.model:Fire(GuildModel.REQUEST_CCMD_EVENT,40808,data.support_sid) self.model.need_go_support_guild_collect_after_40046 = false end end end function GuildCollectHelpRankView:__delete( ) end