-- <* -- @Author: Saber -- @Description: 本国团战对战记录界面节点 -- *> GuildCSGRFightInfoItem = GuildCSGRFightInfoItem or BaseClass(BaseItem) local GuildCSGRFightInfoItem = GuildCSGRFightInfoItem function GuildCSGRFightInfoItem:__init(parent_wnd,prefab_asset,layer_name) self.base_file = "guildCSGR" self.layout_file = "GuildCSGRFightInfoItem" self.parent_wnd = parent_wnd self.layer_name = layer_name self.myguild_iconpos = { [1] = -220, [2] = 51, [3] = 315.5 } self.model = GuildModel:getInstance() self:Load() end function GuildCSGRFightInfoItem:Load_callback() local nodes = { -- 三个位置节点 "guild_node1:obj", "guild_node1/guild_icon1:img", "guild_node1/guild_name1:tmp", "guild_node2:obj", "guild_node2/guild_icon2:img", "guild_node2/guild_name2:tmp", "guild_node3:obj", "guild_node3/guild_icon3:img", "guild_node3/guild_name3:tmp", "vs3:obj", "vs2:obj", "my_guild:obj", "lb_no:tmp", } self:GetChildren(nodes) self:AddEvents() if self.need_refreshData then self:UpdateView() end end function GuildCSGRFightInfoItem:AddEvents( ) end function GuildCSGRFightInfoItem:SetData( data ) self.data = data if self.is_loaded then self.need_refreshData = false self:UpdateView() else self.need_refreshData = true end end function GuildCSGRFightInfoItem:UpdateView( ) if self.data then self.lb_no_tmp.text = self.data.arena_id -- 当前社团id local guild_id = RoleManager.Instance.mainRoleInfo.guild_id local my_guild_index = nil local guild_data for i = 1, 3 do guild_data = self.data.guilds[i] if guild_data then self["guild_node"..i.."_obj"]:SetActive(true) self["guild_name"..i.."_tmp"].text = string.format("s%s.%s", guild_data.server_num, guild_data.guild_name) lua_resM:setImageSprite(self, self["guild_icon"..i.."_img"], "guildIcon_asset", "guild_icon" .. guild_data.guild_flag, true) if i == 2 then self.vs2_obj:SetActive(true) elseif i == 3 then self.vs3_obj:SetActive(true) end if guild_data.guild_id == guild_id then -- 该社团是玩家所在的社团 my_guild_index = i end else self["guild_node"..i.."_obj"]:SetActive(false) end if i == 2 then self.vs2_obj:SetActive(guild_data and true or false) elseif i == 3 then self.vs3_obj:SetActive(guild_data and true or false) end if my_guild_index then self.my_guild_obj:SetActive(true) SetAnchoredPositionX(self.my_guild, self.myguild_iconpos[my_guild_index]) else self.my_guild_obj:SetActive(false) end end end end function GuildCSGRFightInfoItem:__delete( ) end