require("Base/BasePanel") GuildCarDelayFindBossPopup = Inherit(BasePanel) local this = GuildCarDelayFindBossPopup local curMonsterId = 0 local heroListGo = {} local liveNodes = {} local liveNames = {} local roleConfig=ConfigManager.GetConfig(ConfigName.RoleConfig) --初始化组件(用于子类重写) function GuildCarDelayFindBossPopup:InitComponent() this.BackBtn = Util.GetGameObject(self.gameObject, "bg/btnBack") for i = 1, 6 do heroListGo[i] = Util.GetGameObject(this.gameObject,"RoleGrid/Bg"..i.."/Hero"..i) end end --绑定事件(用于子类重写) function GuildCarDelayFindBossPopup:BindEvent() Util.AddClick(this.BackBtn, function() this:ClosePanel() end) end --添加事件监听(用于子类重写) function GuildCarDelayFindBossPopup:AddListener() end --移除事件监听(用于子类重写) function GuildCarDelayFindBossPopup:RemoveListener() end --界面打开时调用(用于子类重写) function GuildCarDelayFindBossPopup:OnOpen(...) end --界面打开或者重新打开后,界面刷新时调用(用于子类重写) function GuildCarDelayFindBossPopup:OnShow() curMonsterId = GuildCarDelayManager.bossIndexId local monsterGroupConfig = ConfigManager.GetConfigData(ConfigName.MonsterGroup,ConfigManager.GetConfigData(ConfigName.WorldBossConfig,curMonsterId).MonsterId) if monsterGroupConfig then for i = 1, #heroListGo do if monsterGroupConfig.Contents[1][i] then this.SetCardSingleData(heroListGo[i],monsterGroupConfig.Contents[1][i],i) heroListGo[i]:SetActive(true) else heroListGo[i]:SetActive(false) end end end end --设置单个上阵英雄信息 function this.SetCardSingleData(go,monsterId,_pos) local monsterConfig = ConfigManager.GetConfigData(ConfigName.MonsterConfig,monsterId) local heroConfig = ConfigManager.GetConfigData(ConfigName.HeroConfig,monsterConfig.MonsterId) local live=Util.GetGameObject(go,"Mask/Live") local lv=Util.GetGameObject(go,"Lv/Text"):GetComponent("Text") local pro=Util.GetGameObject(go,"Pro/Image"):GetComponent("Image") local starGrid=Util.GetGameObject(go,"StarGrid") local name=Util.GetGameObject(go,"Name/Text"):GetComponent("Text") local pos=Util.GetGameObject(go,"Pos"):GetComponent("Image") lv.text=monsterConfig.Level pro.sprite=Util.LoadSprite(GetProStrImageByProNum(monsterConfig.PropertyName)) SetHeroStars(starGrid,heroConfig.Star) name.text=monsterConfig.ReadingName pos.sprite=Util.LoadSprite("bd_bianhao".._pos) --立绘(这里o只当区别索引用) if liveNodes[_pos] then poolManager:UnLoadLive(liveNames[_pos],liveNodes[_pos]) liveNames[_pos]= nil end liveNames[_pos] =GetResourcePath( heroConfig.Live) local _scale=roleConfig[heroConfig.Id].play_liveScale local curPos=roleConfig[heroConfig.Id].offset liveNodes[_pos] = poolManager:LoadLive(liveNames[_pos], live.transform, Vector3.one * _scale, Vector3.New(curPos[1],curPos[2],0)) liveNodes[_pos]:GetComponent("SkeletonGraphic").raycastTarget=false end --界面关闭时调用(用于子类重写) function GuildCarDelayFindBossPopup:OnClose() for i, v in pairs(liveNodes) do if v then poolManager:UnLoadLive(liveNames[i],v) liveNames[i]= nil end end end --界面销毁时调用(用于子类重写) function GuildCarDelayFindBossPopup:OnDestroy() end return GuildCarDelayFindBossPopup