----- 远征怪节点弹窗 ----- local QiJieShiLianMonsterInfo = {} --传入父脚本模块 local parent --传入特效层级 local sortingOrder=0 --item容器 local itemList = {} local heroListGo = {} local waveId = 0 --当前层 local curType = 1 --当前试炼类型 local configData = {} --当前层的数据表 local data = {} --当前试炼的数据 local rewardData = {} --当前层的奖励 local freeTime = 0 local buyTime = 0 local itemId = 0 local costNum = 0 local storeDataId = 0 local roleConfig=ConfigManager.GetConfig(ConfigName.RoleConfig) local itemConfig=ConfigManager.GetConfig(ConfigName.ItemConfig) local monsterGroup = ConfigManager.GetConfig(ConfigName.MonsterGroup) function QiJieShiLianMonsterInfo:InitComponent(gameObject) self.spLoader = SpriteLoader.New() self.titleText=Util.GetGameObject(gameObject,"TitleText"):GetComponent("Text") self.power = Util.GetGameObject(gameObject, "Power/Value"):GetComponent("Text") --滚动条根节点 self.root = Util.GetGameObject(gameObject, "Root") for i = 1, 6 do heroListGo[i] = Util.GetGameObject(gameObject, "RoleGrid/Bg"..i.."/Hero") Util.GetGameObject(gameObject, "RoleGrid/Bg"..i):GetComponent("Image").sprite = self.spLoader:LoadSprite("t_chengyuankuang_kuang")--CardPosImageName[i]) Util.GetGameObject(gameObject, "RoleGrid/Bg"..i.."/Pos"):GetComponent("Image").sprite = self.spLoader:LoadSprite(CardPosImageName[i]) end self.backBtn=Util.GetGameObject(gameObject,"BackBtn") self.sureBtn=Util.GetGameObject(gameObject,"sureBtn") self.targetAttri=Util.GetGameObject(gameObject,"targetAttri") self.targetAttri.gameObject:SetActive(true) self.tip = Util.GetGameObject(gameObject,"tip"):GetComponent("Text") Util.GetGameObject(gameObject, "RoleGrid/FrontImage"):GetComponent("Image").sprite = self.spLoader:LoadSprite("bd_xinqianpai_zh") Util.GetGameObject(gameObject, "RoleGrid/BehindImage"):GetComponent("Image").sprite = self.spLoader:LoadSprite("bd_xinhoupai_zh") self.targetAttri:GetComponent("Image").sprite = self.spLoader:LoadSprite("q_qjsl_wfzjm_mbtx") Util.GetGameObject(gameObject, "Power"):GetComponent("Image").sprite = self.spLoader:LoadSprite("t_tongyong-zhanli_zh") end function QiJieShiLianMonsterInfo:BindEvent() Util.AddClick(self.sureBtn, function() UIManager.OpenPanel(UIName.FormationPanelV2, FORMATION_TYPE.QIJIESHILIAN,self.configData) parent:ClosePanel() end) Util.AddClick(self.targetAttri, function() UIManager.OpenPanel(UIName.GeneralInfoPopup,GENERALINFO_TYPE.QiJieGoalAttri,self.configData,Vector2.New(0,-174)) end) Util.AddClick(self.backBtn, function() parent:ClosePanel() end) end function QiJieShiLianMonsterInfo:AddListener() end function QiJieShiLianMonsterInfo:RemoveListener() end function QiJieShiLianMonsterInfo:OnShow(_parent,...) parent=_parent sortingOrder = _parent.sortingOrder --不定参中包含的不定参 _args[1]为面板类型 _args[2]之后(包括)为打开面板后传入的不定参 local args = {...} self.configData = args[1] --拿取奖励列表 local rewardList = {} table.insert(rewardList,self.configData.JielingReward[1]) for i = 1, #self.configData.Reward do table.insert(rewardList,self.configData.Reward[i]) end if rewardList and #rewardList > 0 then for i, v in pairs(rewardList) do table.insert(rewardData,{v[1],v[2]}) end end self:FormationAdapter() end -- 编队数据匹配 function QiJieShiLianMonsterInfo:FormationAdapter() self.titleText.text = string.format("%s·%s层",self.configData.Chapter,self.configData.Stage) self.power.text = self.configData.Puwer local bossTeaminfo = monsterGroup[self.configData.MonsterGroup].Contents[1] for i = 1, #heroListGo do if (bossTeaminfo[i]) and bossTeaminfo[i] > 0 then -- heroListGo[i].transform.parent:GetComponent("Image").sprite=self.spLoader:LoadSprite("t_chengyuankuang_kuang") self:SetCardSingleData(heroListGo[i],bossTeaminfo[i],i) heroListGo[i]:SetActive(true) else heroListGo[i]:SetActive(true) end end ResetItemView(self.root,self.root.transform,itemList,5,1,sortingOrder,false,rewardData) end function QiJieShiLianMonsterInfo:OnSortingOrderChange() for i = 1, #heroListGo do Util.AddParticleSortLayer(heroListGo[i], self.sortingOrder - sortingOrder) end sortingOrder = self.sortingOrder end --设置单个上阵英雄信息 function QiJieShiLianMonsterInfo:SetCardSingleData(o,monsterId, _pos) local yuanImage=Util.GetGameObject(o,"yuanImage") yuanImage:SetActive(false) local hp = Util.GetGameObject(o,"hpProgress") hp:SetActive(false) local rage = Util.GetGameObject(o,"rageProgress") rage:SetActive(false) local monsterconfig = ConfigManager.GetConfigData(ConfigName.MonsterConfig, monsterId) local heroConfig = ConfigManager.GetConfigData(ConfigName.HeroConfig, monsterconfig.MonsterId) local bg=Util.GetGameObject(o,"Bg1"):GetComponent("Image") -- bg.sprite = self.spLoader:LoadSprite(GetHeroCardStarBg[monsterconfig.Star]) local fg=Util.GetGameObject(o,"Bg2"):GetComponent("Image") -- fg.sprite = self.spLoader:LoadSprite(GetHeroCardStarFg[monsterconfig.Star]) -- local live=Util.GetGameObject(o,"Mask/Live") local lv=Util.GetGameObject(o,"lv/Text"):GetComponent("Text") lv.text=monsterconfig.Level local pro=Util.GetGameObject(o,"Pro/Image"):GetComponent("Image") pro.sprite=self.spLoader:LoadSprite(GetProStrImageByProNum(monsterconfig.PropertyName)) local starGrid=Util.GetGameObject(o,"StarGrid") SetCardStars(starGrid,monsterconfig.Star) local name=Util.GetGameObject(o,"Name/Text"):GetComponent("Text") name.text=heroConfig.ReadingName local live = Util.GetGameObject(o, "Mask/icon"):GetComponent("RawImage") local liveName = GetResourcePath(heroConfig.Live) local roleConfig = ConfigManager.GetConfigData(ConfigName.RoleConfig, heroConfig.Id) local scale = roleConfig.play_liveScale local livePos = Vector3.New(roleConfig.offset[1], roleConfig.offset[2], 0) live.texture = CardRendererManager.GetSpineTexture(_pos, liveName, Vector3.one * scale, livePos, true) live.transform.localScale = Vector3.one live.transform.localPosition = Vector3.zero local zs = Util.GetGameObject(o, "zs") local zsName = GetHeroCardStarZs[monsterconfig.Star] if zsName == "" then zs:SetActive(false) else zs:SetActive(false) zs:GetComponent("Image").sprite = self.spLoader:LoadSprite(zsName) end local effect = Util.GetGameObject(o,"UI_Effect_jinkuang_KaPai") effect.gameObject:SetActive(monsterconfig.Star > 9) SetHeroFormationFlyEffect(o,self.spLoader,effect,monsterconfig.Star,sortingOrder) Util.SetParticleSortLayer(effect.gameObject, sortingOrder + 1) end function QiJieShiLianMonsterInfo:OnClose() rewardData = {} end function QiJieShiLianMonsterInfo:OnDestroy() self.spLoader:Destroy() end return QiJieShiLianMonsterInfo